Guest User

Untitled

a guest
Oct 13th, 2011
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.21 KB | None | 0 0
  1. /**
  2.  * @(#)ValidDNA.java
  3.  *
  4.  *
  5.  * @author Evan Schwartz
  6.  * @version 1.00 2011/10/12
  7.  */
  8.  
  9. import java.io.File;
  10. import java.io.FileNotFoundException;
  11. import java.util.Scanner;
  12.  
  13. public class ValidDNA
  14. {
  15.  
  16.     public static void main (String[] args)throws FileNotFoundException
  17.     {
  18.         Scanner file=new Scanner(new File("sampleTranscript.txt"));
  19.         String id=file.nextLine();
  20.         System.out.println("Transcript ID is "+id.substring(1));
  21.         String dna= "";
  22.  
  23.         while(file.hasNext()==true)
  24.             {
  25.                 dna += file.nextLine();
  26.             }
  27.         System.out.println(dna);
  28. //length
  29.         if(dna.length()%3 == 0)
  30.         {
  31.             System.out.println("Right Length");
  32.         }
  33.         else
  34.         {
  35.             System.out.println("Incorrect Length");
  36.         }
  37. //Start Codon
  38.         if(dna.substring(0,3).equals("ATG"))
  39.         {
  40.             System.out.println("Starts with right triple");
  41.         }
  42.         else
  43.         {
  44.             System.out.println("Does not start with right triple");
  45.         }
  46. //End Codon
  47.         if(dna.substring(324,327).equals("TAG") || dna.substring(324,327).equals("TAA") || dna.substring(324,327).equals("TGA"))
  48.         {
  49.             System.out.println("Correct Stop Codon");
  50.         }
  51.         else
  52.         {
  53.             System.out.println("Missing Stop Codon");
  54.         }      
  55.  
  56.     }
  57.  
  58.  
  59. }
  60.  
Advertisement
Add Comment
Please, Sign In to add comment