INNER CODE UNIT · Python
n_reads
HadrienG/InSilicoSeq · iss/app.py:65
n_reads = sum(readcount_dic.values())
logger.info("Generating %s reads" % n_reads)
else:
n_reads = util.convert_n_reads(args.n_reads)
logger.info("Generating %s reads" % n_reads)
try:
# list holding the prefix for each cpu's temp file
temp_file_list = [f"{args.output}.iss.tmp.{i}" for i in range(args.cpus)]
f = open(genome_file, "r") # re-opens the file
with f:
fasta_file = SeqIO.parse(f, "fasta")
# TODO check if a SeqIO.index (db) leads to better memory usage and is not slower
# fasta_dict = SeqIO.index(f, 'fasta')
# Calculate how many reads we want each cpu to generate
n_read_pairs = n_reads // 2
chunk_size = -((n_read_pairs) // -args.cpus) # this is ceildiv, see https://stackoverflow.com/a/17511341