%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MW = calculateMW(sequence) Calculates de molecular weight of a protein. INPUT: Sequence (can include extra things such as spaces or numbers). OUTPUT: Molecular weight number Benjamín Sánchez. Last edited: 2015-04-13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % MW = calculateMW(sequence) 0004 % Calculates de molecular weight of a protein. 0005 % 0006 % INPUT: Sequence (can include extra things such as spaces or numbers). 0007 % OUTPUT: Molecular weight number 0008 % 0009 % Benjamín Sánchez. Last edited: 2015-04-13 0010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0011 0012 function MW = calculateMW(sequence) 0013 0014 % A Alanine 0015 % B Aspartic acid or Asparagine 0016 % C Cysteine 0017 % D Aspartic acid 0018 % E Glutamic acid 0019 % F Phenylalanine 0020 % G Glycine 0021 % H Histidine 0022 % I Isoleucine 0023 % J Leucine or Isoleucine 0024 % K Lysine 0025 % L Leucine 0026 % M Methionine 0027 % N Asparagine 0028 % O Pyrrolysine 0029 % P Proline 0030 % Q Glutamine 0031 % R Arginine 0032 % S Serine 0033 % T Threonine 0034 % U Selenocysteine 0035 % V Valine 0036 % W Tryptophan 0037 % X any 0038 % Y Tyrosine 0039 % Z Glutamic acid or Glutamine 0040 0041 aa_codes = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N', ... 0042 'O','P','Q','R','S','T','U','V','W','X','Y','Z'}; 0043 aa_MWs = [71.08 114.60 103.14 115.09 129.11 147.17 57.05 137.14 ... 0044 113.16 113.16 128.17 113.16 131.20 114.10 255.31 97.12 ... 0045 128.13 156.19 87.08 101.10 150.04 99.13 186.21 126.50 ... 0046 163.17 128.62]; 0047 0048 MW = 18; 0049 for i = 1:length(aa_codes) 0050 count = length(strfind(sequence,aa_codes{i})); 0051 MW = MW + count*aa_MWs(i); 0052 end 0053 0054 end 0055 0056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%