Advertisement
SorayahBanana

Untitled

Oct 8th, 2015
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.06 KB | None | 0 0
  1. public class DnaUtilities2{
  2.   public static void main(String [] args){
  3.     char a = 'A';
  4.     boolean value;
  5.     value = isValidBase(a);
  6.     System.out.println(value);
  7.    
  8.     char value2;
  9.     value2 = watsonCrickComplement(a);
  10.     System.out.println(value2);
  11.    
  12.     String dnaSequence = "ATT";
  13.     int length = dnaSequence.length();
  14.     System.out.println(length);
  15.     char firstCharacter = dnaSequence.charAt(0);
  16.     char secondCharacter = dnaSequence.charAt(1);
  17.     char thirdCharacter = dnaSequence.charAt(2);
  18.    
  19.     String value3;
  20.     value3=watsonCrickTripletComplement(dnaSequence);
  21.     System.out.println(value3);
  22.    
  23.      
  24.     //System.out.println(a + " gives out :" + value + "\n");
  25.    
  26.     /*for (int i=1; i<26; i++) {
  27.      a++;
  28.      value = isValidBase(a);
  29.      System.out.println("'" + a + "'" + " gives out :" + value + "\n");
  30.     } */
  31.   }
  32.    
  33.  
  34.   public static boolean isValidBase(char x){
  35.       if ((x == 'A')||(x == 'T') || ( x == 'C') || ( x == 'G')){
  36.         return true;
  37.       }
  38.       else{
  39.         return false;
  40.       }
  41.     }
  42.   public static char watsonCrickComplement(char x) {
  43.     /*char a = 'C';
  44.     boolean value;
  45.     value = isValidBase(a);
  46.     System.out.println(value);*/
  47.    
  48.    
  49.     if (x =='A'){
  50.       return 'T';
  51.  
  52.     }
  53.     else if (x == 'T'){
  54.       return 'A';
  55.     }
  56.     else if (x == 'C'){
  57.       return 'G';
  58.     }
  59.     else if (x == 'G') {
  60.       return 'C';
  61.     }
  62.     else {
  63.       return x;
  64.      
  65.     }
  66.    
  67.   }
  68.  
  69.  
  70.  public static String watsonCrickTripletComplement(String dnaSequence){
  71.    // if length is 3 and all characters are valid -- return complement
  72.    if(dnaSequence == "ATA"){
  73.      return "TAT";
  74.    }
  75.    else{
  76.      return "";
  77.    }
  78.  
  79.  
  80.     }
  81.      //it should verify that dnaSequence has exactly 3 characters in it.
  82.     public static int length(){
  83.       int x = 0 ;
  84.       return x;
  85.      
  86.       }
  87.       //Next verify that each of the 3 characters are valid Watson-Crick complements.
  88.     public static int charAt(int i){
  89.       int y = 0;
  90.       return y;
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement