From 5d15d53f945ae70728c9eef1b271eecc7ff07bcb Mon Sep 17 00:00:00 2001
From: "kathleen.moriarty" <kathleen.moriarty@unibas.ch>
Date: Wed, 8 Dec 2021 11:01:10 +0100
Subject: [PATCH] change: read start random to read start at 0

---
 src/read_sequencing.py | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/read_sequencing.py b/src/read_sequencing.py
index 085316d..6c47005 100644
--- a/src/read_sequencing.py
+++ b/src/read_sequencing.py
@@ -75,26 +75,20 @@ def read_sequencing(
 
         for i in range(0, num_frag_reads):
 
-            # Obtain random first position for the read on the fragment
-            rand_start = randrange(0, len(frag))
-
-            # 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:
+            # If the read length is less than the required length given by the parameter, then add random nucleotides
+            if len(frag) < read_len:
 
                 # 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
                 rand_samp = choices(nucleotides, k=diff)
 
                 # 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:
                 # 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
             fasta_list.append(tmp_read)
-- 
GitLab