Skip to content

Commit 607d0d4

Browse files
committed
options to initial_guess added, return_all_outputs added but not complete
1 parent 30a0c07 commit 607d0d4

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
peptide mhc_seq mhc_type anchors id
2-
NLVPMVATV AGSHSMRYFFTSVSRPGRGEPRFIAVGYVDDTQFVRFDSDAASQRMEPRAPWIEQEGPEYWDGETRKVKAHSQTHRVDLGTLRGCYNQSEAGSHTVQRMYGCDVGSDWRFLRGYHQYAYDGKDYIALKEDLRSWTAADMCAQTTKHKWEAAHVAEQLRAYLEGTCVEWLRRYLENGKETLQRTDA 1 1;9 3GSO_0
3-
LLFGYPVYV GSHSMRYFFTSVSRPGRGEPRFIAVGYVDDTQFVRFDSDAASQRMEPRAPWIEQEGPEYWDGETRKVKAHSQTHRVDLGTLRGYYNQSEAGSHTVQRMYGCDVGSDWRFLRGYHQYAYDGKDYIALKEDLRSWTAADMAAQTTKHKWEAAHVAEQLRAYLEGTCVEWLRRYLENGKETLQRTDAP 1 1;9 1IM3_0
4-
ARRPPLAELAALNLSGSRL EEHVIIQAEFYLNPDQSGEFMFDFDGDEIFHVDMAKKETVWRLEEFGRFASFEAQGALANIAVDKANLEIMTKRSNYTPITNVPPEVTVLTNSPV/MGDTRPRFLWQLKFECHFFNGTERVRLLERCIYNQEESVRFDSDVGEYRAVTELGRPDAEYWNSQKDLLEQRRAAVDTYCRHNYGVGESFTVQRR 2 3;6;8;11 2Q6W_0
5-
APMPMPELPYP IVADHVASYGVNLYQSYGPSGQYTHEFDGDEQFYVDLGRKETVWSLPVLRQFRFDPQFALTNIAVLKHNLNSLIKRSNSTAATNEVPEVTVFSKS/SPEDFVYQFKGMCYFTNGTERVRLVSRSIYNREEIVRFDSDVGEFRAVTLLGLPAAEYWNSQKDILERKRAAVDRVCRHNYQLELRTTLQRRVEP 2 3;6;8;11 4OZH_0
2+
NLVPMVATV AGSHSMRYFFTSVSRPGRGEPRFIAVGYVDDTQFVRFDSDAASQRMEPRAPWIEQEGPEYWDGETRKVKAHSQTHRVDLGTLRGCYNQSEAGSHTVQRMYGCDVGSDWRFLRGYHQYAYDGKDYIALKEDLRSWTAADMCAQTTKHKWEAAHVAEQLRAYLEGTCVEWLRRYLENGKETLQRTDA 1 3GSO_0
3+
LLFGYPVYV GSHSMRYFFTSVSRPGRGEPRFIAVGYVDDTQFVRFDSDAASQRMEPRAPWIEQEGPEYWDGETRKVKAHSQTHRVDLGTLRGYYNQSEAGSHTVQRMYGCDVGSDWRFLRGYHQYAYDGKDYIALKEDLRSWTAADMAAQTTKHKWEAAHVAEQLRAYLEGTCVEWLRRYLENGKETLQRTDAP 1 1IM3_0
4+
AWRSDEALPLG EEHVIIQAEFYLNPDQSGEFMFDFDGDEIFHVDMAKKETVWRLEEFGRFASFEAQGALANIAVDKANLEIMTKRSNYTPITNVPPEVTVLTNSPV/MGDTRPRFLWQLKFECHFFNGTERVRLLERCIYNQEESVRFDSDVGEYRAVTELGRPDAEYWNSQKDLLEQRRAAVDTYCRHNYGVGESFTVQRR 2 2Q6W_0
5+
APQPELPYPQPG IVADHVASYGVNLYQSYGPSGQYTHEFDGDEQFYVDLGRKETVWSLPVLRQFRFDPQFALTNIAVLKHNLNSLIKRSNSTAATNEVPEVTVFSKS/SPEDFVYQFKGMCYFTNGTERVRLVSRSIYNREEIVRFDSDVGEFRAVTLLGLPAAEYWNSQKDILERKRAAVDRVCRHNYQLELRTTLQRRVEP 2 4OZH_0

run_PMGen.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,13 @@ def main():
7777
parser.add_argument('--batch_size', type=int, default=1, help='ProteinMPNN batch size.')
7878
parser.add_argument('--hot_spot_thr', type=float, default=6.0, help='Distance threshold to peptide, to define hot-spots on mhc.')
7979
parser.add_argument('--binder_pred', action='store_true', help='Enables binder prediction from ProteinMPNN generated peptides.')
80+
8081
# Setting to Run only a part:
8182
parser.add_argument('--no_alphafold', action='store_false', help='does not run alphafold.')
8283
parser.add_argument('--only_protein_mpnn', action='store_true', help='Skips PANDORA and AF modeling, and runs ProteinMPNN for already available predictions.')
8384
parser.add_argument('--no_pandora', action='store_false', help='does not run pandora')
8485
parser.add_argument('--protein_mpnn_dryrun', action='store_true', help='Overwrites all proteinMPNN flags and just dry run. hotspots are saved.')
86+
parser.add_argument('--return_all_outputs', action='store_true', help='If active, returns all alphafold outputs')
8587

8688
args = parser.parse_args()
8789

run_utils.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def __init__(self, peptide, mhc_seq, mhc_type, id, output_dir='output',
2828
alphafold_param_folder = 'AFfine/af_params/params_original/',
2929
fine_tuned_model_path='AFfine/af_params/params_finetune/params/model_ft_mhc_20640.pkl',
3030
benchmark=False, n_homology_models=1, best_n_templates=4,
31-
pandora_force_run=True, no_modelling=False):
31+
pandora_force_run=True, no_modelling=False,
32+
return_all_outputs=False):
3233
"""
3334
Initializes the PMGen modeling pipeline.
3435
@@ -51,6 +52,7 @@ def __init__(self, peptide, mhc_seq, mhc_type, id, output_dir='output',
5152
best_n_templates (int): number of found templates used for homology modeling via modeler, default=4.
5253
pandora_force_run (bool): Weather to force run pandora or not, default=True.
5354
no_modelling (bool): If active, no modeller homology modeling happens and only PANDORA is used for template search and alignment.
55+
return_all_outputs (bool): If active, all alphafold outputs are saved.
5456
"""
5557
super().__init__()
5658
self.peptide = peptide
@@ -71,6 +73,7 @@ def __init__(self, peptide, mhc_seq, mhc_type, id, output_dir='output',
7173
self.best_n_templates = best_n_templates
7274
self.pandora_force_run = pandora_force_run
7375
self.no_modelling = no_modelling
76+
self.return_all_outputs = return_all_outputs
7477
self.input_assertion()
7578
if len(self.models) > 1:
7679
print(f'\n #### Warning! You are running for multiple models {self.models}'
@@ -244,9 +247,11 @@ def alphafold_preparation(self, template_aln_file, mhc_pep_seq, output):
244247
mhc_pep_seq (str): Full MHC-peptide sequence.
245248
output (str): Path to save the prepared input file.
246249
"""
250+
template_pdb_dict_path = os.path.join(self.pandora_output, self.id, "no_modelling_output_dict.json")
247251
df = pd.DataFrame({"target_chainseq": [mhc_pep_seq],
248252
"templates_alignfile": [template_aln_file],
249-
"targetid": [self.id]})
253+
"targetid": [self.id],
254+
"template_pdb_dict": [template_pdb_dict_path]})
250255
df.to_csv(output, sep='\t', index=False)
251256

252257
def run_alphafold(self, input_file, output_prefix):
@@ -276,8 +281,13 @@ def run_alphafold(self, input_file, output_prefix):
276281
"--ignore_identities",
277282
"--num_recycles", f"{self.num_recycles}"
278283
]
279-
280-
print(command)
284+
if not self.no_modelling:
285+
command += ['--no_initial_guess']
286+
if self.return_all_outputs:
287+
command += ['--return_all_outputs']
288+
else:
289+
print(' -- Alphafold Initial Guess Mode, No homology models will be used --')
290+
print('AFfine Command: \n',command)
281291
try:
282292
# Run the command with unbuffered output
283293
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1)
@@ -292,7 +302,7 @@ def run_alphafold(self, input_file, output_prefix):
292302
elif process.poll() is not None:
293303
break # Process has finished
294304

295-
# Capture remaining stderr output
305+
# Capture remaining stderr outputHi, y
296306
for err_line in process.stderr:
297307
print(err_line, end="", flush=True)
298308

@@ -974,5 +984,3 @@ def get_best_structres(output_dir, df, multiple_anchors):
974984

975985

976986

977-
978-

utils/processing_functions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,6 @@ def alignment_to_df(no_modelling_output_dict, output_dir):
13201320
"identities": identities,
13211321
"target_len": target_len,
13221322
"template_len": template_len})
1323-
print('DEBUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUG', df, output_dir, 'DEBUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUG')
13241323
df.to_csv(output_dir, sep='\t', index=False)
13251324

13261325

0 commit comments

Comments
 (0)