Mercurial > repos > yating-l > gbtofasta
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 0:9573618e2afe | 1:b673449d111a |
|---|---|
| 1 import sys | |
| 2 import argparse | |
| 3 | |
| 4 def filter(cds_file, valid_cds_file): | |
| 5 valid = open(valid_cds_file, 'w') | |
| 6 with open(cds_file, 'r') as f: | |
| 7 for line in f: | |
| 8 if len(line.rstrip().split('\t')) == 2: | |
| 9 valid.write(line) | |
| 10 valid.close() | |
| 11 | |
| 12 def main(argv): | |
| 13 parser = argparse.ArgumentParser(description='Filter out records without CDS coordinates') | |
| 14 parser.add_argument('-f', help='cds file') | |
| 15 parser.add_argument('-o', help='validated cds file') | |
| 16 args = parser.parse_args() | |
| 17 filter(args.f, args.o) | |
| 18 | |
| 19 if __name__ == '__main__': | |
| 20 main(sys.argv) |
