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

Polymer from PQR #285

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

Conversation

rwxayheee
Copy link
Contributor

@rwxayheee rwxayheee commented Dec 15, 2024

This is for #264. PQR is a file format similar to PDB and contains Q (charge) and R (radius). The major programs that uses PQR are PDB2PQR and APBS. Being able to parse PQR would allow us to directly get the computed charges for Polymers with available models in PDB2PQR (PARSE, AMBER, etc.).

This PR is adapted from the PQR parser in PDB2PQR and the existing (RDKit-based) method in Meeko to create Polymer from PDB. Specifically, the partial charge will be first parsed into atoms in a monomer's raw_rdkit_mol. Next, to transfer it to the monomer's padded_mol and molsetup, a get_atomprop_from_raw option is added to function monomer.parameterize. This needs to be a dict, with keys of atom property name and values of corresponding default values. This additional function may be re-used to pass on other properties. Radius from PQR is also parsed, but currently not transferred to raw_rdkit_mol, padded_mol or molsetup.

If more people find it useful, we can add option --read_pqr, and expose option --charge_model to mk_prepare_receptor.py. Might need #277 to merge first before further edits on the command line scripts.

@rwxayheee rwxayheee changed the base branch from release to develop December 15, 2024 04:58
@rwxayheee rwxayheee changed the title Polymer from PQR; mk_prepare_receptor.py --read_pqr --charge_model Polymer from PQR Dec 15, 2024
@rwxayheee rwxayheee marked this pull request as ready for review December 15, 2024 06:39
@rwxayheee rwxayheee requested a review from diogomart December 15, 2024 06:39
@rwxayheee
Copy link
Contributor Author

Python Usage at 29b1464

Input:
1FAS_dry.pqr.txt

from meeko import Polymer
from meeko import ResidueChemTemplates
from meeko import MoleculePreparation
from meeko import PDBQTWriterLegacy

pqr_fn = "1FAS_dry.pqr"
templates = ResidueChemTemplates.create_from_defaults()
with open(pqr_fn, "r") as f:
    pqr_string = f.read()

mk_prep = MoleculePreparation(charge_model="read", charge_atom_prop="PQRCharge")
pol1 = Polymer.from_pqr_string(pqr_string, templates, mk_prep)

pdbqt_name1 = "1FAS_charge_from_pqr.pdbqt"
pdbqt_rigid = PDBQTWriterLegacy.write_from_polymer(pol1)[0]
with open(pdbqt_name1, "w") as f:
    f.write(pdbqt_rigid)

mk_prep = MoleculePreparation()
pol2 = Polymer.from_pqr_string(pqr_string, templates, mk_prep)

pdbqt_name2 = "1FAS_charge_default.pdbqt"
pdbqt_rigid = PDBQTWriterLegacy.write_from_polymer(pol2)[0]
with open(pdbqt_name2, "w") as f:
    f.write(pdbqt_rigid)

Output:
1FAS_charge_from_pqr.pdbqt.txt
1FAS_charge_default.pdbqt.txt

@rwxayheee rwxayheee marked this pull request as draft December 16, 2024 23:12
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

Successfully merging this pull request may close these issues.

1 participant