[ensembl-dev] Cannot get sequence from genome using perl variables (no HTML)

Damian dfermin at umich.edu
Wed Apr 27 16:41:20 BST 2011


Hello.

Sorry for double posting. My message go corrupted since I sent it via HTML.

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
------------------------------------------------------------------------------





More information about the Dev mailing list