diff completemask.py @ 4:ee2beb764a7b draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ivar/ commit 693df287d23b0fd9dfd134b41d401a438c3f5ad6"
author iuc
date Mon, 22 Jun 2020 07:29:10 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/completemask.py	Mon Jun 22 07:29:10 2020 -0400
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import sys
+
+
+if __name__ == '__main__':
+    with open(sys.argv[1]) as i:
+        getmasked_output = i.readline().strip()
+
+    if not getmasked_output:
+        print()
+        print('No affected primer binding sites found!')
+    else:
+        masked_primers = getmasked_output.split('\t')
+        with open(sys.argv[2]) as i:
+            amplicon_data = [line.strip().split('\t') for line in i]
+
+        masked_complete = []
+        for primer in masked_primers:
+            for amplicon in amplicon_data:
+                if primer in amplicon:
+                    masked_complete += amplicon
+        result = '\t'.join(sorted(set(masked_complete)))
+        print()
+        print('Removing reads primed with any of:')
+        print(result)
+        with open(sys.argv[1], 'w') as o:
+            o.write(result + '\n')