torchcell.graph.SCerevisiaeGraph

class SCerevisiaeGraph(sgd_root: str = 'data/sgd/genome', string_root: str = 'data/string', tflink_root: str = 'data/tflink', genome: SCerevisiaeGenome = None)[source]

Bases: object

Lazy builder of SGD, STRING, TFLink, and GO gene graphs for S. cerevisiae.

static parse_genome(genome: Any) → ParsedGenome[source]

Return a ParsedGenome from the genome’s gene set and alias mapping.

property G_raw: Graph

Lazily load or build the raw SGD gene graph from per-gene JSON.

property G_gene: GeneGraph

Lazily load or build the gene graph with protein, loci, and pathway data.

property G_physical: GeneGraph

Lazily load or build the physical interaction gene graph.

property G_genetic: GeneGraph

Lazily load or build the genetic interaction gene graph.

property G_regulatory: GeneGraph

Lazily load or build the regulatory interaction gene graph.

property G_go: DiGraph

Lazily load or build the GO ontology DiGraph annotated with genes.

Lazily load or build the TFLink transcription-factor gene graph.

property G_string9_1_neighborhood: GeneGraph

Lazily load the STRING v9.1 neighborhood channel gene graph.

property G_string9_1_fusion: GeneGraph

Lazily load the STRING v9.1 fusion channel gene graph.

property G_string9_1_cooccurence: GeneGraph

Lazily load the STRING v9.1 co-occurrence channel gene graph.

property G_string9_1_coexpression: GeneGraph

Lazily load the STRING v9.1 co-expression channel gene graph.

property G_string9_1_experimental: GeneGraph

Lazily load the STRING v9.1 experimental channel gene graph.

property G_string9_1_database: GeneGraph

Lazily load the STRING v9.1 database channel gene graph.

property G_string11_0_neighborhood: GeneGraph

Lazily load the STRING v11.0 neighborhood channel gene graph.

property G_string11_0_fusion: GeneGraph

Lazily load the STRING v11.0 fusion channel gene graph.

property G_string11_0_cooccurence: GeneGraph

Lazily load the STRING v11.0 co-occurrence channel gene graph.

property G_string11_0_coexpression: GeneGraph

Lazily load the STRING v11.0 co-expression channel gene graph.

property G_string11_0_experimental: GeneGraph

Lazily load the STRING v11.0 experimental channel gene graph.

property G_string11_0_database: GeneGraph

Lazily load the STRING v11.0 database channel gene graph.

property G_string12_0_neighborhood: GeneGraph

Lazily load the STRING v12.0 neighborhood channel gene graph.

property G_string12_0_fusion: GeneGraph

Lazily load the STRING v12.0 fusion channel gene graph.

property G_string12_0_cooccurence: GeneGraph

Lazily load the STRING v12.0 co-occurrence channel gene graph.

property G_string12_0_coexpression: GeneGraph

Lazily load the STRING v12.0 co-expression channel gene graph.

property G_string12_0_experimental: GeneGraph

Lazily load the STRING v12.0 experimental channel gene graph.

property G_string12_0_database: GeneGraph

Lazily load the STRING v12.0 database channel gene graph.

Download the TFLink interaction file for S. cerevisiae.

Parameters:

output_path – Path to save the downloaded file

download_string_data(output_path: str, version: str = '9.1') → None[source]

Download the STRING protein interaction file for S. cerevisiae.

Parameters:
  • output_path – Path to save the downloaded file

  • version – STRING database version (“9.1”, “11.0”, or “12.0”)

create_string_graphs(file_path: str, version: str) → None[source]

Create GeneGraph objects from STRING data and save them to attributes.

Strip the ‘4932.’ prefix from protein IDs for consistency. Only include nodes that exist in genome.gene_set.

strip_string_prefix(protein_id: str) → str[source]

Strip the ‘4932.’ prefix from STRING protein IDs.

Create a directed graph of transcription factor interactions from TFLink.

Only include interactions where both TF and target are in genome.gene_set. Convert alias gene names to systematic names if possible.

Returns:

Directed graph of TF interactions

Return type:

nx.DiGraph

save_graph(graph: GeneGraph | Graph, graph_name: str, root_type: str = 'sgd') → None[source]

Save graph to a pickle file. Handles both NetworkX graphs and GeneGraph objects.

Parameters:
  • graph – NetworkX graph or GeneGraph to save

  • graph_name – Name of the graph

  • root_type – Type of root directory (‘sgd’, ‘string’, or ‘tflink’)

load_graph(graph_name: str, root_type: str = 'sgd') → GeneGraph | Graph | None[source]

Load graph from a pickle file. Could be a NetworkX graph or a GeneGraph.

Parameters:
  • graph_name – Name of the graph

  • root_type – Type of root directory (‘sgd’, ‘string’, or ‘tflink’)

Returns:

NetworkX graph or GeneGraph object

static add_json_data_to_graph(data_root: str, json_files: list[str]) → Graph[source]

Build a graph whose nodes are genes loaded from per-gene JSON files.

property all_go_terms: SortedSet

Collects a SortedSet of all GO terms for all genes in genome.gene_set.

property go_to_genes: SortedDict[str, GeneSet]

Map each non-obsolete GO term to the set of genes annotated to it.

create_go_subgraph(go_terms: list[str], go_dag: Any) → DiGraph[source]

Build a DiGraph for the given GO terms with parent edges and gene data.

static combine_with_super_node(graphs: list[Graph] | None = None) → Graph[source]

Merge GO subgraphs under a single GO:ROOT super node.

create_G_go() → DiGraph[source]

Build the full GO DiGraph from BP, MF, and CC subgraphs under a root.

static add_physical_edges(G_raw: Graph, G_physical: Graph) → Graph[source]

Add physical interaction edges from the raw graph to G_physical.

static add_genetic_edges(G_raw: Graph, G_genetic: Graph) → Graph[source]

Add genetic interaction edges from the raw graph to G_genetic.

static add_regulatory_edges(G_raw: Graph, G_regulatory: DiGraph = None) → DiGraph[source]

Add regulatory edges from the raw graph to the regulatory graph.

static add_gene_protein_overview(G_raw: Graph, G_gene: Graph) → Graph[source]

Add protein overview attributes (length, weight, pI, etc.) to gene nodes.

static add_loci_information(G_raw: Graph, G_gene: Graph) → Graph[source]

Add S288C start, end, and chromosome loci attributes to gene nodes.

static add_pathway_annotation(G_raw: Graph, G_gene: Graph) → Graph[source]

Add pathway display-name annotations to gene nodes.