diff filter.py @ 1:b673449d111a draft default tip

planemo upload commit f3fb68f4faf6766eef195b8b36157035ab95e7b1-dirty
author yating-l
date Mon, 05 Jun 2017 12:50:14 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter.py	Mon Jun 05 12:50:14 2017 -0400
@@ -0,0 +1,20 @@
+import sys
+import argparse
+
+def filter(cds_file, valid_cds_file):
+    valid = open(valid_cds_file, 'w')
+    with open(cds_file, 'r') as f:
+        for line in f:
+            if len(line.rstrip().split('\t')) == 2:
+                valid.write(line)
+    valid.close()
+
+def main(argv):
+    parser = argparse.ArgumentParser(description='Filter out records without CDS coordinates')
+    parser.add_argument('-f', help='cds file')
+    parser.add_argument('-o', help='validated cds file')
+    args = parser.parse_args()
+    filter(args.f, args.o)
+
+if __name__ == '__main__':
+    main(sys.argv)