Bio-Das
view release on metacpan or search on metacpan
objects for the request (a set of L<Bio::Das::Feature> objects for the
features() request a set of L<Bio::Das::Stylesheet> objects for the
stylesheet() request, a set of L<Bio::Das::Type> objects for the
types() request, and a set of raw DNA strings for the dna()
request.)
In a scalar context, results() will return a hashref in which the keys
are the segment strings passed to the request with the B<-segments>
argument and the values are arrayrefs containing the list of results.
There is an equivalence here. When this code fragment executes, both
$results_hash1 and $results_hash2 will contain the same information.
my @results = $request->results;
my $result_hash1 = {};
for my $r (@results) {
my $segment = $r->segment;
push @{$result_hash{$segment}},$r;
}
my $result2_hash2 = $request->results;
1 901. 3000 4000 4999
c1.1 |---------------|. .|-------|-------|
. . . .
501 1500 . .
c1.2 |-------------| . .
. .
1 1000
c1.1.1 |-------|
These relationships can be described with the following code fragment:
my $m = Bio::Das::Map->new('my_map');
$m->add_segment(['chr1',100,1000] => ['c1.1',1,901]);
$m->add_segment(['chr1',1001,2000] => ['c1.2',501,1500]);
$m->add_segment(['chr1',2001,4000] => ['c1.1',3000,4999]);
$m->add_segment(['c1.1',4000,4999] => ['c1.1.1',1,1000]);
A call to resolve() can now be used to transform a segment relative to
"c1.1.1" into "chr1" coordinates:
Das/Stylesheet.pm view on Meta::CPAN
The stylesheet class was designed to work hand-in-glove with
Bio::Graphics::Panel. You can rely entirely on the stylesheet to
provide the glyph name and attributes, or provide your own default
attributes to fill in those missing from the stylesheet.
It is important to bear in mind that Bio::Graphics::Panel only allows
a single glyph type to occupy a horizontal track. This means that you
must sort the different features by type, determine the suggested
glyph for each type, and then create the tracks.
The following code fragment illustrates the idiom. After sorting the
features by type, we pass the first instance of each type to glyph()
in order to recover a glyph name and attributes applicable to the
entire track.
use Bio::Das;
use Bio::Graphics::Panel;
my $das = Bio::Das->new('http://www.wormbase.org/db/das'=>'elegans');
my $stylesheet = $das->stylesheet;
my $segment = $das->segment(-ref=>'Locus:unc-9');
( run in 1.590 second using v1.01-cache-2.11-cpan-364913b4093 )