Skip to content

Commit

Permalink
Merge pull request #36 from snayfach/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
snayfach authored Nov 12, 2016
2 parents f022f04 + bbd3109 commit d1dc562
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
38 changes: 21 additions & 17 deletions midas/run/snps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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())

Expand Down
2 changes: 1 addition & 1 deletion midas/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 """
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit d1dc562

Please sign in to comment.