Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @(#)ValidDNA.java
- *
- *
- * @author Evan Schwartz
- * @version 1.00 2011/10/12
- */
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class ValidDNA
- {
- public static void main (String[] args)throws FileNotFoundException
- {
- Scanner file=new Scanner(new File("sampleTranscript.txt"));
- String id=file.nextLine();
- System.out.println("Transcript ID is "+id.substring(1));
- String dna= "";
- while(file.hasNext()==true)
- {
- dna += file.nextLine();
- }
- System.out.println(dna);
- //length
- if(dna.length()%3 == 0)
- {
- System.out.println("Right Length");
- }
- else
- {
- System.out.println("Incorrect Length");
- }
- //Start Codon
- if(dna.substring(0,3).equals("ATG"))
- {
- System.out.println("Starts with right triple");
- }
- else
- {
- System.out.println("Does not start with right triple");
- }
- //End Codon
- if(dna.substring(324,327).equals("TAG") || dna.substring(324,327).equals("TAA") || dna.substring(324,327).equals("TGA"))
- {
- System.out.println("Correct Stop Codon");
- }
- else
- {
- System.out.println("Missing Stop Codon");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment