Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl
Commits
dabc460e
Commit
dabc460e
authored
Sep 29, 2005
by
Patrick Meidl
Browse files
allow $SERVERROOT in Conversion.ini, added get_ensembl_chr_mapping
parent
540d4106
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
1 deletion
+44
-1
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
+44
-1
No files found.
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
View file @
dabc460e
...
...
@@ -120,6 +120,7 @@ sub parse_common_options {
if
(
-
e
$conffile
)
{
open
(
CONF
,
$conffile
)
or
throw
(
"
Unable to open configuration file
$conffile
for reading: $!
");
my
$serverroot
=
$self
->
serverroot
;
while
(
<
CONF
>
)
{
chomp
;
...
...
@@ -129,7 +130,13 @@ sub parse_common_options {
# read options into internal parameter datastructure
next
unless
(
/(\w\S*)\s*=\s*(.*)/
);
$self
->
param
(
$
1
,
$
2
);
my
$name
=
$
1
;
my
$val
=
$
2
;
if
(
$val
=~
/\$SERVERROOT/
)
{
$val
=~
s/\$SERVERROOT/$serverroot/g
;
$val
=
abs_path
(
$val
);
}
$self
->
param
(
$name
,
$val
);
}
$self
->
param
('
conffile
',
$conffile
);
}
else
{
...
...
@@ -795,6 +802,42 @@ sub get_chrlength {
return
\
%chr
;
}
=head2 get_ensembl_chr_mapping
Arg[1] : (optional) Bio::EnsEMBL::DBSQL::DBAdaptor $dba
Arg[2] : (optional) String $version - coord_system version
Example : my $ensembl_mapping = $support->get_ensembl_chr_mapping($dba);
Description : Gets a mapping between Vega chromosome names and their
equivalent Ensembl chromosomes.
Return type : Hashref - Vega name => Ensembl name
Exceptions : thrown if not passing a Bio::EnsEMBL::DBSQL::DBAdaptor
Caller : general
=cut
sub
get_ensembl_chr_mapping
{
my
(
$self
,
$dba
,
$version
)
=
@_
;
$dba
||=
$self
->
dba
;
throw
("
get_ensembl_chr_mapping should be passed a Bio::EnsEMBL::DBSQL::DBAdaptor
\n
")
unless
(
$dba
->
isa
('
Bio::EnsEMBL::DBSQL::DBAdaptor
'));
my
$sa
=
$dba
->
get_SliceAdaptor
;
my
@chromosomes
=
map
{
$_
->
seq_region_name
}
@
{
$sa
->
fetch_all
('
chromosome
',
$version
)
};
my
%chrs
;
foreach
my
$chr
(
@chromosomes
)
{
my
$sr
=
$sa
->
fetch_by_region
('
chromosome
',
$chr
,
undef
,
undef
,
undef
,
$version
);
my
(
$ensembl_name_attr
)
=
@
{
$sr
->
get_all_Attributes
('
ensembl_name
')
};
if
(
$ensembl_name_attr
)
{
$chrs
{
$chr
}
=
$ensembl_name_attr
->
value
;
}
else
{
$chrs
{
$chr
}
=
$chr
;
}
}
return
\
%chrs
;
}
=head2 get_taxonomy_id
Arg[1] : Bio::EnsEMBL::DBSQL::DBAdaptor $dba
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment