[med-svn] [Git][med-team/metaphlan2][upstream] New upstream version 2.9.22

Andreas Tille gitlab at salsa.debian.org
Fri Nov 8 06:57:31 GMT 2019



Andreas Tille pushed to branch upstream at Debian Med / metaphlan2


Commits:
26c49726 by Andreas Tille at 2019-11-08T06:22:20Z
New upstream version 2.9.22
- - - - -


6 changed files:

- .hg_archival.txt
- .hgtags
- README.md
- metaphlan2.py
- utils/merge_metaphlan_tables.py
- utils/read_fastx.py


Changes:

=====================================
.hg_archival.txt
=====================================
@@ -1,4 +1,4 @@
 repo: 092c2fe2278cb7f0b18d81faeb4aab98b89dc096
-node: 89633b311684ece67f32a9461aa1567e32dd42f7
+node: b16e6ee425dbf3797cc6c222fe0685818921f853
 branch: 2.9
-tag: 2.9.20
+tag: 2.9.22


=====================================
.hgtags
=====================================
@@ -36,3 +36,5 @@ c20357c9133be435919db0b2948f9aa164f19a0b 2.9.15
 71f40111c849408b60e1bc7aeddfef84c9e55eea 2.9.17
 170242bd646540bfb5521fe7ff2e54bc8a97dd35 2.9.18
 7030c379d395c9eb463ca48943373d52121140d9 2.9.19
+89633b311684ece67f32a9461aa1567e32dd42f7 2.9.20
+c38b12873d9221abc8c6ade3a1c6fbf808e0c325 2.9.21


=====================================
README.md
=====================================
@@ -69,7 +69,7 @@ MetaPhlAn2 requires *python 2.7* or newer with argparse, tempfile, [numpy](http:
 * MetaPhlAn2 is integrated with advanced heatmap plotting with [hclust2](https://bitbucket.org/nsegata/hclust2) and cladogram visualization with [GraPhlAn](https://bitbucket.org/nsegata/graphlan/wiki/Home). If you use such visualization tool please refer to their prerequisites. 
 
 ## Installation
-The best way to install MetaPhlAn2 2.9.15 is through conda:
+The best way to install MetaPhlAn2 2.9.20 is through conda:
 
 ```
 #!bash
@@ -96,10 +96,10 @@ You can also install and run MetaPhlAn2 through Docker
 
 ```
 #!bash
-$ docker pull quay.io/biocontainers/metaphlan2:2.9.15
+$ docker pull quay.io/biocontainers/metaphlan2:2.9.20
 ```
 
-Alternatively, you can **manually download** from [Bitbucket](https://bitbucket.org/biobakery/metaphlan2/get/2.9.15.zip) or **clone the repository** using the following command ``$ hg clone https://bitbucket.org/biobakery/metaphlan2``.
+Alternatively, you can **manually download** from [Bitbucket](https://bitbucket.org/biobakery/metaphlan2/get/2.9.20.zip) or **clone the repository** using the following command ``$ hg clone https://bitbucket.org/biobakery/metaphlan2``.
 
 If you choose this way, **you'll need to install manually all the dependencies!**
 
@@ -115,7 +115,7 @@ By default, the latest MetaPhlAn2 database is downloaded and built. You can down
 
 ```
 #!bash
-$ metaphlan2.py --install --index v29_CHOCOPhlAn_201901
+$ metaphlan2.py --install --index mpa_v29_CHOCOPhlAn_201901
 ```
 
 --------------------------
@@ -612,7 +612,7 @@ for f in $(ls fastqs/*.bz2)
 do
     echo "Running metaphlan2 on ${f}"
     bn=$(basename ${f} | cut -d '.' -f 1)
-     ../metaphlan2.py --index v29_CHOCOPhlAn_201901 --input_type multifastq --nproc 10s -s sams/${bn}.sam.bz2 --bowtie2out sams/${bn}.bowtie2_out.bz2 -o ssams/${bn}.profile ${f}
+     ../metaphlan2.py --index mpa_v29_CHOCOPhlAn_201901 --input_type multifastq --nproc 10s -s sams/${bn}.sam.bz2 --bowtie2out sams/${bn}.bowtie2_out.bz2 -o ssams/${bn}.profile ${f}
 done
 ```
 


=====================================
metaphlan2.py
=====================================
@@ -4,8 +4,8 @@ __author__ = ('Nicola Segata (nicola.segata at unitn.it), '
               'Duy Tin Truong, '
               'Francesco Asnicar (f.asnicar at unitn.it), '
               'Francesco Beghini (francesco.beghini at unitn.it)')
-__version__ = '2.9.20'
-__date__ = '14 Aug 2019'
+__version__ = '2.9.22'
+__date__ = '14 Oct 2019'
 
 import sys
 import os
@@ -247,7 +247,7 @@ def read_params(args):
              "that 'bowtie2-build is present in the system path")
     arg('--bowtie2out', metavar="FILE_NAME", type=str, default=None,
         help="The file for saving the output of BowTie2")
-    arg('--min_mapq_val', type=str, default=5,
+    arg('--min_mapq_val', type=int, default="5",
         help="Minimum mapping quality value (MAPQ)")
     arg('--no_map', action='store_true',
         help="Avoid storing the --bowtie2out map file")
@@ -526,6 +526,9 @@ def download_unpack_tar(url, download_file_name, folder, bowtie2_build, nproc):
             sys.stderr.write("Fatal error running '{}'\nError message: '{}'\n\n".format(' '.join(bt2_cmd), e))
             sys.exit(1)
 
+    for bt2 in glob(os.path.join(folder, download_file_name + "*.bt2")):
+        os.chmod(bt2, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH)  # change permissions to 664
+
     sys.stderr.write('Removing uncompress database {}\n'.format(fna_file))
     os.remove(fna_file)
 
@@ -921,11 +924,11 @@ class TaxTree:
         if ignore_eukaryotes or ignore_bacteria or ignore_archaea:
             cn = cl.get_full_name()
             if ignore_eukaryotes and cn.startswith("k__Eukaryota"):
-                return ""
+                return (None, None)
             if ignore_archaea and cn.startswith("k__Archaea"):
-                return ""
+                return (None, None)
             if ignore_bacteria and cn.startswith("k__Bacteria"):
-                return ""
+                return (None, None)
         # while len(cl.children) == 1:
             # cl = list(cl.children.values())[0]
         cl.markers2nreads[marker] = n
@@ -1104,7 +1107,7 @@ def maybe_generate_biom_file(tree, pars, abundance_predictions):
             ######## clade_ids,     #Modified by George Weingart 5/22/2017 - We will use instead the clade_names
             clade_names,            #Modified by George Weingart 5/22/2017 - We will use instead the clade_names
             sample_metadata      = None,
-            observation_metadata = map(to_biomformat, clade_names),
+            observation_metadata = list(map(to_biomformat, clade_names)),
             table_id             = table_id,
             constructor          = biom.table.DenseOTUTable
         )
@@ -1118,7 +1121,7 @@ def maybe_generate_biom_file(tree, pars, abundance_predictions):
             clade_names,          #Modified by George Weingart 5/22/2017 - We will use instead the clade_names
             sample_ids,
             sample_metadata      = None,
-            observation_metadata = map(to_biomformat, clade_names),
+            observation_metadata = list(map(to_biomformat, clade_names)),
             table_id             = table_id,
             input_is_dense       = True
         )
@@ -1159,7 +1162,6 @@ def metaphlan2():
     # check for the mpa_pkl file
     if not os.path.isfile(pars['mpa_pkl']):
         sys.stderr.write("Error: Unable to find the mpa_pkl file at: " + pars['mpa_pkl'] +
-                         "\nExpecting location ${mpa_dir}/db_v20/map_v20_m200.pkl "
                          "Exiting...\n\n")
         sys.exit(1)
 
@@ -1270,7 +1272,10 @@ def metaphlan2():
 
         elif pars['t'] == 'rel_ab':
             if pars['CAMI_format_output']:
-                outf.write('@SampleID:{}\n at Version:0.9.1\n at __program__:MetaPhlAn{}\n at Ranks:superkingdom|phylum|class|order|family|genus|species\n@@TAXID\tRANK\tTAXPATH\tTAXPATHSN\tPERCENTAGE\n'.format(pars["sample_id"],__version__))
+                outf.write("@SampleID:{}\n"
+                           "@Version:0.10.0\n"
+                           "@Ranks:superkingdom|phylum|class|order|family|genus|species|strain\n"
+                           "@@TAXID\tRANK\tTAXPATH\tTAXPATHSN\tPERCENTAGE\n".format(pars["sample_id"],__version__))
             elif not pars['legacy_output']:
                 outf.write('#clade_name\tNCBI_tax_id\trelative_abundance\n')
 
@@ -1289,7 +1294,7 @@ def metaphlan2():
                         if taxid:
                             rank = ranks2code[clade.split('|')[-1][0]]
                             leaf_taxid = taxid.split('|')[-1]
-                            taxpathsh = '|'.join([remove_prefix(name) for name in clade.split('|')])
+                            taxpathsh = '|'.join([remove_prefix(name) if '_unclassified' not in name else '' for name in clade.split('|')])
                             outf.write( '\t'.join( [ leaf_taxid, rank, taxid, taxpathsh, str(relab*fraction_mapped_reads) ] ) + '\n' )
                 else:
                     if pars['unknown_estimation']:


=====================================
utils/merge_metaphlan_tables.py
=====================================
@@ -39,7 +39,7 @@ def merge( aaastrIn, ostm ):
         if len(listmpaVersion) > 1:
             print('merge_metaphlan_tables found tables made with different versions of the MetaPhlAn2 database.\nPlease re-run MetaPhlAn2 with the same database.\n')
             return
-
+        
         iIn = pd.read_csv(f, 
                           sep='\t',
                           skiprows=len(headers),


=====================================
utils/read_fastx.py
=====================================
@@ -101,6 +101,12 @@ def read_and_write_raw_int(fd, min_len=None):
     else:
         for idx, l in enumerate(fd,1):
             _ = sys.stdout.write(ignore_spaces(l))
+            
+        #Read again the first line of the file to determine if is a fasta or a fastq
+        fd.seek(0)
+        l = fd.readline()
+        readn = 4 if fastx(l) == 'fastq' else 2
+        idx = idx // readn
 
     nreads = idx - discarded
     return nreads



View it on GitLab: https://salsa.debian.org/med-team/metaphlan2/commit/26c497261bed879903b92507a445f91aeb3c9aee

-- 
View it on GitLab: https://salsa.debian.org/med-team/metaphlan2/commit/26c497261bed879903b92507a445f91aeb3c9aee
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/20191108/40ba46d2/attachment-0001.html>


More information about the debian-med-commit mailing list