Skip to content

Commit

Permalink
Optimisation for filter_fasta.py
Browse files Browse the repository at this point in the history
see #13
  • Loading branch information
mcmero committed Aug 23, 2021
1 parent 19e44ff commit f2c784b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion util/filter_fasta.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@

tx_list = pd.read_csv(tx_list_file, sep='\t', header=header)

lookup_list = set(tx_list[col_id].values.tolist())

handle = open(fasta_file, 'r')
for record in SeqIO.parse(handle, 'fasta'):
record.description = record.id
if record.id in tx_list[col_id].values:
if record.id in lookup_list:
sys.stdout.write(record.format('fasta'))
handle.close()

0 comments on commit f2c784b

Please sign in to comment.