NAME
Bio::Chaos::ChaosGraph - object for representing a chaos-xml dataset
SYNOPSIS
use Bio::Chaos::ChaosGraph;
use Data::Stag;
my $chaos_node = Data::Stag->parse('Rab1.chaos');
my $cg = Bio::Chaos::ChaosGraph->new($chaos_node);
my $fl = $cg->top_features;
foreach my $f (@$fl) {
next unless $f->get_type eq 'gene';
$island_feature = $cg->make_gene_island($f, 5000, 5000);
print $island_feature->xml;
}
DESCRIPTION
This class allows manipulation of in-memory Chaos documents as Data::Stag nodes, and provides additional methods for traversing the graph structure defined in the Chaos document
SEE ALSO
The cx-genbank2chaos.pl script
The Bio::Chaos helper module
The BioPerl Bio::SeqIO::chaosxml writer
new
Usage - my $chaos = Bio::Chaos::ChaosGraph->new($chaos_stag)
Returns - Bio::Chaos::ChaosGraph
creates a new Chaos::ChaosGraph object
init_from_stag
Usage - $cg->init_from_stag($chaos_node);
Returns -
Args - L<Data::Stag>
sets up a CG object from a stag node conforming to the Chaos-XML schema
my $cg = Bio::Chaos::ChaosGraph->new;
my $cn = Data::Stag->parse("mydata.chaos.xml");
$cg->init_from_stag($cn);
init_from_file
Usage - $cg->init_from_file($chaos_node);
Returns -
Args - filename string
sets up a CG object from a file conforming to the Chaos-XML schema
my $cg = Bio::Chaos::ChaosGraph->new;
$cg->init_from_file("mydata.chaos.xml");
stag
Usage - my $chaos_node = $cg->stag;
Returns - L<Data::Stag>
Args -
Generates a Data::Stag object conforming to Chaos-XML dtd
unflattener
Usage - my $unf = $cg->unflattener;
Usage - $cg->unflattener(Bio::SeqFeature::Tools::Unflattener->new);
Returns - L<Bio::SeqFeature::Tools::Unflattener>
Args - L<Bio::SeqFeature::Tools::Unflattener> (OPTIONAL)
gets/sets the object that the CG will use for unflattening genbank seqs. See bioperl docs for details
type_mapper
Usage - my $unf = $cg->type_mapper;
Usage - $cg->type_mapper(Bio::SeqFeature::Tools::Type_mapper->new);
Returns - L<Bio::SeqFeature::Tools::Type_mapper>
Args - L<Bio::SeqFeature::Tools::Type_mapper> (OPTIONAL)
gets/sets the object that the CG will use for mapping genbank types to SO. See bioperl docs for details
feature_idx
Usage - my $f = $cg->feature_idx->{$feature_id}
Returns - hashref, keyed by feature ID
Args -
index hash for looking up feature stag nodes by ID
The ID is the value of feature/feature_id in the chaos-xml structure
the hash has values that are chaos Data::Stag nodes, and can be accessed using normal stag methods/functions
get_feature
Usage - my $f = $cg->get_feature($feature_id)
Returns - L<Data::Stag> conforming to Chaos-xml feature element
Args - id string
look up feature stag nodes by ID
The ID is the value of feature/feature_id in the chaos-xml structure
The returned Data::Stag node is a feature node/element, and can be accessed using normal stag methods/functions
graph
Usage - my $graph = $cg->graph;
Returns - L<Graph>
Args -
gets/sets the Graph object which corresponds to the graph defined by the chado/chaos feature_relationships. The sink of the graph is the root (eg genes), the source of the graph is the leaves (eg exons).
The graph labels contain the relationship type and the rank
You should not need to manipulate the Graph object directly - this is mostly used internally, but is made public to allow inspection of the graph using the native Graph methods
graph
Usage - my $locgraph = $cg->locgraph;
Returns - L<Graph>
Args -
gets/sets the Graph object which corresponds to the graph defined by the chado/chaos featurelocs.
The graph labels contain the nbeg, nend, rank, group
You should not need to manipulate the Graph object directly - this is mostly used internally, but is made public to allow inspection of the graph using the native Graph methods
add_feature
Usage - $cg->add_feature($f);
Returns -
Args - L<Data::Stag> [feature node]
add_featureloc
Usage - $cg->add_featureloc($fl);
Returns -
Args - L<Data::Stag> [featureloc node]
replace_featureloc
Usage - $cg->replace_featureloc($f,$fl_old,$fl_new);
Returns -
Args - feature L<Data::Stag> [feature node]
old loc L<Data::Stag> [featureloc node]
new loc L<Data::Stag> [featureloc node]
add_feature_relationship
Usage - $cg->add_feature_relationship($f);
Returns -
Args - L<Data::Stag> [feature_relationship node]
top_features
Usage - my $features = $cg->top_features;
Returns - listref of L<Data::Stag> feature nodes
Args -
returns features at the root of the feature graph (typically genes, but also "simple" features that are not attached other features via feature_relationships, such as SNPs, contigs, etc
Formally, a feature F is a top feature if there is no feature_relationship R with R.subject_id = F
leaf_features
Usage - my $features = $cg->leaf_features;
Returns - listref of L<Data::Stag> feature nodes
Args -
returns features at the leaves of the feature graph (with gene model subgraphs, these may be exons and polypeptides - or "simple" features that are not attached other features via feature_relationships, such as SNPs, contigs, etc)
Formally, a feature F is a leaf feature if there is no feature_relationship R with R.object_id = F
unlocalised_features
Usage - my $topfs = $cg->unlocalised_features;
Synonym - unlocalized_features
Returns - listref of L<Data::Stag> feature nodes
Args -
returns features at the root of the featureloc graph, ie unlocalised features.
Formally, a feature F is unlocalised if it contains no featurelocs
top_unlocalised_features
Usage - my $topfs = $cg->top_unlocalised_features;
Synonym - top_unlocalized_features
Returns - listref of L<Data::Stag> feature nodes
Args -
Returns the intersection of the set of all unlocalised features and all top features
get_features_on
Usage - my $features = $cg->get_features_on($contig_feature)
Returns - listref of L<Data::Stag> feature nodes
Args - L<Data::Stag> feature node OR id string
all features DIRECTLY localised to a particular feature
get_features_contained_by
Usage - my $transcripts = $cg->get_features_contained_by($gene_feature)
Returns - listref of L<Data::Stag> feature nodes
Args - L<Data::Stag> feature node
all features contained by another feature, where containment is defined by any feature_relationship, with the container being the object_id and the containee being the subject_id. feature_relationship.type is ignored
get_features_containing
Usage - my $transcripts = $cg->get_features_containing($exon_feature)
Returns - listref of L<Data::Stag> feature nodes
Args - L<Data::Stag> feature node
all features containing by another feature, where containment is defined by any feature_relationship, with the container being the object_id and the containee being the subject_id. feature_relationship.type is ignored
get_all_contained_features
Usage - my $features = $cg->get_all_contained_features($gene_feature)
Returns - listref of L<Data::Stag> feature nodes
Args - L<Data::Stag> feature node
As get_features_contained_by, but performs the transitive closure - eg for a gene will fetch transcriipts, and the transcripts subfeatures (exons) into one flat list
feature_relationships_for_subject
Usage - $frs = $cg->get_feature_relationships_for_subject($exon_id);
Returns - listref of L<Data::Stag> feature_relationship nodes
Args - L<Data::Stag> feature node OR id string
find the feature_relationship nodes with a particular subject_id
make_gene_islands
Usage - my $contigs = $cg->make_gene_islands;
Returns - listref of L<Data::Stag> feature nodes
Args -
create a contig feature for every gene, and transform the gene and all the subfeatures of gene onto that contig
derive_residues
Usage - my $ok = $cg->derive_residues($feature);
Returns - sequence string
Returns - L<Data::Stag> feature node
splices out the residues from the srcfeature and sets the feature/residues element (does not return the actual residues)
loctransform
Usage - $cg->loctransform($gene,$contig);
Args - source L<Data::Stag> feature node
target L<Data::Stag> feature node
replaces the featureloc(s) of a feature with new featureloc(s) relative to the target feature - eg going from chromosome to contig
get_features_by_type
Usage - my $exons = $cg->get_features_by_type('exon');
Returns - listref of L<Data::Stag> feature nodes
Args - type string
gets features by type (exact - does not traverse ontology graph)
get_features
Usage - my $features = $cg->get_features;
Returns - listref of L<Data::Stag> feature nodes
Args - none
returns all features
name_all_features
Usage - $cg->name_all_features
Returns -
Args -
makes sure all feature have names. will not affect features that already have names
sets both feature/name and feature/uniquename