Gene Complex

class modules.gemtractor.network.genecomplex.GeneComplex(gene=None)[source]

Bases: object

a gene complex (or gene product complex, or enzyme complex) in a network

Parameters:gene (gene.Gene) – initialize this complex with a first gene
add_gene(gene)[source]

add another gene to this complex

Parameters:gene (gene.Gene) – the gene to add to this complex
add_genes(gene_complex)[source]

add all genes of another complex to this complex

will iterate the genes in the other gene_complex, to add each of them to this complex

Parameters:gene_complex (GeneComplex) – the gene complex to copy the genes from
calc_id()[source]

calculate the identifier of this complex

Warning

please note that this can only be calculated once! so only calculate it when the complex contains all genes

Raises:RuntimeError – if the identifier was already calculated before
contains_one_of(genes=[])[source]

check if this complex contains one of the genes of a given list

Parameters:genes (list of str) – the list of gene identifiers
Returns:True if any of the genes in this complex is found in the genes list, otherwise False
Return type:bool
get_id()[source]

get the identifier of this complex

will calculate the id using calc_id(), if the id is not yet calculated

Warning

the id can only be calculated once! so please only calculate it when the complex contains all genes

Returns:the identifier of this complex
Return type:str
serialize(gene_mapper)[source]

serialize to a JSON-dumpable object

will calculate the id using calc_id(), if the id is not yet calculated

Warning

the id can only be calculated once! so please only calculate it when the complex contains all genes

the object will contain the following information:

  • id: the complex’ identifier
  • enzs: list of enzymes that part of this complex - as list of integers pointing into the serialized enzymes
  • reactions: which reactions does the complex catalyze?
Parameters:gene_mapper (dict) – dict that maps a gene id to an integer, which corresponds to the entry in the serialized genes list
Returns:JSON-dumpable object
Return type:dict
to_sbml_string()[source]

serialize this complex to a valid SBML infix string

will join the list of genes using ‘and’, and cares about brackets…

Returns:the SBML infix expression
Return type:str
to_string()[source]

serialise this complex into a string

mainly for debugging purposes

Returns:the string representation of this complex
Return type:str