@@ -1037,7 +1037,7 @@ def match_inputseq_to_netmhcpan_allele(sequence, mhc_type, mhc_allele=None,
10371037
10381038
10391039def run_netmhcpan (peptide_fasta , allele_list , output , mhc_type ,
1040- netmhcipan_path = netmhcipan_path , netmhciipan_path = netmhciipan_path ):
1040+ netmhcipan_path = netmhcipan_path , netmhciipan_path = netmhciipan_path , length = '9,10,11,12,13,14,15,16,17,18' ):
10411041 assert mhc_type in [1 , 2 ]
10421042
10431043 if mhc_type == 1 :
@@ -1055,7 +1055,7 @@ def run_netmhcpan(peptide_fasta, allele_list, output, mhc_type,
10551055 if 'DQB' in allele or 'DPB' in allele :
10561056 final_allele += f'-{ allele .replace ("HLA-" , "" )} '
10571057 cmd = [str (netmhciipan_path ), '-f' , str (peptide_fasta ),
1058- '-BA' , '-u' , '-s' , '-length' , '9,10,11,12,13,14,15,16,17,18' ,
1058+ '-BA' , '-u' , '-s' , '-length' , length ,
10591059 '-inptype' , '0' , '-a' , str (final_allele )]
10601060 # Open the output file and redirect stdout to it
10611061 with open (output , 'w' ) as f :
@@ -1091,7 +1091,7 @@ def split_fasta(fasta_file, n_chunks):
10911091
10921092def run_netmhcpan_chunk (args ):
10931093 """Run NetMHCpan on a single chunk"""
1094- peptide_fasta , allele_list , output , mhc_type , netmhcipan_path , netmhciipan_path = args
1094+ peptide_fasta , allele_list , output , mhc_type , netmhcipan_path , netmhciipan_path , length = args
10951095
10961096 if mhc_type == 1 :
10971097 cmd = [str (netmhcipan_path ), '-f' , str (peptide_fasta ),
@@ -1107,7 +1107,7 @@ def run_netmhcpan_chunk(args):
11071107 if 'DQB' in allele or 'DPB' in allele :
11081108 final_allele += f'-{ allele .replace ("HLA-" , "" )} '
11091109 cmd = [str (netmhciipan_path ), '-f' , str (peptide_fasta ),
1110- '-BA' , '-u' , '-s' , '-length' , '9,10,11,12,13,14,15,16,17,18' ,
1110+ '-BA' , '-u' , '-s' , '-length' , length ,
11111111 '-inptype' , '0' , '-a' , str (final_allele )]
11121112
11131113 with open (output , 'w' ) as f :
@@ -1119,7 +1119,7 @@ def run_netmhcpan_chunk(args):
11191119def run_netmhcpan_parallel (peptide_fasta , allele_list , output , mhc_type ,
11201120 netmhcipan_path = netmhcipan_path ,
11211121 netmhciipan_path = netmhciipan_path ,
1122- n_jobs = None , verbose = False ):
1122+ n_jobs = None , verbose = False , length = '9,10,11,12,13,14,15,16,17,18' ):
11231123 """
11241124 Run NetMHCpan in parallel by splitting the input FASTA
11251125
@@ -1130,7 +1130,7 @@ def run_netmhcpan_parallel(peptide_fasta, allele_list, output, mhc_type,
11301130
11311131 if n_jobs is None :
11321132 n_jobs = cpu_count ()
1133-
1133+ print ( length )
11341134 # Split FASTA into chunks
11351135 if verbose :
11361136 print (f"Splitting FASTA into { n_jobs } chunks..." )
@@ -1146,7 +1146,7 @@ def run_netmhcpan_parallel(peptide_fasta, allele_list, output, mhc_type,
11461146
11471147 args_list .append ((
11481148 chunk_file , allele_list , temp_output .name , mhc_type ,
1149- netmhcipan_path , netmhciipan_path
1149+ netmhcipan_path , netmhciipan_path , length
11501150 ))
11511151
11521152 # Run in parallel
0 commit comments