Monday, September 10, 2012

Perl - [ Create INDEX.HTML ]

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

&Usage if $#ARGV<0;

my $REGEX = shift;

print "
<html>
    <head>
        <title></title>
        </head>
        <body>
                <center><h1></h1></center>

                                                        ";
foreach my $file (glob ("*.html")){

        my $text = $file;
        $text =~ s/\.$REGEX.*//g;

        print "\t\t<a href=\"$file\">$text</a><br/>\n";
}
print "
        </body>

</html>

";

sub Usage(){

    print "\nUsage: perl CreatePageIndex.pl fastq > index.html\n";
        exit(1);
}

----------------------------------------------------------------------------------------------------

-bash-4.0$ ll
total 2356
-rw-r--r-- 1 andre users 326585 2012-09-10 10:57 Phix.sort.bam.html.html
-rw-r--r-- 1 andre users 350366 2012-09-10 10:57 polipo11p.sort.bam.html.html
-rw-r--r-- 1 andre users 336857 2012-09-10 10:57 polipo17p.sort.bam.html.html
-rw-r--r-- 1 andre users 345978 2012-09-10 10:57 polipo45p.sort.bam.html.html
-rw-r--r-- 1 andre users 342493 2012-09-10 10:57 tumor11t.sort.bam.html.html
-rw-r--r-- 1 andre users 344666 2012-09-10 10:57 tumor17t.sort.bam.html.html
-rw-r--r-- 1 andre users 351703 2012-09-10 10:57 tumor45t.sort.bam.html.html
-bash-4.0$perl CreatePageIndex.pl

Usage: perl CreatePageIndex.pl fastq > index.html

-bash-4.0$ perl CreatePageIndex.pl sort

<html>
    <head>
        <title></title>
        </head>
        <body>
                <center><h1></h1></center>

                                                                        <a href="Phix.sort.bam.html.html">Phix</a><br/>
                <a href="polipo11p.sort.bam.html.html">polipo11p</a><br/>
                <a href="polipo17p.sort.bam.html.html">polipo17p</a><br/>
                <a href="polipo45p.sort.bam.html.html">polipo45p</a><br/>
                <a href="tumor11t.sort.bam.html.html">tumor11t</a><br/>
                <a href="tumor17t.sort.bam.html.html">tumor17t</a><br/>
                <a href="tumor45t.sort.bam.html.html">tumor45t</a><br/>

        </body>

</html>

0 comentários:

Post a Comment