Skip to content
Snippets Groups Projects
Commit 5d15d53f authored by Kathleen Moriarty's avatar Kathleen Moriarty Committed by Kathleen Moriarty
Browse files

change: read start random to read start at 0

parent e1993339
Branches
No related tags found
1 merge request!17Issue 7
...@@ -75,26 +75,20 @@ def read_sequencing( ...@@ -75,26 +75,20 @@ def read_sequencing(
for i in range(0, num_frag_reads): for i in range(0, num_frag_reads):
# Obtain random first position for the read on the fragment # If the read length is less than the required length given by the parameter, then add random nucleotides
rand_start = randrange(0, len(frag)) if len(frag) < read_len:
# Calculate the difference of start position and length of read
diff_start_end = len(frag)-rand_start
# If length of read is greater than difference of start to end, then add random nucleotides
if diff_start_end < read_len:
# Calculate number of random nucleotides to add to the end of the read # Calculate number of random nucleotides to add to the end of the read
diff = read_len - diff_start_end diff = read_len - read_len
# Select random nucleotides from list of possible # Select random nucleotides from list of possible
rand_samp = choices(nucleotides, k=diff) rand_samp = choices(nucleotides, k=diff)
# Add the random list to the read and save # Add the random list to the read and save
tmp_read = frag[rand_start:len(frag)] + ''.join(rand_samp) tmp_read = frag[0:(len(frag)-1)] + ''.join(rand_samp)
else: else:
# Save subset of fragment as read # Save subset of fragment as read
tmp_read = frag[rand_start:(rand_start + read_len)] tmp_read = frag[0:(read_len-1)]
# append read to list # append read to list
fasta_list.append(tmp_read) fasta_list.append(tmp_read)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment