LICENSE
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2024] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
CONTACT
Please email comments or questions to the public Ensembl
developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
Questions may also be sent to the Ensembl help desk at
<http://www.ensembl.org/Help/Contact>.
NAME
Bio::EnsEMBL::AltAlleleGroup
SYNOPSIS
use Bio::EnsEMBL::AltAlleleGroup;
use Bio::EnsEMBL::DBSQL::AltAlleleGroupAdaptor;
my $aag_adaptor = Bio::EnsEMBL::Registry->get_DBAdaptor("Human","core","AltAlleleGroup");
# For a known Gene, find the reference alternative allele
my $aag = $aag_adaptor->fetch_Group_by_dbID($gene->dbID);
my $reference_gene = $aag->get_representative_Gene;
# Get a list of AltAlleleGroups
my $list = $aag_adaptor->fetch_all_Groups_by_type('HAS_CODING_POTENTIAL');
$list = $aag_adaptor->fetch_all_Groups();
while ($aag = shift @$list) {
$aag->get_all_Genes;
# Do your important things ...
}
# Creating and editing an AltAlleleGroup
my %type_flags = ('IS_MOST_COMMON_ALLELE' => '1','AUTOMATICALLY_ASSIGNED' => '1');
$aag = Bio::EnsEMBL::AltAlleleGroup->new(
-MEMBERS => [ [$gene_id,\%type_flags ] ],
);
$aag->remove_all_members;
$aag->add_member($gene_id,\%type_flags);
my $dbID = $aag_adaptor->store($aag);
DESCRIPTION
Alt allele groups keep track of which alleles are tied to a particular Gene
They allow related genes to be located. This class allows fetching of both
IDs and fully fledged Gene objects.
AltAlleleGroup members are assigned types to differentiate them by their
origin. These types are set as flags, allowing you to select the union of
types as well as by individual ones.
No flags set denotes a situation of no information.
Valid flags are as follows:
'IS_REPRESENTATIVE',
'IS_MOST_COMMON_ALLELE',
'IN_CORRECTED_ASSEMBLY',
'HAS_CODING_POTENTIAL',
'IN_ARTIFICIALLY_DUPLICATED_ASSEMBLY',
'IN_SYNTENIC_REGION',
'HAS_SAME_UNDERLYING_DNA_SEQUENCE',
'IN_BROKEN_ASSEMBLY_REGION',
'IS_VALID_ALTERNATE',
'SAME_AS_REPRESENTATIVE',
'SAME_AS_ANOTHER_ALLELE',
'MANUALLY_ASSIGNED',
'AUTOMATICALLY_ASSIGNED'
new
Arg [-MEMBERS]: A list reference of [gene_id,type_flags]
: gene_id is a dbID for Gene (consistent only within one release)
: type_flags is a hash ref of attributes for this member
Example : $aag = Bio::EnsEMBL::AltAlleleGroup->new(
-MEMBERS => [ [1,{$type} ], [2,{$other_type}],[3,{$type}],
);
Description: Creates a new alt-allele group object
Returntype : Bio::EnsEMBL::AltAlleleGroup
Exceptions : none
Caller : general
add_member
Arg [1] : Gene dbID
Arg [2] : Type List, used for assigning type flags of this member, see Description above
Description : Adds a record of one new member to the AltAlleleGroup. Once a
change is made, this must be persisted to the database with
AltAlleleGroupAdaptor->store or ->update
Example : $aag->add_member(1040032,$types_hash);
$aaga->update($aag); # updating the whole group is necessary.
get_all_members_with_type
Arg [1] : String The type to search members by
Description : Loops through the internal members array returning all
attributes of the same type as what has been specified
Example : my $members = $aag->get_all_members_with_type('IS_VALID_ALTERNATE');
attribs
Arg [1] : Int gene id to record attributes against
Description : Returns all known attributes of the given gene id. Attributes
are returned as a HashRef but is a copy of the interally
held attribute list
Returntype : HashRef copy of all the given id's attributes
Example : $aag->attribs(10, 'IS_VALID_ALTERNATE');
$aag->attribs(10, [ 'IS_VALID_ALTERNATE' ]);
$aag->attribs(10, {IS_VALID_ALTERNATE => 1});
set_attribs
Arg [1] : Int gene id to set attributes against
Arg [2] : ArrayRef/HashRef/Scalar The attribute you wish to record
Description : Adds the given type to the specified gene id in this group. You
can specify the type using an ArrayRef, HashRef or a single scalar
Example : $aag->attribs(10, 'IS_VALID_ALTERNATE');
$aag->attribs(10, [ 'IS_VALID_ALTERNATE' ]);
$aag->attribs(10, {IS_VALID_ALTERNATE => 1});
remove_attribs
Arg [1] : Int gene id to retrieve attributes against
Arg [2] : ArrayRef/HashRef/Scalar The attribute you wish to remove
Description : Removes the given type from this group against the specified
gene identifier
Example : $aag->remove_attribs(10, 'IS_VALID_ALTERNATE');
$aag->remove_attribs(10, [ 'IS_VALID_ALTERNATE' ]);
$aag->remove_attribs(10, {IS_VALID_ALTERNATE => 1});
remove_member
Arg [1] : Int gene id to retrieve attributes against
Arg [2] : ArrayRef/HashRef/Scalar The attribute you wish to remove
Description : Removes the given member from this group. Any changes
must be persisted back to the database via update() or
store() methods in Bio::EnsEMBL::DBSQL::AltAlleleGroupAdaptor.
Example : $aag->remove_member(10);
contains_member
Arg [1] : Int gene id to retrieve attributes against
Description : Searches through the members list looking for the
specified gene id. Returns true if it was found
or false if not.
Returntype : Boolean indicating if the given gene id is held in this group
Example : $aag->contains_member(10);
remove_all_members
Description : Remove members from this object, but NOT the database. See
AltAlleleGroupAdaptor->remove() to remove the group from the
database
rep_Gene_id
Arg[1] : Optional - set a new representative Gene id for the group
Description : Reports or sets the representative Gene for this AltAlleleGroup
If you wish to remove the representative status of all genes without
setting a new one, see unset_rep_Gene_id
Returntype : Integer or undef if none set
unset_rep_Gene_id
Description : Removes the representative Gene flag from this AltAlleleGroup.
This action is not possible through rep_Gene_id due to
validation of inputs.
get_all_Gene_ids
Arg[1] : Boolean - Do not include representative gene in list of ids.
Arg[2] : ArrayRef - Can contain dbIDs or Gene objects to exclude from the returned list
Description : fetches all the Gene dbIDs within the allele group. It can also
be used to list those ids that are not the representative Gene.
Returntype : ArrayRef of gene dbIDs
get_representative_Gene
Description : Used to fetch a Gene object which has been marked as the
representative Gene for this alt allele group.
Returntype : Bio::EnsEMBL::Gene object which is the representative gene
get_all_Genes
Arg[1] : Boolean - Do not include representative gene in list of ids.
Arg[2] : ArrayRef - Can contain dbIDs or Gene objects to exclude from the returned list
Description : Fetches all the Gene objects within the allele group. It can also
be used to list those Genes that are not the representative Gene.
Returntype : ArrayRef of Bio::EnsEMBL::Gene objects
get_all_Genes_types
Arg[1] : Boolean - Do not include representative gene in list of ids.
Arg[2] : ArrayRef - Can contain dbIDs or Gene objects to exclude from the returned list
Description : Fetches all the Gene objects within the allele group and their
associcated attributes. It can also be used to list those
Genes that are not the representative Gene.
Returntype : ArrayRef. 2 dimensional holding [Bio::EnsEMBL::Gene, {attribute_hash}]
size
Description : Returns the current size of this group in members
Returntype : Int the size of the current alt allele group
get_all_members
Description : Retrieves all of the information about all members. Be aware
that this emits the interal data structure so direct modification
should be done with caution.
Returntype : ArrayRef of id and type list: [gene_id,type]
Caller : AltAlleleGroupAdaptor->store