This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Using Bio::SeqIO to write with fasta format

I want to write some outputs to a file. I can use the standard perl functions but it seems that Bio::SeqIO also does such thing. However, there are some problems with that.

my $chromosome_output= Bio::SeqIO->new(
    -file => ">myfile.fasta",
    -format => 'Fasta'
);
my $gene_adaptor = $registry->get_adaptor('human', 'core', 'Gene');
my @genes = @{ $gene_adaptor->fetch_all_by_external_name("BRCA2") };
my $gene  = @genes[0];
$chromosome_output->write_seq($gene->seq());

But I get

------------- EXCEPTION -------------
MSG: Did not provide a valid Bio::PrimarySeqI object
STACK Bio::SeqIO::fasta::write_seq /opt/perl/lib/site_perl/5.14.2/Bio/SeqIO/fasta.pm:217
STACK toplevel test.pl:31
-------------------------------------

Any idea?

bioperl fasta

0 answers

No answers yet.

Log in to answer this question.