From 730a2da3805f3126230ef80bfce2b056c05dc045 Mon Sep 17 00:00:00 2001
From: Jeremy Mathews <Jeremy.Mathews@utsouthwestern.edu>
Date: Fri, 24 May 2019 16:24:03 -0500
Subject: [PATCH] 55-Fail Pipeline if wrong genome is selected

---
 workflow/scripts/map_reads.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/workflow/scripts/map_reads.py b/workflow/scripts/map_reads.py
index a3a6abf..9c09b0a 100644
--- a/workflow/scripts/map_reads.py
+++ b/workflow/scripts/map_reads.py
@@ -218,6 +218,13 @@ def main():
             shlex.split("samtools flagstat %s" % (bam_filename)),
             stdout=temp_file)
 
+    #Genome/Bad fastq File Check
+    file_check = open(bam_mapstats_filename).readlines()
+    percent = file_check[4].split('(')[1]
+    percent = percent.split('%')[0]
+    if float(percent) < 10:
+        raise Exception ('Mapped Genes too low: Check for correct Genotype')
+
     # Remove sai files
     for sai_file in sai:
         os.remove(sai_file)
-- 
GitLab