develooper Front page | perl.beginners | Postings from October 2009

Fasta format !!

Thread Next
From:
Jyoti
Date:
October 29, 2009 12:23
Subject:
Fasta format !!
Message ID:
de92d70c0910291223t48fd4292gb9552ec4d12f4a3e@mail.gmail.com
#!/usr/bin/perl -w 
 
use strict;  
use CGI;  
use CGI::Carp qw ( fatalsToBrowser );  
use File::Basename;  
use Bio::SeqIO;


my $q = new CGI;  
my $filename = $q->param("file");
my $line;

&get_file_data($filename);

###############################################################################################################################

#subroutine to read fasta files.

sub get_file_data {

my @filename=();
my $line='';
my $j=0;
my($filename) = @_;

open(get_file_data, $filename);

foreach my $line (@_) {

chomp $line;
$line =~ s/[\s0-9]//g;

next;
                      


        # check blank line
        if ($line =~ /^\s*$/) {
            next;
                              }

        # check comment line
       else
{
 $line =~ /^\s*#/ ;
            next;
                              }
        # check fasta header line
        if($line =~ /^>/)     { 
            next;             }
                               
else {
print STDERR "Cannot open file \"$filename\n\n";
exit;
     }
                     
close get_file_data;
}
return @_;

                        }                 

############################################################################################################# 



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About