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
3656484b
Commit
3656484b
authored
Apr 07, 2001
by
Web Admin
Browse files
added function to fetch chr length from a vc via the karyotype DB adaptor
parent
aa561e3a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
193 additions
and
14 deletions
+193
-14
modules/Bio/EnsEMBL/DBSQL/ExternalWrapper.pm
modules/Bio/EnsEMBL/DBSQL/ExternalWrapper.pm
+1
-1
modules/Bio/EnsEMBL/DBSQL/KaryotypeBandAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/KaryotypeBandAdaptor.pm
+90
-3
modules/Bio/EnsEMBL/DBSQL/Obj.pm
modules/Bio/EnsEMBL/DBSQL/Obj.pm
+18
-1
modules/Bio/EnsEMBL/Virtual/StaticContig.pm
modules/Bio/EnsEMBL/Virtual/StaticContig.pm
+81
-6
modules/Bio/EnsEMBL/WebTranscript.pm
modules/Bio/EnsEMBL/WebTranscript.pm
+3
-3
No files found.
modules/Bio/EnsEMBL/DBSQL/ExternalWrapper.pm
View file @
3656484b
...
...
@@ -61,7 +61,7 @@ sub new {
bless
$self
,
$class
;
if
(
!
defined
$dbobj
||
!
$dbobj
->
isa
('
Bio::EnsEMBL::DBSQL::Obj
')
)
{
if
(
!
defined
$dbobj
)
{
$self
->
throw
("
No dbobj or not a dbobj [
$dbobj
]
");
}
...
...
modules/Bio/EnsEMBL/DBSQL/KaryotypeBandAdaptor.pm
View file @
3656484b
...
...
@@ -55,6 +55,53 @@ use Bio::EnsEMBL::DBSQL::BaseAdaptor;
# inherit new from BaseAdaptor
=head2 fetch_by_chromosome_start_end
Title : fetch_by_chromosome_start_end
Usage : $band_obj = $kary_adp->fetch_by_chromosome_position('chr1',10000, 2000);
Function: Retrieves KaryotypeBand objects by chromosome ('chrN' notation)
and its absolute "golden-path" start/end on that chromosome.
Example :
Returns : A KaryotypeBand object list
Args : Chromosome id (chrN notation) and start, end in absolute basepairs
=cut
sub
fetch_by_chromosome_start_end
{
my
(
$self
,
$chr
,
$start
,
$end
)
=
@_
;
$self
->
throw
("
Need both chromosome and start/end
")
unless
(
defined
$start
&&
defined
$end
);
my
$sth
=
$self
->
prepare
("
SELECT chr_start,
chr_end,
band,
stain
FROM karyotype
WHERE chr_name = '
$chr
'
AND
$start
<= chr_end
AND
$end
> chr_start
");
$sth
->
execute
;
my
@bands
=
();
my
(
$chr_start
,
$chr_end
,
$band
,
$stain
)
=
();
while
((
$chr_start
,
$chr_end
,
$band
,
$stain
)
=
$sth
->
fetchrow_array
()){
last
unless
defined
$band
;
my
$band_obj
=
Bio::EnsEMBL::
KaryotypeBand
->
new
();
$band_obj
->
name
(
$band
);
$band_obj
->
chromosome
(
$chr
);
$band_obj
->
start
(
$chr_start
);
$band_obj
->
end
(
$chr_end
);
$band_obj
->
stain
(
$stain
);
#print STDERR "Kary Get: $chr_start,$chr_end,$band,$stain\n";
push
(
@bands
,
$band_obj
);
}
return
@bands
;
}
=head2 fetch_by_chromosome_position
Title : fetch_by_chromosome_position
...
...
@@ -83,8 +130,8 @@ sub fetch_by_chromosome_position{
");
$sth
->
execute
;
my
(
$chr_start
,
$chr_end
,
$band
,
$stain
)
=
$sth
->
fetchrow_array
;
my
(
$chr_start
,
$chr_end
,
$band
,
$stain
)
=
$sth
->
fetchrow_array
();
return
undef
unless
defined
$band
;
my
$band_obj
=
Bio::EnsEMBL::
KaryotypeBand
->
new
();
...
...
@@ -99,7 +146,6 @@ sub fetch_by_chromosome_position{
=head2 fetch_by_chromosome_name
Title : fetch_by_chromosome_name
...
...
@@ -141,6 +187,39 @@ sub fetch_by_chromosome_name{
}
=head2 fetch_chromosome_length
Title : fetch_chromosome_length
Usage :
Function: Returns length of a chromosome ('chrN' notation)
Example :
Returns : SV
Args : Chromosome id (chrN notation)
=cut
sub
fetch_chromosome_length
{
my
(
$self
,
$chr
)
=
@_
;
$self
->
throw
("
Need a chromosome
")
unless
defined
$chr
;
# return a cached copy of the chromosome bands
if
(
$self
->
{'
_karyotype_band_cache
'}){
my
@tmp
=
@
{
$self
->
{'
_karyotype_band_cache
'}};
return
$tmp
[
-
1
]
->
end
();
}
my
$sth
=
$self
->
prepare
("
SELECT
max(chr_end)
FROM karyotype
WHERE chr_name = '
$chr
'
");
$sth
->
execute
;
my
(
$chr_end
)
=
$sth
->
fetchrow_array
();
return
(
$chr_end
);
}
=head2 fetch_all_by_chromosome
...
...
@@ -159,6 +238,11 @@ sub fetch_all_by_chromosome{
$self
->
throw
("
Need a chromosome
")
unless
defined
$chr
;
# return a cached copy of the chromosome bands
if
(
$self
->
{'
_karyotype_band_cache
'}){
return
(
@
{
$self
->
{'
_karyotype_band_cache
'}});
}
my
$sth
=
$self
->
prepare
("
SELECT chr_start,
chr_end,
band,
...
...
@@ -185,6 +269,9 @@ sub fetch_all_by_chromosome{
push
@bands
,
$band_obj
;
}
# save a copy in the local cache
$self
->
{'
_karyotype_band_cache
'}
=
\
@bands
;
return
@bands
;
}
...
...
modules/Bio/EnsEMBL/DBSQL/Obj.pm
View file @
3656484b
...
...
@@ -202,7 +202,8 @@ sub new {
-
ENSDB
=>
$db
,
};
}
#$self->store_mapdb_handle();
# What source of contigoverlaps should we use?
$self
->
contig_overlap_source
(
$contig_overlap_source
)
if
$contig_overlap_source
;
...
...
@@ -242,6 +243,22 @@ sub dbname {
$self
->
{
_dbname
};
}
# make the cunningly stored map DB handle available to everybody
# who wants to play with it...
sub
store_mapdb_handle
{
my
(
$self
,
$arg
)
=
@_
;
my
$dsn
=
"
DBI:
"
.
$self
->
{'
_mapdb
'}
->
{'
-DRIVER
'}
.
"
:database=
"
.
$self
->
{'
_mapdb
'}
->
{'
-DBNAME
'}
.
"
;host=
"
.
$self
->
{'
_mapdb
'}
->
{'
-HOST
'}
.
"
;port=
"
.
$self
->
{'
_mapdb
'}
->
{'
-PORT
'}
;
$self
->
warn
("
Using mapdb DSN
$dsn
");
my
$mapdbh
=
DBI
->
connect
("
$dsn
",
$self
->
{'
_mapdb
'}
->
{'
-USER
'},
$self
->
{'
_mapdb
'}
->
{'
-PASS
'},
{
RaiseError
=>
1
});
$mapdbh
||
$self
->
throw
("
Could not connect to maps database!
");
$self
->
_mapdb_handle
(
$mapdbh
);
}
sub
username
{
my
(
$self
,
$arg
)
=
@_
;
(
defined
$arg
)
&&
...
...
modules/Bio/EnsEMBL/Virtual/StaticContig.pm
View file @
3656484b
...
...
@@ -511,7 +511,10 @@ sub get_all_PredictionFeatures {
# my $id = $self->internal_id();
my
$length
=
$self
->
length
();
if
(
exists
$self
->
{'
_genscan_cache
'}
)
{
return
@
{
$self
->
{'
_genscan_cache
'}};
}
my
$glob_start
=
$self
->
_global_start
;
...
...
@@ -640,6 +643,9 @@ sub get_all_PredictionFeatures {
$previous
=
$hid
;
}
$self
->
{'
_genscan_cache
'}
=
\
@array
;
return
@array
;
}
...
...
@@ -1128,7 +1134,10 @@ sub get_all_Genes_exononly{
unless
(
$idlist
){
return
();
}
if
(
exists
$self
->
{'
_all_Genes_exononly
'}
)
{
return
@
{
$self
->
{'
_all_Genes_exononly
'}};
}
my
$query
=
"
SELECT e.id,e.sticky_rank,et.rank,et.transcript,t.gene,
IF (sgp.raw_ori=1,(e.seq_start+sgp.chr_start-sgp.raw_start-
$glob_start
),
...
...
@@ -1181,9 +1190,9 @@ sub get_all_Genes_exononly{
$current_gene
->
add_Transcript
(
$current_transcript
);
push
(
@trans
,
$current_transcript
);
if
(
$rank
==
1
)
{
$current_transcript
->
is_start_exon_in_context
(
1
);
$current_transcript
->
is_start_exon_in_context
(
'
dummy
',
1
);
}
else
{
$current_transcript
->
is_start_exon_in_context
(
0
);
$current_transcript
->
is_start_exon_in_context
(
'
dummy
',
0
);
}
$current_transcript_id
=
$transcriptid
;
...
...
@@ -1207,6 +1216,7 @@ sub get_all_Genes_exononly{
$exon
->
end
(
$end
);
$exon
->
strand
(
$strand
);
$exon
->
id
(
$exonid
);
$exon
->
seqname
(
$self
->
id
);
$previous_exon
=
$exon
;
$current_transcript
->
add_Exon
(
$exon
);
$current_transcript
->
end_exon_rank
(
$rank
);
...
...
@@ -1223,10 +1233,11 @@ sub get_all_Genes_exononly{
$sth2
->
execute
;
my
(
$rank
)
=
$sth2
->
fetchrow_array
();
if
(
$rank
==
$trans
->
end_exon_rank
)
{
$trans
->
is_end_exon_in_context
(
1
);
$trans
->
is_end_exon_in_context
(
'
dummy
',
1
);
}
else
{
$trans
->
is_end_exon_in_context
(
0
);
$trans
->
is_end_exon_in_context
(
'
dummy
',
0
);
}
}
...
...
@@ -1242,6 +1253,7 @@ sub get_all_Genes_exononly{
$gene_obj
->
_get_description
(
$g
);
}
$self
->
{'
_all_Genes_exononly
'}
=
\
@out
;
return
@out
;
...
...
@@ -1579,7 +1591,70 @@ sub get_all_Genes{
return
@newgenes
;
}
=head2 fetch_chromosome_length
Title : fetch_chromosome_length
Usage : $length_in_bp = $self->fetch_chromosome_length
Function:
Example :
Returns : SV
Args :
=cut
sub
fetch_chromosome_length
{
my
(
$self
,
$chr
)
=
@_
;
unless
(
defined
$chr
){
$chr
=
$self
->
_chr_name
();
}
my
$kba
=
$self
->
dbobj
->
get_KaryotypeBandAdaptor
();
my
$len
=
$kba
->
fetch_chromosome_length
(
$chr
);
return
(
$len
);
}
=head2 fetch_karyotype_adaptor
Title : fetch_karyotype_adaptor
Usage : $band_obj = $self->fetch_karyotype_adaptor
Function:
Example :
Returns : karyotype band adaptor
Args :
=cut
sub
fetch_karyotype_adaptor
{
my
(
$self
,
@args
)
=
@_
;
return
(
$self
->
dbobj
->
get_KaryotypeBandAdaptor
());
}
=head2 fetch_karyotype_band_byname
Title : fetch_karyotype_band_byname
Usage : $band_obj = $self->fetch_karyotype_band_byname
Function:
Example :
Returns : karyotype band object
Args :
=cut
sub
fetch_karyotype_band_by_name
{
my
(
$self
,
$chr
,
$band
)
=
@_
;
my
$kadp
=
$self
->
dbobj
->
get_KaryotypeBandAdaptor
();
my
$band
=
$kadp
->
fetch_by_chromosome_name
(
$chr
,
$band
);
return
$band
;
}
...
...
modules/Bio/EnsEMBL/WebTranscript.pm
View file @
3656484b
...
...
@@ -88,7 +88,7 @@ use Bio::EnsEMBL::Transcript;
=cut
sub
is_start_exon_in_context
{
my
(
$obj
,
$value
)
=
@_
;
my
(
$obj
,
$
dummy
,
$
value
)
=
@_
;
if
(
defined
$value
)
{
$obj
->
{'
is_start_exon_in_context
'}
=
$value
;
}
...
...
@@ -96,7 +96,7 @@ sub is_start_exon_in_context{
}
=head2 is_end_exon_in_context
Title : is_end_exon_in_context
...
...
@@ -110,7 +110,7 @@ sub is_start_exon_in_context{
=cut
sub
is_end_exon_in_context
{
my
(
$obj
,
$value
)
=
@_
;
my
(
$obj
,
$
dummy
,
$
value
)
=
@_
;
if
(
defined
$value
)
{
$obj
->
{'
is_end_exon_in_context
'}
=
$value
;
}
...
...
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