What do the following regular expressions compute Using Perl

What do the following regular expressions compute? (Using Perl)

(vi) $protein =~ /$motif/

(vii) $dna =~ s/\\s//g

(viii) $complement = tr/acgt/tgca/

(ix) $rna =~ s/T/U/g

(x) $codon =~ /GA[TC]/i

Solution

vi) The first expression matches the word motif at the end of the string. $ sign is responsible for matching the word or sequence given at the end of the string.

vii) This expression is responsible for replacement of char. g stands for global which means it will replace globally anywhere in the file. so you will replace here whitespace with the no space as this replacement is as follows: $string =~ s/regex/replacement/g. here regex is /s which is space.

viii) tr here is responsible for translation. it will change acgt to tgca

ix) This is same as $string =~ s/regex/replacement/g. here regex is T which will be replaced by U globally

What do the following regular expressions compute? (Using Perl) (vi) $protein =~ /$motif/ (vii) $dna =~ s/\\s//g (viii) $complement = tr/acgt/tgca/ (ix) $rna =~

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site