[Bioperl-l] Bio::DB::Fasta

Jason Stajich jason at cgt.duhs.duke.edu
Thu Dec 11 11:32:06 EST 2003


There seems to be something wrong with the offsets in Bio::DB::Fasta

$db->seq($id, $start => $end);

Is returning and invalid value.

We need to fix this pre-1.4 release.
I don't have time to delve into the mysteries right now, but have
submitted a bug report.

#!/usr/bin/perl -w
use strict;
use Bio::DB::Fasta;
use Bio::Index::Fasta;
use Test;
BEGIN { plan tests => 1}
use Bio::SeqIO;
use Bio::PrimarySeq;
my $dbfile = 'db.fas';
my $fas_db = Bio::DB::Fasta->new($dbfile);

my $idx_db = Bio::Index::Fasta->new(-filename => '/tmp/test.idx',
				    -write_flag=> 1);
$idx_db->make_index($dbfile);

my ($id,$start,$end) = ('id1', 78408, 80349);

my $seq1 = $fas_db->seq($id, $start => $end);
my $seq2 = $idx_db->get_Seq_by_acc($id);

my $out = Bio::SeqIO->new(-format => 'fasta', -file => ">o.fa");
$out->write_seq(Bio::PrimarySeq->new(-id => 'db::fasta',
				-seq => $seq1));

$out->write_seq(Bio::PrimarySeq->new(-id => 'index::fasta',
				-seq => $seq2->subseq($start,$end)));


ok($seq1, $seq2->subseq($start,$end) );



--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list