Skip to content

Commit 4cc4864

Browse files
committed
Merge branch 'main' into add_potentials
2 parents 9dcf567 + fb80774 commit 4cc4864

9 files changed

Lines changed: 1060 additions & 66 deletions

File tree

examples/design_ppi_dmasif.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ echo ${PYTHONPATH}
88

99
../scripts/run_inference.py inference.output_prefix=example_outputs/design_ppi_dmasif_dimer \
1010
inference.input_pdb=input_pdbs/insulin_target.pdb 'contigmap.contigs=[A1-150/0 70-100]' inference.num_designs=10 \
11-
'potentials.guiding_potentials=["type:dmasif_interactions,non_int_weight:0.5,int_weight:0.5"]'
11+
'potentials.guiding_potentials=["type:dmasif_interactions,non_int_weight:50,int_weight:50"]' \
12+
potentials.guide_scale=2 potentials.guide_decay='quadratic'

rfdiffusion/chemical.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
'SER','THR','TRP','TYR','VAL',
99
'UNK','MAS',
1010
]
11+
num2na=[
12+
'DA','DC','DG','DT','DX',
13+
'A','C','G','U','X',
14+
]
1115

1216
# Mapping 3 letter AA to 1 letter AA (e.g. ALA to A)
1317
one_letter = ["A", "R", "N", "D", "C", \
@@ -16,6 +20,7 @@
1620
"S", "T", "W", "Y", "V", "?", "-"]
1721

1822
aa2num= {x:i for i,x in enumerate(num2aa)}
23+
na2num= {x:i for i,x in enumerate(num2na)}
1924

2025
aa_321 = {a:b for a,b in zip(num2aa,one_letter)}
2126
aa_123 = {val:key for key,val in aa_321.items()}
@@ -51,6 +56,18 @@ def seq2chars(seq):
5156
(" N "," CA "," C "," O "," CB ", None, None, None, None, None, None, None, None, None," H "," HA ","1HB ","2HB ","3HB ", None, None, None, None, None, None, None, None), # unk
5257
(" N "," CA "," C "," O "," CB ", None, None, None, None, None, None, None, None, None," H "," HA ","1HB ","2HB ","3HB ", None, None, None, None, None, None, None, None), # mask
5358
]
59+
na2long=[
60+
(" O4'"," C1'"," C2'"," OP1"," P "," OP2"," O5'"," C5'"," C4'"," C3'"," O3'"," N9 "," C4 "," N3 "," C2 "," N1 "," C6 "," C5 "," N7 "," C8 "," N6 ", None, None,"H5''"," H5'"," H4'"," H3'","H2''"," H2'"," H1'"," H2 "," H61"," H62"," H8 ", None, None), #22 DA
61+
(" O4'"," C1'"," C2'"," OP1"," P "," OP2"," O5'"," C5'"," C4'"," C3'"," O3'"," N1 "," C2 "," O2 "," N3 "," C4 "," N4 "," C5 "," C6 ", None, None, None, None,"H5''"," H5'"," H4'"," H3'","H2''"," H2'"," H1'"," H42"," H41"," H5 "," H6 ", None, None), #23 DC
62+
(" O4'"," C1'"," C2'"," OP1"," P "," OP2"," O5'"," C5'"," C4'"," C3'"," O3'"," N9 "," C4 "," N3 "," C2 "," N1 "," C6 "," C5 "," N7 "," C8 "," N2 "," O6 ", None,"H5''"," H5'"," H4'"," H3'","H2''"," H2'"," H1'"," H1 "," H22"," H21"," H8 ", None, None), #24 DG
63+
(" O4'"," C1'"," C2'"," OP1"," P "," OP2"," O5'"," C5'"," C4'"," C3'"," O3'"," N1 "," C2 "," O2 "," N3 "," C4 "," O4 "," C5 "," C7 "," C6 ", None, None, None,"H5''"," H5'"," H4'"," H3'","H2''"," H2'"," H1'"," H3 "," H71"," H72"," H73"," H6 ", None), #25 DT
64+
(" O4'"," C1'"," C2'"," OP1"," P "," OP2"," O5'"," C5'"," C4'"," C3'"," O3'", None, None, None, None, None, None, None, None, None, None, None, None,"H5''"," H5'"," H4'"," H3'","H2''"," H2'"," H1'", None, None, None, None, None, None), #26 DX (unk DNA)
65+
(" O4'"," C1'"," C2'"," OP1"," P "," OP2"," O5'"," C5'"," C4'"," C3'"," O3'"," O2'"," N1 "," C2 "," N3 "," C4 "," C5 "," C6 "," N6 "," N7 "," C8 "," N9 ", None," H5'","H5''"," H4'"," H3'"," H2'","HO2'"," H1'"," H2 "," H61"," H62"," H8 ", None, None), #27 A
66+
(" O4'"," C1'"," C2'"," OP1"," P "," OP2"," O5'"," C5'"," C4'"," C3'"," O3'"," O2'"," N1 "," C2 "," O2 "," N3 "," C4 "," N4 "," C5 "," C6 ", None, None, None," H5'","H5''"," H4'"," H3'"," H2'","HO2'"," H1'"," H42"," H41"," H5 "," H6 ", None, None), #28 C
67+
(" O4'"," C1'"," C2'"," OP1"," P "," OP2"," O5'"," C5'"," C4'"," C3'"," O3'"," O2'"," N1 "," C2 "," N2 "," N3 "," C4 "," C5 "," C6 "," O6 "," N7 "," C8 "," N9 "," H5'","H5''"," H4'"," H3'"," H2'","HO2'"," H1'"," H1 "," H22"," H21"," H8 ", None, None), #29 G
68+
(" O4'"," C1'"," C2'"," OP1"," P "," OP2"," O5'"," C5'"," C4'"," C3'"," O3'"," O2'"," N1 "," C2 "," O2 "," N3 "," C4 "," O4 "," C5 "," C6 ", None, None, None," H5'","H5''"," H4'"," H3'"," H2'","HO2'"," H1'"," H3 "," H5 "," H6 ", None, None, None), #30 U
69+
(" O4'"," C1'"," C2'"," OP1"," P "," OP2"," O5'"," C5'"," C4'"," C3'"," O3'"," O2'", None, None, None, None, None, None, None, None, None, None, None," H5'","H5''"," H4'"," H3'"," H2'","HO2'"," H1'", None, None, None, None, None, None), #31 RX (unk RNA)
70+
]
5471

5572
# build the "alternate" sc mapping
5673
aa2longalt=[

rfdiffusion/inference/model_runners.py

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def initialize(self, conf: DictConfig) -> None:
172172
self.target_feats = iu.process_target(
173173
self.inf_conf.input_pdb, parse_hetatom=True, center=False
174174
)
175+
175176
self.chain_idx = None
176177
self.idx_pdb = None
177178

@@ -305,9 +306,7 @@ def sample_init(self, return_forward_trajectory=False):
305306
### Parse input pdb ###
306307
#######################
307308

308-
self.target_feats = iu.process_target(
309-
self.inf_conf.input_pdb, parse_hetatom=True, center=False
310-
)
309+
self.target_feats = iu.process_target(self.inf_conf.input_pdb, parse_hetatom=True, parse_na=True, center=True)
311310

312311
################################
313312
### Generate specific contig ###
@@ -490,6 +489,17 @@ def sample_init(self, return_forward_trajectory=False):
490489
self.pair_prev = None
491490
self.state_prev = None
492491

492+
#########################################
493+
### Parse seq for potentials using sidechains ###
494+
#########################################
495+
496+
if self.potential_conf.guiding_potentials is not None:
497+
for pot in self.potential_manager.potentials_to_apply:
498+
if pot.sidechain:
499+
pot.seq = seq_t
500+
pot.mask_seq = self.mask_seq
501+
502+
493503
#########################################
494504
### Parse ligand for ligand potential ###
495505
#########################################
@@ -524,6 +534,26 @@ def sample_init(self, return_forward_trajectory=False):
524534
xyz_het_com = xyz_het.mean(dim=0)
525535
for pot in self.potential_manager.potentials_to_apply:
526536
pot.motif_substrate_atoms = xyz_het
537+
pot.substrate_info = info_het
538+
pot.diffusion_mask = self.diffusion_mask.squeeze()
539+
pot.xyz_motif = xyz_motif_prealign
540+
pot.diffuser = self.diffuser
541+
542+
#########################################
543+
### Parse NA for NA potential ###
544+
#########################################
545+
546+
if self.potential_conf.guiding_potentials is not None:
547+
if any(list(filter(lambda x: "na_" in x, self.potential_conf.guiding_potentials))):
548+
assert len(self.target_feats['na_xyz']) > 0, "If you're using the NA Contact potential, \
549+
you need to make sure there's a NA in the input_pdb file!"
550+
info_na = self.target_feats["na_info"]
551+
xyz_het = self.target_feats['na_xyz']
552+
xyz_het = torch.from_numpy(xyz_het)
553+
xyz_motif_prealign = xyz_motif_prealign[0,0][self.diffusion_mask.squeeze()]
554+
for pot in self.potential_manager.potentials_to_apply:
555+
pot.na_atoms = xyz_het
556+
pot.na_info=info_na
527557
pot.diffusion_mask = self.diffusion_mask.squeeze()
528558
pot.xyz_motif = xyz_motif_prealign
529559
pot.diffuser = self.diffuser

0 commit comments

Comments
 (0)