Open main menu

Biolecture.org β

Changes

no edit summary
<p>It is Myeongji`s idea</p>
 
<p>&nbsp;</p>
 
<p>#!/usr/bin/perl<br />
use strict;<br />
use warnings;</p>
 
<p>my$DNA1=&quot;TRET.txt&quot;;<br />
open(fileHandle, $DNA1);<br />
my@allLines1=&lt;fileHandle&gt;;<br />
chomp(@allLines1);<br />
my@protein1 = splice @allLines1, 1;<br />
close(fileHandle);</p>
 
<p>my$DNA2=&quot;VEGFA.txt&quot;;<br />
open(fileHandle, $DNA2);<br />
my@allLines2=&lt;fileHandle&gt;;<br />
chomp(@allLines2);<br />
my@protein2 = splice @allLines2, 1;<br />
close(fileHandle);</p>
 
<p>my$DNA3=&quot;Propreinsulin.txt&quot;;<br />
open(fileHandle, $DNA3);<br />
my@allLines3=&lt;fileHandle&gt;;<br />
chomp(@allLines3);<br />
my@protein3 = splice @allLines3, 1;<br />
close(fileHandle);</p>
 
<p>my$pro1 = join &quot;&quot;,@protein1;<br />
print &quot;TRET : &quot;, $pro1, &quot;\n&quot;;<br />
my$pro2 = join &quot;&quot;,@protein2;<br />
print &quot;VEGFA : &quot;, $pro2, &quot;\n&quot;;<br />
my$pro3 = join &quot;&quot;,@protein3;<br />
print &quot;Propreinsulin : &quot;, $pro3, &quot;\n&quot;;</p>
 
<p>print &quot;\n&quot;;</p>
 
<p>my$length1=length$pro1;<br />
print &quot;The length of TRET sequence : $length1.\n&quot;;<br />
my$length2=length$pro2;<br />
print &quot;The length of VEGFA sequence : $length2.\n&quot;;<br />
my$length3=length$pro3;<br />
print &quot;The length of Propreinsulin sequence : $length3.\n&quot;;</p>
 
<p>my$average=($length1+$length2+$length3)/3;<br />
print &quot;The average length of multi-sequences : $average.\n&quot;;</p>
 
<p>print &quot;\n&quot;;</p>
 
<p># =~tr/AT/BC/ : A를 B로, T를 C로 교환 (1:1)<br />
my $i;<br />
for($i=1; $i&lt;=3; $i++)<br />
{<br />
&nbsp;&nbsp; &nbsp;if($i == 1)<br />
&nbsp;&nbsp; &nbsp;{<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$pro = $pro1;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$a=($pro=~tr/A/A/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$b=($pro=~tr/C/C/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$c=($pro=~tr/G/G/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$d=($pro=~tr/T/T/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$Total=$a+$b+$c+$d;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;&lt;protein&quot;, $i, &quot;&gt;\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of A is $a.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of C is $b.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of G is $c.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of T is $d.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;Total bases in DNA : $Total.\n&quot;;</p>
 
<p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#count of GC<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#=~s:search, /이걸/이걸로/ 치환 (1:1아님), g:글로벌 매칭(스트링 전체를 훑고 매칭하는 것), 치환한 갯수를 결과로 나타냄<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$GC=($pro=~s/GC/GC/g);&nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The total number of dinucleotide GC in DNA : $GC.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#count of AT<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$AT=($pro=~s/AT/AT/g);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The total number of dinucleotide AT in DNA : $AT.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#percentage of GC &amp; AT<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$GCper=($GC/($Total)*100);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The percentage of GC: $GCper%.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$ATper=($AT/($Total)*100);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The percentage of AT: $ATper%.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print &quot;\n&quot;;<br />
&nbsp;&nbsp; &nbsp;};<br />
&nbsp;&nbsp; &nbsp;if($i == 2)<br />
&nbsp;&nbsp; &nbsp;{<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$pro = $pro2;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$a=($pro=~tr/A/A/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$b=($pro=~tr/C/C/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$c=($pro=~tr/G/G/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$d=($pro=~tr/T/T/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$Total=$a+$b+$c+$d;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;&lt;protein&quot;, $i, &quot;&gt;\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of A is $a.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of C is $b.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of G is $c.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of T is $d.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;Total bases in DNA : $Total.\n&quot;;</p>
 
<p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#count of GC<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#=~s:search, /이걸/이걸로/ 치환 (1:1아님), g:글로벌 매칭(스트링 전체를 훑고 매칭하는 것), 치환한 갯수를 결과로 나타냄<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$GC=($pro=~s/GC/GC/g);&nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The total number of dinucleotide GC in DNA : $GC.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#count of AT<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$AT=($pro=~s/AT/AT/g);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The total number of dinucleotide AT in DNA : $AT.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#percentage of GC &amp; AT<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$GCper=($GC/($Total)*100);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The percentage of GC: $GCper%.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$ATper=($AT/($Total)*100);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The percentage of AT: $ATper%.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print &quot;\n&quot;;<br />
&nbsp;&nbsp; &nbsp;};<br />
&nbsp;&nbsp; &nbsp;if($i == 3)<br />
&nbsp;&nbsp; &nbsp;{<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$pro = $pro3;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$a=($pro=~tr/A/A/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$b=($pro=~tr/C/C/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$c=($pro=~tr/G/G/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$d=($pro=~tr/T/T/);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$Total=$a+$b+$c+$d;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;&lt;protein&quot;, $i, &quot;&gt;\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of A is $a.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of C is $b.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of G is $c.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The number of T is $d.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;Total bases in DNA : $Total.\n&quot;;</p>
 
<p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#count of GC<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#=~s:search, /이걸/이걸로/ 치환 (1:1아님), g:글로벌 매칭(스트링 전체를 훑고 매칭하는 것), 치환한 갯수를 결과로 나타냄<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$GC=($pro=~s/GC/GC/g);&nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The total number of dinucleotide GC in DNA : $GC.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#count of AT<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$AT=($pro=~s/AT/AT/g);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The total number of dinucleotide AT in DNA : $AT.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;#percentage of GC &amp; AT<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$GCper=($GC/($Total)*100);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The percentage of GC: $GCper%.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my$ATper=($AT/($Total)*100);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print&quot;The percentage of AT: $ATper%.\n&quot;;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print &quot;\n&quot;;<br />
&nbsp;&nbsp; &nbsp;};</p>
 
<p>};</p>
 
<p>exit;</p>
 
<p>my $file = &lt;FASTA&gt;;<br />
my @R = split &quot;&quot;,$file;&nbsp;<br />
my $A =0;<br />
foreach my $nuc (@R) {<br />
&nbsp;&nbsp; &nbsp;if ($nuc eq &#39;A&#39;) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$A = $A+1;<br />
&nbsp;&nbsp; &nbsp;}<br />
}</p>
<p>&nbsp;</p>