mirror of
http://43.156.76.180:8026/YuuMJ/EukPhylo.git
synced 2025-12-27 10:50:25 +08:00
Update preguidance.py
This commit is contained in:
parent
8fa40adf9c
commit
8872d1724d
@ -15,6 +15,11 @@ def run(params):
|
|||||||
except (FileNotFoundError, TypeError) as e:
|
except (FileNotFoundError, TypeError) as e:
|
||||||
Logger.Error('Unable to read taxon list file. Please make sure that the path is correct and that the file is formatted correctly.\n\n' + str(e))
|
Logger.Error('Unable to read taxon list file. Please make sure that the path is correct and that the file is formatted correctly.\n\n' + str(e))
|
||||||
|
|
||||||
|
try:
|
||||||
|
blacklist_seqs = list(dict.fromkeys([line.strip() for line in open(params.blacklist)]))
|
||||||
|
except (FileNotFoundError, TypeError) as e:
|
||||||
|
print('\nUnable to read blacklist file. Please make sure that the path is correct and that the file is formatted correctly.\n\n' + str(e))
|
||||||
|
|
||||||
if not os.path.isdir(params.data):
|
if not os.path.isdir(params.data):
|
||||||
Logger.Error(Logger.Error('Input amino-acid data files not found. Please make sure that the given path (--data) is correct.'))
|
Logger.Error(Logger.Error('Input amino-acid data files not found. Please make sure that the given path (--data) is correct.'))
|
||||||
|
|
||||||
@ -31,7 +36,7 @@ def run(params):
|
|||||||
with open(params.output + '/Output/Pre-Guidance/' + og + '_preguidance.faa', 'w') as preguidance_file:
|
with open(params.output + '/Output/Pre-Guidance/' + og + '_preguidance.faa', 'w') as preguidance_file:
|
||||||
for taxon_file in aa_files:
|
for taxon_file in aa_files:
|
||||||
recs = []
|
recs = []
|
||||||
for rec in sorted([rec for rec in SeqIO.parse(params.data + '/' + taxon_file, 'fasta') if rec.id[-10:] == og], key=lambda x: -len(x.seq)):
|
for rec in sorted([rec for rec in SeqIO.parse(params.data + '/' + taxon_file, 'fasta') if rec.id[-10:] == og and rec.id not in blacklist_seqs], key=lambda x: -len(x.seq)):
|
||||||
if(rec.id == rec.description):
|
if(rec.id == rec.description):
|
||||||
recs.append(rec)
|
recs.append(rec)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user