From 3ed80f9e1664a5e411be655bb309620c6241a4aa Mon Sep 17 00:00:00 2001 From: snayfach Date: Sat, 12 Nov 2016 13:28:34 -0800 Subject: [PATCH 1/2] Fixed bug when parsing mpileup --- midas/run/snps.py | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/midas/run/snps.py b/midas/run/snps.py index 5076d48..9a631ea 100644 --- a/midas/run/snps.py +++ b/midas/run/snps.py @@ -138,29 +138,33 @@ def format_pileup(args, species, contigs): # write info from pileup write_present(sp.out, pileup=p) sp.j += 1 + + # end of contig if sp.j >= contig.length: sp.i += 1; sp.j = 0 - contig = contigs[sp.contigs[sp.i]] # fill in downstream positions & contigs with zero coverage for sp in species.values(): - # lefover positions on last contig - # indicates that one or more downstream positions have zero coverage - contig = contigs[sp.contigs[sp.i]] - while sp.j < contig.length: - write_missing(sp.out, ref_id=contig.id, ref_pos=str(sp.j+1), ref_allele=contig.seq[sp.j]) - sp.j += 1 - - # lefover contigs - # indicates that one or more downstream contigs have zero coverage - sp.i += 1; sp.j = 0 - while sp.i < len(sp.contigs): + # no remaining contigs + if sp.i < len(sp.contigs): + + # lefover positions on last contig + # indicates that one or more downstream positions have zero coverage contig = contigs[sp.contigs[sp.i]] - write_missing(sp.out, ref_id=contig.id, ref_pos=str(sp.j+1), ref_allele=contig.seq[sp.j]) - sp.j += 1 - if sp.j >= contig.length: - sp.i += 1; sp.j = 0 + while sp.j < contig.length: + write_missing(sp.out, ref_id=contig.id, ref_pos=str(sp.j+1), ref_allele=contig.seq[sp.j]) + sp.j += 1 + + # lefover contigs + # indicates that one or more downstream contigs have zero coverage + sp.i += 1; sp.j = 0 + while sp.i < len(sp.contigs): + contig = contigs[sp.contigs[sp.i]] + write_missing(sp.out, ref_id=contig.id, ref_pos=str(sp.j+1), ref_allele=contig.seq[sp.j]) + sp.j += 1 + if sp.j >= contig.length: + sp.i += 1; sp.j = 0 # close output files sp.out.close() @@ -281,7 +285,7 @@ def run_pipeline(args): start = time() print("\nRunning mpileup") args['log'].write("\nRunning mpileup\n") - pileup(args) +# pileup(args) print(" %s minutes" % round((time() - start)/60, 2) ) print(" %s Gb maximum memory" % utility.max_mem_usage()) From bbd31095686cc2aee8b047b207024febee5623d4 Mon Sep 17 00:00:00 2001 From: snayfach Date: Sat, 12 Nov 2016 13:32:15 -0800 Subject: [PATCH 2/2] Increment version number --- midas/utility.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/midas/utility.py b/midas/utility.py index bcb38c5..a4c1496 100644 --- a/midas/utility.py +++ b/midas/utility.py @@ -6,7 +6,7 @@ import io, os, stat, sys, resource, gzip, platform, subprocess, bz2 -__version__ = '1.2.0' +__version__ = '1.2.1' def which(program): """ Mimics unix 'which' function """ diff --git a/setup.py b/setup.py index e208915..a7cf744 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name = 'MIDAS', - version = '1.2.0', + version = '1.2.1', description = 'An integrated pipeline and for estimating species and strain-level genomic variation from metagenomic data', license = 'GPL', author = 'Stephen Nayfach',