-->
Showing posts with label Perl. Show all posts
Showing posts with label Perl. Show all posts

Monday, March 14, 2016

Enter the dna sequence and find its length and

a) reverse the dna ,
b) convert into uppercase letters
c)count the GC content of the sequence and Convert DNA into RNA

code
print "Please Enter the DNA sequence: ";
$DNA=<STDIN>;
chomp $DNA;
print the scalar
print $DNA,"\n";
$revDNA = reverse($DNA);
$DNAlength = length($DNA);
$$upperCaseDNA = uc($DNA);
$lowerCaseDNA = lc($DNA);
$GC = ($DNA =~ tr/GCgc//);
$perGC = int(($GC/length($DNA))*100);
print "The GC content is $perGC percent\n";
$RNA = ($DNA =~ tr/Tt/Uu/);
print $RNA,"\n";

enter the dna sequence and and remove all non atgc characters in it code

**-------------------------------**
print”enter the dna \n”;
$i=<STDIN>;
chomp($i);
$i=~tr/atgc/cd;
print”$i \n”;
**--------------------------------**

Thursday, February 18, 2016

Using the subroutine generate a dna seq randomly using regular expression.read the length of the seq from user.


print"enter the length \n";
$len=; chomp($len); $seq= randomsequence ($len); print"randon sequence: $dna\n"; sub randomsequence for($i=0;$i<$len;$i++) { $a=int(rand (5)); { $dna.='A' if($a==0); $dna.='T' if($a==1); $dna.='G' if($a==2); $dna.='C' if($a==3); $dna.='U' if($a==4); } } return $dna;
JavaScript Free Code