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

lists -> listrefs

parent 5082a608
...@@ -44,7 +44,8 @@ Describe contact details here ...@@ -44,7 +44,8 @@ Describe contact details here
=head1 APPENDIX =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 =cut
......
...@@ -192,62 +192,6 @@ sub ungapped_features { ...@@ -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 =head2 dbID
Arg [1] : int $dbID Arg [1] : int $dbID
...@@ -803,7 +747,7 @@ sub _parse_features { ...@@ -803,7 +747,7 @@ sub _parse_features {
sub _transform_to_rawcontig{ sub _transform_to_RawContig{
my ($self) = @_; my ($self) = @_;
#print STDERR "transforming to raw contig coord\n\n"; #print STDERR "transforming to raw contig coord\n\n";
if(!$self->contig){ if(!$self->contig){
...@@ -820,7 +764,7 @@ sub _transform_to_rawcontig{ ...@@ -820,7 +764,7 @@ sub _transform_to_rawcontig{
my %rc_features; my %rc_features;
foreach my $f(@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); push(@mapped_features, @new_features);
} }
...@@ -850,14 +794,6 @@ sub _transform_to_rawcontig{ ...@@ -850,14 +794,6 @@ sub _transform_to_rawcontig{
sub _transform_between_slices {
my ( $self, $to_slice ) = @_;
}
=head2 _hit_unit =head2 _hit_unit
Args : none Args : none
...@@ -893,7 +829,7 @@ sub _query_unit { ...@@ -893,7 +829,7 @@ sub _query_unit {
} }
sub _transform_feature_to_rawcontig{ sub _transform_feature_to_RawContig{
my($self, $feature) = @_; my($self, $feature) = @_;
my $verbose = 0; my $verbose = 0;
......
...@@ -137,7 +137,7 @@ sub get_all_Genes { ...@@ -137,7 +137,7 @@ sub get_all_Genes {
Example : none Example : none
Description: get RawContig objects from this Clone (either manually added Description: get RawContig objects from this Clone (either manually added
or from the database). or from the database).
Returntype : list of Bio::EnsEMBL::RawContig Returntype : listref of Bio::EnsEMBL::RawContig
Exceptions : none Exceptions : none
Caller : general Caller : general
...@@ -153,11 +153,11 @@ sub get_all_Contigs { ...@@ -153,11 +153,11 @@ sub get_all_Contigs {
#from the database #from the database
unless ($c_list = $self->{'_contig_list'}) { unless ($c_list = $self->{'_contig_list'}) {
my $ra = $self->adaptor->db->get_RawContigAdaptor; 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; $self->{'_contig_list'} = $c_list;
} }
return @$c_list; return $c_list;
} }
...@@ -230,10 +230,11 @@ sub get_rawcontig_by_position { ...@@ -230,10 +230,11 @@ sub get_rawcontig_by_position {
$self->throw("get_rawcontig_by_position error: Position must be > 0"); $self->throw("get_rawcontig_by_position error: Position must be > 0");
} }
my @contigs = $self->get_all_Contigs(); my $contigs = $self->get_all_Contigs();
@contigs = sort { $b->embl_offset <=> $a->embl_offset } @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) { if ($pos > $c->embl_offset) {
return $c; return $c;
} }
......
...@@ -295,17 +295,17 @@ sub add_synonym { ...@@ -295,17 +295,17 @@ sub add_synonym {
=head2 get_synonyms =head2 get_synonyms
Args : none Args : none
Example : none Example : @synonyms = @{$db_entry->get_all_synonyms()};
Description: get a list of synonym added to this object Description: get a list of synonym added to this object
Returntype : list of string Returntype : list reference of strings
Exceptions : none Exceptions : none
Caller : general Caller : general
=cut =cut
sub get_synonyms { sub get_all_synonyms {
my $self = shift; my $self = shift;
return @{$self->{_synonyms}}; return $self->{_synonyms};
} }
...@@ -367,4 +367,24 @@ sub comment { ...@@ -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; 1;
...@@ -84,7 +84,7 @@ sub new { ...@@ -84,7 +84,7 @@ sub new {
Example : my @analysis = $analysis_adaptor->fetch_all() Example : my @analysis = $analysis_adaptor->fetch_all()
Description: fetches all of the Analysis objects from the database and caches Description: fetches all of the Analysis objects from the database and caches
them internally. them internally.
Returntype : list of Bio::EnsEMBL::Analysis retrieved from the database Returntype : listref of Bio::EnsEMBL::Analysis retrieved from the database
Exceptions : none Exceptions : none
Caller : AnalysisAdaptor::new Caller : AnalysisAdaptor::new
...@@ -114,7 +114,7 @@ sub fetch_all { ...@@ -114,7 +114,7 @@ sub fetch_all {
$self->{_logic_name_cache}->{$analysis->logic_name()} = $analysis; $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; ...@@ -67,7 +67,7 @@ use Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor;
are on the contig defined by $cid and with a percentage id are on the contig defined by $cid and with a percentage id
greater than $pid. If logic name is defined, only features greater than $pid. If logic name is defined, only features
with an analysis of type $logic_name will be returned. 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 Exceptions : thrown if $pid is not defined
Caller : general Caller : general
...@@ -82,10 +82,7 @@ sub fetch_by_Contig_and_pid { ...@@ -82,10 +82,7 @@ sub fetch_by_Contig_and_pid {
$constraint = "perc_ident > $pid"; $constraint = "perc_ident > $pid";
} }
my @features = return $self->fetch_by_Contig_constraint($contig, $constraint, $logic_name);
$self->fetch_by_Contig_constraint($contig, $constraint, $logic_name);
return @features;
} }
...@@ -102,7 +99,7 @@ sub fetch_by_Contig_and_pid { ...@@ -102,7 +99,7 @@ sub fetch_by_Contig_and_pid {
are on the Slice $slice and with a percentage id are on the Slice $slice and with a percentage id
greater than $pid. If logic name is defined, only features greater than $pid. If logic name is defined, only features
with an analysis of type $logic_name will be returned. 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 Exceptions : thrown if pid is not defined
Caller : general Caller : general
......
...@@ -192,7 +192,7 @@ sub fetch_by_Contig_constraint { ...@@ -192,7 +192,7 @@ sub fetch_by_Contig_constraint {
$constraint = "contig_id = $cid"; $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{ ...@@ -154,7 +154,7 @@ sub fetch_by_chr_name{
Args : none Args : none
Example : @chromosomes = $chromosome_adaptor->fetch_all(); Example : @chromosomes = $chromosome_adaptor->fetch_all();
Description: Retrieves every chromosome object from the database. Description: Retrieves every chromosome object from the database.
Returntype : list of Bio::EnsEMBL::Chromosome Returntype : listref of Bio::EnsEMBL::Chromosome
Exceptions : none Exceptions : none
Caller : general Caller : general
...@@ -189,7 +189,7 @@ sub fetch_all { ...@@ -189,7 +189,7 @@ sub fetch_all {
push @chrs, $chr; push @chrs, $chr;
} }
return @chrs; return \@chrs;
} }
...@@ -230,6 +230,9 @@ sub get_dbID_by_chr_name { ...@@ -230,6 +230,9 @@ sub get_dbID_by_chr_name {
} }
=head2 get_landmark_MarkerFeatures =head2 get_landmark_MarkerFeatures
Arg [1] : none Arg [1] : none
......
...@@ -223,7 +223,7 @@ sub fetch_by_dbID { ...@@ -223,7 +223,7 @@ sub fetch_by_dbID {
Arg [1] : none Arg [1] : none
Example : @clones = $clone_adaptor->fetch_all(); Example : @clones = $clone_adaptor->fetch_all();
Description: Retrieves every clone from the database. Description: Retrieves every clone from the database.
Returntype : Bio::EnsEMBL::Clone Returntype : listref of Bio::EnsEMBL::Clone
Exceptions : none Exceptions : none
Caller : none Caller : none
...@@ -253,7 +253,7 @@ sub fetch_all { ...@@ -253,7 +253,7 @@ sub fetch_all {
$created, $modified); $created, $modified);
} }
return @clones; return \@clones;
} }
...@@ -264,7 +264,7 @@ sub fetch_all { ...@@ -264,7 +264,7 @@ sub fetch_all {
the EMBL accession of the clone versions to retrieve the EMBL accession of the clone versions to retrieve
Example : @vers = $clone->list_embl_version_by_accession($accession) Example : @vers = $clone->list_embl_version_by_accession($accession)
Description: Returns a list of versions for a given EMBL 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 Exceptions : thrown if $id arg is not defined or if no clone with accession
$id exists in the database $id exists in the database
Caller : general Caller : general
...@@ -291,7 +291,7 @@ sub list_embl_version_by_accession { ...@@ -291,7 +291,7 @@ sub list_embl_version_by_accession {
$self->throw("no clone $id") unless scalar @vers > 0; $self->throw("no clone $id") unless scalar @vers > 0;
return @vers; return \@vers;
} }
...@@ -364,9 +364,9 @@ sub delete_by_dbID { ...@@ -364,9 +364,9 @@ sub delete_by_dbID {
retrieved retrieved
Example : my @genes = $clone_adaptor->get_all_Genes('AC011082'); Example : my @genes = $clone_adaptor->get_all_Genes('AC011082');
Description: Retrieves a list of Gene objects which are present on a clone. 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. 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 Exceptions : thrown if $clone_id is not defined
Caller : Clone::get_all_Genes Caller : Clone::get_all_Genes
...@@ -400,7 +400,7 @@ sub get_all_Genes { ...@@ -400,7 +400,7 @@ sub get_all_Genes {
$got{$gene_id} = 1; $got{$gene_id} = 1;
} }
} }
return @genes; return \@genes;
} }
......
...@@ -303,14 +303,15 @@ sub store { ...@@ -303,14 +303,15 @@ sub store {
=head2 fetch_by_gene =head2 fetch_by_Gene
Arg [1] : Arg [1] : Bio::EnsEMBL::Gene $gene
Example : The gene to retrienve DBEntries for
Description: Example : @db_entries = @{$db_entry_adaptor->fetch_by_Gene($gene)};
Returntype : Description: This should be changed, it modifies the gene passed in
Exceptions : Returntype : listref of Bio::EnsEMBL::DBEntries
Caller : Exceptions : none
Caller : Bio::EnsEMBL::Gene
=cut =cut
...@@ -324,49 +325,49 @@ sub fetch_by_Gene { ...@@ -324,49 +325,49 @@ sub fetch_by_Gene {
$sth1->execute( $gene->dbID ); $sth1->execute( $gene->dbID );
while (my $transid = $sth1->fetchrow) { while (my $transid = $sth1->fetchrow) {
my $translation_xrefs =
my @translation_xrefs = $self->_fetch_by_EnsObject_type( $transid, 'Translation' ); $self->_fetch_by_object_type( $transid, 'Translation' );
foreach my $translink(@translation_xrefs) { foreach my $translink(@$translation_xrefs) {
$gene->add_DBLink($translink); $gene->add_DBLink($translink);
} }
} }
my @genelinks = $self->_fetch_by_EnsObject_type( $gene->stable_id, 'Gene' ); my $genelinks = $self->_fetch_by_object_type( $gene->stable_id, 'Gene' );
foreach my $genelink ( @genelinks ) { foreach my $genelink ( @$genelinks ) {
$gene->add_DBLink( $genelink ); $gene->add_DBLink( $genelink );
} }
} }
=head2 fetch_by_rawContig =head2 fetch_by_RawContig
Arg [1] : Arg [1] : Bio::EnsEMBL::RawContig $contig
Example : Example : @db_entries = @{$db_entry_adaptor->fetch_by_RawContig($contig)}
Description: Description: Retrieves a list of RawContigs for this object
Returntype : Returntype : listref of Bio::EnsEMBL::DBEntries
Exceptions : Exceptions : none
Caller : Caller : general
=cut =cut
sub fetch_by_rawContig { sub fetch_by_RawContig {
my ( $self, $rawContigId ) = @_; my ( $self, $contig ) = @_;
return $self->_fetch_by_EnsObject_type( $rawContigId, 'RawContig' ); return $self->_fetch_by_object_type( $rawContigId, 'RawContig' );
} }
=head2 fetch_by_transcript =head2 fetch_by_Transcript
Arg [1] : Arg [1] : Bio::EnsEMBL::Transcript
Example : Example :
Description: Description: This should be changed, it modifies the transcipt passed in
Returntype : Returntype :
Exceptions : Exceptions :
Caller : Caller :
=cut =cut
sub fetch_by_transcript { sub fetch_by_Transcript {
my ( $self, $trans ) = @_; my ( $self, $trans ) = @_;
my $query1 = "SELECT t.translation_id my $query1 = "SELECT t.translation_id
...@@ -383,34 +384,35 @@ sub fetch_by_transcript { ...@@ -383,34 +384,35 @@ sub fetch_by_transcript {
# #
while (my $transid = $sth1->fetchrow) { while (my $transid = $sth1->fetchrow) {
my @translation_xrefs = $self->_fetch_by_EnsObject_type( $transid, 'Translation' ); my $translation_xrefs = $self->_fetch_by_object_type( $transid,
foreach my $translink(@translation_xrefs) { 'Translation' );
$trans->add_DBLink($translink); foreach my $translink(@$translation_xrefs) {
} $trans->add_DBLink($translink);
}
} }
} }
=head2 fetch_by_translation =head2 fetch_by_Translation
Arg [1] : Arg [1] : Bio::EnsEMBL::Translation $trans
Example : The translation to fetch database entries for
Description: