-
Notifications
You must be signed in to change notification settings - Fork 108
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
Added residue replacement to handle protein chemical modifications and NCAAs #128
Open
gfzhou
wants to merge
2
commits into
baker-laboratory:main
Choose a base branch
from
gfzhou:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+124
−5
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,6 +263,37 @@ becomes this so it can be parsed correctly: | |
|
||
We know this syntax is hard to work with and we are happy to review PRs if anyone in the community can figure out how to specify all the necessary requirements in a more user friendly way! | ||
|
||
<a id="residue_replacement"></a> | ||
### Predicting Proteins with Chemical Modifications or Non-Canonical Amino Acids | ||
To predict proteins with chemically modified residues or non-canonical amino acids, you can use residue replacement. This involves replacing the chemically modified residue or NCAA with a small molecule file that defines the structure of the modified residue. Here is an example of predicting a phosphorylated protein structure. (from `rf2aa/config/inference/residue_replacement.yaml`) | ||
``` | ||
defaults: | ||
- base | ||
job_name: "1h4x" | ||
|
||
protein_inputs: | ||
A: | ||
fasta_file: examples/residue_replacement/1h4x.fasta | ||
|
||
residue_replacement: | ||
B: | ||
protein_chain: A | ||
residue_index_to_replace: 57 | ||
input: examples/residue_replacement/SEP_ideal_trim.sdf | ||
input_type: "sdf" | ||
N_index_atom: 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this 0 indexed or 1 indexed? |
||
C_index_atom: 5 | ||
|
||
loader_params: | ||
MAXCYCLE: 10 | ||
``` | ||
To predict the example, run: | ||
``` | ||
python -m rf2aa.run_inference --config-name residue_replacement | ||
``` | ||
In this example, we use the phosphoserine structure defined in `SEP_ideal_trim.sdf` and treat it as an atomized residue to replace the residue 57 in chain A. Please note that one extra oxygen atom has to be removed from the carboxylic group. `N_index_atom` and `C_index_atom` define the atoms to connect to the previous and the next residues, respectively. | ||
|
||
|
||
<a id="outputs"></a> | ||
### Understanding model outputs | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
>1H4X_1|Chains A, B|ANTI-SIGMA F FACTOR ANTAGONIST|BACILLUS SPHAERICUS (1421) | ||
MAFQLEMVTRETVVIRLFGELDHHAVEQIRAKISTAIFQGAVTTIIWNFERLSFMDSSGVGLVLGRMRELEAVAGRTILLNPSPTMRKVFQFSGLGPWMMDATEEEAIDRVRGIVNG | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
SEP | ||
PyMOL2.6 3D 0 | ||
|
||
10 9 0 0 1 0 0 0 0 0999 V2000 | ||
1.8550 0.4210 1.7510 N 0 0 0 0 0 0 0 0 0 0 0 0 | ||
0.4010 0.6200 1.6870 C 0 0 1 0 0 0 0 0 0 0 0 0 | ||
-0.1390 0.0150 0.3910 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
0.4770 0.6550 -0.7270 O 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-0.2490 -0.0530 2.8670 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
0.2540 -1.0380 3.3540 O 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-0.1350 -0.0270 -2.0500 P 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-1.6010 0.1720 -2.0740 O 0 0 0 0 0 0 0 0 0 0 0 0 | ||
0.5200 0.6490 -3.3560 O 0 0 0 0 0 0 0 0 0 0 0 0 | ||
0.1910 -1.6030 -2.0410 O 0 0 0 0 0 0 0 0 0 0 0 0 | ||
1 2 1 0 0 0 0 | ||
2 3 1 0 0 0 0 | ||
2 5 1 0 0 0 0 | ||
3 4 1 0 0 0 0 | ||
4 7 1 0 0 0 0 | ||
5 6 2 0 0 0 0 | ||
7 8 2 0 0 0 0 | ||
7 9 1 0 0 0 0 | ||
7 10 1 0 0 0 0 | ||
M END | ||
> <OPENEYE_ISO_SMILES> | ||
C([C@@H](C(=O)O)N)OP(=O)(O)O | ||
|
||
> <OPENEYE_INCHI> | ||
InChI=1S/C3H8NO6P/c4-2(3(5)6)1-10-11(7,8)9/h2H,1,4H2,(H,5,6)(H2,7,8,9)/t2-/m0/s1 | ||
|
||
> <OPENEYE_INCHIKEY> | ||
BZQFBWGGLXLEPQ-REOHCLBHSA-N | ||
|
||
> <FORMULA> | ||
C3H8NO6P | ||
|
||
$$$$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
defaults: | ||
- base | ||
job_name: "1h4x" | ||
|
||
protein_inputs: | ||
A: | ||
fasta_file: examples/residue_replacement/1h4x.fasta | ||
|
||
residue_replacement: | ||
B: | ||
protein_chain: A | ||
residue_index_to_replace: 57 | ||
input: examples/residue_replacement/SEP_ideal_trim.sdf | ||
input_type: "sdf" | ||
N_index_atom: 1 | ||
C_index_atom: 5 | ||
|
||
loader_params: | ||
MAXCYCLE: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,31 @@ class AtomizedResidue: | |
original_chain: str | ||
index_in_original_chain: int | ||
|
||
def load_residue_replacement( residue_replacement, model_runner ): | ||
chainid_to_input = {} | ||
residues_to_atomize = [] | ||
for chain in residue_replacement: | ||
input_file = residue_replacement[chain]["input"] | ||
input_type = residue_replacement[chain]["input_type"] | ||
assert input_type in ["sdf", "mol2", "pdb"], "only sdf, mol2 and pdb files are supported" | ||
obmol, msa, ins, xyz, mask = parse_mol( | ||
input_file, filetype=input_type, string=False, generate_conformer=True | ||
) | ||
|
||
input = compute_features_from_obmol(obmol, msa, xyz, model_runner) | ||
chainid_to_input[chain] = input | ||
N_index_atom = int(residue_replacement[chain].N_index_atom) | ||
C_index_atom = int(residue_replacement[chain].C_index_atom) | ||
residues_to_atomize.append(AtomizedResidue( | ||
chain, | ||
0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this always 0? |
||
N_index_atom-1, | ||
C_index_atom-1, | ||
residue_replacement[chain].protein_chain, | ||
int(residue_replacement[chain].residue_index_to_replace) - 1 | ||
)) | ||
|
||
return chainid_to_input, residues_to_atomize | ||
|
||
def load_covalent_molecules(protein_inputs, config, model_runner): | ||
if config.covale_inputs is None: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are there any edge cases with running these with protein multimers or cases with small molecules? does order of inputs matter?