Java DNA Sequencing Project

https://www.codecademy.com/courses/learn-java/projects/java-dna-sequencing

Why is this sequence:

“ATTAATATGTACTGA”

Not a valid protein?

it meets all the criteria:

  1. t begins with a “start codon”: ATG .
  2. It ends with a “stop codon”: TGA .
  3. In between, each additional codon is a sequence of three nucleotides.

i.e “ATTAATATGTACTGA

I went back through the hints and the only thing i can figure out is that the instructions were supposed to add an additional constraint

the code given thinks this is a protein

if (start != -1 &&
stop != -1 &&
(stop - start) % 3 == 0) {

String protein = dna.substring(start, stop+3); 
System.out.println("Protein: " + protein);

} else {

System.out.println("No protein.");

}

guessing this was just mislabled and should have been marked “Protein”
or the code should have added a different check:
if (start != 0 &&
stop != -1 &&
(stop - start) % 3 == 0)

Thanks

Hello, @cwnoel

That’s a very good question. It definitely meets the stated criteria. @ionatan, what do you think?

2 Likes

wuh why me ._.
I agree with you, there’s a protein in that.

4 Likes

I’ll file a bug to change the expected outcome for that one…

Thanks guys!

I’ve just reported this issue too.

Thanks!

The dna3 example “ATTAATATGTACTGA”

Contains the start codon ATG and index 6 and stop codon TGA at index 12 and has 3 nucleotides TAC between them, which is divisible by 3, which makes them a protein by the definition provided in the Objective…

"A protein has the following qualities:

It begins with a “start codon”: ATG.
It ends with a “stop codon”: TGA.
In between, each additional codon is a sequence of three nucleotides."

Which conflicts with the solution…

"Let’s test your code with each DNA strand. These should be the results:

dna1: Protein.
dna2: Not a protein.
dna3: Not a protein."

I this this is also reported here: Java DNA Sequencing Project