changeset 1:b673449d111a draft default tip

planemo upload commit f3fb68f4faf6766eef195b8b36157035ab95e7b1-dirty
author yating-l
date Mon, 05 Jun 2017 12:50:14 -0400
parents 9573618e2afe
children
files filter.py gbToFasta.xml
diffstat 2 files changed, 22 insertions(+), 1 deletions(-) [+]
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)
--- a/gbToFasta.xml	Wed Apr 12 17:43:55 2017 -0400
+++ b/gbToFasta.xml	Mon Jun 05 12:50:14 2017 -0400
@@ -15,7 +15,8 @@
             && raToTab
                   -cols=acc,cds
                   outputra
-                  '${outputcds}'
+                  cds_file
+            && python $__tool_directory__/filter.py -f cds_file -o '${outputcds}'
       #end if
 ]]></command>
       <inputs>