[ensembl-dev] Cannot get sequence from genome using perl variables

Daniel Sobral sobral at ebi.ac.uk
Wed Apr 27 14:19:40 BST 2011


$chr = '1'; instead of $chr = "'1'"; might help, I think

Daniel


On 27/04/2011 14:13, Damian wrote:
> Hello.
>
> Down below I've pasted a snippet of a script I've written to retrieve 
> regions of the genome.
> The first call to slice_adaptor works as expected. This call uses the 
> hard coded coordinates.
> The second version of the call to slice_adaptor fails to work, 
> throwing the error:
> Can't call method "seq" on an undefined value at getSeqs.pl line 23.
>
> The only difference between the two calls to slice_adaptor is that the 
> second version uses perl variables ($chr, $start, $end) instead of the 
> hard coded values.
> Is this a bug or am I doing something wrong?
> I'm using Ensembl Perl API version 62 with the Human database 
> installed (homo_sapiens_core_62_37g).
>
> Thanks in advance for any and all help.
> Damian
>
>
> #!/usr/bin/perl -w
>
> use Bio::EnsEMBL::Registry;
> use Bio::EnsEMBL::Slice;
>
> my $registry = 'Bio::EnsEMBL::Registry';
> $registry->load_registry_from_db(
>     -host => '127.0.0.1',
>     -user => 'jonDoe'
> );
>
> $slice_adaptor = $registry->get_adaptor('Human', 'Core', 'Slice');
>
> $slice = $slice_adaptor->fetch_by_region( 'chromosome', '1', 724572, 
> 724726 );
> $x = $slice->seq;
> print "\n## 1 ###\n$x\n\n";
>
> ## this version does NOT work
> $chr = "'1'";
> $start = 724572;
> $end = 724726;
> $slice = $slice_adaptor->fetch_by_region( 'chromosome', $chr, $start, 
> $end );
> $x = $slice->seq;
> print "\n## 2 ###\n$x\n\n";
>
> exit;
>
> -- 
> ------------------------------------------------------------------------------
> Damian Fermin, Ph.D.
> Pathology Department
> University of Michigan
> 4237 Medical Science I
> 1301 Catherine
> Ann Arbor, MI 48109-0602
> 734.615.0302
>
> "There is No Gene for the Human Spirit"
> 	-- GATTACA
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> List admin (including subscribe/unsubscribe): http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20110427/22b5a7c0/attachment.html>


More information about the Dev mailing list