@@ -308,14 +308,17 @@ def __init__(self, id, peptide, allele_type=[], MHC_class = 'I',
308308 self .top_rank_num = 0
309309 success = False
310310 given_by_user = False
311+ top_ids = self .fill_allele_seq_info (use_templ_seq = use_templ_seq , top_rank_num = self .top_rank_num )
311312 while self .top_rank_num <= self .max_num_rank :
312313 print (success , anchors , len (anchors ), '\n ' )
313- self .fill_allele_seq_info (use_templ_seq = use_templ_seq , top_rank_num = self .top_rank_num )
314314 if MHC_class == 'I' and len (anchors ) < 2 :
315- print ('WARNING: no anchor positions provided. Pandora will predict them using NetMHCpan, : anchors' , anchors )
315+ print ('WARNING: no anchor positions provided. Pandora will predict them using NetMHCpan, : anchors' , anchors , self . allele_type )
316316 try :
317- self .fill_allele_seq_info (use_templ_seq = use_templ_seq , top_rank_num = self .top_rank_num )
318- print ('Predicting Anchors for:' , self .allele_type [self .top_rank_num ], self .top_rank_num )
317+ print (top_ids [:5 ])
318+ top_id = top_ids [self .top_rank_num ][0 ] # blast_results is a list of top ids as tuples
319+ print ('###############################DDDDD' , top_ids [self .top_rank_num ][0 ])
320+ self .allele_type = [top_id ]
321+ print ('Predicting Anchors for:' , self .allele_type , self .top_rank_num )
319322 self .anchors = Modelling_functions .predict_anchors_netMHCpan (
320323 self .peptide , self .allele_type , self .output_dir , rm_netmhcpan_output = rm_netmhcpan_output
321324 )
@@ -327,13 +330,15 @@ def __init__(self, id, peptide, allele_type=[], MHC_class = 'I',
327330 success = True
328331 break # Exit loop if successful
329332 except Exception as e :
330- print (
331- f'Error: Something went wrong when predicting the anchors using NetMHCpan (top_rank_num={ self .top_rank_num } )' )
333+ print (f"Error: Something went wrong when predicting the anchors using NetMHCpan "
334+ f" (top_rank_num={ self .top_rank_num } ) - { e } " )
332335
333336 elif MHC_class == 'II' and len (anchors ) < 4 :
334337 print ('WARNING: no anchor positions provided. Pandora will predict them using netMHCIIpan. anchors:' , anchors )
335338 try :
336- self .fill_allele_seq_info (use_templ_seq = use_templ_seq , top_rank_num = self .top_rank_num )
339+ print (top_ids [:5 ])
340+ top_id = top_ids [0 ][1 ]
341+ self .allele_type .extend ([x [0 ] for x in top_ids if x [1 ] == top_id ])
337342 print ('Predicting Anchors For:' , self .allele_type [self .top_rank_num ], self .top_rank_num )
338343 self .anchors = Modelling_functions .predict_anchors_netMHCIIpan (
339344 self .peptide , self .allele_type , self .output_dir , rm_netmhcpan_output = rm_netmhcpan_output
@@ -532,6 +537,7 @@ def fill_allele_seq_info(self, use_templ_seq=False, top_rank_num=1): #### DEBUG
532537 if self .allele_type :
533538 # Check allele name
534539 self .check_allele_name ()
540+ top_ids = None
535541
536542
537543 #Check if there are allele name for each MHC chain
@@ -586,9 +592,9 @@ def fill_allele_seq_info(self, use_templ_seq=False, top_rank_num=1): #### DEBUG
586592 chain = 'M' ,
587593 blastdb = PANDORA .PANDORA_data + '/BLAST_databases/refseq_blast_db/refseq_blast_db' )
588594 #Take only the allele names with the highest id score
589- top_id = blast_results [self .top_rank_num ][0 ]
595+ top_id = blast_results [self .top_rank_num ][0 ] # blast_results is a list of top ids as tuples
596+ top_ids = blast_results
590597 self .allele_type = [top_id ]
591- print ('############## DEBUG' , self .allele_type )
592598 #self.allele_type.extend([x[0] for x in blast_results if x[0] == top_id])
593599
594600 except :
@@ -629,10 +635,12 @@ def fill_allele_seq_info(self, use_templ_seq=False, top_rank_num=1): #### DEBUG
629635 blastdb = PANDORA .PANDORA_data + '/BLAST_databases/refseq_blast_db/refseq_blast_db' )
630636 #Take only the allele names with the highest id score
631637 top_id = blast_results [0 ][1 ]
638+ top_ids = blast_results
632639 self .allele_type .extend ([x [0 ] for x in blast_results if x [1 ] == top_id ])
633640 except :
634641 print ('\n WARNING: something went wrong when trying to retrieve chain M allele' )
635642 print ('with blast. Is blastp properly installed as working as "/bin/bash blastp"?' )
643+ return top_ids
636644
637645 def make_output_dir (self ):
638646 ''' Create an output directory and move the template pdb there
0 commit comments