From b2f1355c457f6b83090c2bb0ab5fb6b081a3c136 Mon Sep 17 00:00:00 2001 From: "U-STI\\morika" <morika@TPH-L17108.sti.local> Date: Mon, 29 Nov 2021 22:37:18 +0100 Subject: [PATCH] fixed ranges to correct # of reads --- src/read_sequencing.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/read_sequencing.py b/src/read_sequencing.py index aaec0e9..f970db3 100644 --- a/src/read_sequencing.py +++ b/src/read_sequencing.py @@ -40,7 +40,10 @@ def read_sequencing(frag_file_name, output_file_name, num_reads, read_len, num_s while frag_line != "": # To stop when the end of file is reached if frag_line.startswith('>'): + # Determine if this is the first fragment in the file + # Ignore the description line (starting with >) of the first fragment if not (len(frag_list) == 0 and frag_str == ""): + # Not the first fragment. Append to list. frag_list.append(frag_str) frag_str = "" else: @@ -60,7 +63,7 @@ def read_sequencing(frag_file_name, output_file_name, num_reads, read_len, num_s sum_frags = sum(map(len, frag_list)) # Repeat the read process for given number of cycles - for j in range(1, num_seq_cyc): + for j in range(0, num_seq_cyc): # Loop through fasta fragments that start with 5' for frag in frag_list: @@ -70,7 +73,7 @@ def read_sequencing(frag_file_name, output_file_name, num_reads, read_len, num_s # TODO resolve this issue num_frag_reads = round((len(frag)/sum_frags) * num_reads) - for i in range(1, num_frag_reads): + for i in range(0, num_frag_reads): # Obtain random first position for the read on the fragment rand_start = randrange(0, len(frag)) -- GitLab