3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
34 representing alternative assemblies
39 $slice_adaptor->fetch_by_region(
'chromosome', 14, 900000, 950000 );
49 NOTE:
this code is under development and not fully functional nor tested
50 yet. Use only
for development.
52 This adaptor is a factory
for creating MappedSlices representing
54 mapper will be created to
map between the reference slice and the common
55 container slice coordinate system.
62 =head1 REALTED MODULES
66 Bio::EnsEMBL::Compara::AlignSlice
67 Bio::EnsEMBL::Compara::AlignSlice::Slice
68 Bio::EnsEMBL::Variation::StrainSlice
72 package Bio::EnsEMBL::DBSQL::AssemblySliceAdaptor;
76 no warnings
'uninitialized';
89 Example : my $assembly_slice_adaptor =
91 Description : Constructor.
103 my $class = ref($caller) || $caller;
104 my $self = $class->SUPER::new(@_);
110 =head2 fetch_by_version
113 to attach MappedSlices to
114 Arg[2] : String $version - the assembly version to fetch
115 Example : my ($mapped_slice) = @{ $msc->fetch_by_version(
'NCBIM36') };
116 Description : Creates a MappedSlice representing an alternative assembly
117 version of the container
's reference slice.
118 Return type : listref of Bio::EnsEMBL::MappedSlice
119 Exceptions : thrown on wrong or missing arguments
120 Caller : general, Bio::EnsEMBL::MappedSliceContainer
126 sub fetch_by_version {
128 my $container = shift;
132 unless ($container and ref($container) and
134 throw("Need a MappedSliceContainer.");
138 throw("Need an assembly version.");
141 my $slice = $container->ref_slice;
143 # project slice onto other assembly and construct MappedSlice for result
144 my $mapped_slice = Bio::EnsEMBL::MappedSlice->new(
146 -CONTAINER => $container,
147 -NAME => $slice->name."\#mapped_$version",
150 my $cs_name = $slice->coord_system_name;
152 foreach my $seg (@{ $slice->project($cs_name, $version) }) {
154 my $proj_slice = $seg->to_Slice;
156 # create a Mapper to map to/from the mapped_slice artificial coord system
157 my $mapper = Bio::EnsEMBL::Mapper->new('mapped_slice
', 'native_slice
');
159 # tell the mapper how to map this segment
160 $mapper->add_map_coordinates(
164 ($slice->strand * $proj_slice->strand),
165 $proj_slice->seq_region_name,
170 # add the Slice/Mapper pair to the MappedSlice
171 $mapped_slice->add_Slice_Mapper_pair($proj_slice, $mapper);
174 return [$mapped_slice];
180 Arg[1] : Bio::EnsEMBL::MappedSliceContainer $container - the container
181 to attach MappedSlices to
182 Arg[2] : String $name - the assembly name to fetch
183 Arg[3] : (optional) String $version -- the version for the new assembly
184 Example : my ($mapped_slice) = @{ $msc->fetch_by_name('LRG1
','1
') };
185 Description : Creates a MappedSlice representing an alternative assembly
186 version of the container's reference slice.
188 Exceptions : thrown on wrong or missing arguments
197 my $container = shift;
202 unless ($container and ref($container) and
203 $container->isa(
'Bio::EnsEMBL::MappedSliceContainer')) {
204 throw(
"Need a MappedSliceContainer.");
208 throw(
"Need an assembly name.");
214 # project slice onto other assembly and construct MappedSlice for result
217 -CONTAINER => $container,
218 -NAME => $slice->name.
"\#mapped_$name:$version",
222 foreach my $seg (@{ $slice->project($name, $version) }) {
224 my $proj_slice = $seg->to_Slice;
226 # create a Mapper to map to/from the mapped_slice artificial coord system
229 # tell the mapper how to map this segment
230 $mapper->add_map_coordinates(
234 ($slice->strand * $proj_slice->strand),
235 $proj_slice->seq_region_name,
240 # add the Slice/Mapper pair to the MappedSlice
241 $mapped_slice->add_Slice_Mapper_pair($proj_slice, $mapper);
244 return [$mapped_slice];