Difference between revisions of "User:Jeongmin Oh"

From Biolecture.org
imported>S
m (Creating user page with biography of new user.)
 
imported>Jeongmin Oh
 
Line 1: Line 1:
The previous Id i made didn't work on this page but biopedia.
+
<p>#!/usr/bin/perl<br />
 +
use strict;<br />
 +
use warnings;</p>
 +
 
 +
<p>use Path::Class;<br />
 +
use autodie; # die if problem reading or writing a file</p>
 +
 
 +
<p>my $dir = dir(&quot;C:/Temp&quot;); # C:/Temp<br />
 +
print &quot;The Fasta File will be generated in C:/Temp\n&quot;;<br />
 +
print &quot;The name of file is FASTA20131369.txt.\n&quot;;<br />
 +
my $file = $dir-&gt;file(&quot;file.txt&quot;); # C:/Temp/FASTA20131369.txt</p>
 +
 
 +
<p># Get a file_handle (IO::File object) you can write to<br />
 +
my $file_handle = $file-&gt;openw();</p>
 +
 
 +
<p>my @list = (&#39;&gt;Your_first_seq&#39;, &#39;ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br />
 +
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br />
 +
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br />
 +
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA&#39;);</p>
 +
 
 +
<p>foreach my $line ( @list ) {<br />
 +
&nbsp; &nbsp; # Add the line to the file<br />
 +
&nbsp; &nbsp; $file_handle-&gt;print($line . &quot;\n&quot;);<br />
 +
}<br />
 +
&nbsp;</p>

Latest revision as of 02:07, 4 December 2015

#!/usr/bin/perl
use strict;
use warnings;

use Path::Class;
use autodie; # die if problem reading or writing a file

my $dir = dir("C:/Temp"); # C:/Temp
print "The Fasta File will be generated in C:/Temp\n";
print "The name of file is FASTA20131369.txt.\n";
my $file = $dir->file("file.txt"); # C:/Temp/FASTA20131369.txt

# Get a file_handle (IO::File object) you can write to
my $file_handle = $file->openw();

my @list = ('>Your_first_seq', 'ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA');

foreach my $line ( @list ) {
    # Add the line to the file
    $file_handle->print($line . "\n");
}