[Bioperl-l] retrieving seq from miltifasta files

Vesko Baev vesko_baev at abv.bg
Thu Sep 4 11:56:23 EDT 2003


Hello,
I'm a new user of Bioperl.
For several hours I'm reading POD for indexing multiple fasta files (Bio::Index::Fasta) but I don't get it?!
For eximple I have one file (database) 'elegans.fa' which contains:
>imkl2
cgatcgatcgac
>imk13
gtattacgagcacac
>imk14
.......
And I want to retrieve 'imk13' sequence in Seqobj. How to do it?
I look in Fasta.pm there is a script but I don't how to make it.

   # Complete code for making an index for several
    # fasta files
    use Bio::Index::Fasta;
    use strict;

    my $Index_File_Name = shift;
    my $inx = Bio::Index::Fasta->new(
        '-filename' => $Index_File_Name,
        '-write_flag' => 1);
    $inx->make_index(@ARGV);

    # Print out several sequences present in the index
    # in Fasta format
    use Bio::Index::Fasta;
    use strict;

    my $Index_File_Name = shift;
    my $inx = Bio::Index::Fasta->new('-filename' => $Index_File_Name);
    my $out = Bio::SeqIO->new('-format' => 'Fasta','-fh' => \*STDOUT);

    foreach my $id (@ARGV) {
        my $seq = $inx->fetch($id); # Returns Bio::Seq object
	$out->write_seq($seq);
    }

    # or, alternatively

    my $seq = $inx->get_Seq_by_id($id); #identical to fetch


THANKS!!!! BioFRIENDS

Vesko
plovdiv,Bulgaria


-----------------------------------------------------------------
http://nova.GBG.bg - Направи си сайт! Лесно, бързо и професионално.


More information about the Bioperl-l mailing list