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

Andreas Tille gitlab at salsa.debian.org
Wed Sep 4 16:43:09 BST 2019



Andreas Tille pushed to branch master at Debian Med / sspace


Commits:
5374b420 by Andreas Tille at 2019-09-04T14:45:59Z
Use 2to3 to port to Python3

- - - - -
6e459f71 by Andreas Tille at 2019-09-04T14:46:43Z
debhelper-compat 12

- - - - -
27f2ed7c by Andreas Tille at 2019-09-04T14:46:46Z
Standards-Version: 4.4.0

- - - - -
53cb1b87 by Andreas Tille at 2019-09-04T14:46:46Z
Remove trailing whitespace in debian/changelog

- - - - -
0af870d2 by Andreas Tille at 2019-09-04T15:00:18Z
Fix permission of fasta file

- - - - -
61f97b32 by Andreas Tille at 2019-09-04T15:00:41Z
Depends: s/python/python3/

- - - - -
37cce103 by Andreas Tille at 2019-09-04T15:42:34Z
Just for debugging - something seems to be wrong with bowtie

- - - - -


8 changed files:

- debian/changelog
- − debian/compat
- debian/control
- + debian/patches/2to3.patch
- + debian/patches/debug.patch
- debian/patches/series
- debian/rules
- debian/tests/example-tests


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,14 @@
+sspace (2.1.1+dfsg-5) UNRELEASED; urgency=medium
+
+  * Use 2to3 to port to Python3
+    Closes: #938565
+  * debhelper-compat 12
+  * Standards-Version: 4.4.0
+  * Remove trailing whitespace in debian/changelog
+  * Fix permission of fasta file
+
+ -- Andreas Tille <tille at debian.org>  Wed, 04 Sep 2019 16:44:45 +0200
+
 sspace (2.1.1+dfsg-4) unstable; urgency=medium
 
   * debhelper 11
@@ -26,7 +37,7 @@ sspace (2.1.1+dfsg-2) unstable; urgency=medium
 
 sspace (2.1.1+dfsg-1) unstable; urgency=low
 
-  [ Andreas Tille and Sascha Steinbiss ] 
+  [ Andreas Tille and Sascha Steinbiss ]
   * Initial release (Closes: #826682)
 
  -- Sascha Steinbiss <sascha at steinbiss.name>  Tue, 07 Jun 2016 21:55:43 +0000


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


=====================================
debian/control
=====================================
@@ -4,12 +4,12 @@ Uploaders: Andreas Tille <tille at debian.org>,
            Sascha Steinbiss <satta at debian.org>
 Section: science
 Priority: optional
-Build-Depends: debhelper (>= 11~),
+Build-Depends: debhelper-compat (= 12),
                recode,
                python,
                asciidoctor,
                bowtie
-Standards-Version: 4.2.1
+Standards-Version: 4.4.0
 Vcs-Browser: https://salsa.debian.org/med-team/sspace
 Vcs-Git: https://salsa.debian.org/med-team/sspace.git
 Homepage: https://github.com/nsoranzo/sspace_basic
@@ -18,7 +18,7 @@ Package: sspace
 Architecture: all
 Depends: ${perl:Depends},
          ${misc:Depends},
-         python,
+         python3,
          bowtie
 Description: scaffolding pre-assembled contigs after extension
  SSAKE-based Scaffolding of Pre-Assembled Contigs after Extension (SSPACE)


=====================================
debian/patches/2to3.patch
=====================================
@@ -0,0 +1,279 @@
+Description: Use 2to3 to port to Python3
+Bug-Debian: https://bugs.debian.org/938565
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Wed, 04 Sep 2019 16:44:45 +0200
+
+--- a/tools/TQS.py
++++ b/tools/TQS.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python3
+ 
+ __doc__ = """
+ TQS
+@@ -53,18 +53,18 @@ def main():
+ 		f = open(opts.seqfile)
+ 		seq = f.readlines()
+ 		f.close()
+-	except Exception, e:
+-		print "ERROR: Could not read from %s: %s" % (opts.seqfile, e)
+-		print usage % (sys.argv[0:])
++	except Exception as e:
++		print("ERROR: Could not read from %s: %s" % (opts.seqfile, e))
++		print(usage % (sys.argv[0:]))
+ 		sys.exit()
+ 
+         try:
+                 f = open(opts.qualfile)
+                 qual = f.readlines()
+                 f.close()
+-        except Exception, e:
+-                print "ERROR: Could not read from %s: %s" % (opts.qualfile, e)
+-                print usage % (sys.argv[0:])
++        except Exception as e:
++                print("ERROR: Could not read from %s: %s" % (opts.qualfile, e))
++                print(usage % (sys.argv[0:]))
+                 sys.exit()
+ 	
+ 
+@@ -75,22 +75,22 @@ def main():
+         try:
+                 FASTA = open(fasta, 'w')
+         except:
+-                print "ERROR: Can not write to %s" % fasta
++                print("ERROR: Can not write to %s" % fasta)
+                 sys.exit()
+ 
+ 	try:
+ 		LOG = open(log, 'w')
+ 	except:
+-		print "ERROR: Can not write to %s" % log
++		print("ERROR: Can not write to %s" % log)
+ 		sys.exit()
+ 	
+ 
+ 	if opts.mer < 15 or opts.mer > 200:
+-		print "ERROR: -l must be a number between 15 and 200."
++		print("ERROR: -l must be a number between 15 and 200.")
+ 		sys.exit()
+ 	
+ 	if opts.consec < 16 or opts.consec > opts.mer:
+-		print "ERROR: -c must be a number between 16 and -l."
++		print("ERROR: -c must be a number between 16 and -l.")
+ 		sys.exit()
+ 
+ 	LOG.write("""
+@@ -130,7 +130,7 @@ def parseQualFile(threshold, difference,
+ 	read_number = 0
+ 
+ 	if verbose:
+-		print "Printing trimming pattern for all reads passing the set threshold values...\n"
++		print("Printing trimming pattern for all reads passing the set threshold values...\n")
+ 	
+ 	for line in qual:
+ 		read_number += 1                ### this keeps track of the read order, respected between the prb and seq files
+@@ -156,7 +156,7 @@ def parseQualFile(threshold, difference,
+  		if head_match != None:
+ 			ok_read += 1
+ 			col = head_match.span()
+-                        if not trim_info.has_key(read_number):
++                        if read_number not in trim_info:
+                                 trim_info[read_number] = {}
+ 
+ 			start = int(col[0])	
+@@ -167,7 +167,7 @@ def parseQualFile(threshold, difference,
+ 
+ 			if verbose:
+ 				sub = concat[trim_info[read_number]['start']:trim_info[read_number]['end']]
+-				print "passed seqs:%i line#%i %s (start trim:%i,length:%i) %s\n" % (ok_read, read_number, concat, start, end, sub)
++				print("passed seqs:%i line#%i %s (start trim:%i,length:%i) %s\n" % (ok_read, read_number, concat, start, end, sub))
+ 
+ 	LOG.write("%i out of %i sequences passed your filter (I >= %i and D >= %i and L >= %i)\n" % (ok_read, read_number, threshold, difference, consecutive))
+ 
+@@ -191,7 +191,7 @@ def readNTrim(trim_info, seq, verbose, F
+ 	gDNAlinker2_field = re.compile('^ATCTAACAG')	
+ 
+ 	if verbose:
+-		print "Printing trimmed sequences for all reads passing the set threshold values minus, excluding sequence containing linkers...\n"
++		print("Printing trimmed sequences for all reads passing the set threshold values minus, excluding sequence containing linkers...\n")
+ 
+         for line in seq:
+ 		read_number += 1            ### tracks read number / will match order in prb file
+@@ -199,7 +199,7 @@ def readNTrim(trim_info, seq, verbose, F
+ 		info = line.split("\t")     ### split line, the seq file lists: lane tile xcoord y coord DNAseq 
+ 		dna_string = info[4]
+ 	
+-		if trim_info.has_key(read_number):
++		if read_number in trim_info:
+ 			trim_seq = dna_string[trim_info[read_number]['start']:trim_info[read_number]['end']]
+ 			if re.match(dna_sequence_field, trim_seq):		### no ambiguous bases?
+ 				if re.match(gDNAlinker1_field, trim_seq) or re.match(gDNAlinker2_field,trim_seq):	### matches gDNA linker?
+@@ -208,7 +208,7 @@ def readNTrim(trim_info, seq, verbose, F
+ 					usable_reads += 1
+ 					FASTA.write(">%s-%s-%s-%s\n%s\n" % (info[0],info[1],info[2],info[3],trim_seq))
+ 					if verbose:
+-						print "line#%i %s (start trim:%i,length:%i) %s" % (read_number,info[4],trim_info[read_number]['start'],trim_info[read_number]['end'],trim_seq)
++						print("line#%i %s (start trim:%i,length:%i) %s" % (read_number,info[4],trim_info[read_number]['start'],trim_info[read_number]['end'],trim_seq))
+ 	LOG.write("%i out of %i sequences appear to be usable, after filtering out sequences hard-coded in this program * %i gDNA linker sequences*\n" % (usable_reads, read_number,gDNAlinker_count))
+ 	return
+ 
+--- a/tools/TQS.readme
++++ b/tools/TQS.readme
+@@ -24,12 +24,12 @@ __version__ = '1.0'
+ 
+ Execution example
+ ==================
+-python TQS.py -f test_seq.txt -q test_prb.txt -l 36 -t 5 -d 5 -c 20
++python3 TQS.py -f test_seq.txt -q test_prb.txt -l 36 -t 5 -d 5 -c 20
+ 
+ 
+ Options
+ =======
+-python TQS.py --help
++python3 TQS.py --help
+ 
+ Usage: TQS.py [options]
+ 
+--- a/tools/TQSexport.py
++++ b/tools/TQSexport.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python3
+ 
+ __doc__ = """
+ TQS
+@@ -47,9 +47,9 @@ def main():
+ 		f = open(opts.exportfile)
+ 		seq = f.readlines()
+ 		f.close()
+-	except Exception, e:
+-		print "ERROR: Could not read from %s: %s" % (opts.exportfile, e)
+-		print usage % (sys.argv[0:])
++	except Exception as e:
++		print("ERROR: Could not read from %s: %s" % (opts.exportfile, e))
++		print(usage % (sys.argv[0:]))
+ 		sys.exit()
+ 
+ 
+@@ -61,17 +61,17 @@ def main():
+         try:
+                 FASTA = open(fasta, 'w')
+         except:
+-                print "ERROR: Can not write to %s" % fasta
++                print("ERROR: Can not write to %s" % fasta)
+                 sys.exit()
+ 
+ 	try:
+ 		LOG = open(log, 'w')
+ 	except:
+-		print "ERROR: Can not write to %s" % log
++		print("ERROR: Can not write to %s" % log)
+ 		sys.exit()
+ 	
+ 	if opts.consec < minimum_length:
+-		print "ERROR: -c must be a number larger than %i." % (minimum_length)
++		print("ERROR: -c must be a number larger than %i." % (minimum_length))
+ 		sys.exit()
+ 
+ 	LOG.write("""
+@@ -106,7 +106,7 @@ YYYYRYYYYYYYYYYYTTTTTOOOMOOOMMOOOOOG	chr
+ 	read_number = 0
+ 
+ 	if verbose:
+-		print "Printing trimming pattern for all reads passing the set threshold values...\n"
++		print("Printing trimming pattern for all reads passing the set threshold values...\n")
+ 	
+ 	for line in export:
+ 		read_number += 1
+@@ -134,7 +134,7 @@ YYYYRYYYYYYYYYYYTTTTTOOOMOOOMMOOOOOG	chr
+  		if head_match != None:
+ 			ok_read += 1
+ 			col = head_match.span()
+-                        if not trim_info.has_key(read_number):
++                        if read_number not in trim_info:
+                                 trim_info[read_number] = {}
+ 
+ 			start = int(col[0])	
+@@ -150,7 +150,7 @@ YYYYRYYYYYYYYYYYTTTTTOOOMOOOMMOOOOOG	chr
+                         FASTA.write(">%s-%s-%s-%s%s\n%s\n" % (info[1],info[2],info[3],info[4],pair,trim_seq))
+ 
+ 			if verbose:
+-				print "passed seqs:%i line#%i %s (start trim:%i,end trim:%i) %s\n" % (ok_read, read_number, concat, start, end, trim_seq)
++				print("passed seqs:%i line#%i %s (start trim:%i,end trim:%i) %s\n" % (ok_read, read_number, concat, start, end, trim_seq))
+ 
+ 	LOG.write("%i out of %i sequences passed your filter (-t >= %i and -c >= %i)\n" % (ok_read, read_number, threshold, consecutive))
+ 
+--- a/tools/TQSfastq.py
++++ b/tools/TQSfastq.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python3
+ 
+ __doc__ = """
+ TQS
+@@ -52,9 +52,9 @@ def main():
+ 		f = open(opts.fastqfile)
+ 		seq = f.readlines()
+ 		f.close()
+-	except Exception, e:
+-		print "ERROR: Could not read from %s: %s" % (opts.fastqfile, e)
+-		print usage % (sys.argv[0:])
++	except Exception as e:
++		print("ERROR: Could not read from %s: %s" % (opts.fastqfile, e))
++		print(usage % (sys.argv[0:]))
+ 		sys.exit()
+ 
+ 
+@@ -66,21 +66,21 @@ def main():
+         try:
+                 FASTA = open(fasta, 'w')
+         except:
+-                print "ERROR: Can not write to %s" % fasta
++                print("ERROR: Can not write to %s" % fasta)
+                 sys.exit()
+ 
+ 	try:
+ 		LOG = open(log, 'w')
+ 	except:
+-		print "ERROR: Can not write to %s" % log
++		print("ERROR: Can not write to %s" % log)
+ 		sys.exit()
+ 	
+ 	if opts.consec < minimum_length:
+-		print "ERROR: -c must be a number larger than %i." % (minimum_length)
++		print("ERROR: -c must be a number larger than %i." % (minimum_length))
+ 		sys.exit()
+ 
+         if opts.encoding != 33 and opts.encoding != 64:
+-                print "ERROR: -e must be either 33 or 64."
++                print("ERROR: -e must be either 33 or 64.")
+                 sys.exit()
+ 
+ 	LOG.write("""
+@@ -114,7 +114,7 @@ def readNtrim(fastq, threshold, consecut
+ 	record_line = 0
+ 	
+ 	if verbose:
+-		print "Printing trimming pattern for all reads passing the set threshold values...\n"
++		print("Printing trimming pattern for all reads passing the set threshold values...\n")
+ 	
+ 	for line in fastq:
+ 		record_line += 1
+@@ -150,7 +150,7 @@ def readNtrim(fastq, threshold, consecut
+ 	 		if head_match != None:
+ 				ok_read += 1
+ 				col = head_match.span()
+-	                        if not trim_info.has_key(read_number):
++	                        if read_number not in trim_info:
+ 	                                trim_info[read_number] = {}
+ 	
+ 				start = int(col[0])	
+@@ -160,7 +160,7 @@ def readNtrim(fastq, threshold, consecut
+ 	                        FASTA.write(">%s\n%s\n" % (read_id, trim_seq))
+ 	
+ 				if verbose:
+-					print "%s\n%s\n%s\n passed seqs:%i line#%i %s (start trim:%i,end trim:%i) %s\n" % (read_id,seq,qual,ok_read, read_number, concat, start, end, trim_seq)
++					print("%s\n%s\n%s\n passed seqs:%i line#%i %s (start trim:%i,end trim:%i) %s\n" % (read_id,seq,qual,ok_read, read_number, concat, start, end, trim_seq))
+ 
+ 	LOG.write("%i out of %i sequences passed your filter (-t >= %i and -c >= %i)\n" % (ok_read, read_number, threshold, consecutive))
+ 


=====================================
debian/patches/debug.patch
=====================================
@@ -0,0 +1,11 @@
+--- a/bin/PairingAndScaffolding.pl
++++ b/bin/PairingAndScaffolding.pl
+@@ -821,7 +821,7 @@ sub mapReadsWithBowtie{
+    my $procline = "bowtie -p $threads -v $gaps -m 1 bowtieoutput/$bowtieout --suppress 6,7 -f $singlereads --quiet --refidx |";
+    die "Contig file ($contigFile) not found. Exiting...\n" if(!(-e $contigFile));
+    &printMessage("\n=>".getDate().": Building Bowtie index for contigs\n");
+-   system("bowtie-build $contigFile bowtieoutput/$bowtieout --quiet --noref") == 0 || die "\nBowtie-build error; $?"; # returns exit status values
++   system("bowtie-build $contigFile bowtieoutput/$bowtieout --quiet --noref") == 0 || die "\nBowtie-build error\n\tbowtie-build $contigFile bowtieoutput/$bowtieout --quiet --noref; $?"; # returns exit status values
+    
+    #Treat the output of Bowtie differently if multithreading is used or not
+    readBowtieOneThread($procline) if($threads <= 1);


=====================================
debian/patches/series
=====================================
@@ -1 +1,3 @@
 shebangs.patch
+2to3.patch
+debug.patch


=====================================
debian/rules
=====================================
@@ -31,3 +31,7 @@ override_dh_installexamples:
 override_dh_installman:
 	asciidoctor -a docdate='' -b manpage debian/sspace.1.adoc
 	dh_installman
+
+override_dh_fixperms:
+	dh_fixperms
+	find debian -name contigs_abyss.fasta -exec chmod -x \{\} \;


=====================================
debian/tests/example-tests
=====================================
@@ -5,7 +5,7 @@ set -e
 
 ORIGDIR=$(pwd)
 WORKDIR=$(mktemp -d)
-trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
+# trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
 cd $WORKDIR
 
 cp $ORIGDIR/example/* .
@@ -17,6 +17,12 @@ else
   CMD=sspace
 fi
 
+set -x
+which python
+python
+which bowtie-build
+bowtie-build --help
+ls -l
 $CMD -l libraries.txt -s contigs_abyss.fasta
 
 [ -s standard_output.final.evidence ]



View it on GitLab: https://salsa.debian.org/med-team/sspace/compare/d12ee449039406d66c96097c5ff5c72f94fdc3ed...37cce1033af271420fae9e171601dfc504826c3a

-- 
View it on GitLab: https://salsa.debian.org/med-team/sspace/compare/d12ee449039406d66c96097c5ff5c72f94fdc3ed...37cce1033af271420fae9e171601dfc504826c3a
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/20190904/40b26dfd/attachment-0001.html>


More information about the debian-med-commit mailing list