[med-svn] [iva] 01/03: Imported Upstream version 0.10.1

Jorge Soares jssoares-guest at moszumanska.debian.org
Mon Dec 8 11:20:28 UTC 2014


This is an automated email from the git hooks/post-receive script.

jssoares-guest pushed a commit to branch master
in repository iva.

commit b7cc516243cc092d34ecb440a5eec1779eec6d8b
Author: Jorge Soares <j.s.soares at gmail.com>
Date:   Mon Dec 8 08:43:27 2014 +0000

    Imported Upstream version 0.10.1
---
 iva/assembly.py       |  6 +++---
 iva/common.py         | 10 +++++++++-
 iva/external_progs.py |  2 +-
 iva/kcount.py         |  2 +-
 iva/kraken.py         |  2 +-
 iva/mapping.py        |  6 +++---
 iva/qc.py             |  1 +
 setup.py              |  3 ++-
 8 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/iva/assembly.py b/iva/assembly.py
index 3a92bb6..5c4d4ed 100644
--- a/iva/assembly.py
+++ b/iva/assembly.py
@@ -2,7 +2,7 @@ import os
 import pysam
 import tempfile
 import shutil
-from iva import contig, mapping, seed, mummer, graph, edge
+from iva import contig, mapping, seed, mummer, graph, edge, common
 import fastaq
 
 class Assembly:
@@ -158,10 +158,10 @@ class Assembly:
                 if sam_type == mapping.CAN_EXTEND_LEFT:
                     name = mapping.get_ref_name(sam, sam_reader)
                     clipped = mapping.soft_clipped(sam)[0]
-                    self.contigs[name].add_left_kmer(sam.seq[:clipped].decode())
+                    self.contigs[name].add_left_kmer(common.decode(sam.seq[:clipped]))
                 elif sam_type == mapping.CAN_EXTEND_RIGHT:
                     name = mapping.get_ref_name(sam, sam_reader)
-                    self.contigs[name].add_right_kmer(sam.seq[sam.qend:].decode())
+                    self.contigs[name].add_right_kmer(common.decode(sam.seq[sam.qend:]))
 
                 if out_prefix is not None and sam_type in keep_read_types:
                     if sam.is_read1:
diff --git a/iva/common.py b/iva/common.py
index ba73bc5..e8deeed 100644
--- a/iva/common.py
+++ b/iva/common.py
@@ -2,7 +2,7 @@ import argparse
 import os
 import sys
 import subprocess
-version = '0.10.0'
+version = '0.10.1'
 
 class abspathAction(argparse.Action):
     def __call__(self, parser, namespace, value, option_string):
@@ -30,3 +30,11 @@ def syscall(cmd, allow_fail=False, verbose=False):
             sys.exit(1)
 
     return True
+
+
+def decode(x):
+    try:
+        s = x.decode()
+    except:
+        return x
+    return s
diff --git a/iva/external_progs.py b/iva/external_progs.py
index 221f7c6..475b784 100644
--- a/iva/external_progs.py
+++ b/iva/external_progs.py
@@ -68,7 +68,7 @@ def get_version(prog, must_be_in_path=True):
 
     cmd, regex = prog_to_version_cmd[prog]
     cmd_output = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
-    cmd_output = cmd_output[0].decode().split('\n')[:-1] + cmd_output[1].decode().split('\n')[:-1]
+    cmd_output = common.decode(cmd_output[0]).split('\n')[:-1] + common.decode(cmd_output[1]).split('\n')[:-1]
     for line in cmd_output:
         hits = regex.search(line)
         if hits:
diff --git a/iva/kcount.py b/iva/kcount.py
index 48a67ab..d79c540 100644
--- a/iva/kcount.py
+++ b/iva/kcount.py
@@ -149,7 +149,7 @@ def _kmc_to_kmer_counts(infile, number, kmers_to_ignore=None, contigs_to_check=N
             except:
                 raise Error('Error getting count from sequence name in bam:\n' + sam.qname)
 
-            counts[sam.seq.decode()] = count
+            counts[common.decode(sam.seq)] = count
         sam_reader.close()
 
     shutil.rmtree(tmpdir)
diff --git a/iva/kraken.py b/iva/kraken.py
index d12f17c..63f69f1 100644
--- a/iva/kraken.py
+++ b/iva/kraken.py
@@ -100,7 +100,7 @@ class Database:
         for i in range(max_tries):
             try:
                 url = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&rettype=' + filetype + '&retmode=text&id=' + gi
-                file_contents = urllib.request.urlopen(url).read().decode().rstrip()
+                file_contents = iva.common.decode(urllib.request.urlopen(url).read()).rstrip()
             except:
                 time.sleep(delay)
                 continue
diff --git a/iva/mapping.py b/iva/mapping.py
index bc345b5..f291531 100644
--- a/iva/mapping.py
+++ b/iva/mapping.py
@@ -107,7 +107,7 @@ def get_bam_region_coverage(bam, seqname, seq_length, rev=False, verbose=0, both
     mpileup_cmd = 'samtools mpileup -r ' + seqname + ' ' + flags + ' ' + bam + ' | cut -f 2,4'
     if verbose >= 2:
         print('    get_bam_region_coverage:', mpileup_cmd)
-    mpileup_out = subprocess.Popen(mpileup_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].decode().split('\n')[:-1]
+    mpileup_out = common.decode(subprocess.Popen(mpileup_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0]).split('\n')[:-1]
 
     for line in mpileup_out:
         pos, depth = [int(killer_rabbit) for killer_rabbit in line.rstrip().split()]
@@ -174,7 +174,7 @@ def find_incorrect_ref_bases(bam, ref_fasta):
     bad_bases = {}
     fastaq.tasks.file_to_dict(ref_fasta, ref_seqs)
     mpileup_cmd = 'samtools mpileup ' + bam + ' | cut -f 1,2,5'
-    mpileup_out = subprocess.Popen(mpileup_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].decode().split('\n')[:-1]
+    mpileup_out = common.decode(subprocess.Popen(mpileup_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0]).split('\n')[:-1]
 
     for line in mpileup_out:
         # somteimes mpileup has an empty bases column, so skip those
@@ -214,7 +214,7 @@ def sam_to_fasta(s):
     else:
         raise Error('Read', name, 'must be first of second of pair according to flag. Cannot continue')
 
-    seq = fastaq.sequences.Fasta(name, s.seq.decode())
+    seq = fastaq.sequences.Fasta(name, common.decode(s.seq))
     if s.is_reverse:
         seq.revcomp()
 
diff --git a/iva/qc.py b/iva/qc.py
index 845eade..301b5e9 100644
--- a/iva/qc.py
+++ b/iva/qc.py
@@ -651,6 +651,7 @@ class Qc:
         self._calculate_incorrect_assembly_bases()
         self._calculate_contig_placement()
         self._write_fasta_contigs_hit_ref()
+        self._write_fasta_contigs_not_hit_ref()
         self._calculate_ref_read_coverage()
         self._calculate_ref_read_region_coverage()
         self._calculate_ref_positions_covered_by_contigs()
diff --git a/setup.py b/setup.py
index a0220ea..0a53ca1 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ def read(fname):
 
 setup(
     name='iva',
-    version='0.10.0',
+    version='0.10.1',
     description='Iterative Virus Assembler',
     long_description=read('README.md'),
     packages = find_packages(),
@@ -18,5 +18,6 @@ setup(
     scripts=glob.glob('scripts/*'),
     test_suite='nose.collector',
     install_requires=['nose >= 1.3', 'fastaq >= 1.6.0', 'networkx'],
+    dependency_links=['http://github.com/sanger-pathogens/fastaq/tarball/master#egg=fastaq-1.7.0'],
     license='GPLv3',
 )

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/iva.git



More information about the debian-med-commit mailing list