Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify output_name #476

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions alphapulldown/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,13 @@ class MultimericObject:
multimeric_template_dir: a directory where all the multimeric templates mmcifs files are stored
"""

def __init__(self, interactors: list, pair_msa: bool = True,
def __init__(self, interactors: list, input: list, pair_msa: bool = True,
multimeric_template: bool = False,
multimeric_template_meta_data: str = None,
multimeric_template_dir:str = None) -> None:
self.description = ""
self.interactors = interactors
self.input = input
self.build_description_monomer_mapping()
self.pair_msa = pair_msa
self.multimeric_template = multimeric_template
Expand All @@ -479,11 +480,23 @@ def build_description_monomer_mapping(self):

def create_output_name(self):
"""a method to create output name"""
list_oligo = self.input[0].split("+")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this work if is the delimiter is other than '+'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Between differents proteins, delimiter is always "+", if there is no "+" in self.input[0] so list_oligo will look like [P13979] (monomer) or [P13979:2] (dimere)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I mean we can choose a delimiter when run structure predictions. The '+' symbol is the default one, but it can be set to any other character:
https://github.com/KosinskiLab/AlphaPulldown/blob/main/alphapulldown/scripts/run_structure_prediction.py#L153
Therefore we have to pass the delimiter flag as well, otherwise it will not work for any custom delimiters other than '+'.
Then the code would look like:
list_oligo = self.input[0].split(self.delimiter)
and we need to pass this delimiter beforehand e.g.
object_to_model = MultimericObject( interactors=interactors, delimiter=delimiter, ...
On the other hand, maybe it makes more sense to move all this logic from objects.py to modelling_setup.py and keep MultimericObject logic as simple as possible (given it's already far from being simple)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sorry I don't know delimiter flag exist. Yes that make more sense to add this at modelling_setup.py.

oligo_count = 0
for i in range(len(self.interactors)):
if i == 0:
self.description += f"{self.interactors[i].description}"
if ":" in list_oligo[i] :
self.description += f"{self.interactors[i].description}_homo_{list_oligo[i].split(':')[1]}er"
else :
self.description += f"{self.interactors[i].description}"
else:
self.description += f"_and_{self.interactors[i].description}"
if self.interactors[i].description in self.description :
oligo_count += 1
pass
else :
if ":" in list_oligo[i-oligo_count] :
self.description += f"_and_{self.interactors[i].description}_homo_{list_oligo[i-oligo_count].split(':')[1]}er"
else :
self.description += f"_and_{self.interactors[i].description}"

def create_chain_id_map(self):
"""a method to create chain id"""
Expand Down