[Bioperl-l] a problem when using the Bio::DB::Fasta

Guifeng Wei guifengwei at gmail.com
Mon Aug 23 22:44:57 EDT 2010


i came across a problem when i use the Bio::DB::Fasta modules of
BioPerl. The aim i want to arrive at is to extract the subsequences
accoording to the *.bed files which are the C.elegans genomic sequnece

when i tried to run the scripts i wrote, the error message was coming, as

Can't call method "seq" on an undefined value at bed_to_fasta.pl line 28,
<IN> line 1.

so, ask for favor to slove this problem.
Here is my perl scripts.

#!/usr/bin/perl -w
# Purpose: extract sequences from genomic sequences
use strict;
use Bio::DB::Fasta;
open(IN,$ARGV[0]) || die "sorry, the program cannot open the .bed file, plea
check it. \n";
my $db = Bio::DB::Fasta->new( '/home/wgf/elegans190.dna/' );
# The dir ...../elegans190.dna/ includes 6
#each stands for the sequences from the coressponding chromosome.

        chomp $_;
        my @bed=split(/\s+/, $_ );

        my $chr_id=$bed[0];
        my $start=$bed[1];
        my $end=$bed[2];
        my $seq_name=$bed[3];
        my $strand=$bed[5];

        my $segment =  $db->seq( $chr_id, $start=>$end );

        print ">",$seq_name,"_",$chr_id,":",$start=>$end;
        print "$segment\n";



More information about the Bioperl-l mailing list