diff mut2read.py @ 84:e46d5e377760 draft

planemo upload for repository https://github.com/Single-Molecule-Genetics/VariantAnalyzerGalaxy/tree/master/tools/variant_analyzer commit ee4a8e6cf290e6c8a4d55f9cd2839d60ab3b11c8-dirty
author mheinzl
date Fri, 19 Aug 2022 11:23:37 +0000
parents fdfe9a919ff7
children
line wrap: on
line diff
--- a/mut2read.py	Fri Aug 05 08:23:34 2022 +0000
+++ b/mut2read.py	Fri Aug 19 11:23:37 2022 +0000
@@ -40,6 +40,8 @@
                         help='Output FASTQ file of reads with mutations.')
     parser.add_argument('--outputJson',
                         help='Output JSON file to store collected data.')
+    parser.add_argument('--refalttiers', action="store_true",
+                        help='Store also information about the reference allele.')
     return parser
 
 
@@ -52,6 +54,7 @@
     file3 = args.familiesFile
     outfile = args.outputFastq
     json_file = args.outputJson
+    refalttiers = args.refalttiers
 
     if os.path.isfile(file1) is False:
         sys.exit("Error: Could not find '{}'".format(file1))
@@ -189,16 +192,26 @@
                 line = line.rstrip('\n')
                 splits = line.split('\t')
                 tag = splits[0]
-
-                if tag in tag_dict or tag in tag_dict_ref:
-                    str1 = splits[4]
-                    curr_seq = str1.replace("-", "")
-                    str2 = splits[5]
-                    curr_qual = str2.replace(" ", "")
-                    out.write("@" + splits[0] + "." + splits[1] + "." + splits[2] + "\n")
-                    out.write(curr_seq + "\n")
-                    out.write("+" + "\n")
-                    out.write(curr_qual + "\n")
+                if refalttiers is True:
+                    if tag in tag_dict or tag in tag_dict_ref:
+                        str1 = splits[4]
+                        curr_seq = str1.replace("-", "")
+                        str2 = splits[5]
+                        curr_qual = str2.replace(" ", "")
+                        out.write("@" + splits[0] + "." + splits[1] + "." + splits[2] + "\n")
+                        out.write(curr_seq + "\n")
+                        out.write("+" + "\n")
+                        out.write(curr_qual + "\n")
+                else:
+                    if tag in tag_dict:
+                        str1 = splits[4]
+                        curr_seq = str1.replace("-", "")
+                        str2 = splits[5]
+                        curr_qual = str2.replace(" ", "")
+                        out.write("@" + splits[0] + "." + splits[1] + "." + splits[2] + "\n")
+                        out.write(curr_seq + "\n")
+                        out.write("+" + "\n")
+                        out.write(curr_qual + "\n")
 
 
 if __name__ == '__main__':