Mysterious Organism Project Extensions

Hi everybody

i am trying to solve the Project Extensions & Solution part 9 of the Mysterious Organism project.

Create a .transcribe() method to the factory function’s object that returns the match RNA sequence of the object’s dna.
Use the RNA sequence to see what protein is translated.

i cant even understand the question, what am i supposed to do? what is rna?
thanks
Dorit

1 Like

Well that’s some biological question :wink: .

Based on your provided info I guess you have to write a method .transcribe() as part of an object.
This method will somehow have to access the match RNA key value pair of the object and return this, like a getter.

But before continuing, have you had any exercises on objects yet?

BTW you didn’t include a link to the project so I had to make assumptions.

Hi janneslohmeijer
thanks for your answers, i am trying to find my last post about lodash dropwhile method and i cant find it, i am telling you that because i think that you reply to that post, weird…
about the rna i didn’t write my question good enough, i am trying to understand what is the exercise, yes i did the object exercise, how do i put a link to the project?
so if i understand right all that the transcribe method is doing is a getter?
and what about this clause Use the RNA sequence to see what protein is translated.
Dorit

Hey @doritfish

I did answer to your post about the lodash library, but the topic has been removed somehow… weird.
Anyways, I found the project you are doing under this link.

To link a topic to an exercise you merely have to paste the url into the message or use the link button in the post menu.

I have read a bit into the exercise. You are attempting to do the extra challenges which as the name says are challenging :stuck_out_tongue: . I guess to solve those you will need some knowledge of how RNA works in relation to DNA. What I can remember from biology class is that RNA is used to copy DNA to produce more DNA, but I might be wrong.

More I really can’t say with certainty. Perhaps there is someone out there who has done the extra challenges.

1 Like

Hi @doritfish,

Just got to the same exercise and had no idea either.

However looking at this question I think I get what “transcribing” is. DNA pairs A and T, and C and G. RNA does the same but replaces T with U. So looks like the method would need to convert in the following way: A -> U, T -> A, C -> G and G -> C.

Hope this helps!

1 Like

im trying to figure out #7, but i want a function to do this, i dont want to have to call this function 30 times seperatly. Increasing the specimen number each time i call it with my do…while loop is where im having issue

const returnRandBase = () => {
  const dnaBases = ['A', 'T', 'C', 'G']
  return dnaBases[Math.floor(Math.random() * 4)] 
}

const mockUpStrand = () => {
  const newStrand = []
  for (let i = 0; i < 15; i++) {
    newStrand.push(returnRandBase())
  }
  return newStrand
};

const pAequorFactory = (num, seq) => {
  return {
    specimenNum: num++,
    dna: seq,
    mutate(){
      let idx = Math.floor(Math.random() * 15);
      let x = this.dna[idx];
      let y = '';
      do {
        y = returnRandBase();
      } while (x === y);
      if (x !== y) {
        this.dna.splice(idx, 1, y);
      }
      return this.dna;
    },
    compareDNA(obj) {
      let match = 0
      for (x = 0; x < this.dna.length; x++) {
        if (this.dna[x] === obj[x]) {
          match++;
        }
      }
      let percenti = match/obj.length * 100
      let percent = (match/obj.length * 100).toFixed(2);
      return `The two DNA strands have ${percent}% DNA in common.`
    },
    willLikelySurvive(){
      let match = 0
      for (x = 0; x < this.dna.length; x++) {
        if (this.dna[x] === 'C' || this.dna[x] === 'G') {
          match++;
        } 
      }
      let percent = match/this.dna.length * 100;
      if (percent < 60) {
        return false;
      }
      return true;
    }
  }
};


let arr = [];
let count = 0
let match = 0;
do {
  let test10 = pAequorFactory(1, mockUpStrand());
  console.log(test10);
  test10 = test10.willLikelySurvive();
  console.log(test10);
  count++;
  if (test10 === true) {
    match++;
  }
} while (match < 30);
console.log(match)
console.log(count)