Mercurial > repos > earlhaminst > t_coffee
changeset 4:fa59d6fea7f5 draft
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/t_coffee commit 988b1fc1cb8739e45648465adbf099f3fdaf87f8
author | earlhaminst |
---|---|
date | Fri, 03 Mar 2017 07:29:32 -0500 |
parents | 78dd29aa7fc1 |
children | a91be6005274 |
files | filter_by_fasta_ids.py |
diffstat | 1 files changed, 12 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/filter_by_fasta_ids.py Mon Feb 20 06:25:50 2017 -0500 +++ b/filter_by_fasta_ids.py Fri Mar 03 07:29:32 2017 -0500 @@ -9,20 +9,20 @@ def FASTAReader_gen(fasta_filename): - fasta_file = open(fasta_filename) - line = fasta_file.readline() - while True: - if not line: - return - assert line.startswith('>'), "FASTA headers must start with >" - header = line.rstrip() - sequence_parts = [] + with open(fasta_filename) as fasta_file: line = fasta_file.readline() - while line and line[0] != '>': - sequence_parts.append(line.rstrip()) + while True: + if not line: + return + assert line.startswith('>'), "FASTA headers must start with >" + header = line.rstrip() + sequence_parts = [] line = fasta_file.readline() - sequence = "".join(sequence_parts) - yield Sequence(header, sequence) + while line and line[0] != '>': + sequence_parts.append(line.rstrip()) + line = fasta_file.readline() + sequence = "".join(sequence_parts) + yield Sequence(header, sequence) def target_match(target, search_entry): @@ -47,7 +47,6 @@ work_summary['wanted'] = len(targets) - # output = open(sys.argv[3], "w") for entry in FASTAReader_gen(sys.argv[2]): target_matched_results = target_match(targets, entry.header) if target_matched_results: