Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
cc9bc6f9
Commit
cc9bc6f9
authored
11 years ago
by
Alessandro Vullo
Browse files
Options
Downloads
Patches
Plain Diff
fetch_all_by_biotype as in GeneAdaptor, which implies the inclusion of method biotype_contraint
Added method count_all_by_biotype as in GeneAdaptor.
parent
706dd65f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
+52
-77
52 additions, 77 deletions
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
with
52 additions
and
77 deletions
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
+
52
−
77
View file @
cc9bc6f9
...
...
@@ -706,100 +706,75 @@ sub fetch_all_by_exon_stable_id {
return
\
@trans
;
}
=head2 fetch_all_by_source
Arg [1] : String $source
listref of $sources
The source of the transcript to retrieve. You can also have a reference
to a list of sources in the event of needing several.
Example : $transcript = $transcript_adaptor->fetch_all_by_source('ensembl');
$
transcript
= $transcript_adaptor->fetch_all_by_
source(['ensembl','another_source']
);
Description: Retrieves an array refer
en
c
e
of
transcript
objects from the
database via its
source or sourc
es.
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
=head2 fetch_all_by_biotype
Arg [1] : String $biotype
listref of $biotypes
The biotype of the transcript to retrieve. You can have as an argument a reference
to a list of biotypes
Example
:
$
gene
= $transcript_adaptor->fetch_all_by_
biotype('protein_coding'
);
$g
ene
= $
transcript
_adaptor->fetch_all_by_biotypes(['protein_coding', 'sRNA', 'miRNA']);
Description: Retrieves an array reference of transcript objects from the
database via its
biotype or biotyp
es.
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
gene or exon
is not found
undef is returned instead.
Returntype : listref of Bio::EnsEMBL::Transcript
Exceptions : if we cant get the
transcript
in given coord system
Returntype
: listref of Bio::EnsEMBL::Transcript
Exceptions : if we cant get the
gene
in given coord system
Caller : general
Status : Stable
=cut
sub
fetch_all_by_source
{
my
(
$self
,
$source
)
=
@_
;
if
(
!
defined
$source
){
throw
("
Source or listref of sources expected
");
}
my
$constraint
;
if
(
ref
(
$source
)
eq
'
ARRAY
'){
$constraint
=
"
t.source IN (
";
foreach
my
$s
(
@
{
$source
}){
$constraint
.=
"
?,
";
$self
->
bind_param_generic_fetch
(
$s
,
SQL_VARCHAR
);
}
chop
(
$constraint
);
#remove last , from expression
$constraint
.=
"
) and t.is_current = 1
";
}
else
{
$constraint
=
"
t.source = ? and t.is_current = 1
";
$self
->
bind_param_generic_fetch
(
$source
,
SQL_VARCHAR
);
}
my
@transcripts
=
@
{
$self
->
generic_fetch
(
$constraint
)
};
return
\
@transcripts
;
sub
fetch_all_by_biotype
{
my
(
$self
,
$biotype
)
=
@_
;
my
@transcripts
=
@
{
$self
->
generic_fetch
(
$self
->
biotype_constraint
(
$biotype
))};
return
\
@transcripts
;
}
=head2
fetch_all_by_biotype
=head2
biotype_constraint
Arg [1] : String $biotype
Arg [1] : String $biotype
s
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
The biotype of the transcript to retrieve. You can have as an argument a reference
to a list of biotypes
Description: Used internally to generate a SQL constraint to restrict a transcript query by biotype
Returntype : String
Exceptions : If biotype is not supplied
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
;
sub
biotype_constraint
{
my
(
$self
,
$biotypes
,
$inline_variables
)
=
@_
;
my
$constraint
=
"
t.is_current = 1
";
my
$in_statement
=
$self
->
generate_in_constraint
(
$biotypes
,
'
t.biotype
',
SQL_VARCHAR
,
$inline_variables
);
$constraint
.=
"
and
$in_statement
";
return
$constraint
;
}
=head2 count_all_by_biotype
Arg [1] : String $biotype
listref of $biotypes
The biotype of the transcript to retrieve. You can have as an argument a reference
to a list of biotypes
Example : $cnt = $transcript_adaptor->count_all_by_biotype('protein_coding');
$cnt = $transcript_adaptor->count_all_by_biotypes(['protein_coding', 'sRNA', 'miRNA']);
Description : Retrieves count of transcript objects from the database via its biotype or biotypes.
Returntype : integer
Caller : general
Status : Stable
=cut
sub
count_all_by_biotype
{
my
(
$self
,
$biotype
)
=
@_
;
return
$self
->
generic_count
(
$self
->
biotype_constraint
(
$biotype
));
}
=head2 store
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment