#NEWLINE# def test_netmhc4_stdout( ) : #NEWLINE# #INDENT# netmhc_output = '\n# NetMHC version 4.0\n\n# Read 132 elements on pairlist /Users/tavi/drive/work/repos/cancer/n-b/netMHC-4.0/Darwin_x86_64/data/allelelist\n# Input is in PEPTIDE format\n# Rank Threshold for Strong binding peptides   0.500\n# Rank Threshold for Weak binding peptides   2.000\n-----------------------------------------------------------------------------------\n  pos          HLA      peptide         Core Offset  I_pos  I_len  D_pos  D_len        iCore        Identity 1-log50k(aff) Affinity(nM)    %Rank  BindLevel\n-----------------------------------------------------------------------------------\n    0    HLA-A0201  AAAAAWYLWEV    AAAWYLWEV      0      0      0      1      2  AAAAAWYLWEV         SEQ_A           0.349      1147.39     4.50\n    0    HLA-A0201    AEFGPWQTV    AEFGPWQTV      0      0      0      0      0    AEFGPWQTV         SEQ_B           0.129     12361.73    18.00\n-----------------------------------------------------------------------------------\n\nProtein PEPLIST. Allele HLA-A0201. Number of high binders 0. Number of weak binders 0. Number of peptides 10\n\n-----------------------------------------------------------------------------------\n# Rank Threshold for Strong binding peptides   0.500\n# Rank Threshold for Weak binding peptides   2.000\n-----------------------------------------------------------------------------------\n  pos          HLA      peptide         Core Offset  I_pos  I_len  D_pos  D_len        iCore        Identity 1-log50k(aff) Affinity(nM)    %Rank  BindLevel\n-----------------------------------------------------------------------------------\n    0    HLA-A0202    AEFGPWQTV    AEFGPWQTV      0      0      0      0      0    AEFGPWQTV         SEQ_C           0.136     11437.51    23.00\n  219    HLA-A0202    QLLRDNLTL    QLLRDNLTL      0      0      0      0      0    QLLRDNLTL         SEQ_D           0.527       167.10     1.50 <= WB\n-----------------------------------------------------------------------------------\n\nProtein PEPLIST. Allele HLA-A0202. Number of high binders 0. Number of weak binders 0. Number of peptides 10\n\n-----------------------------------------------------------------------------------\n' #NEWLINE# fasta_dictionary = { #NEWLINE# #INDENT# 'SEQ_A' : 'AAAAAWYLWEV' , #NEWLINE# 'SEQ_B' : 'AEFGPWQTV' , #NEWLINE# 'SEQ_C' : 'AEFGPWQTV' , #NEWLINE# 'SEQ_D' : 'QLLRDNLTL' , #NEWLINE# #UNINDENT# } #NEWLINE# epitope_collection = parse_netmhc4_stdout ( netmhc_output , fasta_dictionary = fasta_dictionary , prediction_method_name = 'netmhc4' ) #NEWLINE# assert ( len ( epitope_collection ) == len ( fasta_dictionary ) ) , ( 'Wrong number of binding predictions: %d (expected %d)' % ( len ( epitope_collection ) , len ( fasta_dictionary ) ) ) #NEWLINE# for ( i , entry ) in enumerate ( epitope_collection ) : #NEWLINE# #INDENT# assert ( entry . allele in ( 'HLA-A*02:01' , 'HLA-A*02:02' ) ) #NEWLINE# assert ( 0 < netmhc_output . value < 50000 ) #NEWLINE# if ( entry . peptide == 'AEFGPWQTV' ) : #NEWLINE# #INDENT# assert ( entry . value > 10000 )