Question

Please develop a Java program to read in a piece of DNA sequence from a FASTA format sequence fil...

Please develop a Java program to read in a piece of DNA sequence from a FASTA format sequence file (alternatively you can use the getRandomSeq(long) method of the RandomSeq class to generate a piece of DNA sequence),

and then print out all the codons in three forward reading frames. Design a method called codon() that can be used to find all the codons from three reading frames. The method will take in an argument, the reading frame (1, 2, or 3), and return an array or ArrayList with all the codons.

All the codons should have three nucleotides, please discard the last one if it does not have three nucleotides. Below is a sample output of the program:

Please enter the file name contains the DNA sequence:

DNAseq.seq

The DNA sequence is:

TCAGCGAGATGGGAAAGATCACCTTCTTCGAGGACCGAGGCTTCCAGGGC

Reading frame #1 codons are:

TCA GCG AGA TGG GAA AGA TCA CCT TCT TCG AGG ACC GAG GCT TCC AGG

Reading frame #2 codons are:

CAG CGA GAT GGG AAA GAT CAC CTT CTT CGA GGA CCG AGG CTT CCA GGG

Reading frame #3 codons are:

AGC GAG ATG GGA AAG ATC ACC TTC TTC GAG GAC CGA GGC TTC CAG GGC

Please add another method called codon2aa() to modify the previous program (question #1) to print the corresponding amino acid beneath each codon. Use a single letter representation of the amino acid, and a * for the stopping codon. See below for a sample output.

Please enter the file name of DNA sequence:

DNAseq.seq

The DNA sequence is:

TCAGCGAGATGGGAAAGATCACCTTCTTCGAGGACCGAGGCTTCCAGGGC

Reading frame #1 codons and amino acids are:

TCA GCG AGA TGG GAA AGA TCA CCT TCT TCG AGG ACC GAG GCT TCC AGG

S   A   R   W   E   R   S   P   S   S   R   T   E   A   S   R

Reading frame #2 codons and amino acids are:

CAG CGA GAT GGG AAA GAT CAC CTT CTT CGA GGA CCG AGG CTT CCA GGG

Q   R   D   G   K   D   H   L   L   R   G   P   R   L   P   G

Reading frame #3 codons and amino acids are:

AGC GAG ATG GGA AAG ATC ACC TTC TTC GAG GAC CGA GGC TTC CAG GGC

S   E   M   G   K   I   T   F   F   E   D   R   G   F   Q   G

0 0
Add a comment Improve this question Transcribed image text
Answer #1

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package task3;
import java.util.Scanner;
import java.io.FileReader;
/**
*
* @author Haseeb
*/
public class Task3 {

    /**
     * @param args the command line arguments
     */
    public static String codon2aa( String codon )
    {
        switch(codon) {
            case "GCA": return "A";
            case "GCC": return "A";
            case "GCG": return "A";
            case "GCT": return "A";
            case "TGC": return "C";
            case "TGT": return "C";
            case "GAC": return "D";
            case "GAT": return "D";
            case "GAA": return "E";
            case "GAG": return "E";
            case "TTC": return "F";
            case "TTT": return "F";
            case "GGA": return "G";
            case "GGC": return "G";
            case "GGG": return "G";
            case "GGT": return "G";
            case "CAC": return "H";
            case "CAT": return "H";
            case "ATA": return "I";
            case "ATC": return "I";
            case "ATT": return "I";
            case "AAA": return "K";
            case "AAG": return "K";
            case "CTA": return "L";
            case "CTC": return "L";
            case "CTG": return "L";
            case "CTT": return "L";
            case "TTA": return "L";
            case "TTG": return "L";
            case "ATG": return "M";
            case "AAC": return "N";
            case "AAT": return "N";
            case "CCA": return "P";
            case "CCC": return "P";
            case "CCG": return "P";
            case "CCT": return "P";
            case "CAA": return "Q";
            case "CAG": return "Q";
            case "AGA": return "R";
            case "AGG": return "R";
            case "CGA": return "R";
            case "CGC": return "R";
            case "CGG": return "R";
            case "CGT": return "R";
            case "AGC": return "S";
            case "AGT": return "S";
            case "TCA": return "S";
            case "TCC": return "S";
            case "TCG": return "S";
            case "TCT": return "S";
            case "ACA": return "T";
            case "ACC": return "T";
            case "ACG": return "T";
            case "ACT": return "T";
            case "GTA": return "V";
            case "GTC": return "V";
            case "GTG": return "V";
            case "GTT": return "V";
            case "TGG": return "W";
            case "TAC": return "Y";
            case "TAT": return "Y";
            case "TGA": return "";
            case "TAA": return "";
            case "TAG": return "";
            default:    return "-1";
        }
    }
    public static void codon(String DNASEQ)
    {
        int condons = 3;
        String print = "";
        for (int j = 0; j < condons; j++)
        {
            System.out.println("Reading frame #" + j + "codons are:");
            print = "";
            for (int k = j; k < DNASEQ.length(); k++)
            {
                if(print.length() % 3 == 0)
                {
                    print = "";
                    System.out.print(" ");
                }
                print += DNASEQ.charAt(k);
                if (print.length() == 3)
                {
                    System.out.print(print);
                }       
            }
            System.out.println("");
        }
    }
    public static void aminoacid(String DNASEQ)
    {
        int condons = 3;
        String print = "";
        for (int j = 0; j < condons; j++)
        {
            System.out.println("Reading frame #" + j + "codons and amino acids are:");
            print = "";
            for (int k = j; k < DNASEQ.length(); k++)
            {
                if(print.length() % 3 == 0)
                {
                    print = "";
                    System.out.print(" ");
                }
                print += DNASEQ.charAt(k);
                if (print.length() == 3)
                {
                    System.out.print(print);
                    System.out.print(" (" + codon2aa(print) + ") ");
                }       
            }
            System.out.println("");
        }
    }
    public static void main(String[] args)throws Exception
    {
        String DNASEQ = "";
        Scanner scan= new Scanner(System.in);
        System.out.println("Please enter the file name contains the DNA sequence::");
        String str=scan.nextLine();
        FileReader fr=new FileReader("D:\\" + str + ".txt");  
        int i;  
        while((i=fr.read())!=-1)
        {
            DNASEQ += (char)i;
        }
        fr.close();
        System.out.println("The DNA sequence is:" + DNASEQ);
        codon(DNASEQ);
        System.out.println("");
        aminoacid(DNASEQ);
     
    }  
}

Please enter the file name contains the DNA sequence DNAseq The DNA sequence is TCAGCGAGATGGGAAAGATCACCITCITCGAGGACCGAGGCITCC

COMMENT DOWN FOR ANY QUERIES,

AND LEAVE A THUMBS UP IF THIS ANSWER HELPS YOU.

Add a comment
Know the answer?
Add Answer to:
Please develop a Java program to read in a piece of DNA sequence from a FASTA format sequence fil...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Adenosine deaminases modify adenosines to form _____________________, which is then read as _________________________ by the translation...

    Adenosine deaminases modify adenosines to form _____________________, which is then read as _________________________ by the translation and splicing systems, as well as by reverse transcriptase. Cephalopods like squid and octopus use this form of editing very extensively in their protein-coding regions.  For each of the following, please indicate how these enzymes can alter the mRNA to produce the indicated codon changes.   I (Ileu)  is changed to V (val): K (Lys) is changed to E (Glu): T (Thr) is changed to A (ala):...

  • The DNA sequence shown encodes the last amino acids of a protein that has a total...

    The DNA sequence shown encodes the last amino acids of a protein that has a total of 270 amino acids. The bolded base pairs indicate the translation reading frame. 5’ …….GCT AAG TAT TGC TCA AGA TTA GGA TGA TAA ATA ACT TGG 3’ 3’ …….CGA TTA ATA ACG AGT TCT AAT CCT ACT ATT TAT TGA ACC 5’ Which is the template strand for transcription? Explain.

  • mRNA transcr leaves the mucl ke protcins Th eings the amino no acids anre the bui...

    mRNA transcr leaves the mucl ke protcins Th eings the amino no acids anre the bui ead in onder to. start and stop mak Land when to stot C. Use your codon chart to determine the amino acid sequence. Remember to read through the strand and ONLY start on AUG and STOP when it tells you to stop Follow example below Example: DNA AGA CGG TAC CTC CGG TGG GTG CTT GTC TGT ATC CTT CTC AGT ATC UCU GCC...

  • 2. Then determine the sequence of amino acids if an insertion occurred to the left of...

    2. Then determine the sequence of amino acids if an insertion occurred to the left of the first adenosine and changed the reading frame as shown below. Notice that (1) the insertion is shown on the left by the lower-case "I", and (2) the bases are still in the same sequence; they are just shifted so that they are read differently. iAG GTC TTC AGG GAA TGC CTG GCG AGA GGG GAG CAG CTG GTA TCG CTG GGC CCA AAG...

  • 15. Transcribe into mRNA and then translate into amino acids (protein) the following DNA sequence TAC...

    15. Transcribe into mRNA and then translate into amino acids (protein) the following DNA sequence TAC ATG TCT AGG ATC. Write out the tRNA anticodons for each of the 5 codons as well. What is the complementary DNA sequence for the above DNA (the complementary sequence would be produced in DNA replication)? Suggested Format: DNA: TAC ATG TCT AGG ATC. Complementary: mRNA based on DNA: TRNAs that would pair with mRNA (the anticodon): Amino Acid Sequence: To transcribe the sequence...

  • 8) You have extracted DNA from two different organisms. In the purification process, you find that...

    8) You have extracted DNA from two different organisms. In the purification process, you find that the two test tubes have lost their identifying labels. The sequences of DNA are: Sample 1: TCC CTA TGC CCG AGG GAT ACG GGC Sample 2: CGA TCT TAA CCC GCT AGA ATT GGG The only other piece of information you have is the corresponding amino acid sequence of a particular protein for both organisms. Organism I has ala-arg-ile-gly and organism II has ala-arg-ile-pro....

  • 8) You have extracted DNA from two different organisms. In the purification process, you find that...

    8) You have extracted DNA from two different organisms. In the purification process, you find that the two test tubes have lost their identifying labels. The sequences of DNA are: Sample 1: TCC CTA TGC CCG ///// AGG GAT ACG GGC Sample 2: CGA TCT TAA CCC ///// GCT AGA ATT GGG The only other piece of information you have is the corresponding amino acid sequence of a particular protein for both organisms. Organism I has ala-arg-ile-gly and organism II...

  • The following genomic DNA sequence comes from the first exon of a human gene and contains...

    The following genomic DNA sequence comes from the first exon of a human gene and contains the 3'-end of the 5'-untranslated region and the start of a long open reading frame that codes for 200 amino acids (a.k.a. coding sequence). Note: There are no introns in this short portion and only one strand of the genomic DNA is shown. Which of the following answers lists the first three amino acids of the translated protein correctly? Seconed Position tyr ser leu...

  • 18 please 18a. The DNA is mutated on the 4th nucleotide (see bases in box) to...

    18 please 18a. The DNA is mutated on the 4th nucleotide (see bases in box) to the follo DNA :3TAC GCT GAG AGA GAC ACTS sº ATG CGA CTC TCT CTG TGA 3» 18b. (2pts) Does this mutation change the amino acid sequence? If yes - what is 18c. (2pts) Can this mutation change the way the protein functions? 18d. (2pts) How can a DNA mutation change protein function? Explain your answer in terms of gene expression. 15. Answer the...

  • A template strand of DNA in a gene reads 3’ CCA AGC TCT 5’. Using the...

    A template strand of DNA in a gene reads 3’ CCA AGC TCT 5’. Using the codon chart provided, answer the following questions: -What is the sequence of amino acids that is produced when this gene is translated? -If a mutation causes a substitution (an A instead of a T) 3’ CCA AGC ACT 5’, what effect will it have on the mRNA transcript AND on the protein? -What do we call this type of mutation? Second letter U С...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT