001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 */ 021package org.biojava.nbio.aaproperties; 022 023import java.util.Set; 024import java.util.stream.Collectors; 025import java.util.stream.Stream; 026 027/** 028 * This class provides the protein properties at the level of individual amino acids. 029 * 030 * @author Yana Valasatava 031 */ 032public class AminoAcidProperties { 033 034 private static final Set<String> negChargedAAs = Stream.of("D", "E").collect(Collectors.toSet()); 035 private static final Set<String> posChargedAAs = Stream.of("K", "R", "H").collect(Collectors.toSet()); 036 private static final Set<String> polarAAs = Stream.of("D", "E", "K", "R", "H", "N", "Q", "S", "T", "Y") 037 .collect(Collectors.toSet()); 038 039 /** 040 * At pH=7, two are negative charged: aspartic acid (Asp, D) and glutamic acid (Glu, E) (acidic side chains), 041 * and three are positive charged: lysine (Lys, K), arginine (Arg, R) and histidine (His, H) (basic side chains). 042 * 043 * @param aa The one-letter amino acid code 044 * @return true if amino acid is charged 045 */ 046 public static final boolean isCharged(char aa) { 047 if (negChargedAAs.contains(String.valueOf(aa))) { 048 return true; 049 } 050 else if (posChargedAAs.contains(String.valueOf(aa))) { 051 return true; 052 } 053 return false; 054 } 055 056 /** 057 * Returns the charge of amino acid. At pH=7, two are negative charged: aspartic acid (Asp, D) and glutamic acid (Glu, E) (acidic side chains), 058 * and three are positive charged: lysine (Lys, K), arginine (Arg, R) and histidine (His, H) (basic side chains). 059 * 060 * @param aa The one-letter amino acid code 061 * @return the charge of amino acid (1 if positively charged, -1 if negatively charged, 0 if not charged) 062 */ 063 public static final int getChargeOfAminoAcid(char aa) { 064 if (negChargedAAs.contains(String.valueOf(aa))) { 065 return -1; 066 } 067 else if (posChargedAAs.contains(String.valueOf(aa))) { 068 return 1; 069 } 070 return 0; 071 } 072 073 /** 074 * There are 10 amino acids: D, E, H, K, R, N, Q, S, T, Y, that are polar. 075 * 076 * @param aa The one-letter amino acid code 077 * @return true if amino acid is polar 078 */ 079 public static final boolean isPolar(char aa) { 080 if (polarAAs.contains(String.valueOf(aa))) { 081 return true; 082 } 083 return false; 084 } 085 086 /** 087 * There are 10 amino acids: D, E, H, K, R, N, Q, S, T, Y, that are polar. 088 * 089 * @param aa The one-letter amino acid code 090 * @return the polarity of amino acid (1 if polar, 0 if not polar) 091 */ 092 public static final int getPolarityOfAminoAcid(char aa) { 093 if (polarAAs.contains(String.valueOf(aa))) { 094 return 1; 095 } 096 return 0; 097 } 098}