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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

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
@rwxayheee
Copy link
Contributor Author

This PR provides useful ways to import alternate charge models for receptor and/or prepared receptor file with assigned protonation states from PDB2PQR.

The most recent change added option --read_pqr, and expose option --charge_model to mk_prepare_receptor.py.

Description in help message

  --read_pdb PDB_FILENAME
                        reads PDB, not PDBQT, and does not use ProDy
  --read_pqr PQR_FILENAME
                        reads PQR with assigned partial charges, and does not use ProDy
.
.
.
  --charge_model {gasteiger,espaloma,zero}
                        default is 'gasteiger', 'zero' sets all zeros

Example usage 1: Parsing PQR

[input]
1FAS_dry.pqr.txt

mk_prepare_receptor.py --read_pqr 1FAS_dry.pqr -o 1FAS_pqr -p
Reading stuctures and partial charges from PQR. 
Options --charge_model, --default_altloc and --wanted_altloc will be ignored. 

Files written:
1FAS_pqr.pdbqt <-- static (i.e., rigid) receptor input file

[output]
1FAS_pqr.pdbqt.txt

Example usage 2: Using alternate charge model

[input]
3ZD5.pdb.txt

mk_prepare_receptor.py --charge_model espaloma -i 3ZD5.pdb -o 3ZD5_espaloma -p
mk_prepare_receptor.py --charge_model zero -i 3ZD5.pdb -o 3ZD5_zero -p

[output]
3ZD5_espaloma.pdbqt.txt
3ZD5_zero.pdbqt.txt

@rwxayheee rwxayheee marked this pull request as ready for review January 9, 2025 02:57
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