exonize_analysis module¶
Expansion
¶
Expansion class represents an expansion graph for a specific gene expansion.
Attributes: |
|
---|
__init__(expansion_id, nodes, edges)
¶
Initializes an Expansion instance.
Parameters: |
|
---|
Gene
¶
Gene class is a container for gene expansion graphs.
Attributes: |
|
---|
__getitem__(expansion_id)
¶
Retrieves the expansion graph for the specified expansion ID.
Parameters: |
|
---|
Returns: |
|
---|
Examples:
>>> gene[1] # Retrieves the expansion graph for expansion ID 1
__init__(gene_id, coordinates, strand, chromosome)
¶
Initializes a Gene instance.
Parameters: |
|
---|
__iter__()
¶
Returns an iterator over the expansion graphs.
Returns: |
|
---|
Examples:
>>> for graph in gene:
... print(graph)
__len__()
¶
Returns the number of expansions associated with the gene.
Returns: |
|
---|
Examples:
>>> len(gene)
0
__repr__()
¶
Returns a string representation of the Gene object.
Returns: |
|
---|
Examples:
>>> repr(gene)
'<Gene GENE123 with 0 expansions (iterable of expansion graphs)>'
build_gene_graph()
¶
Builds and returns a consolidated gene graph containing nodes and edges from all expansion graphs.
Returns: |
|
---|
Examples:
>>> combined_graph = gene.build_gene_graph()
>>> print(combined_graph.nodes)
>>> print(combined_graph.edges)
draw_expansions_multigraph(expansion_id=None, figure_path=None, figure_size=(8.0, 8.0), legend=True, connect_overlapping_nodes=False, color_tandem_pair_edges=False, full_expansion=False, tandem_edges_color='blue')
¶
Draws a multi-graph of gene expansions.
Parameters: |
|
---|
draw_gene_structure(expansion_id=None, save_path=None)
¶
Visualize the gene structure, highlighting coding exons and expansion events.
This method uses the dna_features_viewer library to plot the gene structure, showing the locations
of coding exons and expansion events within the specified gene. The plot can be saved to a file if
save_path
is provided.
Parameters: |
|
---|
Returns: |
|
---|
GenomeExpansions
¶
A container for managing gene expansions across an entire genome.
Attributes: |
|
---|
genes: list
property
¶
Returns a list of gene IDs.
Returns: |
|
---|
Examples:
>>> genome_expansions.genes
['GENE123', 'GENE456', 'GENE789']
__contains__(n)
¶
Checks if a gene ID exists in the GenomeExpansions.
Parameters: |
|
---|
Returns: |
|
---|
Examples:
>>> "GENE123" in genome_expansions
True
__getitem__(gene_id)
¶
Retrieves a Gene object by gene ID.
Parameters: |
|
---|
Returns: |
|
---|
Examples:
>>> gene = genome_expansions["GENE123"]
>>> print(gene)
<Gene GENE123 with 0 expansions (iterable of expansion graphs)>
__init__(exonize_db_path)
¶
Initializes a GenomeExpansions instance and builds expansions from the database.
Parameters: |
|
---|
__iter__()
¶
Returns an iterator over the Gene objects.
Returns: |
|
---|
Examples:
>>> for gene in genome_expansions:
... print(gene)
__len__()
¶
Returns the number of genes in the GenomeExpansions.
Returns: |
|
---|
Examples:
>>> len(genome_expansions)
18
build_expansions()
¶
Constructs the gene expansions from the Exonize database.
This method initializes each Gene object and populates its expansions based on data from the Exonize database. Each expansion consists of nodes and edges, forming a graph for each gene.
Examples:
>>> genome_expansions.build_expansions()
>>> print(len(genome_expansions))
18