diff vsnp_statistics.py @ 25:b908bb18008a draft

Uploaded
author greg
date Thu, 16 Sep 2021 00:56:07 +0000
parents b34843f09f9f
children
line wrap: on
line diff
--- a/vsnp_statistics.py	Fri Aug 27 20:04:26 2021 +0000
+++ b/vsnp_statistics.py	Thu Sep 16 00:56:07 2021 +0000
@@ -64,11 +64,14 @@
     # Starting at row 3, keep every 4 row
     # random sample specified number of rows.
     file_size = nice_size(os.path.getsize(fastq_file))
-    total_reads = int(len(fastq_df.index) / 4)
+    total_reads = len(seqs)
     # Mean Read Length
     if sampling_size > total_reads:
         sampling_size = total_reads
-    fastq_df = fastq_df.iloc[3::4].sample(sampling_size)
+    try:
+        fastq_df = fastq_df.iloc[3::4].sample(sampling_size)
+    except ValueError:
+        fastq_df = fastq_df.iloc[3::4].sample(sampling_size, replace=True)
     dict_mean = {}
     list_length = []
     i = 0