Changes

From Biolecture.org
no edit summary
<p><span style="font-size:14px"><strong>There is a given sequence, and if there is this script can extract &quot;MKKTGIKG in &quot; from the&nbsp;sequence, it will match and print it &nbsp;to the new &quot;output.txt&quot; file.</strong></span> &nbsp;</p>
<p><span style="font-size:14px">#!/usr/bin/perl<br />
&nbsp;use strict;<br />
&nbsp;use warnings;<br />
<strong>&nbsp;open(<strong>OUT</strong>, &quot;&gt;output.txt&quot;) </strong> or die &quot;Can&#39;t open file $_\n&quot;; &nbsp; &nbsp; &nbsp;##it creates new text file<br />&nbsp;my <strong>$seq</strong> =&quot;ASMKATAHQMKKTGIKGMSTYALLRL&quot;;<br />&nbsp;if (print &nbsp;OUT &quot;Original sequence: $seq\n&quot;;<br /><strong> $seq =~ s/(MKKTGIKG)//g;</strong>/){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ##finding particular&nbsp;matchings in a scalar variable<br />&nbsp;<strong>print OUT &quot;After extraction: $1seq\n&quot;; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ##$1 means matched item in a parenthesis</span></p> <p>-----------------------------------------------------</p> <p><strong>The output file content:<br /strong>}<br /p>&nbsp;else { print OUT $seq;} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;##if there is no match, will print out original <p>Original sequence: ASMKATAHQMKKTGIKGMSTYALLRL<br /span>After extraction: ASMKATAHQMSTYALLRL<br /p<p>&nbsp;</p>
Anonymous user

Navigation menu