[med-svn] [Git][med-team/bitseq][master] 6 commits: Use 2to3 to port scripts to Python3

Andreas Tille gitlab at salsa.debian.org
Sun Sep 1 06:59:23 BST 2019



Andreas Tille pushed to branch master at Debian Med / bitseq


Commits:
39d9e842 by Andreas Tille at 2019-09-01T05:46:02Z
Use 2to3 to port scripts to Python3

- - - - -
c613406b by Andreas Tille at 2019-09-01T05:46:18Z
debhelper-compat 12

- - - - -
f9bd6824 by Andreas Tille at 2019-09-01T05:46:21Z
Standards-Version: 4.4.0

- - - - -
8dc7aa7d by Andreas Tille at 2019-09-01T05:46:22Z
Trim trailing whitespace.

Fixes lintian: file-contains-trailing-whitespace
See https://lintian.debian.org/tags/file-contains-trailing-whitespace.html for more details.

- - - - -
996f1f60 by Andreas Tille at 2019-09-01T05:54:33Z
Build-Depends: python3

- - - - -
e6947ad9 by Andreas Tille at 2019-09-01T05:57:56Z
Upload to unstable

- - - - -


6 changed files:

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


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,13 @@
+bitseq (0.7.5+dfsg-5) unstable; urgency=medium
+
+  * Use 2to3 to port scripts to Python3
+    Closes: #936209
+  * debhelper-compat 12
+  * Standards-Version: 4.4.0
+  * Trim trailing whitespace.
+
+ -- Andreas Tille <tille at debian.org>  Sun, 01 Sep 2019 07:54:49 +0200
+
 bitseq (0.7.5+dfsg-4) unstable; urgency=medium
 
   [ Graham Inggs ]


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


=====================================
debian/control
=====================================
@@ -4,14 +4,14 @@ Uploaders: Tim Booth <tbooth at ceh.ac.uk>,
            Andreas Tille <tille at debian.org>
 Section: science
 Priority: optional
-Build-Depends: debhelper (>= 11~),
+Build-Depends: debhelper-compat (= 12),
                zlib1g-dev,
                libbam-dev,
                libboost-dev,
                help2man,
-               python,
-               python-numpy
-Standards-Version: 4.2.1
+               python3,
+               python3-numpy
+Standards-Version: 4.4.0
 Vcs-Browser: https://salsa.debian.org/med-team/bitseq
 Vcs-Git: https://salsa.debian.org/med-team/bitseq.git
 Homepage: https://github.com/BitSeq/BitSeq
@@ -20,7 +20,8 @@ Package: bitseq
 Architecture: any
 Depends: ${shlibs:Depends},
          ${misc:Depends},
-         python
+         python3,
+         python3-numpy
 Suggests: samtools
 Description: Bayesian Inference of Transcripts from Sequencing Data
  BitSeq is an application for inferring expression levels of individual


=====================================
debian/patches/2to3.patch
=====================================
@@ -0,0 +1,256 @@
+Description: Use 2to3 to port scripts to Python3
+Bug-Debian: https://bugs.debian.org/936209
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Sun, 01 Sep 2019 07:43:45 +0200
+
+--- a/checkTR.py
++++ b/checkTR.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ 
+ """
+ Due to an error in our code, GENE EXPRESSION and WITHIN GENE EXPRESSION results
+@@ -53,14 +53,14 @@ def checkFile(fileName):
+    if len(genesWrong) == 0:
+       print("Everything seems to be fine.")
+    else:
+-      print("These "+str(len(genesWrong))+" (out of "+str(len(genesSeen))+") have wrong GENE EXPRESSION results:")
++      print(("These "+str(len(genesWrong))+" (out of "+str(len(genesSeen))+") have wrong GENE EXPRESSION results:"))
+       trCount = 0;
+       genesStr = "";
+       for it in genesWrong:
+          genesStr += it+" ";
+          trCount+=len(g2ts[it]);
+       print(genesStr);
+-      print("These "+str(trCount)+" transcripts have wrong WITHIN GENE EXPRESSION results:");
++      print(("These "+str(trCount)+" transcripts have wrong WITHIN GENE EXPRESSION results:"));
+       trsStr = "";
+       for it in genesWrong:
+          for trit in g2ts[it]:
+@@ -70,7 +70,7 @@ def checkFile(fileName):
+ if __name__ == "__main__":
+    if len(sys.argv) <2:
+       sys.exit("Please provide file name as argument.");
+-   print("Checking file "+sys.argv[1]);
++   print(("Checking file "+sys.argv[1]));
+    checkFile(sys.argv[1]);
+ 
+ 
+--- a/extractTranscriptInfo.py
++++ b/extractTranscriptInfo.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # Initialization {{{
+ import sys
+ from optparse import OptionParser
+@@ -13,7 +13,7 @@ parser.add_option("-t","--type",dest="ty
+ (options, args) = parser.parse_args()
+ def verbose(str):
+    if options.verbose:
+-      print str;
++      print(str);
+ 
+ if len(args)<2: 
+    sys.exit("Missing arguments");
+@@ -41,16 +41,16 @@ li = 0;
+ if options.type:
+    if options.type=="ensembl": 
+       itype = "ens";
+-      print "Expecting header line format:\n>[tr Name] .* gene:[gene Name] .*";
++      print("Expecting header line format:\n>[tr Name] .* gene:[gene Name] .*");
+    elif options.type=="cuff":
+       itype = "cuf";
+-      print "Expecting header line format:\n>[tr Name] .* gene=[gene Name] .*";
++      print("Expecting header line format:\n>[tr Name] .* gene=[gene Name] .*");
+    else:
+       itype = "non";
+-      print "Expecting header line format:\n>[tr Name] .*\n -> using \"none\" as gene names";
++      print("Expecting header line format:\n>[tr Name] .*\n -> using \"none\" as gene names");
+ else:
+    itype = "non";
+-   print "Expecting header line format:\n>[tr Name] .*\n -> using \"none\" as gene names";
++   print("Expecting header line format:\n>[tr Name] .*\n -> using \"none\" as gene names");
+ 
+ for line in inF:
+    li+=1;
+@@ -64,7 +64,7 @@ for line in inF:
+       seqName = lSplit[0];
+       if seqName == "":
+          seqName = "unknown-tr"+str(seqCount);
+-         print "Warning: no name on line ",li,". Using '",seqName,"'.";
++         print("Warning: no name on line ",li,". Using '",seqName,"'.");
+       if itype == "non":
+          geneName = "none";
+       else:
+--- a/getCounts.py
++++ b/getCounts.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # Initialization {{{
+ import sys
+ import numpy as np
+@@ -15,7 +15,7 @@ parser.add_option("-p", "--probDir", des
+ parser.add_option("-n", "--Nmap", dest="Nmap", help = "Comma separated list of total aligned-read-counts for each experiment.",type="string");
+ def verbose(str):
+    if options.verbose:
+-      print str;
++      print(str);
+ (options, args) = parser.parse_args()
+ 
+ if len(args)==0:
+@@ -45,12 +45,12 @@ else:
+          inF = open(fn);
+       except:
+          sys.exit("Unable to open file: "+fn);
+-      print "Reading file: ",fn;
++      print("Reading file: ",fn);
+       Nmap = 0;
+       for line in inF:
+          if line[0]!="#": break;
+          ls=line.split();
+-         for i in xrange(len(ls)-1): 
++         for i in range(len(ls)-1): 
+             if ls[i] == "Nmap": Nmap = int(ls[i+1]);
+       inF.close();
+       if Nmap <= 0:
+@@ -59,18 +59,18 @@ else:
+ 
+ 
+ means = [np.transpose(np.loadtxt(arg))[1] for arg in args];
+-print "Files:";
+-for j in xrange(len(args)):
+-   print "  ",args[j],N[j];
++print("Files:");
++for j in range(len(args)):
++   print("  ",args[j],N[j]);
+ 
+ try:
+    outF = open(options.out,"w");
+ except:
+    sys.exit("Unable to open output file: ",options.out);
+ 
+-for i in xrange(len(means[0])):
+-   for j in xrange(len(means)):
+-      outF.write(str(long(round(means[j][i]*N[j])))+" ");
++for i in range(len(means[0])):
++   for j in range(len(means)):
++      outF.write(str(int(round(means[j][i]*N[j])))+" ");
+    outF.write("\n");
+ 
+ outF.close();
+--- a/parseAlignment.py
++++ b/parseAlignment.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # Initialization {{{
+ import sys
+ import numpy as np
+@@ -6,7 +6,7 @@ def normpdf(x,m,s):
+    return 1./(s*2.5066282746310002)*np.exp(-1./(2.0*s*s)*(x-m)**2.)
+ import os, time # needed for this:
+ time_str = time.strftime("%b %e %Y %H:%M:%S", time.gmtime(os.lstat(sys.argv[0]).st_mtime));
+-print "###",os.path.basename(sys.argv[0]),"build:",time_str;
++print("###",os.path.basename(sys.argv[0]),"build:",time_str);
+ # {{{ parse arguments and set filenames
+ from optparse import OptionParser
+ parser = OptionParser(usage="%prog [options]\n -a -t are necessary\n -e is adviced")
+@@ -80,7 +80,7 @@ def nuc2i(str):#{{{
+ #}}}
+ def verbose(str):#{{{
+    if options.verbose:
+-      print str;
++      print(str);
+ #}}}
+ verbose("Using files:\n   "+aFileName+" for reading alignments\n   "+oFileName+" for writing probabilities\n   "+tFileName+" for writing transcript info");
+ # {{{ reading transcript info
+@@ -178,7 +178,7 @@ if options.inputType=="fasta": #{{{
+    #            while pos >= len(nucProb):
+    #               nucProb.append([[pseudoCount for i in range(5)] for k in range(5)]);
+                nucProb[pos][ nuc2 ][ nuc2 ]-=1;
+-               if nucProb[pos][nuc2][nuc2]<1 : print pos,nuc2,seq,mismatch;
++               if nucProb[pos][nuc2][nuc2]<1 : print(pos,nuc2,seq,mismatch);
+                nucProb[pos][ nuc1 ][ nuc2 ]+=1;
+    # }}}
+    """verbose("Using only unique reads");#{{{ 
+@@ -217,13 +217,13 @@ for line in aFile:
+             nucProb[i][j][k] /= total;
+ 
+    if options.veryVerbose:
+-      print "Noise probabilities: ";
+-      print "   ",;
+-      print noiseProb;
+-      print "Nucleotide mismatch matrix:";
++      print("Noise probabilities: ");
++      print("   ", end=' ');
++      print(noiseProb);
++      print("Nucleotide mismatch matrix:");
+       for i in range(len(nucProb)):
+-         print "Position ",i,":\n   ",;
+-         print nucProb[i];
++         print("Position ",i,":\n   ", end=' ');
++         print(nucProb[i]);
+    #}}}
+    verbose("Writing alignment probabilities"); # {{{
+    aFile.seek(0);
+@@ -274,7 +274,7 @@ for line in aFile:
+          trans = trMap[ alignment[2+colS][prefixL:] ];
+       else:
+          trans = 0;
+-         print "Transcript '"+alignment[2+colS]+"' or '"+alignment[2+colS][prefixL:]+"' was not found in the transcript file.";
++         print("Transcript '"+alignment[2+colS]+"' or '"+alignment[2+colS][prefixL:]+"' was not found in the transcript file.");
+          #print alignment;
+       # calculate probabilities
+       prob=1.0;
+@@ -313,11 +313,11 @@ else:
+       phredS = float(ord(Q)-Qshift);
+       if phredS<0:
+          if not phredWarning:
+-            print "WARNING: Phred score too low (",int(phredS),") perhpas use --inputType fastq33.";
++            print("WARNING: Phred score too low (",int(phredS),") perhpas use --inputType fastq33.");
+             phredWarning=True;
+       elif phredS>65:
+          if not phredWarning:
+-            print "NOTE: Phred score unnaturally high (",int(phredS),") check your input type and perhaps set --inputType fastq.";
++            print("NOTE: Phred score unnaturally high (",int(phredS),") check your input type and perhaps set --inputType fastq.");
+             phredWarning=True;
+       return 1-10**( phredS / -10);
+    def qTOpInvert(Q):
+@@ -436,7 +436,7 @@ else:
+          trans = trMap[ alignment[2+colS][prefixL:] ];
+       else:
+          trans = 0;
+-         print "Transcript '"+alignment[2+colS]+"' or '"+alignment[2+colS][prefixL:]+"' was not found in the transcript file.";
++         print("Transcript '"+alignment[2+colS]+"' or '"+alignment[2+colS][prefixL:]+"' was not found in the transcript file.");
+          #print alignment;
+       # calculate probabilities
+       probLoc = prob;
+@@ -448,7 +448,7 @@ else:
+                   pos = int( mis.split(":")[0] );
+                except:
+                   pos=0;
+-                  print 'X',mis,'X',alignment;
++                  print('X',mis,'X',alignment);
+                probLoc = probLoc * qTOpInvert(phread[pos]);
+       if options.paired and len(align2)==columnN:
+             mismatch=align2[columnN-1]
+@@ -458,7 +458,7 @@ else:
+                   pos = int( mis.split(":")[0] );
+                except:
+                   pos=0;
+-                  print mis
++                  print(mis)
+                probLoc = probLoc * qTOpInvert(phread2[pos]);
+ 
+       # add new alignment to list
+@@ -477,6 +477,6 @@ else:
+    oFile.write("\n");
+ 
+ 
+-print "Processed:\n  ",alN,"alignments + (",readN,"noise alignments)\n  ",readN,"reads\n  ",trN,"transcripts\nTotal reads: ",Ntotal,"\n";
++print("Processed:\n  ",alN,"alignments + (",readN,"noise alignments)\n  ",readN,"reads\n  ",trN,"transcripts\nTotal reads: ",Ntotal,"\n");
+ aFile.close();
+ oFile.close();


=====================================
debian/patches/series
=====================================
@@ -3,3 +3,4 @@ hardening.patch
 fix_clean_target.patch
 spelling.patch
 fix_build_options.patch
+2to3.patch


=====================================
debian/rules
=====================================
@@ -76,5 +76,3 @@ override_dh_auto_install:
 	    if [ "$${bscript}" = "parseAlignment.py" ] ; then continue ; fi ; \
 	    ln -s  $(debianmedsysdir)/$${bscript} $(bindir)/`echo $${bscript} | sed -e 's/\.py$$//' -e 's/\.sh$$//'` ; \
 	done
-
-



View it on GitLab: https://salsa.debian.org/med-team/bitseq/compare/ee0c5d03c823008d84154aa9af9633aba3342971...e6947ad914fb8b11305db190c03e64bd6fc348ce

-- 
View it on GitLab: https://salsa.debian.org/med-team/bitseq/compare/ee0c5d03c823008d84154aa9af9633aba3342971...e6947ad914fb8b11305db190c03e64bd6fc348ce
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/20190901/f3638912/attachment-0001.html>


More information about the debian-med-commit mailing list