[med-svn] [Git][med-team/parsnp][master] 12 commits: Use 2to3 to port to Python3

Andreas Tille gitlab at salsa.debian.org
Fri Sep 13 12:34:57 BST 2019



Andreas Tille pushed to branch master at Debian Med / parsnp


Commits:
fe07a083 by Andreas Tille at 2019-09-13T10:56:04Z
Use 2to3 to port to Python3

- - - - -
8e172853 by Andreas Tille at 2019-09-13T10:57:29Z
Adapt packaging

- - - - -
8f300def by Andreas Tille at 2019-09-13T11:02:51Z
Refresh patch

- - - - -
7d6db4f5 by Andreas Tille at 2019-09-13T11:03:51Z
DEP3

- - - - -
3320e538 by Andreas Tille at 2019-09-13T11:04:26Z
debhelper-compat 12

- - - - -
02d97017 by Andreas Tille at 2019-09-13T11:04:30Z
Standards-Version: 4.4.0

- - - - -
506660da by Andreas Tille at 2019-09-13T11:04:31Z
Secure URI in copyright format

- - - - -
aa5bb93b by Andreas Tille at 2019-09-13T11:04:37Z
Use secure URI in Homepage field.

Fixes lintian: homepage-field-uses-insecure-uri
See https://lintian.debian.org/tags/homepage-field-uses-insecure-uri.html for more details.

- - - - -
c216dce8 by Andreas Tille at 2019-09-13T11:06:17Z
buildsystem=pybuild

- - - - -
315762b0 by Andreas Tille at 2019-09-13T11:07:36Z
Inform users about Python3 migration in NEWS.Debian

- - - - -
da32d293 by Andreas Tille at 2019-09-13T11:15:36Z
pybuild is only important to keep dh_auto_clean silent.  The configuration is rather done by automake

- - - - -
1f861360 by Andreas Tille at 2019-09-13T11:28:15Z
Upload to unstable

- - - - -


9 changed files:

- + debian/NEWS.Debian
- debian/changelog
- − debian/compat
- debian/control
- debian/copyright
- + debian/docs
- + debian/patches/2to3_new.patch
- debian/patches/series
- debian/rules


Changes:

=====================================
debian/NEWS.Debian
=====================================
@@ -0,0 +1,14 @@
+parsnp (1.2+dfsg-6) unstable; urgency=medium
+
+  Parsnp was converted to Python3 by the Debian Med team since
+  Python2 will be removed from Debian 11.
+  If you notice any issues that might be connected to this conversion
+  please do
+
+     reportbug parsnp
+
+  to let us know.
+
+ -- Andreas Tille <tille at debian.org>  Fri, 13 Sep 2019 12:08:17 +0200
+
+


=====================================
debian/changelog
=====================================
@@ -1,3 +1,16 @@
+parsnp (1.2+dfsg-6) unstable; urgency=medium
+
+  * Use 2to3 to port to Python3
+    Closes: #937242
+  * debhelper-compat 12
+  * Standards-Version: 4.4.0
+  * Secure URI in copyright format
+  * Use secure URI in Homepage field.
+  * buildsystem=pybuild
+  * Inform users about Python3 migration in NEWS.Debian
+
+ -- Andreas Tille <tille at debian.org>  Fri, 13 Sep 2019 13:07:43 +0200
+
 parsnp (1.2+dfsg-5) unstable; urgency=medium
 
   * Build-Depends: dh-python


=====================================
debian/compat deleted
=====================================
@@ -1 +0,0 @@
-11


=====================================
debian/control
=====================================
@@ -3,27 +3,27 @@ Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.
 Uploaders: Andreas Tille <tille at debian.org>
 Section: science
 Priority: optional
-Build-Depends: debhelper (>= 11~),
+Build-Depends: debhelper-compat (= 12),
                dh-python,
-               python-all-dev,
-               python-setuptools,
-               cython,
+               python3-all-dev,
+               python3-setuptools,
+               cython3,
                libmuscle-dev
-Standards-Version: 4.1.5
+Standards-Version: 4.4.0
 Vcs-Browser: https://salsa.debian.org/med-team/parsnp
 Vcs-Git: https://salsa.debian.org/med-team/parsnp.git
-Homepage: http://harvest.readthedocs.org/en/latest/content/parsnp.html
+Homepage: https://harvest.readthedocs.org/en/latest/content/parsnp.html
 
 Package: parsnp
 Architecture: any
 Depends: ${shlibs:Depends},
          ${misc:Depends},
-         ${python:Depends},
-         python-numpy,
+         ${python3:Depends},
+         python3-numpy,
          fasttree,
          mummer,
          phipack
-Recommends: python-dendropy
+Recommends: python3-dendropy
 Description: rapid core genome multi-alignment
  Parsnp was designed to align the core genome of hundreds to thousands of
  bacterial genomes within a few minutes to few hours. Input can be both


=====================================
debian/copyright
=====================================
@@ -1,4 +1,4 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: ParSNP
 Upstream-Contact: Todd J Treangen <treangen at gmail.com>
 Source: https://github.com/marbl/parsnp/releases


=====================================
debian/docs
=====================================
@@ -0,0 +1 @@
+debian/NEWS.Debian


=====================================
debian/patches/2to3_new.patch
=====================================
@@ -0,0 +1,605 @@
+Description: Use 2to3 to port to Python3
+Bug-Debian: https://bugs.debian.org/937242
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Fri, 13 Sep 2019 12:08:17 +0200
+
+--- a/Parsnp.py
++++ b/Parsnp.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # See the LICENSE file included with this software for license information.
+ 
+ import os, sys, string, getopt, random,subprocess, time, glob,operator, math, datetime,numpy #pysam
+@@ -94,7 +94,7 @@ else:
+ def handler(signum, frame):
+     global SIGINT
+     SIGINT = True
+-    print 'Caught request to terminate by user (CTRL+C), exiting now, bye'
++    print('Caught request to terminate by user (CTRL+C), exiting now, bye')
+     sys.exit(128)
+ 
+ signal.signal(signal.SIGINT, handler)
+@@ -218,79 +218,79 @@ if os.path.exists("%s/MUMmer/nucmer_run"
+     ff.close()
+ 
+ def version():
+-    print VERSION
++    print(VERSION)
+ 
+ def usage():
+-    print "usage: parsnp [options] [-g|-r|-q](see below) -d <genome_dir> -p <threads>"
+-    print ""
+-    print "Parsnp quick start for three example scenarios: "
+-    print "1) With reference & genbank file: "
+-    print " >parsnp -g <reference_genbank_file1,reference_genbank_file2,..> -d <genome_dir> -p <threads> "
+-    print ""
+-    print "2) With reference but without genbank file:"
+-    print " >parsnp -r <reference_genome> -d <genome_dir> -p <threads> "
+-    print ""
+-    print "3) Autorecruit reference to a draft assembly:"
+-    print " >parsnp -q <draft_assembly> -d <genome_db> -p <threads> "
+-    print ""
+-    print "[Input parameters]"
+-    print "<<input/output>>"
+-    print " -c = <flag>: (c)urated genome directory, use all genomes in dir and ignore MUMi? (default = NO)"
+-    print " -d = <path>: (d)irectory containing genomes/contigs/scaffolds"
+-    print " -r = <path>: (r)eference genome (set to ! to pick random one from genome dir)"
+-    print " -g = <string>: Gen(b)ank file(s) (gbk), comma separated list (default = None)"
+-    print " -o = <string>: output directory? default [./P_CURRDATE_CURRTIME]"
+-    print " -q = <path>: (optional) specify (assembled) query genome to use, in addition to genomes found in genome dir (default = NONE)"
+-    print ""
+-    print "<<MUMi>>"
+-    print " -U = <float>: max MUMi distance value for MUMi distribution "
+-    print " -M = <flag>: calculate MUMi and exit? overrides all other choices! (default: NO)"
++    print("usage: parsnp [options] [-g|-r|-q](see below) -d <genome_dir> -p <threads>")
++    print("")
++    print("Parsnp quick start for three example scenarios: ")
++    print("1) With reference & genbank file: ")
++    print(" >parsnp -g <reference_genbank_file1,reference_genbank_file2,..> -d <genome_dir> -p <threads> ")
++    print("")
++    print("2) With reference but without genbank file:")
++    print(" >parsnp -r <reference_genome> -d <genome_dir> -p <threads> ")
++    print("")
++    print("3) Autorecruit reference to a draft assembly:")
++    print(" >parsnp -q <draft_assembly> -d <genome_db> -p <threads> ")
++    print("")
++    print("[Input parameters]")
++    print("<<input/output>>")
++    print(" -c = <flag>: (c)urated genome directory, use all genomes in dir and ignore MUMi? (default = NO)")
++    print(" -d = <path>: (d)irectory containing genomes/contigs/scaffolds")
++    print(" -r = <path>: (r)eference genome (set to ! to pick random one from genome dir)")
++    print(" -g = <string>: Gen(b)ank file(s) (gbk), comma separated list (default = None)")
++    print(" -o = <string>: output directory? default [./P_CURRDATE_CURRTIME]")
++    print(" -q = <path>: (optional) specify (assembled) query genome to use, in addition to genomes found in genome dir (default = NONE)")
++    print("")
++    print("<<MUMi>>")
++    print(" -U = <float>: max MUMi distance value for MUMi distribution ")
++    print(" -M = <flag>: calculate MUMi and exit? overrides all other choices! (default: NO)")
+     #new, mutually exclusive
+-    print " -i = <float>: max MUM(i) distance (default: autocutoff based on distribution of MUMi values)"
+-    print ""   
+-    print "<<MUM search>>"
++    print(" -i = <float>: max MUM(i) distance (default: autocutoff based on distribution of MUMi values)")
++    print("")   
++    print("<<MUM search>>")
+     #new, default to lower, 12-17
+-    print " -a = <int>: min (a)NCHOR length (default = 1.1*Log(S))"
+-    print " -C = <int>: maximal cluster D value? (default=100)"
+-    print " -z = <path>: min LCB si(z)e? (default = 25)"
+-    print ""
+-    print "<<LCB alignment>>"
+-    print " -D = <float>: maximal diagonal difference? Either percentage (e.g. 0.2) or bp (e.g. 100bp) (default = 0.12)"    
+-    print " -e = <flag> greedily extend LCBs? experimental! (default = NO)"
+-    print " -n = <string>: alignment program (default: libMUSCLE)"        
+-    print " -u = <flag>: output unaligned regions? .unaligned (default: NO)"
+-    print ""
+-    print "<<Recombination filtration>>"
++    print(" -a = <int>: min (a)NCHOR length (default = 1.1*Log(S))")
++    print(" -C = <int>: maximal cluster D value? (default=100)")
++    print(" -z = <path>: min LCB si(z)e? (default = 25)")
++    print("")
++    print("<<LCB alignment>>")
++    print(" -D = <float>: maximal diagonal difference? Either percentage (e.g. 0.2) or bp (e.g. 100bp) (default = 0.12)")    
++    print(" -e = <flag> greedily extend LCBs? experimental! (default = NO)")
++    print(" -n = <string>: alignment program (default: libMUSCLE)")        
++    print(" -u = <flag>: output unaligned regions? .unaligned (default: NO)")
++    print("")
++    print("<<Recombination filtration>>")
+     #new, default is OFF
+-    print " -x = <flag>: enable filtering of SNPs located in PhiPack identified regions of recombination? (default: NO)"
+-    print ""
+-    print "<<Misc>>"
+-    print " -h = <flag>: (h)elp: print this message and exit"
+-    print " -p = <int>: number of threads to use? (default= 1)"
+-    print " -P = <int>: max partition size? limits memory usage (default= 15000000)"
+-    print " -v = <flag>: (v)erbose output? (default = NO)"
+-    print " -V = <flag>: output (V)ersion and exit"
+-    print ""
++    print(" -x = <flag>: enable filtering of SNPs located in PhiPack identified regions of recombination? (default: NO)")
++    print("")
++    print("<<Misc>>")
++    print(" -h = <flag>: (h)elp: print this message and exit")
++    print(" -p = <int>: number of threads to use? (default= 1)")
++    print(" -P = <int>: max partition size? limits memory usage (default= 15000000)")
++    print(" -v = <flag>: (v)erbose output? (default = NO)")
++    print(" -V = <flag>: output (V)ersion and exit")
++    print("")
+ 
+ #hidden, not yet supported options
+-#print "-q = <path>: (optional) specify (assembled) query genome to use, in addition to genomes found in genome dir (default = NONE)"
+-#print "-s = <flag>: (s)plit genomes by n's (default = NO)"
+-#print "-z = <path>: min cluster si(z)e? (default = 10)"
+-#print "-F = <flag>: fast MUMi calc? (default=NO)"
+-#print "-g = <bool>: auto-launch (g)ingr? (default = NO)"
++#print("-q = <path>: (optional) specify (assembled) query genome to use, in addition to genomes found in genome dir (default = NONE)")
++#print("-s = <flag>: (s)plit genomes by n's (default = NO)")
++#print("-z = <path>: min cluster si(z)e? (default = 10)")
++#print("-F = <flag>: fast MUMi calc? (default=NO)")
++#print("-g = <bool>: auto-launch (g)ingr? (default = NO)")
+ 
+ 
+ if __name__ == "__main__":
+     parsnp_dir= sys.path[0]
+-    #print parsnp_dir
++    #print(parsnp_dir)
+     #PARSNP_DIR = parsnp_dir
+     opts = []
+     args = []
+     try:
+         opts, args = getopt.getopt(sys.argv[1:], "hxved:C:F:D:i:g:m:MU:o:a:cln:p:P:q:r:Rsz:uV", ["help","xtrafast","verbose","extend","sequencedir","clusterD","DiagonalDiff","iniFile","genbank","mumlength","onlymumi","MUMi","outputDir","anchorlength","curated","layout","aligNmentprog","threads","max-partition-size","query","reference","nofiltreps","split","minclustersiZe","unaligned","version"])
+-    except getopt.GetoptError, err:
++    except getopt.GetoptError as err:
+         # print help information and exit:                                                                                                                                                                                                        
+-        print str(err) 
++        print(str(err)) 
+         usage()
+         sys.exit(2)
+ 
+@@ -346,7 +346,7 @@ if __name__ == "__main__":
+             usage()
+             sys.exit(0)
+         elif o in ("-R","--filtreps"):
+-            print "WARNING: -R option is no longer supported, ignoring. Please see harvest.readthedocs.org for bed filtering w/ harvesttools"
++            print("WARNING: -R option is no longer supported, ignoring. Please see harvest.readthedocs.org for bed filtering w/ harvesttools")
+             filtreps = False
+         elif o in ("-r","--reference"):
+             ref = a
+@@ -436,7 +436,7 @@ if __name__ == "__main__":
+                         genbank_ref1.write(">gi|"+giline.split("GI:")[-1])
+                     ntdata = False
+                     data = ""
+-                    for line in rf.xreadlines():
++                    for line in rf:
+                         if ntdata:
+                             if "//" in line:
+                                 ntdata = False
+@@ -549,20 +549,20 @@ if __name__ == "__main__":
+         ref = query
+ 
+     if 1:
+-        print (len(outputDir)+17)*"*"
+-        print BOLDME+"SETTINGS:"+ENDC
++        print((len(outputDir)+17)*"*")
++        print(BOLDME+"SETTINGS:"+ENDC)
+         if ref != "!":
+-            print "|-"+BOLDME+"refgenome:\t%s"%(ref)+ENDC
++            print("|-"+BOLDME+"refgenome:\t%s"%(ref)+ENDC)
+         else:
+-            print "|-"+BOLDME+"refgenome:\t%s"%("autopick")+ENDC
+-        print "|-"+BOLDME+"aligner:\tlibMUSCLE"+ENDC
+-        print "|-"+BOLDME+"seqdir:\t%s"%(seqdir)+ENDC
+-        print "|-"+BOLDME+"outdir:\t%s"%(outputDir)+ENDC
+-        print "|-"+BOLDME+"OS:\t\t%s"%(OSTYPE)+ENDC
+-        print "|-"+BOLDME+"threads:\t%s"%(threads)+ENDC
+-        print (len(outputDir)+17)*"*"
++            print("|-"+BOLDME+"refgenome:\t%s"%("autopick")+ENDC)
++        print("|-"+BOLDME+"aligner:\tlibMUSCLE"+ENDC)
++        print("|-"+BOLDME+"seqdir:\t%s"%(seqdir)+ENDC)
++        print("|-"+BOLDME+"outdir:\t%s"%(outputDir)+ENDC)
++        print("|-"+BOLDME+"OS:\t\t%s"%(OSTYPE)+ENDC)
++        print("|-"+BOLDME+"threads:\t%s"%(threads)+ENDC)
++        print((len(outputDir)+17)*"*")
+ 
+-    print "\n<<Parsnp started>>\n"
++    print("\n<<Parsnp started>>\n")
+ 
+     #1)read fasta files (contigs/scaffolds/finished/DBs/dirs)
+     sys.stderr.write( "-->Reading Genome (asm, fasta) files from %s..\n"%(seqdir))
+@@ -605,7 +605,7 @@ if __name__ == "__main__":
+                 for char in special_chars:
+                     if char in file:
+               
+-                        print "WARNING: File %s contains a non-supported special character (\'%s\') in file name. Please remove if you'd like to include. For best practices see: http://support.apple.com/en-us/HT202808"%(file,char)
++                        print("WARNING: File %s contains a non-supported special character (\'%s\') in file name. Please remove if you'd like to include. For best practices see: http://support.apple.com/en-us/HT202808"%(file,char))
+                         nameok = False
+                         break
+             if nameok:
+@@ -632,7 +632,7 @@ if __name__ == "__main__":
+ 
+        for char in special_chars:
+           if char in file:
+-              #print "WARNING: File %s contains a non-supported special character (%s) in file name. Please remove if you'd like to include. For best practices see: http://support.apple.com/en-us/HT202808"%(file,char)
++              #print("WARNING: File %s contains a non-supported special character (%s) in file name. Please remove if you'd like to include. For best practices see: http://support.apple.com/en-us/HT202808"%(file,char))
+               nameok = False
+               break
+        if not nameok:
+@@ -644,7 +644,7 @@ if __name__ == "__main__":
+ 
+                 data = []
+                 totlen = 0
+-                for line in ff.xreadlines():
++                for line in ff:
+                     if line[0] != ">":
+                         data.append(line.replace("\n",""))
+                         if "-" in line:
+@@ -690,7 +690,7 @@ if __name__ == "__main__":
+                 continue
+             seq_dict[hdr] = nt
+             seq_len[hdr] = len(nt.replace("\n",""))
+-        seq_len_sort = sorted(seq_len.iteritems(), key=operator.itemgetter(1))
++        seq_len_sort = sorted(iter(seq_len.items()), key=operator.itemgetter(1))
+         seq_len_sort.reverse()
+         ffo = open("%s"%(outputDir+os.sep+ref.split(os.sep)[-1]+".ref"),'w')
+         for item in seq_len_sort:
+@@ -750,7 +750,7 @@ if __name__ == "__main__":
+     if not inifile_exists:
+         if len(fnafiles) < 1 or ref == "":
+             sys.stderr.write( "Parsnp requires 2 or more genomes to run, exiting\n")
+-            print fnafiles, ref
++            print(fnafiles, ref)
+             sys.exit(0)
+     
+         file_string = ""
+@@ -779,7 +779,7 @@ if __name__ == "__main__":
+         run_command(command)
+         try:
+             mumif = open(outputDir+os.sep+"all.mumi",'r')
+-            for line in mumif.xreadlines():
++            for line in mumif:
+                 line = line.replace("\n","")
+                 try:
+                     idx,mi = line.split(":")
+@@ -791,13 +791,13 @@ if __name__ == "__main__":
+             i = 0
+             for file in fnafiles:
+                 mumi_dict[i] = 1
+-        print "  |->["+OK_GREEN+"OK"+ENDC+"]"
++        print("  |->["+OK_GREEN+"OK"+ENDC+"]")
+     finalfiles = []
+     lowest_mumi = 100
+     auto_ref = ""
+ 
+     if autopick_ref:
+-        for idx in mumi_dict.keys():
++        for idx in list(mumi_dict.keys()):
+             if mumi_dict[idx] < lowest_mumi:
+                 auto_ref = seqdir+os.sep+fnafiles[idx]
+                 ref = auto_ref        
+@@ -813,9 +813,9 @@ if __name__ == "__main__":
+             mumi_f = open(outputDir+os.sep+"recruited_genomes.lst",'w')
+         
+     if VERBOSE:
+-        print "RECRUITED GENOMES:\n"
++        print("RECRUITED GENOMES:\n")
+ 
+-    sorted_x = sorted(mumi_dict.iteritems(), key=operator.itemgetter(1))
++    sorted_x = sorted(iter(mumi_dict.items()), key=operator.itemgetter(1))
+     scnt = 0
+     mumivals = []
+     for item in sorted_x:
+@@ -838,7 +838,7 @@ if __name__ == "__main__":
+         hpv = minv+(3*stdv)
+ 
+ 
+-    for idx in mumi_dict.keys():
++    for idx in list(mumi_dict.keys()):
+         if mumi_dict[idx] < (float(mumidistance)) or curated:
+             if fastmum and mumi_dict[idx] > hpv:
+                 continue
+@@ -846,11 +846,11 @@ if __name__ == "__main__":
+                 if mumi_only:
+                     mumi_f.write(os.path.abspath(seqdir+os.sep+fnafiles[idx])+",%f"%(mumi_dict[idx])+"\n")
+                 if VERBOSE:
+-                    print "\t"+fnafiles[idx]
++                    print("\t"+fnafiles[idx])
+                 finalfiles.append(fnafiles[idx])
+                 allfiles.append(fnafiles[idx])
+     if VERBOSE:
+-        print 
++        print() 
+ 
+     if curated:
+         for file in fnafiles:
+@@ -878,7 +878,7 @@ if __name__ == "__main__":
+                 continue
+             seq_dict[hdr] = nt
+             seq_len[hdr] = len(nt.replace("\n",""))
+-        seq_len_sort = sorted(seq_len.iteritems(), key=operator.itemgetter(1))
++        seq_len_sort = sorted(iter(seq_len.items()), key=operator.itemgetter(1))
+         seq_len_sort.reverse()
+         ffo = open("%s"%(outputDir+os.sep+auto_ref.split(os.sep)[-1]+".ref"),'w')
+         for item in seq_len_sort:
+@@ -888,8 +888,8 @@ if __name__ == "__main__":
+         ffo.close()
+         auto_ref = outputDir+os.sep+auto_ref.split(os.sep)[-1]+".ref"
+         ref = auto_ref
+-        #print ref
+-    #print ref
++        #print(ref)
++    #print(ref)
+     inifiled_closest = inifiled
+     if not inifile_exists:
+         if len(finalfiles) < 1 or ref == "":
+@@ -934,7 +934,7 @@ if __name__ == "__main__":
+     
+ 
+     #3)run parsnp (cores, grid?)
+-    print "-->Running Parsnp multi-MUM search and libMUSCLE aligner.."
++    print("-->Running Parsnp multi-MUM search and libMUSCLE aligner..")
+     if not os.path.exists(outputDir+os.sep+"blocks"):
+         os.mkdir(outputDir+os.sep+"blocks")
+     command = ""
+@@ -983,7 +983,7 @@ if __name__ == "__main__":
+     totseqs = 0
+     try:
+         cf = open("%sparsnpAligner.log"%(outputDir+os.sep)) 
+-        for line in cf.xreadlines():
++        for line in cf:
+             if "Total coverage among all sequences:" in line:
+                 coverage = line.split(":",1)[-1].replace("\n","")
+                 coverage = float(coverage.replace("%",""))/100.0
+@@ -991,7 +991,7 @@ if __name__ == "__main__":
+                 totlength += int(line.split(":",1)[-1].replace("\n","").split("bps")[0])
+                 totseqs +=1
+     except IOError:
+-        print ERROR_RED+"parsnpAligner.log missing, parsnpAligner failed, exiting.."+ENDC
++        print(ERROR_RED+"parsnpAligner.log missing, parsnpAligner failed, exiting.."+ENDC)
+         sys.exit(1)
+ 
+     #update thresholds
+@@ -1002,10 +1002,10 @@ if __name__ == "__main__":
+         sys.stderr.write( "  |->["+WARNING_YELLOW+"WARNING"+ENDC+"]"+": aligned regions cover less than 10% of reference genome! please verify recruited genomes are all strain of interest"+ENDC)
+     else:
+         pass
+-    print "  |->["+OK_GREEN+"OK"+ENDC+"]"
++    print("  |->["+OK_GREEN+"OK"+ENDC+"]")
+     t2 = time.time()
+     elapsed = float(t2)-float(t1)
+-    #print "-->Getting list of LCBs.."
++    #print("-->Getting list of LCBs..")
+     allbfiles = glob.glob(outputDir+os.sep+"blocks/b*/*")
+     blockfiles = []
+     icnt = 0
+@@ -1047,7 +1047,7 @@ if __name__ == "__main__":
+     recombination_sites = {}
+     bedfile = ""
+     bedfile_dict = {}
+-    print "-->Running PhiPack on LCBs to detect recombination.."
++    print("-->Running PhiPack on LCBs to detect recombination..")
+     if run_recomb_filter and len(blockfiles) > 0:
+ 
+         bedfile = open("%s/parsnp.rec"%(outputDir),'w')
+@@ -1078,7 +1078,7 @@ if __name__ == "__main__":
+     
+         #run parallelPhiPack
+         pool = Pool(processes=int(threads))
+-        result = pool.map_async(parallelPhiWrapper,tasks).get(sys.maxint)
++        result = pool.map_async(parallelPhiWrapper,tasks).get(sys.maxsize)
+         
+         for i in result:
+             if (i["status"] == 1):
+@@ -1113,7 +1113,7 @@ if __name__ == "__main__":
+                             bedfile_dict[srpos] = "1\t%s\t%s\tREC\t%.3f\t+\n"%(srpos,pos+50+block_spos,eval)
+                         else:
+                             chrnum = 1
+-                            chr_spos = ref_seqs.keys()
++                            chr_spos = list(ref_seqs.keys())
+                             for cs in chr_spos:
+                                 if block_spos < chr_spos:
+                                     chrnum = ref_seqs[cs]
+@@ -1129,7 +1129,7 @@ if __name__ == "__main__":
+ 
+         pool.close()
+         pool.join()
+-        brkeys = bedfile_dict.keys()
++        brkeys = list(bedfile_dict.keys())
+         brkeys.sort()
+         for key in brkeys:
+             bedfile.write(bedfile_dict[key])
+@@ -1160,14 +1160,14 @@ if __name__ == "__main__":
+         run_command("harvesttools -q -i %s/parsnp.ggr -S "%(outputDir)+outputDir+os.sep+"parsnp.snps.mblocks")
+ 
+     command = "fasttree -nt -quote -gamma -slow -boot 100 "+outputDir+os.sep+"parsnp.snps.mblocks > "+outputDir+os.sep+"parsnp.tree"
+-    print "-->Reconstructing core genome phylogeny.."
++    print("-->Reconstructing core genome phylogeny..")
+     run_command(command)
+     #7)reroot to midpoint
+     if os.path.exists("outtree"):
+         os.system("rm outtree")
+        
+     if reroot_tree and len(finalfiles) > 1:
+-        #print "-->Midpoint reroot.."
++        #print("-->Midpoint reroot..")
+         try:
+             mtree = open("%sparsnp.tree"%(outputDir+os.sep), 'r')
+             mtreedata = mtree.read()
+@@ -1175,32 +1175,32 @@ if __name__ == "__main__":
+             tree = dendropy.Tree.get_from_string(mtreedata,"newick")
+             tree.reroot_at_midpoint(update_splits=False)
+             mftreef = tree.as_string('newick').split(" ",1)[1]
+-            #print mftreef
++            #print(mftreef)
+             mtreef = open(outputDir+os.sep+"parsnp.final.tree",'w')
+             mtreef.write(mftreef)
+             mtreef.close()
+             os.system("mv %s %s"%(outputDir+os.sep+"parsnp.final.tree",outputDir+os.sep+"parsnp.tree"))
+         except IOError:
+             sys.stderr.write( "ERROR: cannot process fasttree output, skipping midpoint reroot..\n")
+-    print "  |->["+OK_GREEN+"OK"+ENDC+"]"
++    print("  |->["+OK_GREEN+"OK"+ENDC+"]")
+ 
+ 
+     if 1 or len(use_gingr) > 0:
+-        print "-->Creating Gingr input file.."
++        print("-->Creating Gingr input file..")
+         if xtrafast or 1:
+             #if newick available, add
+             #new flag to update branch lengths
+             run_command("harvesttools --midpoint-reroot -u -q -i "+outputDir+os.sep+"parsnp.ggr -o "+outputDir+os.sep+"parsnp.ggr -n %s"%(outputDir+os.sep+"parsnp.tree "))
+  
+-    print "  |->["+OK_GREEN+"OK"+ENDC+"]"
++    print("  |->["+OK_GREEN+"OK"+ENDC+"]")
+ 
+-    print "-->Calculating wall clock time.. "
++    print("-->Calculating wall clock time.. ")
+     if float(elapsed)/float(60.0) > 60:
+-        print "  |->"+BOLDME+"Aligned %d genomes in %.2f hours"%(totseqs,float(elapsed)/float(3600.0))+ENDC
++        print("  |->"+BOLDME+"Aligned %d genomes in %.2f hours"%(totseqs,float(elapsed)/float(3600.0))+ENDC)
+     elif float(elapsed) > 60:
+-        print "  |->"+BOLDME+"Aligned %d genomes in %.2f minutes"%(totseqs,float(elapsed)/float(60.0))+ENDC
++        print("  |->"+BOLDME+"Aligned %d genomes in %.2f minutes"%(totseqs,float(elapsed)/float(60.0))+ENDC)
+     else: 
+-        print "  |->"+BOLDME+"Aligned %d genomes in %.2f seconds"%(totseqs,float(elapsed))+ENDC
++        print("  |->"+BOLDME+"Aligned %d genomes in %.2f seconds"%(totseqs,float(elapsed))+ENDC)
+     #cleanup
+     rmfiles = glob.glob(outputDir+os.sep+"*.aln")
+     #rmfiles2 = glob.glob(outputDir+os.sep+"blocks/b*/*")
+@@ -1211,33 +1211,33 @@ if __name__ == "__main__":
+         os.system("rm -rf %s"%(file))
+ 
+     filepres = 0
+-    print BOLDME+"\n<<Parsnp finished! All output available in %s>>"%(outputDir)+ENDC
+-    print
+-    print BOLDME+"Validating output directory contents..."+ENDC
+-    print BOLDME+"\t1)parsnp.tree:\t\tnewick format tree"+ENDC,
++    print(BOLDME+"\n<<Parsnp finished! All output available in %s>>"%(outputDir)+ENDC)
++    print()
++    print(BOLDME+"Validating output directory contents..."+ENDC)
++    print(BOLDME+"\t1)parsnp.tree:\t\tnewick format tree"+ENDC, end=' ')
+     if os.path.exists("%sparsnp.tree"%(outputDir+os.sep)) and os.path.getsize("%sparsnp.tree"%(outputDir+os.sep)) > 0:
+-        print "\t\t\t["+OK_GREEN+"OK"+ENDC+"]"
++        print("\t\t\t["+OK_GREEN+"OK"+ENDC+"]")
+         filepres+=1
+     else:
+-        print "\t|->"+ERROR_RED+"MISSING"+ENDC
+-    print BOLDME+"\t2)parsnp.ggr:\t\tharvest input file for gingr (GUI)"+ENDC,
++        print("\t|->"+ERROR_RED+"MISSING"+ENDC)
++    print(BOLDME+"\t2)parsnp.ggr:\t\tharvest input file for gingr (GUI)"+ENDC, end=' ')
+     if os.path.exists("%sparsnp.ggr"%(outputDir+os.sep)) and os.path.getsize("%sparsnp.ggr"%(outputDir+os.sep)) > 0:
+-        print "\t["+OK_GREEN+"OK"+ENDC+"]"
++        print("\t["+OK_GREEN+"OK"+ENDC+"]")
+         filepres+=1
+     else:
+-        print "\t|->"+ERROR_RED+"MISSING"+ENDC
+-    print BOLDME+"\t3)parsnp.xmfa:\t\tXMFA formatted multi-alignment"+ENDC,
++        print("\t|->"+ERROR_RED+"MISSING"+ENDC)
++    print(BOLDME+"\t3)parsnp.xmfa:\t\tXMFA formatted multi-alignment"+ENDC, end=' ')
+     if os.path.exists("%sparsnp.xmfa"%(outputDir+os.sep)) and os.path.getsize("%sparsnp.xmfa"%(outputDir+os.sep)) > 0:
+-        print "\t\t["+OK_GREEN+"OK"+ENDC+"]"
++        print("\t\t["+OK_GREEN+"OK"+ENDC+"]")
+         filepres+=1
+     else:
+-        print "\t|->"+ERROR_RED+"MISSING"+ENDC
++        print("\t|->"+ERROR_RED+"MISSING"+ENDC)
+     if filepres == 3:
+         pass
+ 
+     else:
+-        print "\t\t["+ERROR_RED+"Output files missing, something went wrong. Check logs and relaunch or contact developers for assistance"+ENDC+"]"
+-    print
++        print("\t\t["+ERROR_RED+"Output files missing, something went wrong. Check logs and relaunch or contact developers for assistance"+ENDC+"]")
++    print()
+     if os.path.exists("%sblocks"%(outputDir+os.sep)):
+         os.rmdir("%sblocks"%(outputDir+os.sep))
+     if os.path.exists("allmums.out"):
+@@ -1281,6 +1281,6 @@ if __name__ == "__main__":
+         #check if available first
+         rc = 0
+         if binary_type == "osx":
+-            print ">>Launching gingr.."
++            print(">>Launching gingr..")
+             os.system("open -n %s --args %s/parsnp.ggr"%(use_gingr,outputDir))
+ 
+--- a/install.py
++++ b/install.py
+@@ -1,12 +1,12 @@
+ import os,sys,string
+ #parsnp basic INSTALL script
+ user_home = os.environ["HOME"]
+-print "<<Welcome to Parsnp utility script install>>"
++print("<<Welcome to Parsnp utility script install>>")
+ 
+ #check for python version
+ if (sys.version_info[0] < 2) or (sys.version_info[0] == 2 and sys.version_info[1] < 6):
+     
+-    print "Python version is %s. Parsnp requires at least 2.6"%(sys.version)
++    print("Python version is %s. Parsnp requires at least 2.6"%(sys.version))
+     sys.exit(1)
+ 
+ #complete shebang
+--- a/script/shuffle.py
++++ b/script/shuffle.py
+@@ -51,7 +51,7 @@ if __name__ == "__main__":
+      rnumber = 0
+      shuffleperseq = 1
+      if len(sys.argv) < 6:
+-         print "\nUsage: shuffleGenome <FastA input file> <output file> <Rearrangement size> <Number of rearrangements> <Shuffled sequences per seq>"
++         print("\nUsage: shuffleGenome <FastA input file> <output file> <Rearrangement size> <Number of rearrangements> <Shuffled sequences per seq>")
+          sys.exit(1)
+      else:
+          infileName = sys.argv[1]
+@@ -77,22 +77,22 @@ if __name__ == "__main__":
+          header = infile.readline()
+          infiled = infile.read()
+          filelen = len(infiled)
+-         print "\nInput sequence:%s"%seqfile
+-         print "Input sequence length: %d\n"%filelen
++         print("\nInput sequence:%s"%seqfile)
++         print("Input sequence length: %d\n"%filelen)
+ 
+          #split genome into filelen/rsize parts
+          partlist = []
+          pos = 0
+          if rsize > filelen:
+              rsize = filelen
+-         for part in xrange(0,filelen/rsize):
++         for part in range(0,filelen/rsize):
+              partlist.append(infiled[pos:(part+1)*rsize])
+              pos +=rsize
+ 
+          partlist.append(infiled[pos:])
+ 
+ 
+-         for shuffleit in xrange(0,shuffleperseq): 
++         for shuffleit in range(0,shuffleperseq): 
+              count = 0
+              seq = ""
+              parttemp = ""
+@@ -114,13 +114,13 @@ if __name__ == "__main__":
+                      parttemp = partlist[part1]
+                      partlist[part1] = partlist[part2]
+                      partlist[part2] = parttemp
+-                     print "Transposition"
+-                     print "  Positions %d and %d swapped"%(part1,part2)
++                     print("Transposition")
++                     print("  Positions %d and %d swapped"%(part1,part2))
+                  elif operation == 2:
+                      #inversion
+                      partlist[part1] = invertSeq(partlist[part1])
+-                     print "Inversion"
+-                     print " Position %d"%part1
++                     print("Inversion")
++                     print(" Position %d"%part1)
+ 
+ 
+                      
+@@ -137,7 +137,7 @@ if __name__ == "__main__":
+              #write output to file
+              fname = seqfile[:-4]
+              fname+= "_Shuffled_%d.fna"%(shuffleit+1)
+-             print "output: %s"%(fname)
++             print("output: %s"%(fname))
+              
+              fout = open(fname,'w')
+              fout.write(output)


=====================================
debian/patches/series
=====================================
@@ -8,3 +8,4 @@ proper_calls_to_tools.patch
 drop_m64.patch
 fix_build_with_as-needed.patch
 non-versioned-libs.patch
+2to3_new.patch


=====================================
debian/rules
=====================================
@@ -7,14 +7,17 @@ include /usr/share/dpkg/default.mk
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
 %:
-	dh $@ --with python2
+	dh $@ --with python3
+
+override_dh_auto_clean:
+	dh_auto_clean -O--buildsystem=pybuild
 
 override_dh_auto_configure:
 	dh_auto_configure -- --with-libmuscle=/usr/include/libMUSCLE-3.7
 
 override_dh_auto_install:
 	dh_auto_install
-	# The actual user interface is the Python script so move the binary to /usr/lib
+	# The actual user interface is the Python3 script so move the binary to /usr/lib
 	mkdir -p debian/$(DEB_SOURCE)/usr/lib/$(DEB_SOURCE)
 	mv debian/$(DEB_SOURCE)/usr/bin/$(DEB_SOURCE) debian/$(DEB_SOURCE)/usr/lib/$(DEB_SOURCE)
 



View it on GitLab: https://salsa.debian.org/med-team/parsnp/compare/d12bea2f4b5d9f5a7d9fdccad8baf663494782fc...1f8613601625fefb10d504c984fffa370fe85124

-- 
View it on GitLab: https://salsa.debian.org/med-team/parsnp/compare/d12bea2f4b5d9f5a7d9fdccad8baf663494782fc...1f8613601625fefb10d504c984fffa370fe85124
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190913/5a09336a/attachment-0001.html>


More information about the debian-med-commit mailing list