cd met4j-core;
mvn clean install;
Put this in the pom.xml file of your project:
<dependencies>
...
<dependency>
<groupId>fr.inrae.toulouse.metexplore</groupId>
<artifactId>met4j-core</artifactId>
<version>0.12.0</version>
</dependency>
...
</dependencies>
Change the version number if needed.
Examples can be found here : https://forgemia.inra.fr/metexplore/tutorialmet4j/blob/master/src/main/java/fr/inrae/toulouse/metexplore/tutorialmet4j/met4j_core
All the classes describing biological entities inherit from the BioEntity class. Each BioEntity has these fields:
- id (String). The main field of a BioEntity is its id. This id is final, i.e. it can not be changed after the creation of the BioEntity. This ensures the consistency of the maps containing BioEntity, especially BioCollection instances. If during the construction of a BioEntity, the id is null or empty, a unique random id will be set. The id must not contain spaces.
- name (String)
- synonyms (Array of String)
- comment (String)
- A map of references (BioRef)
- A map of attributes (Object)
The collections of biological entities are handled by the BioCollection class. The most important rule of a BioCollection is that we can not add an entity if an entity with the same id already exists in the BioCollection.
The BioNetwork class is the essential class of met4j.
It contains and links all the entities composing a metabolic network (metabolites, reactions, pathways, genes, proteins, enzymes, compartments).
All the links between biological entities are handled by methods in the BioNetwork class.
From scratch:
BioNetwork network = new BioNetwork("myBioNetwork");
Read the met4j-io documentation to see how create a BioNetwork from SBML, TSV or KEGG.
The BioMetabolite class has these additional fields:
- molecularWeight (Double)
- chemicalFormula (String)
- charge (int)
- inchi (String) : International Chemical Identifier
- smiles (string) : Simplified molecular-input line-entry system
BioMetabolite m = new BioMetabolite("m", "myMetabolite");
network.add(m);
network.removeOnCascade(m);
Removing a metabolite causes the removal of other entities linked to it in the network.
Cascade of removals after removing a BioMetabolite from a BioNetwork
BioCollection<BioMetabolite> metabolites = network.getMetabolitesView();
The returned BioCollection is in fact a copy of the list of BioMetabolite present in the BioNetwork so that operations on this BioCollection does not affect the BioNetwork itself.
A BioCompartment contains a BioCollection of BioEntity (most often BioMetabolite). This list is private, the only way to add BioEntity in a BioCompartment is to use BioNetwork methods.
BioCompartment c = new BioCompartment("c", "cytosol");
Only empty compartments can be added to a BioNetwork.
network.add(c);
network.affectToCompartment(c, m);
network.affectToCompartment(c, m1, m2, m3);
or
BioCollection<BioMetabolite> metabolites = new BioCollection<>;
metabolites.add(m1, m2, m3);
network.affectToCompartment(c, metabolites);
network.removeOnCascade(c);
Removing a BioCompartment causes the removal of other entities linked to it in the network.
Cascade of removals after removing a BioCompartment from a BioNetwork
BioCollection<BioCompartment> compartments = network.getCompartmentsView();
The returned BioCollection is in fact a copy of the list of BioCompartment present in the BioNetwork so that operations on this BioCollection does not affect the BioNetwork itself.
The BioReaction has these additional parameters:
- spontaneous (Boolean)
- ecNumber (String) :Enzyme Commission Number
- reversible (Boolean)
- left : a BioCollection of BioReactant
- right : a BioCollection of BioReactant
- enzymes : a BioCollection of BioEnzyme
BioReaction r = new BioReaction("r", "myReaction");
Only reactions without left nor right reactants nor enzymes can be added to a BioNetwork.
network.add(r);
A reactant is a triplet BioMetabolite-stoichiometry-BioCompartment. The BioCompartment and the BioMetabolite must be present in the BioNetwork and the BioMetabolite must be present in the BioCompartment.
network.affectLeft(r, 1.0, c, m1);
network.affectRight(r, 2.0, c, m2);
It's possible to add several reactants in a BioReaction if they are in the same compartment and they have the same stroichiometry.
network.affectLeft(r, 1.0, c, m1, m2, m3);
network.removeOnCascade(r);
Removing a BioReaction causes the removal of other entities linked to it in the network.
Cascade of removals after removing a BioReaction from a BioNetwork
BioCollection<BioReaction> reactions = network.getReactionsView();
The returned BioCollection is in fact a copy of the list of BioReaction present in the BioNetwork so that operations on this BioCollection does not affect the BioNetwork itself.
BioGene g = new BioGene("g");
network.add(g);
network.removeOnCascade(g);
Removing a BioGene causes the removal of other entities linked to it in the network.
Cascade of removals after removing a BioGene from a BioNetwork
BioCollection<BioGene> genes = network.getGenesView();
The returned BioCollection is in fact a copy of the list of BioGene present in the BioNetwork so that operations on this BioCollection does not affect the BioNetwork itself.
A BioProtein has only one additional parameter: a BioGene. Indeed, in met4j, a BioProtein corresponds to only one BioGene but a BioGene can code for different BioProtein (e.g. splicing event).
BioProtein p = new BioProtein("p", "myProtein");
The protein must not be linked to a BioGene to be added to a BioNetwork.
network.add(p);
Both BioProtein and BioGene must be present in the BioNetwork.
network.affectGeneProduct(p, g);
network.removeOnCascade(p);
Removing a BioProtein causes the removal of other entities linked to it in the network.
Cascade of removals after removing a BioProtein from a BioNetwork
BioCollection<BioProtein> proteins = network.getProteinsView();
The returned BioCollection is in fact a copy of the list of BioProtein present in the BioNetwork so that operations on this BioCollection does not affect the BioNetwork itself.
A BioEnzyme can be composed by several BioEnzymeParticipant which are a pair of a BioProtein (or a BioMetabolite) and a stroichiometry.
BioEnzyme e = new BioEnzyme("e", "myEnzyme");
The BioEnzyme must not contain BioEnzymeParticipant.
network.add(e);
Both BioEnzyme and BioProtein must be present in the BioNetwork.
network.affectSubUnit(e, 1.0, p);
network.affectSubUnit(e, 1.0, p, m);
Both BioEnzyme and BioReaction must be present in the BioNetwork.
network.affectEnzyme(r, e);
network.affectEnzyme(r, e1, e2);
or
BioCollection<BioEnzyme> enzymes = new BioCollection<>();
enzymes.add(e1, e2)
network.affectEnzyme(r, enzymes);
BioCollection<BioEnzyme> enzymes = network.getEnzymesView();
The returned BioCollection is in fact a copy of the list of BioEnzyme present in the BioNetwork so that operations on this BioCollection does not affect the BioNetwork itself.
network.removeOnCascade(e);
Removing a BioEnzyme causes the removal of other entities linked to it in the network.
Cascade of removals after removing a BioEnzyme from a BioNetwork
A BioPathway contains several BioReaction.
BioPathway p = new BioPathway("p", "myProtein");
network.affectToPathway(p, r);
network.affectToPathway(p, r1, r2, r3);
or
BioCollection<BioReaction> reactions = new BioCollection<>();
network.affectToPathway(p, reactions);
network.removeOnCascade(p);
BioCollection<BioPathway> pathways = network.getPathwaysView();
The returned BioCollection is in fact a copy of the list of BioPathway present in the BioNetwork so that operations on this BioCollection does not affect the BioNetwork itself.