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
a85f6b1e
Commit
a85f6b1e
authored
Apr 24, 2012
by
Kieron Taylor
😠
Browse files
Copied fetch_all_by_biotype from GeneAdaptor to TranscriptAdaptor.
parent
f99c5816
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
1 deletion
+59
-1
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
+47
-0
modules/t/transcript.t
modules/t/transcript.t
+12
-1
No files found.
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
View file @
a85f6b1e
...
...
@@ -684,6 +684,53 @@ sub fetch_all_by_exon_stable_id {
return
\
@trans
;
}
=head2 fetch_all_by_biotype
Arg [1] : String $biotype
listref of $biotypes
The biotype of the gene to retrieve. You can also have a reference
to a list of biotypes in the event of needing several.
Example : $transcript = $transcript_adaptor->fetch_all_by_biotype('pseudogene');
$transcript = $transcript_adaptor->fetch_all_by_biotype(['protein_coding','ambiguous_orf']);
Description: Retrieves an array reference of transcript objects from the
database via its biotype or biotypes.
The transcript will be retrieved in its native coordinate system
(i.e. in the coordinate system it is stored in the database).
It may be converted to a different coordinate system through a
call to transform() or transfer(). If the transcript is not found
undef is returned instead.
Returntype : listref of Bio::EnsEMBL::Transcript
Exceptions : if we cant get the transcript in given coord system
Caller : general
Status : Stable
=cut
sub
fetch_all_by_biotype
{
my
(
$self
,
$biotype
)
=
@_
;
if
(
!
defined
$biotype
){
throw
("
Biotype or listref of biotypes expected
");
}
my
$constraint
;
if
(
ref
(
$biotype
)
eq
'
ARRAY
'){
$constraint
=
"
t.biotype IN (
";
foreach
my
$b
(
@
{
$biotype
}){
$constraint
.=
"
?,
";
$self
->
bind_param_generic_fetch
(
$b
,
SQL_VARCHAR
);
}
chop
(
$constraint
);
#remove last , from expression
$constraint
.=
"
) and t.is_current = 1
";
}
else
{
$constraint
=
"
t.biotype = ? and t.is_current = 1
";
$self
->
bind_param_generic_fetch
(
$biotype
,
SQL_VARCHAR
);
}
my
@transcripts
=
@
{
$self
->
generic_fetch
(
$constraint
)
};
return
\
@transcripts
;
}
=head2 store
...
...
modules/t/transcript.t
View file @
a85f6b1e
...
...
@@ -258,6 +258,17 @@ ok($tr && $tr->stable_id eq 'ENST00000201961');
ok
(
$tr
->
display_id
()
eq
$tr
->
stable_id
());
#
# test TranscriptAdaptor::fetch_all_by_biotype
#
debug
("
Test fetch_all_by_biotype
");
my
@transcripts
=
@
{
$ta
->
fetch_all_by_biotype
('
protein_coding
')};
ok
(
@transcripts
==
25
);
@transcripts
=
@
{
$ta
->
fetch_all_by_biotype
(['
protein_coding
','
pseudogene
'])};
warn
"
Got
"
.
scalar
(
@transcripts
)
.
"
transcripts
\n
";
ok
(
@transcripts
==
25
);
#
# Test get_all_Introns by joining Exons and introns
# and comparing it to the original
...
...
@@ -506,7 +517,7 @@ $tr = $ta->fetch_by_stable_id('ENST00000355555');
debug
("
fetch_by_stable_id
");
ok
(
$tr
->
dbID
==
21740
);
my
@transcripts
=
@
{
$ta
->
fetch_all_versions_by_stable_id
('
ENST00000355555
')
};
@transcripts
=
@
{
$ta
->
fetch_all_versions_by_stable_id
('
ENST00000355555
')
};
debug
("
fetch_all_versions_by_stable_id
");
ok
(
scalar
(
@transcripts
)
==
1
);
...
...
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