Skip to content

Commit

Permalink
Update tree.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KennthShang authored Dec 6, 2024
1 parent 3848ba3 commit 6d9b451
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/phabox2/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def run(inputs):
# run marker alignment
logger.info(f"[3/5] running marker:")
for item in marker:
if os.path.exists(f'{rootpth}/{midfolder}/marker/{item}_conbined_db.fa'):
if os.path.exists(f'{rootpth}/{midfolder}/marker/{item}_combined_db.fa'):
logger.info(f"Skip the marker {item} since the combined db file already exists.")
continue
else:
Expand Down Expand Up @@ -132,9 +132,9 @@ def run(inputs):
logger.info(f"You probably shouldn't choose the marker {item} or use a more flexible --mcov and --mpident.")
exit(1)
_ = SeqIO.write(rec, f'{rootpth}/{midfolder}/marker/{item}.fa', 'fasta')
run_command(f'cat {rootpth}/{midfolder}/marker/{item}.fa {db_dir}/marker/{item}.fa > {rootpth}/{midfolder}/marker/{item}_conbined_db.fa')
run_command(f'cp {rootpth}/{midfolder}/marker/{item}_conbined_db.fa {rootpth}/{out_dir}/tree_supplementary/finded_marker_{item}_conbined_db.fa')
run_command(f'cp {rootpth}/{midfolder}/marker/{item}.fa {rootpth}/{out_dir}/tree_supplementary/finded_marker_{item}_without_db.fa')
run_command(f'cat {rootpth}/{midfolder}/marker/{item}.fa {db_dir}/marker/{item}.fa > {rootpth}/{midfolder}/marker/{item}_combined_db.fa')
run_command(f'cp {rootpth}/{midfolder}/marker/{item}_combined_db.fa {rootpth}/{out_dir}/tree_supplementary/found_marker_{item}_combined_db.fa')
run_command(f'cp {rootpth}/{midfolder}/marker/{item}.fa {rootpth}/{out_dir}/tree_supplementary/found_marker_{item}_without_db.fa')

logger.info("[4/5] Running the msa...")
if msa == 'Y':
Expand All @@ -144,7 +144,7 @@ def run(inputs):
continue
else:
logger.info(f"Running msa: {item}...This may take a long time...")
run_command(f'mafft --auto --quiet --thread {threads} {rootpth}/{midfolder}/marker/{item}_conbined_db.fa > {rootpth}/{midfolder}/msa/{item}.aln')
run_command(f'mafft --auto --quiet --thread {threads} {rootpth}/{midfolder}/marker/{item}_combined_db.fa > {rootpth}/{midfolder}/msa/{item}.aln')

msa = {}
for item in marker:
Expand Down Expand Up @@ -183,4 +183,4 @@ def run(inputs):
else:
logger.info("Skip the msa and tree building step...")

logger.info("Run time: %s seconds\n" % round(time.time() - program_start, 2))
logger.info("Run time: %s seconds\n" % round(time.time() - program_start, 2))

0 comments on commit 6d9b451

Please sign in to comment.