Skip to content

Commit

Permalink
Use CFEIntact's python API instead of operating system's shell
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Jul 8, 2024
1 parent 2345afa commit bc1d1ea
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions gene_splicer/primer_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from operator import itemgetter
import os
from tarfile import TarFile
import cfeintact

import pandas as pd
from pathlib import Path
Expand Down Expand Up @@ -531,19 +532,32 @@ def run(contigs_csv,
archive_hivseqinr_results(working_path,
hivseqinr_results_tar)
if run_hivintact:
working_path: Path = outpath / f'hivintact_{i}'
working_path.mkdir(exist_ok=True)
with (working_path / 'hiv-intact.log').open('w') as log_file:
subprocess.run(['cfeintact',
'check',
'--working-folder', working_path,
'--subtype=B',
'--ignore-distance',
str(no_primers_fasta)],
check=True,
stdout=log_file,
stderr=subprocess.STDOUT,
cwd=working_path)
working_path = outpath / f'hivintact_{i}'
log_file_path = working_path / 'hiv-intact.log'
os.makedirs(working_path, exist_ok=True)

logger = cfeintact.logger
file_handler = logging.FileHandler(log_file_path)
logger.addHandler(file_handler)

cfeintact.check(
working_dir=working_path,
input_file=str(no_primers_fasta),
subtype="B",
check_packaging_signal=True,
check_rre=True,
check_major_splice_donor_site=True,
check_hypermut=True,
check_long_deletion=True,
check_nonhiv=True,
check_scramble=True,
check_internal_inversion=True,
check_unknown_nucleotides=True,
check_small_orfs=True,
check_distance=False,
output_csv=True,
)

if hivintact_results_tar is not None:
archive_hivintact_results(working_path,
hivintact_results_tar)
Expand Down

0 comments on commit bc1d1ea

Please sign in to comment.