Skip to content

Commit

Permalink
updated nerf & getpy usage
Browse files Browse the repository at this point in the history
  • Loading branch information
psalveso committed Mar 24, 2021
1 parent fadeea7 commit ee6bd76
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 77 deletions.
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,90 @@
# pyRIF
Using Rotamer Interaction Fields from RIFGen/Dock in python


### Installation
`pip install pyRIF`

### Pose Example
Moves your input pose into the region of the RIF
```
import glob
import pyrosetta
from pyrosetta.rosetta.core.select.residue_selector import ChainSelector
from pyrif import RotamerInteractionField
pyrosetta.init()
# dictionary pointing to RIFGen outputs
L_AA_RIF = {
'HDF5' : '/path/to/py_rif.h5',
'rots' : '/path/to/rotamer_index_spec.txt',
'target' : '/path/to/target.pdb.gz',
}
# residue selectors to select target and binder residues
target_selector = ChainSelector('A')
binder_selector = ChainSelector('B')
# create RIF object outside of loop
RIF = RotamerInteractionField(
L_AA_RIF_kwargs=L_AA_RIF,
residue_selector=binder_selector,
target_selector=target_selector,
)
for PDB in glob.iglob('/path/to/pdbs/*.pdb'):
pose = pyrosetta.io.pose_from_pdb(PDB)
# apply the RIF
STATUS, RIF_score, sequence_mapping = RIF.apply(pose)
if STATUS:
print(f'pass, {RIF_SCORE}\n{sequence_mapping}')
# continue with remainder of protocol
else:
print('fail')
```

### Numpy Example
Assumes your XYZs are already within the region of the RIF
```
import glob
import numpy as np
import pyrosetta
from pyrif import RotamerInteractionField
pyrosetta.init()
# dictionary pointing to RIFGen outputs
L_AA_RIF = {
'HDF5' : '/path/to/py_rif.h5',
'rots' : '/path/to/rotamer_index_spec.txt',
'target' : '/path/to/target.pdb.gz',
}
# create RIF object outside of loop
RIF = RotamerInteractionField(
L_AA_RIF_kwargs=L_AA_RIF,
)
binder_xyzs = np.random.rand(1000, 100, 3, 3)# [(1000 proteins), (100 residues), (N CA C), (X Y Z)]
for i in range(binder_xyzs.shape[0]):
STATUS, RIF_score, sequence_mapping = RIF.search_xyzs(binder_xyzs[i, :, :, :])
if STATUS:
print(f'pass, {RIF_SCORE}\n{sequence_mapping}')
# continue with remainder of protocol
else:
print('fail')
```
2 changes: 0 additions & 2 deletions example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@
if STATUS: print(f'rif score: {RIF_score}\n{sequence_mapping}')



print('D_RIF ONLY')
# RIF just with canonical D-AAs
RIF = RotamerInteractionField(
D_AA_RIF_kwargs=D_AA_RIF,
Expand Down
Loading

0 comments on commit ee6bd76

Please sign in to comment.