Skip to content

Commit

Permalink
fix in coverage specification
Browse files Browse the repository at this point in the history
  • Loading branch information
maxibor committed Mar 27, 2018
1 parent 2874481 commit 455463d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
3 changes: 1 addition & 2 deletions adrsm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import argparse
def _get_args():
'''This function parses and return arguments passed in'''
parser = argparse.ArgumentParser(
prog='ADRSM',
prog='ADRSM v0.5',
description='Ancient DNA Read Simulator for Metagenomics')
parser.add_argument('confFile', help="path to configuration file")
parser.add_argument(
Expand Down Expand Up @@ -127,7 +127,6 @@ if __name__ == "__main__":
all_genomes = read_config(INFILE, GENDIR)
for agenome in all_genomes.keys():
stat_and_run = ad.run_read_simulation_multi(INFILE=agenome,
NREAD=None,
COV=all_genomes[agenome][1],
READLEN=READLEN,
INSERLEN=all_genomes[agenome][0],
Expand Down
18 changes: 7 additions & 11 deletions lib/adrsmlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def scale(x, themin, themax):
def reverse_complement(dna):
dna = dna.upper()
'''
Reverse complement a DNA string
Reverse complement a DNA string
'''
dna = dna[::-1]
revcom = []
Expand Down Expand Up @@ -159,13 +159,10 @@ def write_fastq_multi(fastq_dict, outputfile):
f2.write(reads2)


def run_read_simulation_multi(INFILE, NREAD, COV, READLEN, INSERLEN, LENDEV, A1, A2, MINLENGTH, ERR, DAMAGE, GEOM_P, THEMIN, THEMAX, fastq_dict, QUALITY):
def run_read_simulation_multi(INFILE, COV, READLEN, INSERLEN, LENDEV, A1, A2, MINLENGTH, ERR, DAMAGE, GEOM_P, THEMIN, THEMAX, fastq_dict, QUALITY):
print("===================")
print("Genome: ", INFILE)
if COV:
print("Coverage: ", COV)
else:
print("Number of reads: ", NREAD)
print("Coverage: ", COV)
print("Read length: ", READLEN)
print("Mean Insert length: ", INSERLEN)
print("Insert length standard deviation: ", LENDEV)
Expand All @@ -178,15 +175,14 @@ def run_read_simulation_multi(INFILE, NREAD, COV, READLEN, INSERLEN, LENDEV, A1,
basename = get_basename(INFILE)
fasta = read_fasta(INFILE)

if COV:
nread = int(fasta[1] / INSERLEN)
print("Number of reads: ", nread)
print("===================\n")
nread = int((fasta[1] / INSERLEN) * COV)
print("Number of reads: ", nread)
print("===================\n")

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

all_inserts = random_insert(fasta, insert_lengths, READLEN, MINLENGTH)
if DAMAGE == True:
if DAMAGE:
all_inserts = add_damage(
all_inserts=all_inserts,
geom_p=GEOM_P,
Expand Down

0 comments on commit 455463d

Please sign in to comment.