-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlignmentsTrackConfig.pm
More file actions
142 lines (99 loc) · 3.92 KB
/
AlignmentsTrackConfig.pm
File metadata and controls
142 lines (99 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package ApiCommonModel::Model::JBrowseTrackConfig::AlignmentsTrackConfig;
use base qw(ApiCommonModel::Model::JBrowseTrackConfig::TrackConfig);
use strict;
use warnings;
use ApiCommonModel::Model::JBrowseTrackConfig::BamStore;
sub getMin {$_[0]->{min}}
sub setMin {$_[0]->{min} = $_[1]}
sub getMax {$_[0]->{max}}
sub setMax {$_[0]->{max} = $_[1]}
sub getYScalePosition {$_[0]->{yscale_position}}
sub setYScalePosition {$_[0]->{yscale_position} = $_[1]}
sub getChunkSizeLimit {$_[0]->{chunk_size}}
sub setChunkSizeLimit {$_[0]->{chunk_size} = $_[1]}
sub getColorFwdStrand {$_[0]->{color_fwd_strand}}
sub setColorFwdStrand {$_[0]->{color_fwd_strand} = $_[1]}
sub getColorRevStrand {$_[0]->{color_rev_strand}}
sub setColorRevStrand {$_[0]->{color_rev_strand} = $_[1]}
sub getBorderColor {$_[0]->{border_color}}
sub setBorderColor {$_[0]->{border_color} = $_[1]}
sub skipHistograms {$_[0]->{_skip_histograms}}
sub new {
my ($class, $args) = @_;
my $self = $class->SUPER::new($args);
my $store = ApiCommonModel::Model::JBrowseTrackConfig::BamStore->new($args);
$self->setStore($store);
if($self->getApplicationType() eq 'jbrowse' || $self->getApplicationType() eq 'apollo') {
$self->setDisplayType("JBrowse/View/Track/Alignments2");
$self->setTrackTypeDisplay("Coverage (Read Alignments zoomed)");
}
else {
$self->setTrackType("AlignmentsTrack");
$self->setDisplayType("LinearAlignmentsDisplay");
$self->setTrackTypeDisplay("Alignment");
}
#my $displayName = $self->getDisplayName();
#my $datasetName = $self->getDatasetName();
$self->setId($args->{key});
#$self->setId("${datasetName}_${displayName}_Alignments");
#$self->setColor("black");
$self->setMin(0);
$self->setMax(500);
$self->setYScalePosition("left");
$self->setChunkSizeLimit(50000000);
if($args->{skip_histograms}) {
$self->{_skip_histograms} = 1;
}
if(my $colorFwdStrand = $args->{color_fwd_strand}) {
$self->setColorFwdStrand($colorFwdStrand);
}
if(my $colorRevStrand = $args->{color_rev_strand}) {
$self->setColorRevStrand($colorRevStrand);
}
return $self;
}
sub getJBrowseStyle {
my $self = shift;
my $jbrowseStyle = $self->SUPER::getJBrowseStyle();
if ($self->getColorFwdStrand && $self->getColorRevStrand){
$jbrowseStyle->{color_fwd_strand}=$self->getColorFwdStrand;
$jbrowseStyle->{color_rev_strand}=$self->getColorRevStrand;
}
return $jbrowseStyle;
}
sub getHistograms {
my $self = shift;
my $store = $self->getStore();
my $bigwigUrl = $store->getBigwigUrl();
$bigwigUrl = "/a/service/jbrowse/store?data=" . $bigwigUrl;
my $histograms = {};
#$histograms->{color} = $self->getColor();
$histograms->{color} = "black";
$histograms->{storeClass} = $store->getBigWigStoreType();
$histograms->{min} = $self->getMin();
$histograms->{urlTemplate} = $bigwigUrl;
$histograms->{max} = $self->getMax();
return $histograms;
}
sub getJBrowseObject{
my $self = shift;
my $jbrowseObject = $self->SUPER::getJBrowseObject();
$jbrowseObject->{yScalePosition} = $self->getYScalePosition();
$jbrowseObject->{chunkSizeLimit} = $self->getChunkSizeLimit();;
$jbrowseObject->{urlTemplate}= $self->getStore()->getUrlTemplate();
unless($self->skipHistograms()) {
my $histograms = $self->getHistograms();
$jbrowseObject->{histograms} = $histograms;
}
return $jbrowseObject;
}
sub getJBrowse2Object{
my $self = shift;
my $jbrowse2Object = $self->SUPER::getJBrowse2Object();
my $indexLocation = $self->getStore()->getIndexUrlTemplate();
$jbrowse2Object->{adapter}->{index}->{location}->{uri} = $indexLocation;
$jbrowse2Object->{adapter}->{bamLocation} = {uri => $self->getStore()->getUrlTemplate(),locationType => "UriLocation"};
$jbrowse2Object->{displays}->[0]->{displayId} = "bam_" . scalar($self);
return $jbrowse2Object;
}
1;