[Bioperl-l] Bio::SeqIO

Malcolm Cook mcook@dna.com
Thu, 18 Oct 2001 11:41:06 -0700


Patrick,

Looking at line 14 of your script:

my $out = Bio::SeqIO->new(-format => 'Fasta', -fh => exons);

I see 'exons' used as the -fh arg.  This is your 'bad arg'.

Guessing your intention, you probably want to not specify -fh, but rather
the -file param instead with a value of $out, as in:

my $out = Bio::SeqIO->new(-format => 'Fasta', -file => $out);

Good luck,

Malcolm Cook

>-----Original Message-----
>From: Loerch, Patrick [mailto:patrick_loerch@merck.com]
>Sent: Thursday, October 18, 2001 11:00 AM
>To: 'bioperl-l@bioperl.org'
>Subject: [Bioperl-l] Bio::SeqIO
>
>
>
>I am attempting to connect to a database using DBI, bring in a sequence
>using a SQL string, and output that sequence using SeqIO, in 
>Fasta format,
>to STDOUT. I keep getting an error message which replies "Bad 
>Name after
>Fasta' at fetch_exons.pl Line 14". 
>
>I was wondering if this is a problem with the SeqIO (or 
>possibly with the
>databse connection). Here is the script below. There are a 
>number of perl
>Modules which I am also using. I am finding this to be very 
>frustrating,
>cdoes anyone have any suggestions?
>
>Patrick
>
>#!/usr/local/bin/perl -w
>
>use lib '/usr/lib/perl/;
>use strict;
>use BigFasta;
>use JimKent;
>use SQLServer;
>use Bio::SeqIO;
>use Bio::PrimarySeq;
>
>#my $FASTA = "$ENV{HOME}/superlink_masked.fasta";
>my $FASTA = "/info/hgapdb/UCSC/Dec0401/chr22.fa";
>
>my $out = Bio::SeqIO->new(-format => 'Fasta', -fh => exons);
>
>my $accession = $ARGV[0] || "NM_005160";
>
>get_database_handle('OLIVE_UCSC');
>
>my $sql = "select a.* from ucsc_refgene_exons a, ucsc_refgene b where
>a.refgene_id = b.refgene_id and b.name like '$accession'";
>
>
>my @exons = select($sql);
>
>
>my @transcript = ();
>my $strand;
>
>
>for my $e (@exons) {
>    
>    my ($start, $end) = jk_coords(start => $e->{exonstart},
>				  end   => $e->{exonend});
>    
>    my $exon = rip_substring(fasta => $FASTA, 
>			     start => $start,
>			     end   => $end);    
>    
>    my $seq = Bio::PrimarySeq->new(-seq => $exon,
>				   -moltype => 'dna'
>				   );
>    
>    push(@transcript, $seq);
>    
>    $strand = $e->{strand};
>}
>
>
>my $count = 1;
>
>while (@transcript) {
>
>    if ($strand == -1) {
>
>	my $seq = pop(@transcript);
>	$seq->display_id("$accession.$count");
>	$out->write_seq($seq->revcom);
>
>    } else {
>
>	my $seq = shift(@transcript);
>	$seq->display_id("$accession.$count");
>	$out->write_seq($seq);    
>    }
>    
>    $count++;
>
>}
>
>release_database_handle();
>
>
>
>_______________________________________________
>Bioperl-l mailing list
>Bioperl-l@bioperl.org
>http://bioperl.org/mailman/listinfo/bioperl-l
>