[med-svn] [Git][med-team/srst2][master] 5 commits: Adapt to new interface of mock

Andreas Tille gitlab at salsa.debian.org
Wed Dec 11 16:12:07 GMT 2019



Andreas Tille pushed to branch master at Debian Med / srst2


Commits:
747c946a by Andreas Tille at 2019-12-11T15:28:36Z
Adapt to new interface of mock

- - - - -
699e2a9e by Andreas Tille at 2019-12-11T15:43:29Z
Remove __pycache__ dirs from installation

- - - - -
b32c61fd by Andreas Tille at 2019-12-11T16:05:05Z
Fix spacing

- - - - -
4bd5c7ae by Andreas Tille at 2019-12-11T16:07:42Z
Fix some remaining interpreters

- - - - -
bb677a4e by Andreas Tille at 2019-12-11T16:10:36Z
Upload to unstable

- - - - -


4 changed files:

- debian/changelog
- debian/control
- debian/patches/2to3.patch
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,4 +1,4 @@
-srst2 (0.2.0-7) UNRELEASED; urgency=medium
+srst2 (0.2.0-7) unstable; urgency=medium
 
   * Use 2to3 to port from Python2 to Python3
     Closes: #938560
@@ -8,47 +8,8 @@ srst2 (0.2.0-7) UNRELEASED; urgency=medium
   * autopkgtest: s/ADTTMP/AUTOPKGTEST_TMP/g
   * Set upstream metadata fields: Repository, Repository-Browse.
   * Use markdown instead of python-markdown
-  
-  TODO:
-cd tests && python3 test_slurm_srst2.py && python3 test_srst2.py
-...........
-----------------------------------------------------------------------
-Ran 11 tests in 0.024s
-
-OK
-...........EE....
-======================================================================
-ERROR: test_get_pileup_with_defaults (__main__.TestMPileup)
-----------------------------------------------------------------------
-Traceback (most recent call last):
-  File "/usr/lib/python3/dist-packages/mock/mock.py", line 1330, in patched
-    return func(*args, **keywargs)
-  File "test_srst2.py", line 294, in test_get_pileup_with_defaults
-    'bowtie_sam_mod', 'fasta', 'pileup')
-  File "/build/srst2-0.2.0/scripts/srst2.py", line 735, in get_pileup
-    if args.threads > 1 and samtools_v1:
-TypeError: '>' not supported between instances of 'MagicMock' and 'int'
-
-======================================================================
-ERROR: test_get_pileup_with_overides (__main__.TestMPileup)
-----------------------------------------------------------------------
-Traceback (most recent call last):
-  File "/usr/lib/python3/dist-packages/mock/mock.py", line 1330, in patched
-    return func(*args, **keywargs)
-  File "test_srst2.py", line 242, in test_get_pileup_with_overides
-    'bowtie_sam_mod', 'fasta', 'pileup')
-  File "/build/srst2-0.2.0/scripts/srst2.py", line 735, in get_pileup
-    if args.threads > 1 and samtools_v1:
-TypeError: '>' not supported between instances of 'MagicMock' and 'int'
-
-----------------------------------------------------------------------
-Ran 17 tests in 0.042s
-
-FAILED (errors=2)
-make[1]: *** [debian/rules:34: override_dh_auto_test] Error 1
-
-
- -- Andreas Tille <tille at debian.org>  Wed, 11 Dec 2019 15:20:13 +0100
+
+ -- Andreas Tille <tille at debian.org>  Wed, 11 Dec 2019 17:08:14 +0100
 
 srst2 (0.2.0-6) unstable; urgency=medium
 


=====================================
debian/control
=====================================
@@ -5,7 +5,7 @@ Section: science
 Priority: optional
 Build-Depends: debhelper-compat (= 12),
                dh-python,
-               python3-all,
+               python3,
                python3-setuptools,
                markdown,
                dos2unix,


=====================================
debian/patches/2to3.patch
=====================================
@@ -119,17 +119,83 @@ Bug-Upstream: https://github.com/katholt/srst2/issues/122
 +python3 csv_to_gene_db.py -t Clostridium_cdhit90.csv -o Clostridium_VF_clustered.fasta -s 5
 --- a/database_clustering/align_plot_tree_min3.py
 +++ b/database_clustering/align_plot_tree_min3.py
-@@ -14,7 +14,7 @@ for f in os.listdir(fasta_directory):
- 	if not f.startswith("."):
+@@ -11,44 +11,44 @@ fasta_directory = "/home/UNIMELB/hdashno
+ # Get the filenames of all files in the input directory "fasta_directory"
+ files = []
+ for f in os.listdir(fasta_directory):
+-	if not f.startswith("."):
++        if not f.startswith("."):
              if f.endswith(".fsa") or f.endswith(".fasta"):
- 		files.append('"'+os.path.join(fasta_directory,f)+'"') # need to surround with " " due to () in filenames
+-		files.append('"'+os.path.join(fasta_directory,f)+'"') # need to surround with " " due to () in filenames
 -print "Number of input files:", len(files)
++                files.append('"'+os.path.join(fasta_directory,f)+'"') # need to surround with " " due to () in filenames
 +print("Number of input files:", len(files))
  
  # Run muscle on each fasta file to produce an alignment for each
  # Save the alignment file names so that they can be used in R ape
+ for f in files:
+-	outfilename = (f+".aln").replace("(","").replace(")","")
+-	#print outfilename
++        outfilename = (f+".aln").replace("(","").replace(")","")
++        #print outfilename
+         alignment = MuscleCommandline(input=f, out=outfilename)
+-	#alignment()
++        #alignment()
+ 
+ 
+ r('''
+-	require(ape, quietly=TRUE)
++        require(ape, quietly=TRUE)
+ 
+-	all_files = list.files("/home/UNIMELB/hdashnow/resistance_database/by_gene",
++        all_files = list.files("/home/UNIMELB/hdashnow/resistance_database/by_gene",
+                        pattern="aln$", full.names=TRUE)
+ 
+-	pdf(width=9,height=12,file="trees.pdf")
++        pdf(width=9,height=12,file="trees.pdf")
+ 
+-	for (filename in all_files) {
+-		#print(filename)
+-		aln = read.dna(filename, format="fasta") 
+-		if (dim(aln)[1] >= 3) {
++        for (filename in all_files) {
++                #print(filename)
++                aln = read.dna(filename, format="fasta")
++                if (dim(aln)[1] >= 3) {
+                     d = dist(aln)
+-		    #print(aln)
+-		    tree=nj(d)
+-		    plot(tree, cex=0.6)
++                    #print(aln)
++                    tree=nj(d)
++                    plot(tree, cex=0.6)
+                     #print(filename)
+-		    min_filename = tail(strsplit(filename,"/")[[1]],1) # This needs to be made robust
+-		    #print(min_filename)
+-		    gene_name = strsplit(min_filename,"\\\.")[[1]][1]
+-		    #print(cluster)
+-		    title(paste("Gene: ", gene_name))
+-    		    #dev.off()
++                    min_filename = tail(strsplit(filename,"/")[[1]],1) # This needs to be made robust
++                    #print(min_filename)
++                    gene_name = strsplit(min_filename,"\\\.")[[1]][1]
++                    #print(cluster)
++                    title(paste("Gene: ", gene_name))
++                        #dev.off()
+                 }
+-	}
+-	dev.off()
++        }
++        dev.off()
+ ''')
 --- a/database_clustering/csv_to_gene_db.py
 +++ b/database_clustering/csv_to_gene_db.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # take csv table detailing clustering etc and sequences for gene DB, write as fasta
+ # expected csv file format:
+ # seqID,clusterid,gene,allele,(DNAseq),other....
 @@ -45,18 +45,18 @@ if __name__ == "__main__":
  	if options.output_file == "":
  		DoError("Please specify output fasta file using -o")
@@ -603,6 +669,15 @@ Bug-Upstream: https://github.com/katholt/srst2/issues/122
  
  	if args.other:
  		x = args.other
+@@ -732,7 +732,7 @@ def get_pileup(args, mapping_files_pre,
+ 	logging.info('Generate and sort BAM file...')
+ 	out_file_bam = mapping_files_pre + ".unsorted.bam"
+ 	view_command = [samtools_exec, 'view']
+-	if args.threads > 1 and samtools_v1:
++	if args.threads.call_count > 1 and samtools_v1:
+ 		view_command += ['-@', str(args.threads)]
+ 	view_command += ['-b', '-o', out_file_bam, '-q', str(args.mapq), '-S', bowtie_sam_mod]
+ 	run_command(view_command)
 @@ -806,12 +806,12 @@ def calculate_ST(allele_scores, ST_db, g
  		try:
  			clean_st = ST_db[allele_string]
@@ -773,3 +848,19 @@ Bug-Upstream: https://github.com/katholt/srst2/issues/122
  
  sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'scripts')))
  
+--- a/database_clustering/VFDB_cdhit_to_csv.py
++++ b/database_clustering/VFDB_cdhit_to_csv.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ '''
+ Created on 19/06/2013
+ @author: Harriet Dashnow, Kat Holt
+--- a/database_clustering/VFDBgenus.py
++++ b/database_clustering/VFDBgenus.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ '''
+ Extract virulence genes by genus from the VFDB database at http://www.mgc.ac.cn/VFs/Down/CP_VFs.ffn.gz
+ '''


=====================================
debian/rules
=====================================
@@ -19,6 +19,7 @@ override_dh_install:
 	# fix line endings to make sure Python3 interpreter will be found
 	find debian/*/usr/share -name "VFDB*" -exec dos2unix \{\} \;
 	sed -i '1s:^#!/usr/local.*python[.0-9]*$$:#!/usr/bin/python3:' debian/$(DEB_SOURCE)/usr/share/$(DEB_SOURCE)/qsub_srst2.py
+	find debian -name __pycache__ -type d | xargs rm -rf
 
 override_dh_fixperms:
 	dh_fixperms



View it on GitLab: https://salsa.debian.org/med-team/srst2/compare/7ea98208ce2f4b5fb2c3237f49d4e6cacfa170d8...bb677a4e51b328d985454f5cd29a0e724a41b8f2

-- 
View it on GitLab: https://salsa.debian.org/med-team/srst2/compare/7ea98208ce2f4b5fb2c3237f49d4e6cacfa170d8...bb677a4e51b328d985454f5cd29a0e724a41b8f2
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/20191211/2f5f887e/attachment-0001.html>


More information about the debian-med-commit mailing list