I have a DNA sequence in a scalar and have already performed the reverse function, now I want to get the compliment by using tr in perl, I'm getting a syntax error.
my $seq = "CCTCACACGCCCTGTTCTGGTGTCTGGTCGGATGTGTTGGTCGTGCGCAGATTGGTGCTC";
my $revseq = reverse $seq;
print "$revseq";
my $compseq = if($revseq =~ tr/ATCG/TAGC/){
print "$compseq";
then after I get the reverse compliment I have to get the RNA seq by using TR to replace T with U.
The hard part is I have a text file with codons and need to translate my RNA sequence into a protein. Any suggestions?
Btw.: your code is a fragment only and this is the error I get:
You can't use an if statement as right-hand value of an assignment in Perl, the following should be slightly more safe:
the sequence its returning is shorter than the original ?
No, why?
your correct sorry. how would I Get three nucleotides at a time (a codon) from each sequence until it is not possible to get another codon. Get the single letter amino acid code for each codon and add it to a scalar which contains the final translated sequence. i have the codons in a text file
So, as you are trying to learn how to do it, I will show you some steps that you could try and which documentation to read, and not a full solution, I will also list things that can go wrong. Please check my answer.