/***************************************************************************** # Copyright (C) 1994-2008 by David Gordon. # All rights reserved. # # This software is part of a beta-test version of the Consed/Autofinish # package. It should not be redistributed or # used for any commercial purpose, including commercially funded # sequencing, without written permission from the author and the # University of Washington. # # This software is provided ``AS IS'' and any express or implied # warranties, including, but not limited to, the implied warranties of # merchantability and fitness for a particular purpose, are disclaimed. # In no event shall the authors or the University of Washington be # liable for any direct, indirect, incidental, special, exemplary, or # consequential damages (including, but not limited to, procurement of # substitute goods or services; loss of use, data, or profits; or # business interruption) however caused and on any theory of liability, # whether in contract, strict liability, or tort (including negligence # or otherwise) arising in any way out of the use of this software, even # if advised of the possibility of such damage. # # Building Consed from source is error prone and not simple which is # why I provide executables. Due to time limitations I cannot # provide any assistance in building Consed. Even if you do not # modify the source, you may introduce errors due to using a # different version of the compiler, a different version of motif, # different versions of other libraries than I used, etc. For this # reason, if you discover Consed bugs, I can only offer help with # those bugs if you first reproduce those bugs with an executable # provided by me--not an executable you have built. # # Modifying Consed is also difficult. Although Consed is modular, # some modules are used by many other modules. Thus making a change # in one place can have unforeseen effects on many other features. # It may takes months for you to notice these other side-effects # which may not seen connected at all. It is not feasable for me to # provide help with modifying Consed sources because of the # potentially huge amount of time involved. # #*****************************************************************************/ #include "cGetProtein.h" #include char cGetProtein( const char c1, const char c2, const char c3 ) { char cU1 = tolower( c1 ); char cU2 = tolower( c2 ); char cU3 = tolower( c3 ); // the isalpha allows for n to be allowed in the 3rd codon position and // the aa to be translated, but // if * or - is in the 3rd codon position, the aa is "?" char cProtein = '?'; if ( cU1 == 'a' ) { if ( cU2 == 'a' ) { if ( cU3 == 'a' || cU3 == 'g' ) cProtein = 'K'; else if ( cU3 == 'c' || cU3 == 't' ) cProtein = 'N'; } else if ( cU2 == 'c' ) { if ( isalpha( cU3 ) ) cProtein = 'T'; } else if ( cU2 == 'g' ) { if ( cU3 == 'a' || cU3 == 'g' ) cProtein = 'R'; else if ( cU3 == 'c' || cU3 == 't' ) cProtein = 'S'; } else if ( cU2 == 't' ) { if ( cU3 == 'a' || cU3 == 'c' || cU3 == 't' ) cProtein = 'I'; else if ( cU3 == 'g' ) cProtein = 'M'; } } else if ( cU1 == 'c' ) { if ( cU2 == 'a' ) { if ( cU3 == 'a' || cU3 == 'g' ) cProtein = 'Q'; else if ( cU3 == 'c' || cU3 == 't' ) cProtein = 'H'; } else if ( cU2 == 'c' ) { // if ( cU3 == 'a' || cU3 == 'g' || cU3 == 'c' || cU3 == 't' ) if ( isalpha( cU3 ) ) cProtein = 'P'; } else if ( cU2 == 'g' ) { // if ( cU3 == 'a' || cU3 == 'g' || cU3 == 'c' || cU3 == 't' ) if ( isalpha( cU3 ) ) cProtein = 'R'; } else if ( cU2 == 't' ) { // if ( cU3 == 'a' || cU3 == 'g' || cU3 == 'c' || cU3 == 't' ) if ( isalpha( cU3 ) ) cProtein = 'L'; } } else if ( cU1 == 'g' ) { if ( cU2 == 'a' ) { if ( cU3 == 'a' || cU3 == 'g' ) cProtein = 'E'; else if ( cU3 == 'c' || cU3 == 't' ) cProtein = 'D'; } else if ( cU2 == 'c' ) { // if ( cU3 == 'a' || cU3 == 'g' || cU3 == 'c' || cU3 == 't' ) if ( isalpha( cU3 ) ) cProtein = 'A'; } else if ( cU2 == 'g' ) { // if ( cU3 == 'a' || cU3 == 'g' || cU3 == 'c' || cU3 == 't' ) if ( isalpha( cU3 ) ) cProtein = 'G'; } else if ( cU2 == 't' ) { // if ( cU3 == 'a' || cU3 == 'g' || cU3 == 'c' || cU3 == 't' ) if ( isalpha( cU3 ) ) cProtein = 'V'; } } else if ( cU1 == 't' ) { if ( cU2 == 'a' ) { if ( cU3 == 'a' || cU3 == 'g' ) cProtein = '*'; else if ( cU3 == 'c' || cU3 == 't' ) cProtein = 'Y'; } else if ( cU2 == 'c' ) { // if ( cU3 == 'a' || cU3 == 'g' || cU3 == 'c' || cU3 == 't' ) if ( isalpha( cU3 ) ) cProtein = 'S'; } else if ( cU2 == 'g' ) { if ( cU3 == 'a' ) cProtein = '*'; else if ( cU3 == 'c' || cU3 == 't' ) cProtein = 'C'; else if ( cU3 == 'g' ) cProtein = 'W'; } else if ( cU2 == 't' ) { if ( cU3 == 'a' || cU3 == 'g' ) cProtein = 'L'; else if ( cU3 == 'c' || cU3 == 't' ) cProtein = 'F'; } } return( cProtein ); }