From 16168760a3843f62d1f58fb3321b4ca1bef7e086 Mon Sep 17 00:00:00 2001 From: AnnaRehm Date: Mon, 19 Apr 2021 12:30:49 +0200 Subject: [PATCH] Changed variable names to work for all sequences. #32 --- bakta/features/signal_peptides.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bakta/features/signal_peptides.py b/bakta/features/signal_peptides.py index d659b3b1..90eacb38 100644 --- a/bakta/features/signal_peptides.py +++ b/bakta/features/signal_peptides.py @@ -9,7 +9,7 @@ log = logging.getLogger('SIGNAL_PEPTIDES') -def execute_deepsig(cdss, cds_fasta_path): +def execute_deepsig(seqs, seqs_fasta_path): """Search for Signal Peptides using DeepSig tool.""" deepsig_output_path = cfg.tmp_path.joinpath('deepsig.gff3') if cfg.gram == '?': @@ -18,7 +18,7 @@ def execute_deepsig(cdss, cds_fasta_path): gram = 'gramn' if cfg.gram == '-' else 'gramp' cmd = [ 'deepsig.py', - '-f', str(cds_fasta_path), + '-f', str(seqs_fasta_path), '-k', gram, '-o', str(deepsig_output_path) ] @@ -34,7 +34,7 @@ def execute_deepsig(cdss, cds_fasta_path): log.error('signal peptide: deepsig failed to run through: command=%s, stdout=%s, stderr=%s, error-code=%s', cmd, proc.stdout, proc.stderr, proc.returncode) sys.exit('ERROR: deepsig failed to run through! error code: %s, error output: %s', proc.returncode, proc.stderr) - cds_by_hexdigest = {f"{cds['aa_hexdigest']}": cds for cds in cdss} + sequences_by_hexdigest = {f"{seq['aa_hexdigest']}": seq for seq in seqs} sig_pep = OrderedDict() sig_peps = [] with deepsig_output_path.open() as fh: @@ -43,8 +43,8 @@ def execute_deepsig(cdss, cds_fasta_path): if feature_type == "Signal peptide": identifier, tool, feature_type, start, stop, feature_annotation_score, placeholder, placeholder2, description = line.split("\t") aa_identifier = identifier.split("-")[0] - cds = cds_by_hexdigest[aa_identifier] - if cds['strand']=='-': + seq = sequences_by_hexdigest[aa_identifier] + if seq['strand']=='-': start_nucleotides = start #TODO: figure out correct reverse positions stop_nucleotides = stop else: @@ -55,8 +55,8 @@ def execute_deepsig(cdss, cds_fasta_path): sig_pep['stop'] = stop_nucleotides sig_pep['feature_annotation_score'] = feature_annotation_score sig_pep['identifier'] = aa_identifier - sig_pep['sequence'] = cds['sequence'] - sig_pep['strand'] = cds['strand'] + sig_pep['sequence'] = seq['sequence'] + sig_pep['strand'] = seq['strand'] sig_peps.append(sig_pep) return sig_peps