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

deprotonate=False not working? #374

Closed
l-Dr-MR-l opened this issue Mar 13, 2024 · 5 comments
Closed

deprotonate=False not working? #374

l-Dr-MR-l opened this issue Mar 13, 2024 · 5 comments

Comments

@l-Dr-MR-l
Copy link

l-Dr-MR-l commented Mar 13, 2024

Hi, I'm probably not understanding something correctly but I'm setting deprotonate to False and still get deprotonation happening:

        self.graphein_config = ProteinGraphConfig(granularity='atom',
                                                  deprotonate=False,
                                                  edge_construction_functions= [
                                                                                add_peptide_bonds,
                                                                                add_atomic_edges,
                                                                                #add_hydrogen_bond_interactions,
                                                                                #add_hydrophobic_interactions,
                                                                                add_bond_order,
                                                                                #partial(add_distance_threshold, long_interaction_threshold=5, threshold=10.)
                                                                                #partial(add_k_nn_edges, k=3, long_interaction_threshold=0)
                                                                                ],
                                                  node_metadata_functions= [amino_acid_one_hot, expasy_protein_scale])
        print(self.graphein_config.dict())

and run using:
graph_list.append(construct_graph(config=self.graphein_config, path=file_path))

output:

2024-03-13 13:12:00,703 - INFO - Initialising data loader.
{'granularity': 'atom', 'keep_hets': [], 'insertions': True, 'alt_locs': 'max_occupancy', 'pdb_dir': None, 'verbose': False, 'exclude_waters': True, 'deprotonate': False, 'protein_df_processing_functions': None, 'edge_construction_functions': [<function add_peptide_bonds at 0x7f4ace2c7ec0>, <function add_atomic_edges at 0x7f4ace2d1120>, <function add_bond_order at 0x7f4ace2d1260>], 'node_metadata_functions': [<function amino_acid_one_hot at 0x7f4ace2d2f20>, <function expasy_protein_scale at 0x7f4ace2d2b60>], 'edge_metadata_functions': None, 'graph_metadata_functions': None, 'get_contacts_config': None, 'dssp_config': None}
2024-03-13 13:12:00,703 - INFO - Building graphs with batch_size 5
                    DEBUG    Deprotonating protein. This removes H atoms from the       graphs.py:188
                             pdb_df dataframe

if I'm reading this correctly it is applied out of this graphs.py, where I see deprotonate's default value is true so I'm not assigning it properly somehow?

def process_dataframe(
    protein_df: pd.DataFrame,
    atom_df_processing_funcs: Optional[List[Callable]] = None,
    hetatom_df_processing_funcs: Optional[List[Callable]] = None,
    granularity: str = "centroids",
    chain_selection: str = "all",
    insertions: bool = False,
    alt_locs: bool = False,
    deprotonate: bool = True,

I've also tried simply copying and running the code in https://graphein.ai/notebooks/atom_graph_tutorial.html to see if deprotonation=False works there.
But I get a TypeError: construct_graph() got an unexpected keyword argument 'pdb_code'
Is the documentation site out of date?

@a-r-j
Copy link
Owner

a-r-j commented Mar 13, 2024

Hi @l-Dr-MR-l thanks for finding this. It appears the argument was not wired up. I've made a PR; would you be able to test it out & see if it resolves your issue? #375

@a-r-j
Copy link
Owner

a-r-j commented Mar 13, 2024

Re docs, yes they're a little out of date at this point. I've been meaning to get around to updating them. Is the error with pdb_code or pdb_path? pdb_path was renamed to just path but pdb_code shouldn't have been touched for some time.

a-r-j added a commit that referenced this issue Mar 22, 2024
* wire up deprotonate arg #374

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update test

* fix test typo

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix test

* update changelog

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@l-Dr-MR-l
Copy link
Author

l-Dr-MR-l commented Mar 27, 2024

Hi @l-Dr-MR-l thanks for finding this. It appears the argument was not wired up. I've made a PR; would you be able to test it out & see if it resolves your issue? #375

Hi @a-r-j , I've run
pip install --update pip
pip install --update graphein[all]

and then ran my code again, unfortunately it seems to still deprotonate despite being set to False.
Did I need to update it in a different way?

        self.graphein_config = ProteinGraphConfig(granularity='atom',
                                                  deprotonate=False,    
                                                  edge_construction_functions= [
                                                      add_peptide_bonds,
                                                      add_atomic_edges,                   # Covalent bonds
                                                      add_ring_status,                    # Needs other edges to add to. Adds ring structures.
                                                      add_bond_order,                     # Needs other edges to add to. Adds single/double bond.
                                                      add_disulfide_interactions,
                                                  ],
                                                  node_metadata_functions= [amino_acid_one_hot,
                                                                            expasy_protein_scale,
                                                                            hydrogen_bond_acceptor,
                                                                            hydrogen_bond_donor
                                                                            ])
        graph_list.append(construct_graph(config=self.graphein_config, path=file_path))

terminal output:

DEBUG    Deprotonating protein. This removes H atoms from the     graphs.py:188
                             pdb_df dataframe

@a-r-j
Copy link
Owner

a-r-j commented Mar 27, 2024

Hi, yes. I've not pushed a new version to PyPI yet (will be doing so today) as there were a few other PRs I was hoping to squeeze in. You can try the change if you pip install from the github repository though pip install git+https://github.com/a-r-j/graphein

@l-Dr-MR-l
Copy link
Author

Cheers that worked, it is now corrently following the deprotonate argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants