Skip to content

Commit 455463d

Browse files
committed
fix in coverage specification
1 parent 2874481 commit 455463d

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

adrsm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import argparse
99
def _get_args():
1010
'''This function parses and return arguments passed in'''
1111
parser = argparse.ArgumentParser(
12-
prog='ADRSM',
12+
prog='ADRSM v0.5',
1313
description='Ancient DNA Read Simulator for Metagenomics')
1414
parser.add_argument('confFile', help="path to configuration file")
1515
parser.add_argument(
@@ -127,7 +127,6 @@ if __name__ == "__main__":
127127
all_genomes = read_config(INFILE, GENDIR)
128128
for agenome in all_genomes.keys():
129129
stat_and_run = ad.run_read_simulation_multi(INFILE=agenome,
130-
NREAD=None,
131130
COV=all_genomes[agenome][1],
132131
READLEN=READLEN,
133132
INSERLEN=all_genomes[agenome][0],

lib/adrsmlib.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def scale(x, themin, themax):
3030
def reverse_complement(dna):
3131
dna = dna.upper()
3232
'''
33-
Reverse complement a DNA string
33+
Reverse complement a DNA string
3434
'''
3535
dna = dna[::-1]
3636
revcom = []
@@ -159,13 +159,10 @@ def write_fastq_multi(fastq_dict, outputfile):
159159
f2.write(reads2)
160160

161161

162-
def run_read_simulation_multi(INFILE, NREAD, COV, READLEN, INSERLEN, LENDEV, A1, A2, MINLENGTH, ERR, DAMAGE, GEOM_P, THEMIN, THEMAX, fastq_dict, QUALITY):
162+
def run_read_simulation_multi(INFILE, COV, READLEN, INSERLEN, LENDEV, A1, A2, MINLENGTH, ERR, DAMAGE, GEOM_P, THEMIN, THEMAX, fastq_dict, QUALITY):
163163
print("===================")
164164
print("Genome: ", INFILE)
165-
if COV:
166-
print("Coverage: ", COV)
167-
else:
168-
print("Number of reads: ", NREAD)
165+
print("Coverage: ", COV)
169166
print("Read length: ", READLEN)
170167
print("Mean Insert length: ", INSERLEN)
171168
print("Insert length standard deviation: ", LENDEV)
@@ -178,15 +175,14 @@ def run_read_simulation_multi(INFILE, NREAD, COV, READLEN, INSERLEN, LENDEV, A1,
178175
basename = get_basename(INFILE)
179176
fasta = read_fasta(INFILE)
180177

181-
if COV:
182-
nread = int(fasta[1] / INSERLEN)
183-
print("Number of reads: ", nread)
184-
print("===================\n")
178+
nread = int((fasta[1] / INSERLEN) * COV)
179+
print("Number of reads: ", nread)
180+
print("===================\n")
185181

186182
insert_lengths = [int(n) for n in npr.normal(INSERLEN, LENDEV, nread)]
187183

188184
all_inserts = random_insert(fasta, insert_lengths, READLEN, MINLENGTH)
189-
if DAMAGE == True:
185+
if DAMAGE:
190186
all_inserts = add_damage(
191187
all_inserts=all_inserts,
192188
geom_p=GEOM_P,

0 commit comments

Comments
 (0)