Skip to content

Commit 5afe842

Browse files
author
Nicholas Youngblut
committed
0 fold read sims skipped
1 parent c07a2d7 commit 5afe842

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

MGSIM/SimHtReads.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ def sim_illumina(frag_fasta, barcode, seq_depth, total_barcodes,
173173

174174
# calculate fold coverage to simulate
175175
fold = calc_fold(frag_fasta, seq_depth, total_barcodes, art_params, tmp_dir=tmp_dir)
176+
if fold <= 0:
177+
return [None]
176178

177179
# art_illumina command
178180
art_params = ' '.join(['{} {}'.format(k,v) for k,v in art_params.items()])
@@ -192,6 +194,8 @@ def sim_illumina(frag_fasta, barcode, seq_depth, total_barcodes,
192194
stdout=subprocess.PIPE,
193195
stderr=subprocess.PIPE)
194196
except subprocess.CalledProcessError as e:
197+
sys.stderr.write(res.stderr.decode() + '\n')
198+
sys.stderr.write(res.stdout.decode() + '\n')
195199
raise e
196200
if debug is True:
197201
sys.stderr.write(res.stderr.decode() + '\n')
@@ -303,7 +307,7 @@ def combine_reads(fq_files, out_files, name_fmt='{readID} BX:Z:{barcodeID}', deb
303307
Debug mode
304308
"""
305309
# split by read pairs
306-
R1_files = [x[0] for x in fq_files]
310+
R1_files = [x[0] for x in fq_files if x[0] is not None]
307311
assert len(R1_files) == len(list(set(R1_files))), 'fastq files are not unique!'
308312
try:
309313
R2_files = [x[1] for x in fq_files]

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
desc = 'Metagenome simulation of multiple synthetic communities'
2020
setup(
2121
name = 'MGSIM',
22-
version = '0.2.1',
22+
version = '0.2.2',
2323
description = desc,
2424
long_description = desc + '\n See README for more information.',
2525
author = 'Nick Youngblut',

tests/data/comm_abund.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Community Taxon Perc_rel_abund Rank
2-
1 Methanosarcina_barkeri_MS 67.618940512 1
3-
1 Escherichia_coli_K-12_MG1655 21.616962188 2
4-
1 Clostridium_perfringens_ATCC_13124 10.764097301 3
2+
1 Methanosarcina_barkeri_MS 92.021627736 1
3+
1 Escherichia_coli_K-12_MG1655 6.884694035 2
4+
1 Clostridium_perfringens_ATCC_13124 1.093678229 3

tests/data/comm_wAbund.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Community Taxon Perc_rel_abund Rank
2-
1 Methanosarcina_barkeri_MS 72.475927709 1
3-
1 Escherichia_coli_K-12_MG1655 16.256348259 2
4-
1 Clostridium_perfringens_ATCC_13124 11.267724032 3
2+
1 Methanosarcina_barkeri_MS 93.976139793 1
3+
1 Escherichia_coli_K-12_MG1655 4.933046911 2
4+
1 Clostridium_perfringens_ATCC_13124 1.090813296 3

0 commit comments

Comments
 (0)