From 5532fa6d2d0fb0f8bd120ab0edc899bb6fd15aff Mon Sep 17 00:00:00 2001
From: Venkat Malladi <venkat.malladi@utsouthwestern.edu>
Date: Tue, 3 Oct 2017 14:13:17 -0500
Subject: [PATCH] Add in argument for trim_parameters.

---
 workflow/scripts/trim_reads.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/workflow/scripts/trim_reads.py b/workflow/scripts/trim_reads.py
index 29d9b92..c0f80a2 100644
--- a/workflow/scripts/trim_reads.py
+++ b/workflow/scripts/trim_reads.py
@@ -34,6 +34,11 @@ def get_args():
                         nargs='+',
                         required=True)
 
+    parser.add_argument('-p', '--paired',
+                        help="True/False if paired-end or single end.",
+                        default=False,
+                        action='store_true')
+
     args = parser.parse_args()
     return args
 
@@ -58,10 +63,15 @@ def check_tools():
         raise Exception('Missing cutadapt')
 
 
-def trim_reads(fastq):
+def trim_reads(fastq, paired):
     '''Run trim_galore on 1 or 2 files.'''
-    qc_command = "trim_galore --paired -q 25 --illumina --gzip --length 35 " \
-                + " ".join(fastq)
+
+    if paired: # paired-end data
+        qc_command = "trim_galore --paired -q 25 --illumina --gzip --length 35 " \
+                    + " ".join(fastq)
+    else:
+        qc_command = "trim_galore -q 25 --illumina --gzip --length 35 " \
+                    + " ".join(fastq)
 
     logger.info("Running trim_galore with %s", qc_command)
 
@@ -80,7 +90,7 @@ def main():
     check_tools()
 
     # Run trim_reads
-    trim_reads(args.fastq)
+    trim_reads(args.fastq, args.paired)
 
 
 if __name__ == '__main__':
-- 
GitLab