Skip to content

Commit

Permalink
Changed variable names to work for all sequences. #32
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Rehm committed Apr 20, 2021
1 parent 1c45336 commit 1616876
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bakta/features/signal_peptides.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 == '?':
Expand All @@ -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)
]
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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

0 comments on commit 1616876

Please sign in to comment.