Hi guys;
I am with a problem with my parse. Well I'll try to explain the code before posting it:
I have a table with information on areas where I need to find intergenic regions, ie, I can not use ID or locus_tag to search these regions. So I picked up at the table and startCoord stopCoord of each target region I'm going to put in array for later use as a search key.
PS: The db isn't gbrowser.
The output is multiFasta my $ out = Bio :: SeqIO-> new (-file => "> outputfilename", '-format' => 'Fasta'); #unfinished.
#!/usr/bin/perl -w
use strict;
use Bio::Perl;
use Bio::Seq;
use Bio::SeqIO;
use IO::String;
use Bio::SearchIO;
use DBI;
use CGI;
use Bio::PrimarySeq;
my ($fastaFile)=@ARGV;
#Get fasta file
my $in = Bio::SeqIO->new(-file => $fastaFile, -format => 'Fasta');
#write fasta file
my $out = Bio::SeqIO->new(-file => '>multFasta.fa', -format => "Fasta", -flush => 0);
my $subseq;
#DB Parte, take informations, Regulator, Target, starCoord, stopCoord.
my $dbh = DBI->connect('dbi:mysql:db_name','user','password') or die "Connection Error: $DBI::errstr\n";
# select multiple fields with multiple rows:
my $sql = qq`SELECT Regulator , Target , startCoord , stopCoord FROM table WHERE 1`;
my $sth = $dbh->prepare($sql) or die "Cannot prepare: " . $dbh->errstr();
$sth->execute() or die "Cannot execute: " . $sth->errstr();
my @row;
my @fields;
while(@row = $sth->fetchrow_array()) {
my @record = @row;
push(@fields, \@record);
}
$sth->finish();
# now process the fields
if (@fields != 0) {
my $i=0;
foreach my $line (@fields) {
my $seq = $in->next_seq();
$subseq = $seq->subseq(@$line[2],@$line[3]); #Here is the problem
print "$subseq";
#print "@$line[2], @$line[3]"."\n";
#$out ->write_seq($subseq);
}
$i++;
}
}
$sth -> finish;
$dbh -> disconnect;
### End of DB Part ###
exit;
When I run, bioperl told me:
------------- EXCEPTION: Bio::Root::Exception -------------
MSG: Bad end parameter (2692830). End must be less than the total length of sequence (total=1524)
STACK: Error::throw
STACK: Bio::Root::Root::throw /usr/local/share/perl/5.10.1/Bio/Root/Root.pm:368
STACK: Bio::PrimarySeq::subseq /usr/local/share/perl/5.10.1/Bio/PrimarySeq.pm:401
STACK: Bio::Seq::subseq /usr/local/share/perl/5.10.1/Bio/Seq.pm:635
STACK: parse_starr_and_stop.perl:48
I've been a weak with this problem, and I can't resolve.
I thank you in advance.
I am with a problem with my parse. Well I'll try to explain the code before posting it:
I have a table with information on areas where I need to find intergenic regions, ie, I can not use ID or locus_tag to search these regions. So I picked up at the table and startCoord stopCoord of each target region I'm going to put in array for later use as a search key.
PS: The db isn't gbrowser.
The output is multiFasta my $ out = Bio :: SeqIO-> new (-file => "> outputfilename", '-format' => 'Fasta'); #unfinished.
#!/usr/bin/perl -w
use strict;
use Bio::Perl;
use Bio::Seq;
use Bio::SeqIO;
use IO::String;
use Bio::SearchIO;
use DBI;
use CGI;
use Bio::PrimarySeq;
my ($fastaFile)=@ARGV;
#Get fasta file
my $in = Bio::SeqIO->new(-file => $fastaFile, -format => 'Fasta');
#write fasta file
my $out = Bio::SeqIO->new(-file => '>multFasta.fa', -format => "Fasta", -flush => 0);
my $subseq;
#DB Parte, take informations, Regulator, Target, starCoord, stopCoord.
my $dbh = DBI->connect('dbi:mysql:db_name','user','password') or die "Connection Error: $DBI::errstr\n";
# select multiple fields with multiple rows:
my $sql = qq`SELECT Regulator , Target , startCoord , stopCoord FROM table WHERE 1`;
my $sth = $dbh->prepare($sql) or die "Cannot prepare: " . $dbh->errstr();
$sth->execute() or die "Cannot execute: " . $sth->errstr();
my @row;
my @fields;
while(@row = $sth->fetchrow_array()) {
my @record = @row;
push(@fields, \@record);
}
$sth->finish();
# now process the fields
if (@fields != 0) {
my $i=0;
foreach my $line (@fields) {
my $seq = $in->next_seq();
$subseq = $seq->subseq(@$line[2],@$line[3]); #Here is the problem
print "$subseq";
#print "@$line[2], @$line[3]"."\n";
#$out ->write_seq($subseq);
}
$i++;
}
}
$sth -> finish;
$dbh -> disconnect;
### End of DB Part ###
exit;
------------- EXCEPTION: Bio::Root::Exception -------------
MSG: Bad end parameter (2692830). End must be less than the total length of sequence (total=1524)
STACK: Error::throw
STACK: Bio::Root::Root::throw /usr/local/share/perl/5.10.1/Bio/Root/Root.pm:368
STACK: Bio::PrimarySeq::subseq /usr/local/share/perl/5.10.1/Bio/PrimarySeq.pm:401
STACK: Bio::Seq::subseq /usr/local/share/perl/5.10.1/Bio/Seq.pm:635
STACK: parse_starr_and_stop.perl:48
I've been a weak with this problem, and I can't resolve.

I thank you in advance.