Commit cb9c682b authored by Graham McVicker's avatar Graham McVicker
Browse files

lists -> listrefs

parent 5082a608
......@@ -44,7 +44,8 @@ Describe contact details here
=head1 APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
=cut
......
......@@ -192,62 +192,6 @@ sub ungapped_features {
=head2 transform
Arg [1] : Bio::EnsEMBL::Slice $slice
Example : none
Description: if argument is given, transforms this feature into the slice
coordinate system, invalidating this one.
if no argument is given, transforms this feature into raw contig
coordinates, invalidating this one.
The process can produce more than one feature so we return an array.
Returntype : list of Bio::EnsEMBL::BaseAlignFeature
Exceptions : none
Caller : general
=cut
sub transform{
my ($self, $slice) = @_;
#print "transforming ".$self." to ".$slice." coords\n";
if( ! defined $slice ) {
#Since slice arg is not defined - we want raw contig coords
if(( defined $self->contig ) &&
( $self->contig->isa( "Bio::EnsEMBL::RawContig" )) ) {
# print STDERR "BaseAlignFeature::transform, you are already apparently in rawcontig coords so why try to transform to them\n";
#we are already in rawcontig coords, nothing needs to be done
return $self;
} else {
#transform to raw_contig coords from Slice coords
my @array = $self->_transform_to_rawcontig();
# print "transform to rawcontig has returned ".@array." features\n";
# foreach my $a(@array){
# print "feature is ".$a."\n";
# }
return @array;
}
}
if( defined $self->contig ) {
if($self->contig->isa( "Bio::EnsEMBL::RawContig" )) {
#transform to slice coords from raw contig coords
return $self->_transform_to_slice( $slice );
} elsif($self->contig->isa( "Bio::EnsEMBL::Slice" )) {
#transform to slice coords from other slice coords
return $self->_transform_between_slices( $slice );
} else {
#Unknown contig type - throw an exception
return $self->throw("Exon's 'contig' is of unknown type "
. $self->contig() . " - cannot transform to Slice coords");
}
} else {
#Can't convert to slice coords without a contig to work with
return $self->throw("Exon's contig is not defined - cannot transform to " .
"Slice coords");
}
}
=head2 dbID
Arg [1] : int $dbID
......@@ -803,7 +747,7 @@ sub _parse_features {
sub _transform_to_rawcontig{
sub _transform_to_RawContig{
my ($self) = @_;
#print STDERR "transforming to raw contig coord\n\n";
if(!$self->contig){
......@@ -820,7 +764,7 @@ sub _transform_to_rawcontig{
my %rc_features;
foreach my $f(@features){
my @new_features = $self->_transform_feature_to_rawcontig($f);
my @new_features = $self->_transform_feature_to_RawContig($f);
push(@mapped_features, @new_features);
}
......@@ -850,14 +794,6 @@ sub _transform_to_rawcontig{
sub _transform_between_slices {
my ( $self, $to_slice ) = @_;
}
=head2 _hit_unit
Args : none
......@@ -893,7 +829,7 @@ sub _query_unit {
}
sub _transform_feature_to_rawcontig{
sub _transform_feature_to_RawContig{
my($self, $feature) = @_;
my $verbose = 0;
......
......@@ -137,7 +137,7 @@ sub get_all_Genes {
Example : none
Description: get RawContig objects from this Clone (either manually added
or from the database).
Returntype : list of Bio::EnsEMBL::RawContig
Returntype : listref of Bio::EnsEMBL::RawContig
Exceptions : none
Caller : general
......@@ -153,11 +153,11 @@ sub get_all_Contigs {
#from the database
unless ($c_list = $self->{'_contig_list'}) {
my $ra = $self->adaptor->db->get_RawContigAdaptor;
$c_list = $ra->fetch_by_clone($self);
$c_list = $ra->fetch_by_Clone($self);
$self->{'_contig_list'} = $c_list;
}
return @$c_list;
return $c_list;
}
......@@ -230,10 +230,11 @@ sub get_rawcontig_by_position {
$self->throw("get_rawcontig_by_position error: Position must be > 0");
}
my @contigs = $self->get_all_Contigs();
@contigs = sort { $b->embl_offset <=> $a->embl_offset } @contigs;
my $contigs = $self->get_all_Contigs();
my @sorted_contigs =
sort { $b->embl_offset <=> $a->embl_offset } @$contigs;
foreach my $c ( @contigs ) {
foreach my $c ( @sorted_contigs ) {
if ($pos > $c->embl_offset) {
return $c;
}
......
......@@ -295,17 +295,17 @@ sub add_synonym {
=head2 get_synonyms
Args : none
Example : none
Example : @synonyms = @{$db_entry->get_all_synonyms()};
Description: get a list of synonym added to this object
Returntype : list of string
Returntype : list reference of strings
Exceptions : none
Caller : general
=cut
sub get_synonyms {
sub get_all_synonyms {
my $self = shift;
return @{$self->{_synonyms}};
return $self->{_synonyms};
}
......@@ -367,4 +367,24 @@ sub comment {
}
}
=head2 get_synonyms
Arg [1] : none
Example : none
Description: DEPRECATED use get_all_synonyms instead
Returntype : none
Exceptions : none
Caller : none
=cut
sub get_synonyms {
my $self = shift;
$self->warn("get_synonyms has been rename get_all_synonyms\n" . caller);
return $self->get_all_synonyms;
}
1;
......@@ -84,7 +84,7 @@ sub new {
Example : my @analysis = $analysis_adaptor->fetch_all()
Description: fetches all of the Analysis objects from the database and caches
them internally.
Returntype : list of Bio::EnsEMBL::Analysis retrieved from the database
Returntype : listref of Bio::EnsEMBL::Analysis retrieved from the database
Exceptions : none
Caller : AnalysisAdaptor::new
......@@ -114,7 +114,7 @@ sub fetch_all {
$self->{_logic_name_cache}->{$analysis->logic_name()} = $analysis;
}
return values %{$self->{_cache}};
return \{values %{$self->{_cache}}};
}
......
......@@ -67,7 +67,7 @@ use Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor;
are on the contig defined by $cid and with a percentage id
greater than $pid. If logic name is defined, only features
with an analysis of type $logic_name will be returned.
Returntype : list of Bio::EnsEMBL::*AlignFeature in contig coordinates
Returntype : listref of Bio::EnsEMBL::*AlignFeature in contig coordinates
Exceptions : thrown if $pid is not defined
Caller : general
......@@ -82,10 +82,7 @@ sub fetch_by_Contig_and_pid {
$constraint = "perc_ident > $pid";
}
my @features =
$self->fetch_by_Contig_constraint($contig, $constraint, $logic_name);
return @features;
return $self->fetch_by_Contig_constraint($contig, $constraint, $logic_name);
}
......@@ -102,7 +99,7 @@ sub fetch_by_Contig_and_pid {
are on the Slice $slice and with a percentage id
greater than $pid. If logic name is defined, only features
with an analysis of type $logic_name will be returned.
Returntype : list of Bio::EnsEMBL::*AlignFeature in Slice coordinates
Returntype : listref of Bio::EnsEMBL::BaseAlignFeatures in Slice coordinates
Exceptions : thrown if pid is not defined
Caller : general
......
......@@ -192,7 +192,7 @@ sub fetch_by_Contig_constraint {
$constraint = "contig_id = $cid";
}
return @{$self->generic_fetch($constraint, $logic_name)};
return $self->generic_fetch($constraint, $logic_name);
}
......
......@@ -154,7 +154,7 @@ sub fetch_by_chr_name{
Args : none
Example : @chromosomes = $chromosome_adaptor->fetch_all();
Description: Retrieves every chromosome object from the database.
Returntype : list of Bio::EnsEMBL::Chromosome
Returntype : listref of Bio::EnsEMBL::Chromosome
Exceptions : none
Caller : general
......@@ -189,7 +189,7 @@ sub fetch_all {
push @chrs, $chr;
}
return @chrs;
return \@chrs;
}
......@@ -230,6 +230,9 @@ sub get_dbID_by_chr_name {
}
=head2 get_landmark_MarkerFeatures
Arg [1] : none
......
......@@ -223,7 +223,7 @@ sub fetch_by_dbID {
Arg [1] : none
Example : @clones = $clone_adaptor->fetch_all();
Description: Retrieves every clone from the database.
Returntype : Bio::EnsEMBL::Clone
Returntype : listref of Bio::EnsEMBL::Clone
Exceptions : none
Caller : none
......@@ -253,7 +253,7 @@ sub fetch_all {
$created, $modified);
}
return @clones;
return \@clones;
}
......@@ -264,7 +264,7 @@ sub fetch_all {
the EMBL accession of the clone versions to retrieve
Example : @vers = $clone->list_embl_version_by_accession($accession)
Description: Returns a list of versions for a given EMBL accession
Returntype : list of ints
Returntype : listref of ints
Exceptions : thrown if $id arg is not defined or if no clone with accession
$id exists in the database
Caller : general
......@@ -291,7 +291,7 @@ sub list_embl_version_by_accession {
$self->throw("no clone $id") unless scalar @vers > 0;
return @vers;
return \@vers;
}
......@@ -364,9 +364,9 @@ sub delete_by_dbID {
retrieved
Example : my @genes = $clone_adaptor->get_all_Genes('AC011082');
Description: Retrieves a list of Gene objects which are present on a clone.
It might be better to have this on the gene adaptor but
It would be better to have this on the gene adaptor but
for now it will stay here.
Returntype : list of Bio::EnsEMBL::Genes
Returntype : listref of Bio::EnsEMBL::Genes
Exceptions : thrown if $clone_id is not defined
Caller : Clone::get_all_Genes
......@@ -400,7 +400,7 @@ sub get_all_Genes {
$got{$gene_id} = 1;
}
}
return @genes;
return \@genes;
}
......
......@@ -303,14 +303,15 @@ sub store {
=head2 fetch_by_gene
=head2 fetch_by_Gene
Arg [1] :
Example :
Description:
Returntype :
Exceptions :
Caller :
Arg [1] : Bio::EnsEMBL::Gene $gene
The gene to retrienve DBEntries for
Example : @db_entries = @{$db_entry_adaptor->fetch_by_Gene($gene)};
Description: This should be changed, it modifies the gene passed in
Returntype : listref of Bio::EnsEMBL::DBEntries
Exceptions : none
Caller : Bio::EnsEMBL::Gene
=cut
......@@ -324,49 +325,49 @@ sub fetch_by_Gene {
$sth1->execute( $gene->dbID );
while (my $transid = $sth1->fetchrow) {
my @translation_xrefs = $self->_fetch_by_EnsObject_type( $transid, 'Translation' );
foreach my $translink(@translation_xrefs) {
my $translation_xrefs =
$self->_fetch_by_object_type( $transid, 'Translation' );
foreach my $translink(@$translation_xrefs) {
$gene->add_DBLink($translink);
}
}
my @genelinks = $self->_fetch_by_EnsObject_type( $gene->stable_id, 'Gene' );
foreach my $genelink ( @genelinks ) {
my $genelinks = $self->_fetch_by_object_type( $gene->stable_id, 'Gene' );
foreach my $genelink ( @$genelinks ) {
$gene->add_DBLink( $genelink );
}
}
=head2 fetch_by_rawContig
=head2 fetch_by_RawContig
Arg [1] :
Example :
Description:
Returntype :
Exceptions :
Caller :
Arg [1] : Bio::EnsEMBL::RawContig $contig
Example : @db_entries = @{$db_entry_adaptor->fetch_by_RawContig($contig)}
Description: Retrieves a list of RawContigs for this object
Returntype : listref of Bio::EnsEMBL::DBEntries
Exceptions : none
Caller : general
=cut
sub fetch_by_rawContig {
my ( $self, $rawContigId ) = @_;
return $self->_fetch_by_EnsObject_type( $rawContigId, 'RawContig' );
sub fetch_by_RawContig {
my ( $self, $contig ) = @_;
return $self->_fetch_by_object_type( $rawContigId, 'RawContig' );
}
=head2 fetch_by_transcript
=head2 fetch_by_Transcript
Arg [1] :
Arg [1] : Bio::EnsEMBL::Transcript
Example :
Description:
Description: This should be changed, it modifies the transcipt passed in
Returntype :
Exceptions :
Caller :
=cut
sub fetch_by_transcript {
sub fetch_by_Transcript {
my ( $self, $trans ) = @_;
my $query1 = "SELECT t.translation_id
......@@ -383,34 +384,35 @@ sub fetch_by_transcript {
#
while (my $transid = $sth1->fetchrow) {
my @translation_xrefs = $self->_fetch_by_EnsObject_type( $transid, 'Translation' );
foreach my $translink(@translation_xrefs) {
my $translation_xrefs = $self->_fetch_by_object_type( $transid,
'Translation' );
foreach my $translink(@$translation_xrefs) {
$trans->add_DBLink($translink);
}
}
}
=head2 fetch_by_translation
=head2 fetch_by_Translation
Arg [1] :
Example :
Description:
Returntype :
Exceptions :
Caller :
Arg [1] : Bio::EnsEMBL::Translation $trans
The translation to fetch database entries for
Example : @db_entries = @{$db_entry_adptr->fetch_by_Translation($trans)};
Description: Retrieves external database entries for an EnsEMBL translation
Returntype : listref of dbEntries to obtain
Exceptions : none
Caller : general
=cut
sub fetch_by_translation {
my ( $self, $trslId ) = @_;
return $self->_fetch_by_EnsObject_type( $trslId, 'Translation' );
sub fetch_by_Translation {
my ( $self, $trans ) = @_;
return $self->_fetch_by_object_type( $trans->dbID(), 'Translation' );
}
=head2 fetch_by_EnsObject_type
=head2 fetch_by_object_type
Arg [1] :
Example :
......@@ -421,15 +423,19 @@ sub fetch_by_translation {
=cut
sub _fetch_by_EnsObject_type {
sub _fetch_by_object_type {
my ( $self, $ensObj, $ensType ) = @_;
my @out;
my $sth = $self->prepare("
SELECT xref.xref_id, xref.dbprimary_acc, xref.display_label,
xref.version, xref.description,
exDB.db_name, exDB.release, oxr.object_xref_id, es.synonym, idt.query_identity, idt.target_identity
FROM xref, external_db exDB, object_xref oxr LEFT JOIN external_synonym es on es.xref_id = xref.xref_id
SELECT xref.xref_id, xref.dbprimary_acc, xref.display_label, xref.version,
xref.description,
exDB.db_name, exDB.release,
oxr.object_xref_id,
es.synonym,
idt.query_identity, idt.target_identity
FROM xref xref, external_db exDB, object_xref oxr
LEFT JOIN external_synonym es on es.xref_id = xref.xref_id
LEFT JOIN identity_xref idt on idt.object_xref_id = oxr.object_xref_id
WHERE xref.xref_id = oxr.xref_id
AND xref.external_db_id = exDB.external_db_id
......@@ -443,9 +449,9 @@ sub _fetch_by_EnsObject_type {
my %seen;
while ( my $arrRef = $sth->fetchrow_arrayref() ) {
my ( $refID, $dbprimaryId, $displayid, $version, $desc, $dbname, $release, $objid,
$synonym, $queryid, $targetid ) =
@$arrRef;
my ( $refID, $dbprimaryId, $displayid, $version,
$desc, $dbname, $release, $objid,
$synonym, $queryid, $targetid ) = @$arrRef;
my $exDB;
......@@ -493,7 +499,7 @@ sub _fetch_by_EnsObject_type {
#}
} # while <a row from database>
return @out;
return \out;
}
......@@ -718,20 +724,78 @@ sub create_tables {
}
1;
=head2 fetch_by_translation
__END__
Arg [1] : none
Example : none
Description: DEPRECATED use fetch_by_Translation instead
Returntype : none
Exceptions : none
Caller : none
=cut
sub fetch_by_translation {
my ($self, $trans_id) = @_;
$self->warn("fetch_by_translation has been renamed fetch_by_Translation");
my $trans = $self->db->get_TranslationAdaptor->fetch_by_dbID($trans_id);
# remove the tables from database
sub delete_tables {
return $self->fetch_by_Translation($trans);
}
# check if tables exist
sub exists_tables {
=head2 fetch_by_rawContig
Arg [1] : none
Example : none
Description: DEPRECATED use Bio::EnsEMBL::fetch_by_rawContig instead
Returntype : none
Exceptions : none
Caller : none
=cut
sub fetch_by_rawContig {
my ( $self, $rawContigId ) = @_;
$self->warn("fetch_by_rawContig has been renamed fetch_by_RawContig");
my $contig =
$self->db->get_RawContigAdaptor->fetch_by_dbID($rawContigID);
return $self->fetch_by_RawContig( $contig );
}
=head2 fetch_by_transcript
Arg [1] : none
Example : none
Description: DEPRECATED fetch_by_Transcript instead
Returntype : none
Exceptions : none
Caller : none
=cut
sub fetch_by_transcript {
my ( $self, $trans ) = @_;
$self->warn("fetch_by_transcript has been renamed fetch_by_Transcript");
return $self->fetch_by_Transcript($trans);
}
1;
__END__
Objectxref
=============
ensembl_id varchar, later int
......
......@@ -121,26 +121,26 @@ sub fetch_by_stable_id {
=head2 fetch_by_geneId