Skip to content

UnboundLocalError: local variable 'n_tokens' referenced before assignment #66

@BioGeek

Description

@BioGeek

When the ProForma parsing fails in simulate_token_scores, you get the following error:

ProForma failed on: [UNIMOD:5][UNIMOD:385]-EEEEHQEEEEDNNR
Traceback (most recent call last):
File "/algo/./output_mapper.py", line 102, in <module>
output_data = output_mapper.format_output(output_data)
File "/algo/base/output_mapper.py", line 130, in format_output
output_data["aa_scores"] = output_data.apply(
File "/opt/conda/envs/PrimeNovo/lib/python3.10/site-packages/pandas/core/frame.py", line 9565, in apply
return op.apply().__finalize__(self, method="apply")
File "/opt/conda/envs/PrimeNovo/lib/python3.10/site-packages/pandas/core/apply.py", line 746, in apply
return self.apply_standard()
File "/opt/conda/envs/PrimeNovo/lib/python3.10/site-packages/pandas/core/apply.py", line 873, in apply_standard
results, res_index = self.apply_series_generator()
File "/opt/conda/envs/PrimeNovo/lib/python3.10/site-packages/pandas/core/apply.py", line 889, in apply_series_generator
results[i] = self.f(v)
File "/algo/base/output_mapper.py", line 131, in <lambda>
lambda row: self.simulate_token_scores(row["score"], row["sequence"]),
File "/algo/base/output_mapper.py", line 90, in simulate_token_scores
scores = [str(pep_score),] * n_tokens
UnboundLocalError: local variable 'n_tokens' referenced before assignment

I encountered this when running pi-PrimeNovo on the human_antibodies_trypsin dataset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions