I have the script below but it isnt quite working what did i do wrong?<br>Plus can you get the entire length of the gene?<br><br><br>use strict;<br>use warnings;<br>use Bio::EnsEMBL::Registry;<br>use Bio::EnsEMBL::DBSQL::DBConnection;<br>
use Bio::EnsEMBL::Utils::SqlHelper;<br><br>#Load all DBs from Ensembl Genomes<br>Bio::EnsEMBL::Registry->load_registry_from_db(<br>  -HOST => '<a href="http://mysql.ebi.ac.uk">mysql.ebi.ac.uk</a>',<br>  -PORT => 4157,<br>
  -USER => 'anonymous'<br>);<br><br>my $dbc = Bio::EnsEMBL::DBSQL::DBConnection->new(<br>  -HOST => 'localhost', <br>  -PORT => 3306,<br>  -USER => 'xxxxxx', <br>  -PASS => 'xxxxxx',<br>
  -DBNAME => 'xxxxxx'<br>);<br>#Holds a soft reference to the DBConnection so we cannot combine the two news<br>my $h = Bio::EnsEMBL::Utils::SqlHelper->new(-DB_CONNECTION => $dbc);<br><br>#Cleanup schema using do()<br>
$dbc->do('DROP TABLE IF EXISTS exon');<br>$dbc->do(<<'SQL');<br>CREATE TABLE exon (<br>  idgld int(10) NOT NULL auto_increment,<br>   stbl_id varchar(12), <br>  seq_start varchar(12), <br>  seq_stop varchar(12), <br>
  sequence text, <br>  PRIMARY KEY(idgld)#)<br>SQL<br><br>#File management<br>my $file = '/home/glduncan/data/intron.txt';<br>if(-f $file) {<br>  unlink $file or die "Cannot remove file '${file}': $!";<br>
}<br> open my $out, '>', $file or die "Cannot open ${file} for writing: $!";<br><br>my $ids_file = '/home/glduncan/data/three4.txt';<br>open my $fh, '<', $ids_file or die "Failed. Cannot open '${ids_file}' for reading: $!";<br>
my $i = 1;<br><br>#Get the adaptors once<br>my $dba = Bio::EnsEMBL::Registry->get_DBAdaptor('Dictyostelium discoideum', 'core');<br>my $gene_adaptor = $dba->get_GeneAdaptor();<br><br>my @data;<br><br>
while(my $stable_id = <$fh>){<br>    chomp $stable_id;<br>    my $gene = $gene_adaptor->fetch_by_stable_id($stable_id);<br>    foreach my $transcript (@{$gene->get_all_Transcripts()}) {<br>      # print $out $transcript->stable_id(), "\n";<br>
        foreach my $exons (@{$transcript->get_all_Exons}) {<br>        print $out $exons->seq_region_start.' - '.$exons->seq_region_end.' - '.$exons->seq. "\n";<br>          #Store into a temporary array<br>
          push(@data, [<br>            $transcript->stable_id(),<br>            $exons->seq_region_start(),<br>            $exons->seq_region_end(),<br>            $exons->seq()<br>          ]);<br>        }<br>
    }<br>}<br>close($fh) or die "Cannot close input file handle: $!";<br><br>#Use the batch command from the helper to insert the data using only one prepared statement<br>my $dml = <<'SQL';<br>INSERT INTO exon (stbl_id, seq_start, seq_stop, sequence) <br>
VALUES (?,?,?,?)<br>SQL<br>my $affected_rows = $h->batch(-DATA => \@data, -SQL => $dml);<br>foreach my $row(@data){<br>    foreach my $value(@$row){<br>    print $value,'\n';<br>}<br>}<br><br><br><br>