diff --git a/met4j-toolbox/README.md b/met4j-toolbox/README.md index 0d014113e81995a9429902c009571b971dc554ac..fb0340938ca9928a28ba654703e33d45a2107bff 100644 --- a/met4j-toolbox/README.md +++ b/met4j-toolbox/README.md @@ -111,7 +111,6 @@ sudo docker pull metexplore/met4j:develop If you want to build by yourself the docker image: ```console -mvn clean install cd met4j-toolbox mvn package cd ../ @@ -121,15 +120,7 @@ sudo docker build -t metexplore/met4j:myversion . To list all the apps: ```console -sudo docker run metexplore/met4j:latest -``` - -To run an app, you have to specify the full name of the app, -with the last part of the package name and the app name separated by a dot. -For instance: - -```console -sudo docker run metexplore/met4j:latest convert.Tab2Sbml -h +sudo docker run metexplore/met4j:latest met4j.sh ``` Don't forget to map volumes when you want to process local files. @@ -137,10 +128,18 @@ Example: ```console sudo docker run -v /home/lcottret/work:/work \ - metexplore/met4j:latest convert.Sbml2Tab \ + metexplore/met4j:latest met4j.sh convert.Sbml2Tab \ -in /work/toy_model.xml -out /work/toy_model.tsv ``` +If you change the working directory, you have to specify "sh /usr/bin/met4j.sh": + +```console +sudo docker run -w /work -v /home/lcottret/work:/work \ + metexplore/met4j:latest sh /usr/bin/met4j.sh convert.Sbml2Tab \ + -in toy_model.xml -out toy_model.tsv +``` + ### Galaxy instance [Galaxy](https://galaxyproject.org/) wrappers for met4j-toolbox apps are available in the [Galaxy toolshed](https://toolshed.g2.bx.psu.edu/) (master version) and in the [Galaxy test toolsdhed](https://testtoolshed.g2.bx.psu.edu/) (develop version). @@ -476,7 +475,7 @@ Wrappers launch the met4j singularity container, so the server where your Galaxy -skip N : [0] Number of lines to skip at the beginning of the compound file (default: 0) </code></pre></details></td></tr> -<tr><td>ORApathwayEnrichment</td><td>Perform Over Representation Analysis for Pathway Enrichment, using one-tailed exact Fisher Test.<br/>The fisher exact test compute the probability p to randomly get the given set of value. <br/>This version compute the probability to get at least the given overlap between the given set and the given modality :<br/>Sum the hypergeometric probability with increasing target/query intersection cardinality.<br/><br/>The hypergeometric probability is computed from the following contingency table entries.<br/>(value in cells correspond to the marginal totals of each intersection groups)<br/> Query !Query<br/> Target a b<br/> !Target c d<br/><br/>The probability of obtaining the set of value is computed as following:<br/>p = ((a+b)!(c+d)!(a+c)!(b+d)!)/(a!b!c!d!(a+b+c+d)!)<br/><br/>The obtained p-value is then adjusted for multiple testing using one of the following methods:<br/> - Bonferroni: adjusted p-value = p*n<br/> - Benjamini-Hochberg: adjusted p-value = p*n/k<br/> - Holm-Bonferroni: adjusted p-value = p*(n+1-k)<br/>n : number of tests; k : pvalue rank<details><summary><small>more</small></summary>Perform Over Representation Analysis for Pathway Enrichment, using one-tailed exact Fisher Test.<br/><br/><pre><code> -c (--correction) [Bonferroni | : Method for multiple testing p-value +<tr><td>ORApathwayEnrichment</td><td>Perform Over Representation Analysis for Pathway Enrichment, using one-tailed exact Fisher Test.<details><summary><small>more</small></summary>Perform Over Representation Analysis for Pathway Enrichment, using one-tailed exact Fisher Test.<br/>The fisher exact test compute the probability p to randomly get the given set of value. <br/>This version compute the probability to get at least the given overlap between the given set and the given modality :<br/>Sum the hypergeometric probability with increasing target/query intersection cardinality.<br/><br/>The hypergeometric probability is computed from the following contingency table entries.<br/>(value in cells correspond to the marginal totals of each intersection groups)<br/> Query !Query<br/> Target a b<br/> !Target c d<br/><br/>The probability of obtaining the set of value is computed as following:<br/>p = ((a+b)!(c+d)!(a+c)!(b+d)!)/(a!b!c!d!(a+b+c+d)!)<br/><br/>The obtained p-value is then adjusted for multiple testing using one of the following methods:<br/> - Bonferroni: adjusted p-value = p*n<br/> - Benjamini-Hochberg: adjusted p-value = p*n/k<br/> - Holm-Bonferroni: adjusted p-value = p*(n+1-k)<br/>n : number of tests; k : pvalue rank<br/><br/><pre><code> -c (--correction) [Bonferroni | : Method for multiple testing p-value BenjaminiHochberg | HolmBonferroni] adjustment. (default: BenjaminiHochber g) -h : prints the help (default: false) @@ -536,7 +535,7 @@ Wrappers launch the met4j singularity container, so the server where your Galaxy false) -un (--undirected) : create as undirected (default: false) </code></pre></details></td></tr> -<tr><td>ChemSimilarityWeighting</td><td>Provides tabulated compound graph edge list, with one column with reactant pair's chemical similarity.<details><summary><small>more</small></summary>Provides tabulated compound graph edge list, with one column with reactant pair's chemical similarity.Chemical similarity has been proposed as edge weight for finding meaningful paths in metabolic networks, using shortest (lightest) path search. See McSha et al. 2003 (https://doi.org/10.1093/bioinformatics/btg217), Rahman et al. 2005 (https://doi.org/10.1093/bioinformatics/bti116) and Pertusi et al. 2014 (https://doi.org/10.1093/bioinformatics/btu760)<br/><br/><pre><code> -d (--asDist) : Use distance rather than similarity +<tr><td>ChemSimilarityWeighting</td><td>Provides tabulated compound graph edge list, with one column with reactant pair's chemical similarity.<details><summary><small>more</small></summary>Provides tabulated compound graph edge list, with one column with reactant pair's chemical similarity.Chemical similarity has been proposed as edge weight for finding meaningful paths in metabolic networks, using shortest (lightest) path search.<br/><br/>References:<br/><a href="https://doi.org/10.1093/bioinformatics/bti116">Rahman et al.; Metabolic pathway analysis web service (Pathway Hunter Tool at CUBIC); Bioinformatics; 2005</a><br/><a href="https://doi.org/10.1093/bioinformatics/btg217">McShan et al.; PathMiner: predicting metabolic pathways by heuristic search; Bioinformatics; 2003</a><br/><a href="https://doi.org/10.1093/bioinformatics/btu760">Pertusi et al.; Efficient searching and annotation of metabolic networks using chemical similarity; Bioinformatics; 2015</a><br/><br/><br/><pre><code> -d (--asDist) : Use distance rather than similarity (default: false) -f (--fingerprint) [EState | Extended : The chemical fingerprint to use | KlekotaRoth | MACCS | PubChem] (default: Extended) @@ -571,7 +570,7 @@ Wrappers launch the met4j singularity container, so the server where your Galaxy (default: false) -un (--undirected) : create as undirected (default: false) </code></pre></details></td></tr> -<tr><td>ChokePoint</td><td>Compute the Choke points of a metabolic network.<details><summary><small>more</small></summary>Compute the Choke points of a metabolic network.<br/>Choke points constitute an indicator of lethality and can help identifying drug target Choke points are reactions that are required to consume or produce one compound. Targeting of choke point can lead to the accumulation or the loss of some metabolites, thus choke points constitute an indicator of lethality and can help identifying drug target <br/>See : Syed Asad Rahman, Dietmar Schomburg; Observing local and global properties of metabolic pathways: ‘load points’ and ‘choke points’ in the metabolic networks. Bioinformatics 2006; 22 (14): 1767-1774. doi: 10.1093/bioinformatics/btl181<br/><br/><pre><code> -h : prints the help (default: false) +<tr><td>ChokePoint</td><td>Compute the Choke points of a metabolic network.<details><summary><small>more</small></summary>Compute the Choke points of a metabolic network.<br/>Choke points constitute an indicator of lethality and can help identifying drug target Choke points are reactions that are required to consume or produce one compound. Targeting of choke point can lead to the accumulation or the loss of some metabolites, thus choke points constitute an indicator of lethality and can help identifying drug target.<br/><br/>References:<br/><a href="https://doi.org/10.1093/bioinformatics/btl181">Rahman et al.; Observing local and global properties of metabolic pathways: ‘load points’ and ‘choke points’ in the metabolic networks; Bioinformatics; 2006</a><br/><br/><br/><pre><code> -h : prints the help (default: false) -i VAL : input SBML file -o VAL : output results file </code></pre></details></td></tr> @@ -602,7 +601,7 @@ Wrappers launch the met4j singularity container, so the server where your Galaxy (default: false) -un (--undirected) : create as undirected (default: false) </code></pre></details></td></tr> -<tr><td>DegreeWeighting</td><td>Provides tabulated compound graph edge list, with one column with target's degree.<details><summary><small>more</small></summary>Provides tabulated compound graph edge list, with one column with target's degree.Degree has been proposed as edge weight for finding meaningful paths in metabolic networks, using shortest (lightest) path search. See Croes et al. 2006 (https://doi.org/10.1016/j.jmb.2005.09.079) and Croes et al. 2005 (https://doi.org/10.1093/nar/gki437)<br/><br/><pre><code> -h : prints the help (default: false) +<tr><td>DegreeWeighting</td><td>Provides tabulated compound graph edge list, with one column with target's degree.<details><summary><small>more</small></summary>Provides tabulated compound graph edge list, with one column with target's degree.Degree has been proposed as edge weight for finding meaningful paths in metabolic networks, using shortest (lightest) path search.<br/><br/>References:<br/><a href="https://doi.org/10.1016/j.jmb.2005.09.079">Croes et al.; Inferring Meaningful Pathways in Weighted Metabolic Networks; Journal of Molecular Biology; 2006</a><br/><br/><br/><pre><code> -h : prints the help (default: false) -mc (--mergecomp) [no | by_name | : merge compartments. Use names if by_id] consistent and unambiguous across compartments, or identifiers if @@ -655,7 +654,7 @@ Wrappers launch the met4j singularity container, so the server where your Galaxy (default: false) -u (--undirected) : Ignore reaction direction (default: false) </code></pre></details></td></tr> -<tr><td>ExtractSubNetwork</td><td>Create a subnetwork from a GSMN in SBML format, and two files containing lists of compounds of interests ids, one per row.<details><summary><small>more</small></summary>Create a subnetwork from a GSMN in SBML format, and two files containing lists of compounds of interests ids, one per row.<br/>The subnetwork correspond to part of the network that connects compounds from the first list to compounds from the second list.<br/>Sources and targets list can have elements in common. The connecting part can be defined as the union of shortest or k-shortest paths between sources and targets, or the Steiner tree connecting them. The relevance of considered path can be increased by weighting the edges using degree squared, chemical similarity (require InChI or SMILES annotations) or any provided weighting.<br/><br/>See previous works on subnetwork extraction for parameters recommendations:Frainay, C., & Jourdan, F. Computational methods to identify metabolic sub-networks based on metabolomic profiles. Bioinformatics 2016;1–14. https://doi.org/10.1093/bib/bbv115<br/>Faust, K., Croes, D., & van Helden, J. Prediction of metabolic pathways from genome-scale metabolic networks. Bio Systems 2011;105(2), 109–121. https://doi.org/10.1016/j.biosystems.2011.05.004<br/>Croes D, Couche F, Wodak SJ, et al. Metabolic PathFinding: inferring relevant pathways in biochemical networks. Nucleic Acids Res 2005;33:W326–30.<br/>Croes D, Couche F, Wodak SJ, et al. Inferring meaningful pathways in weighted metabolic networks. J Mol Biol 2006; 356:222–36.<br/>Rahman SA, Advani P, Schunk R, et al. Metabolic pathway analysis web service (Pathway Hunter Tool at CUBIC). Bioinformatics 2005;21:1189–93.<br/>Pertusi DA, Stine AE, Broadbelt LJ, et al. Efficient searching and annotation of metabolic networks using chemical similarity. Bioinformatics 2014;1–9.<br/>McShan DC, Rao S, Shah I. PathMiner: predicting metabolic pathways by heuristic search. Bioinformatics 2003;19:1692–8.<br/><br/><br/><pre><code> -cw (--customWeights) VAL : an optional file containing weights for compound +<tr><td>ExtractSubNetwork</td><td>Create a subnetwork from a GSMN in SBML format, and two files containing lists of compounds of interests ids, one per row.<details><summary><small>more</small></summary>Create a subnetwork from a GSMN in SBML format, and two files containing lists of compounds of interests ids, one per row.<br/>The subnetwork correspond to part of the network that connects compounds from the first list to compounds from the second list.<br/>Sources and targets list can have elements in common. The connecting part can be defined as the union of shortest or k-shortest paths between sources and targets, or the Steiner tree connecting them. The relevance of considered path can be increased by weighting the edges using degree squared, chemical similarity (require InChI or SMILES annotations) or any provided weighting.<br/><br/>See previous works on subnetwork extraction for parameters recommendations.<br/><br/>References:<br/><a href="https://doi.org/10.1016/j.biosystems.2011.05.004">Faust et al.; Prediction of metabolic pathways from genome-scale metabolic networks; Biosystems; 2011</a><br/><a href="https://doi.org/10.1093/nar/gki437">Croes et al.; Metabolic PathFinding: inferring relevant pathways in biochemical networks; Nucleic Acids Research; 2005</a><br/><a href="https://doi.org/10.1093/bioinformatics/bti116">Rahman et al.; Metabolic pathway analysis web service (Pathway Hunter Tool at CUBIC); Bioinformatics; 2005</a><br/><a href="https://doi.org/10.1016/j.jmb.2005.09.079">Croes et al.; Inferring Meaningful Pathways in Weighted Metabolic Networks; Journal of Molecular Biology; 2006</a><br/><a href="https://doi.org/10.1093/bioinformatics/btg217">McShan et al.; PathMiner: predicting metabolic pathways by heuristic search; Bioinformatics; 2003</a><br/><a href="https://doi.org/10.1093/bioinformatics/btu760">Pertusi et al.; Efficient searching and annotation of metabolic networks using chemical similarity; Bioinformatics; 2015</a><br/><a href="https://doi.org/10.1093/bib/bbv115">Frainay et al.; Computational methods to identify metabolic sub-networks based on metabolomic profiles; Briefings in Bioinformatics; 2017</a><br/><br/><br/><pre><code> -cw (--customWeights) VAL : an optional file containing weights for compound pairs -dw (--degreeWeights) : penalize traversal of hubs by using degree square weighting (default: false) @@ -697,7 +696,7 @@ Wrappers launch the met4j singularity container, so the server where your Galaxy -o VAL : output results file -s (--side) VAL : an optional file containing list of side compounds to ignore </code></pre></details></td></tr> -<tr><td>MetaboRank</td><td>Compute the MetaboRank, a custom personalized PageRank for metabolic network.<details><summary><small>more</small></summary>Compute the MetaboRank, a custom personalized PageRank for metabolic network.<br/>The MetaboRank takes a metabolic network and a list of compounds of interest, and provide a score of relevance for all of the other compounds in the network.<br/>The MetaboRank can, from metabolomics results, be used to fuel a recommender system highlighting interesting compounds to investigate, retrieve missing identification and drive literature mining.<br/>It is a two dimensional centrality computed from personalized PageRank and CheiRank, with special transition probability and normalization to handle the specificities of metabolic networks.<br/>For convenience, a one dimensional centrality rank is also computed from the highest rank from PageRank or CheiRank, and using lowest rank as tie-breaker.<br/>See publication for more information: Frainay et al. MetaboRank: network-based recommendation system to interpret and enrich metabolomics results, Bioinformatics (35-2), https://doi.org/10.1093/bioinformatics/bty577<br/><br/><pre><code> -d N : damping factor (default: 0.85) +<tr><td>MetaboRank</td><td>Compute the MetaboRank, a custom personalized PageRank for metabolic network.<details><summary><small>more</small></summary>Compute the MetaboRank, a custom personalized PageRank for metabolic network.<br/>The MetaboRank takes a metabolic network and a list of compounds of interest, and provide a score of relevance for all of the other compounds in the network.<br/>The MetaboRank can, from metabolomics results, be used to fuel a recommender system highlighting interesting compounds to investigate, retrieve missing identification and drive literature mining.<br/>It is a two dimensional centrality computed from personalized PageRank and CheiRank, with special transition probability and normalization to handle the specificities of metabolic networks.<br/>For convenience, a one dimensional centrality rank is also computed from the highest rank from PageRank or CheiRank, and using lowest rank as tie-breaker.<br/>See publication for more information.<br/><br/>References:<br/><a href="https://doi.org/10.1093/bioinformatics/bty577">Frainay et al.; MetaboRank: network-based recommendation system to interpret and enrich metabolomics results; Bioinformatics; 2019</a><br/><br/><br/><pre><code> -d N : damping factor (default: 0.85) -h : prints the help (default: false) -i VAL : input SBML file: path to network used for computing centrality, in sbml format. @@ -761,7 +760,7 @@ Wrappers launch the met4j singularity container, so the server where your Galaxy -u (--undirected) : Ignore reaction direction (default: false) -w (--weights) VAL : an optional file containing weights for compound pairs </code></pre></details></td></tr> -<tr><td>ScopeNetwork</td><td>Perform a network expansion from a set of compound seeds to create a scope network<details><summary><small>more</small></summary>Perform a network expansion from a set of compound seeds to create a scope network<br/>The scope of a set of compounds (seed) refer to the maximal metabolic network that can be extended from them,where the extension process consist of adding a reaction to the network if and only if all of its substrates are either a seed or a product of a previously added reaction<br/>For more information, see Handorf, Ebenhöh and Heinrich (2005). *Expanding metabolic networks: scopes of compounds, robustness, and evolution.* Journal of molecular evolution, 61(4), 498-512. (https://doi.org/10.1007/s00239-005-0027-1)<br/><br/><pre><code> -h : prints the help (default: false) +<tr><td>ScopeNetwork</td><td>Perform a network expansion from a set of compound seeds to create a scope network<details><summary><small>more</small></summary>Perform a network expansion from a set of compound seeds to create a scope network<br/>The scope of a set of compounds (seed) refer to the maximal metabolic network that can be extended from them,where the extension process consist of adding a reaction to the network if and only if all of its substrates are either a seed or a product of a previously added reaction<br/><br/>References:<br/><a href="https://doi.org/10.1007/s00239-005-0027-1">Handorf et al.; Expanding Metabolic Networks: Scopes of Compounds, Robustness, and Evolution; Journal of Molecular Evolution; 2005</a><br/><br/><br/><pre><code> -h : prints the help (default: false) -i VAL : input SBML file: path to network used for computing scope, in sbml format. -ir (--ignore) VAL : an optional file containing list of reaction to ignore @@ -778,7 +777,7 @@ Wrappers launch the met4j singularity container, so the server where your Galaxy (default: false) -tab (--asTable) : Export in tabulated file instead of .GML (default: false) </code></pre></details></td></tr> -<tr><td>SeedsAndTargets</td><td>Identify exogenously acquired compounds, producible compounds exogenously available and/or dead ends metabolites from metabolic network topology<details><summary><small>more</small></summary>Identify exogenously acquired compounds, producible compounds exogenously available and/or dead ends metabolites from metabolic network topology. Metabolic seeds and targets are useful for identifying medium requirements and metabolic capability, and thus enable analysis of metabolic ties within communities of organisms.<br/>This application can use seed definition and SCC-based detection algorithm by Borenstein et al. or, alternatively, degree-based sink and source detection with compartment adjustment.<br/>The first method (see Borenstein et al. 2008 Large-scale reconstruction and phylogenetic analysis of metabolic environments https://doi.org/10.1073/pnas.0806162105) consider strongly connected components rather than individual nodes, thus, members of cycles can be considered as seed. A sink from an external compartment can however be connected to a non sink internal counterpart, thus highlighting what could end up in the external compartment rather than what must be exported.<br/>The second approach is neighborhood based and identify sources and sinks. Since "real" sinks and sources in intracellular compartment(s) may be involved in transport/exchange reactions reversible by default, thus not allowing extracellular source or sink, an option allows to take the degree (minus extracellular neighbors) of intracellular counterparts.<br/><br/><pre><code> -!s (--notSeed) : export nodes that are not seed (default: false) +<tr><td>SeedsAndTargets</td><td>Identify exogenously acquired compounds, producible compounds exogenously available and/or dead ends metabolites from metabolic network topology<details><summary><small>more</small></summary>Identify exogenously acquired compounds, producible compounds exogenously available and/or dead ends metabolites from metabolic network topology. Metabolic seeds and targets are useful for identifying medium requirements and metabolic capability, and thus enable analysis of metabolic ties within communities of organisms.<br/>This application can use seed definition and SCC-based detection algorithm by Borenstein et al. or, alternatively, degree-based sink and source detection with compartment adjustment.<br/>The first method (see Borenstein et al. 2008 Large-scale reconstruction and phylogenetic analysis of metabolic environments https://doi.org/10.1073/pnas.0806162105) consider strongly connected components rather than individual nodes, thus, members of cycles can be considered as seed. A sink from an external compartment can however be connected to a non sink internal counterpart, thus highlighting what could end up in the external compartment rather than what must be exported.<br/>The second approach is neighborhood based and identify sources and sinks. Since "real" sinks and sources in intracellular compartment(s) may be involved in transport/exchange reactions reversible by default, thus not allowing extracellular source or sink, an option allows to take the degree (minus extracellular neighbors) of intracellular counterparts.<br/><br/>References:<br/><a href="https://doi.org/10.1073/pnas.0806162105">Borenstein et al.; Large-scale reconstruction and phylogenetic analysis of metabolic environments; Proceedings of the National Academy of Sciences; 2008</a><br/><br/><br/><pre><code> -!s (--notSeed) : export nodes that are not seed (default: false) -!t (--notTarget) : export nodes that are not targets (default: false) -B (--useBorensteinAlg) : use Borenstein Algorithm. Please cite Borenstein et al. 2008 Large-scale reconstruction and phylogenetic diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateDoc.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateDoc.java index 7790dc228ba21775fd314aaf227ce112bdc1dcef..33d28d2c48a346cc2b324b905b6ece2cc0ab3ff0 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateDoc.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateDoc.java @@ -35,6 +35,8 @@ */ package fr.inrae.toulouse.metexplore.met4j_toolbox; +import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.ResourceURLFilter; import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Resources; import org.kohsuke.args4j.CmdLineParser; @@ -53,6 +55,8 @@ import java.util.Set; /** * generate doc by creating a html table with name and description of each app * + * Be careful, network is needed to crete the references from dois + * * @author cfrainay * @version $Id: $Id */ @@ -252,11 +256,7 @@ public class GenerateDoc { return baos.toString(java.nio.charset.StandardCharsets.UTF_8); } - /** - * <p>main.</p> - * - * @param args an array of {@link java.lang.String} objects. - */ + public static void main(String[] args) { try { @@ -288,45 +288,59 @@ public class GenerateDoc { Class<?> myClass = Class.forName(entry.replace('/', '.')); + if (AbstractMet4jApplication.class.isAssignableFrom(myClass)) { - try { - myClass.getMethod("main", String[].class); - Constructor<?> ctor = myClass.getConstructor(); - - Object obj = ctor.newInstance(); - - String packageName = myClass.getPackageName(); - String id = myClass.getCanonicalName(); - - if (!apps.containsKey(packageName)) { - apps.put(packageName, new HashMap<>()); - } - String desc = ""; try { - Object labelo = myClass.getMethod("getLabel").invoke(obj); - String label = labelo !=null ? (String) labelo : ""; - Object spo = myClass.getMethod("getShortDescription").invoke(obj); - String sp = spo !=null ? (String) spo : ""; - sp=sp.replaceAll("\n","<br/>"); - Object lpo = myClass.getMethod("getLongDescription").invoke(obj); - String lp = lpo !=null ? (String) lpo : ""; - lp=lp.replaceAll("\n\r?","<br/>"); - String us =getUsage(obj); - desc += "<tr><td>"+ - label + - "</td><td>" + - sp+"<details><summary><small>more</small></summary>" + - lp+"<br/><br/>" + - "<pre><code>"+us+"</code></pre>" + - "</details>"+ - "</td></tr>"; - - apps.get(packageName).put(id, desc); - } catch (Exception e) { - System.err.println("no description set for "+id); + myClass.getMethod("main", String[].class); + Constructor<?> ctor = myClass.getConstructor(); + + Object obj = ctor.newInstance(); + + String packageName = myClass.getPackageName(); + String id = myClass.getCanonicalName(); + + if (!apps.containsKey(packageName)) { + apps.put(packageName, new HashMap<>()); + } + String desc = ""; + try { + Object labelo = myClass.getMethod("getLabel").invoke(obj); + String label = labelo != null ? (String) labelo : ""; + Object spo = myClass.getMethod("getShortDescription").invoke(obj); + String sp = spo != null ? (String) spo : ""; + sp = sp.replaceAll("\n", "<br/>"); + Object lpo = myClass.getMethod("getLongDescription").invoke(obj); + String lp = lpo != null ? (String) lpo : ""; + lp = lp.replaceAll("\n\r?", "<br/>"); + + Set<Doi> dois = (Set<Doi>) myClass.getMethod("getDois").invoke(obj); + + if (dois.size() > 0) { + + lp += "<br/><br/>References:<br/>"; + for (Doi doiInfo : dois) { + lp += "<a href=\"https://doi.org/" + doiInfo.getDoi() + "\">" + doiInfo.getAbbreviatedReference() + "</a><br/>"; + } + } + + String us = getUsage(obj); + desc += "<tr><td>" + + label + + "</td><td>" + + sp + "<details><summary><small>more</small></summary>" + + lp + "<br/><br/>" + + "<pre><code>" + us + "</code></pre>" + + "</details>" + + "</td></tr>"; + + apps.get(packageName).put(id, desc); + } catch (Exception e) { + e.printStackTrace(); + System.err.println("no description set for " + id); + } + } catch (Exception e1) { + //method not set } - } catch (Exception e1) { - //method not set } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java index 1d26274c58bfe78f9e89f7f5162885c7b4aff488..4fce0733dc519aec6f9ba8d30e8a4fb2ca9a590b 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java @@ -36,6 +36,7 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.ResourceURLFilter; import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Resources; import org.apache.commons.lang3.ClassUtils; @@ -57,6 +58,7 @@ import java.lang.reflect.Method; import java.net.URL; import java.util.Comparator; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; public class GenerateGalaxyFiles extends AbstractMet4jApplication { @@ -239,4 +241,10 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication { public String getShortDescription() { return "Create the galaxy file tree containing met4j-toolbox app wrappers"; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } + } \ No newline at end of file diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/DecomposeSBML.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/DecomposeSBML.java index c483a3f9de07070ccc1b5dd7c8d93a74ad1870b8..613f08b2412d4aa301f2c07dd9c8dc810cbfb8f2 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/DecomposeSBML.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/DecomposeSBML.java @@ -8,11 +8,13 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import java.util.Set; public class DecomposeSBML extends AbstractMet4jApplication { @@ -131,4 +133,11 @@ public class DecomposeSBML extends AbstractMet4jApplication { public String getShortDescription() { return "Parse SBML to render list of composing entities: metabolites, reactions, genes and others."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } + + } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractPathways.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractPathways.java index 2214f76a0dba82fe6e06fb37f2729bbe2ff68617..d921bbdf1f2e2170abfae5bc6a163018434ed688 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractPathways.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractPathways.java @@ -11,9 +11,11 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; +import java.util.Set; public class ExtractPathways extends AbstractMet4jApplication { @@ -118,4 +120,11 @@ public class ExtractPathways extends AbstractMet4jApplication { public String getShortDescription() { return "Extract pathway(s) from GSMN"; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } + + } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java index 640f6c508664ff44338732b1e86de308131cfa27..722e60a6b6a8aec9477fd1890ed4354a1ddc477a 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java @@ -11,6 +11,7 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.FileWriter; @@ -145,4 +146,9 @@ public class ExtractSbmlAnnot extends AbstractMet4jApplication { public String getShortDescription() { return "Extract databases' references from SBML annotations or notes."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/GetGenesFromReactions.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/GetGenesFromReactions.java index 777cba704360b24e78c9a76c5c53f135e26446b8..d2c8e52a07293ee510088c9b23589dd34c621561 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/GetGenesFromReactions.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/GetGenesFromReactions.java @@ -13,11 +13,13 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import java.util.Set; public class GetGenesFromReactions extends AbstractMet4jApplication { @@ -125,4 +127,9 @@ public class GetGenesFromReactions extends AbstractMet4jApplication { public String getShortDescription() { return "Get gene lists from a list of reactions and a GSMN."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/GetReactantsFromReactions.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/GetReactantsFromReactions.java index 336ac4dd798ab94a71b3af04852388f5b7030c0c..592cd036d3d09e8f4141aa220e6ab9d46772e350 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/GetReactantsFromReactions.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/GetReactantsFromReactions.java @@ -10,11 +10,13 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import java.util.Set; public class GetReactantsFromReactions extends AbstractMet4jApplication { @@ -138,4 +140,9 @@ public class GetReactantsFromReactions extends AbstractMet4jApplication { public String getShortDescription() { return "Get reactants lists from a list of reactions and a GSMN."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java index b149a5bdfddaedf0ced1965409a132656bf940eb..884a461405aba87c10dfc631d50a2912067a8f40 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java @@ -40,8 +40,11 @@ import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork; import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetChargesFromFile; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; +import java.util.Set; + /** * <p>SbmlSetChargesFromFile class.</p> * @@ -77,6 +80,11 @@ public class SbmlSetChargesFromFile extends AbstractSbmlSetMetabolite { "containing the metabolite ids and the formulas"; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + /** * <p>main.</p> * diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java index 82def6bbce7064c3b4d0a009782296cb9b99a05b..ae6c9ed3f4ac8b7ba6395930fc0efad362f97d34 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java @@ -40,8 +40,11 @@ import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork; import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetEcsFromFile; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; +import java.util.Set; + /** * <p>SbmlSetEcsFromFile class.</p> * @@ -75,6 +78,11 @@ public class SbmlSetEcsFromFile extends AbstractSbmlSetReaction { return "Set EC numbers to reactions from a tabulated file containing the reaction ids and the EC"; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + /** * <p>main.</p> * diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java index c7f3d665eed8b5ee6bc8ac55a3e985af1c4f797e..2e0b5cc92ce709b76506067b68c8e1aecfe26a53 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java @@ -40,8 +40,11 @@ import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork; import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetFormulasFromFile; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; +import java.util.Set; + /** * <p>SbmlSetFormulasFromFile class.</p> * @@ -75,6 +78,11 @@ public class SbmlSetFormulasFromFile extends AbstractSbmlSetMetabolite { return "Set Formula to network metabolites from a tabulated file containing the metabolite ids and the formulas"; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + /** * <p>main.</p> * diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java index f57578de2c19af9d7b51fc9c63b5e8d10dbec1d2..fb93771f5aeb419b8a6f89a2996dddb8ed8dba6a 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java @@ -40,9 +40,11 @@ import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork; import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetGprsFromFile; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; +import java.util.Set; /** * <p>SbmlSetGprsFromFile class.</p> @@ -85,6 +87,11 @@ public class SbmlSetGprsFromFile extends AbstractSbmlSetReaction { return "Create a new SBML file from an original sbml file and a tabulated file containing reaction ids and Gene association written in a cobra way"; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + /** * <p>main.</p> * diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetIdsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetIdsFromFile.java index dae320521c936fa7e6ef9ed9a25def39052a7ef9..0ce64ca8ae3f07561e4844a2615580b9c1fee9a9 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetIdsFromFile.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetIdsFromFile.java @@ -40,8 +40,11 @@ import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetIdsFromFile import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetNamesFromFile; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; +import java.util.Set; + public class SbmlSetIdsFromFile extends AbstractSbmlSetAny { @ParameterType(name= EnumParameterTypes.Integer) @@ -67,6 +70,11 @@ public class SbmlSetIdsFromFile extends AbstractSbmlSetAny { return "Set new ids to network objects from a tabulated file containing the old ids and the new ids"; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + /** * <p>main.</p> * diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java index 24195b8bd807524f893d6875ce02d2403d4a06ba..cae147f535c068ba41a417ae2fb2211d7eefef81 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java @@ -41,8 +41,11 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader; import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetNamesFromFile; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; +import java.util.Set; + /** * <p>SbmlSetNamesFromFile class.</p> * @@ -74,6 +77,11 @@ public class SbmlSetNamesFromFile extends AbstractSbmlSetAny { return "Set names to network objects from a tabulated file containing the object ids and the names"; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + /** * <p>main.</p> * diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java index 127269f56cc72d3c3607715d0bbd87223b4de107..058779511c788c9ace78deb9bcdafb5ee36cd486 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java @@ -40,8 +40,11 @@ import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork; import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetPathwaysFromFile; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; +import java.util.Set; + /** * <p>SbmlSetPathwaysFromFile class.</p> * @@ -84,6 +87,11 @@ public class SbmlSetPathwaysFromFile extends AbstractSbmlSetReaction { return "Set pathway to reactions in a network from a tabulated file containing the reaction ids and the pathways"; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + /** * <p>main.</p> * diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java index 0f8be55508546e28217efc6e9155832d54ffdac1..e7acbb4d7c27cb1f138be4c2cf3ebe0729587a2d 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java @@ -41,8 +41,11 @@ import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetChargesFrom import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetRefsFromFile; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; +import java.util.Set; + /** * <p>SbmlSetRefsFromFile class.</p> * @@ -79,6 +82,11 @@ public class SbmlSetRefsFromFile extends AbstractSbmlSetAny { return "Add refs to network objects from a tabulated file containing the metabolite ids and the formulas"; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + /** * <p>main.</p> * diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java index 9dbf0949a155c68995c63ecadd3d5b13d1845957..7ee464c1ff1eaf5e53ae68bfc8cc685b4f3f94d5 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java @@ -45,11 +45,13 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import java.util.Set; /** * <p>SbmlToMetaboliteTable class.</p> @@ -141,4 +143,8 @@ public class SbmlToMetaboliteTable extends AbstractMet4jApplication { return "Create a tabulated file with metabolite attributes from a SBML file"; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java index 668db2799e949c66f5259fd0b083880211db9968..7e144df98450a5fb320725baf0b8160b122d32e5 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java @@ -41,6 +41,7 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; @@ -352,4 +353,9 @@ public class GetModelProteome extends AbstractMet4jApplication { public String getShortDescription() { return description; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java index 56f8fce6491a428c6fe18d1c0d235fc8607b78b4..b6af1f7ef03568abb78af9e013374610b02d7964 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java @@ -49,12 +49,14 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplicati import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.Option; import java.io.IOException; import java.util.HashSet; +import java.util.Set; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile; @@ -153,6 +155,10 @@ public class FbcToNotes extends AbstractMet4jApplication { return "Convert FBC package annotations to sbml notes"; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java index b5a6184f769e75cfca3d39bc85c87e890e249bb5..cf498a57e4116cb1ce58fc02461c07f0e93f555c 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java @@ -42,8 +42,11 @@ import fr.inrae.toulouse.metexplore.met4j_io.kegg.Kegg2BioNetwork; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; +import java.util.Set; + import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile; @@ -73,6 +76,11 @@ public class Kegg2Sbml extends AbstractMet4jApplication { return "Build a SBML file from KEGG organism-specific pathways. Uses Kegg API."; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + public static void main(String[] args) { Kegg2Sbml app = new Kegg2Sbml(); diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/SBMLwizard.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/SBMLwizard.java index ded73f749bccb8e1eb53c99e9a1d29faed9613d0..4c3ebbcee33ea344a99e8652f58180628964e5b5 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/SBMLwizard.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/SBMLwizard.java @@ -19,11 +19,13 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Set; public class SBMLwizard extends AbstractMet4jApplication { @@ -243,4 +245,9 @@ public class SBMLwizard extends AbstractMet4jApplication { public String getShortDescription() { return "General SBML model processing"; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java index 2486eb4bc04d4c217faa579ffb6866fa73174731..147d3ab5ad424468fad0c00fb8acc3ae0d0254b4 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java @@ -11,11 +11,13 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderExcepti import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.plugin.*; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Set; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile; @@ -122,4 +124,9 @@ public class Sbml2Graph extends AbstractMet4jApplication { return "Create a graph representation of a SBML file content, and export it in graph file format."; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java index 2d481edd963a750e4688bf313425f25f1b333183..d0dfcb9e78942fb7ac73f89f5e3ceb6db039c224 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java @@ -45,9 +45,11 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; +import java.util.Set; /** * <p>Sbml2Tab class.</p> @@ -144,4 +146,9 @@ public class Sbml2Tab extends AbstractMet4jApplication { public String getShortDescription() { return "Create a tabulated file from a SBML file"; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java index 668e8c98d119b5912c410fa0253a3fc68991c8cb..2dcb43933d2336814d58459acf7f6deab34e0cca 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java @@ -45,9 +45,11 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; +import java.util.Set; /** * <p>Tab2Sbml class.</p> @@ -128,6 +130,11 @@ public class Tab2Sbml extends AbstractMet4jApplication { return "Create a Sbml File from a tabulated file that contains the reaction ids and the formulas"; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + /** * <p>main.</p> * diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java index 62cfb9a94c91c5efd38581cd399d0d7d5da1e785..df51926f3edc00f1e17f08f8b1d8ad75d49dd6d9 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java @@ -38,16 +38,16 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox.generic; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.hibernate.validator.constraints.Range; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.Option; -import org.hibernate.validator.constraints.Range; - -import org.apache.maven.model.Model; -import org.apache.maven.model.io.xpp3.MavenXpp3Reader; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -58,20 +58,21 @@ import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.*; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import java.io.*; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.lang.annotation.Annotation; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; -import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile; - /** * <p>Abstract AbstractMet4jApplication class.</p> * @@ -82,6 +83,26 @@ public abstract class AbstractMet4jApplication { private ArrayList<HashMap<String, String>> options; + @Option(name = "-h", usage = "prints the help", required = false) + private Boolean h = false; + + public static String getVersion() throws IOException, XmlPullParserException { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model; + if ((new File("pom.xml")).exists()) + model = reader.read(new FileReader("pom.xml")); + else + model = reader.read( + new InputStreamReader( + AbstractMet4jApplication.class.getResourceAsStream( + "/META-INF/maven/fr.inrae.toulouse.metexplore/met4j-toolbox/pom.xml" + ) + ) + ); + + return model.getVersion().replace("-SNAPSHOT", ""); + } + /** * Inits the options from the field annotations * @@ -146,8 +167,7 @@ public abstract class AbstractMet4jApplication { map.put("default", defaultValue); for (Annotation a : f.getDeclaredAnnotations()) { - if (a instanceof Option) { - Option option = (Option) a; + if (a instanceof Option option) { map.put("label", option.usage()); @@ -164,8 +184,7 @@ public abstract class AbstractMet4jApplication { optional = "false"; } map.put("optional", optional); - } else if (a instanceof Range) { - Range option = (Range) a; + } else if (a instanceof Range option) { map.put("min", Double.toString(option.min())); map.put("max", Double.toString(option.max())); @@ -173,7 +192,7 @@ public abstract class AbstractMet4jApplication { } else if (a instanceof ParameterType) { String parameterType = ((ParameterType) a).name().toString().toLowerCase(); map.put("type", parameterType); - if(parameterType.startsWith("output")) { + if (parameterType.startsWith("output")) { map.put("output", "true"); } } else if (a instanceof Format) { @@ -203,9 +222,9 @@ public abstract class AbstractMet4jApplication { parameters.addAll(options); JSONObject jsonObject = new JSONObject(); - jsonObject.put("name", new String(this.getLabel())); - jsonObject.put("description", new String(this.getLongDescription())); - jsonObject.put("short_description", new String(this.getShortDescription())); + jsonObject.put("name", this.getLabel()); + jsonObject.put("description", this.getLongDescription()); + jsonObject.put("short_description", this.getShortDescription()); jsonObject.put("java_class", this.getClass().getSimpleName()); String simplePackageName = this.getSimplePackageName(); @@ -222,13 +241,12 @@ public abstract class AbstractMet4jApplication { public String getSimplePackageName() { String packageName = this.getClass().getPackage().getName(); - String tab[] = packageName.split("\\."); + String[] tab = packageName.split("\\."); String simplePackageName = tab[tab.length - 1]; return simplePackageName; } - public void xmlGalaxyWrapper(String outputDirectory, GalaxyPackageType packageType, String version) throws ParserConfigurationException, XmlPullParserException, IOException, IllegalAccessException, TransformerException, SAXException { String packageName = this.getSimplePackageName(); @@ -251,6 +269,8 @@ public abstract class AbstractMet4jApplication { NodeList testList = null; NodeList citationList = null; + Node citationsTag = null; + if (file.exists()) { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); @@ -272,11 +292,14 @@ public abstract class AbstractMet4jApplication { } citationList = doc.getElementsByTagName("citation"); + NodeList citationsTags = doc.getElementsByTagName("citations"); - if (citationList.getLength() > 0) { - citationExists = true; - } + if (citationsTags.getLength() == 0) { + citationsTag = citationsTags.item(0); + } else { + citationsTag = doc.createElement("citations"); + } } @@ -425,14 +448,15 @@ public abstract class AbstractMet4jApplication { help.appendChild(cHelp); root.appendChild(help); + Element citations = document.createElement("citations"); root.appendChild(citations); - if (citationExists) { - for (int i = 0; i < citationList.getLength(); i++) { - Node newNode = document.importNode(testList.item(i), true); - citations.appendChild(newNode); - } + for (Doi doi : this.getDois()) { + Element citation = document.createElement("citation"); + citation.setAttribute("type", "doi"); + citation.setTextContent(doi.getDoi()); + citations.appendChild(citation); } document.appendChild(root); @@ -473,7 +497,6 @@ public abstract class AbstractMet4jApplication { return param; } - private List<HashMap<String, String>> getInputOptions() { return this.options.stream().filter(o -> !o.containsKey("type") || !o.get("type").equals("outputfile")).collect(Collectors.toList()); } @@ -482,23 +505,6 @@ public abstract class AbstractMet4jApplication { return this.options.stream().filter(o -> !o.containsKey("type") || o.get("type").equals("outputfile")).collect(Collectors.toList()); } - public static String getVersion() throws IOException, XmlPullParserException { - MavenXpp3Reader reader = new MavenXpp3Reader(); - Model model; - if ((new File("pom.xml")).exists()) - model = reader.read(new FileReader("pom.xml")); - else - model = reader.read( - new InputStreamReader( - AbstractMet4jApplication.class.getResourceAsStream( - "/META-INF/maven/fr.inrae.toulouse.metexplore/met4j-toolbox/pom.xml" - ) - ) - ); - - return model.getVersion().replace("-SNAPSHOT", ""); - } - /** * <p>getLabel.</p> * @@ -520,8 +526,7 @@ public abstract class AbstractMet4jApplication { */ public abstract String getShortDescription(); - @Option(name = "-h", usage = "prints the help", required = false) - private Boolean h = false; + public abstract Set<Doi> getDois(); /** * <p>printHeader.</p> @@ -562,7 +567,7 @@ public abstract class AbstractMet4jApplication { try { parser.parseArgument(args); } catch (CmdLineException e) { - if (this.h == false) { + if (!this.h) { this.printShortHeader(); System.err.println("Error in arguments"); parser.printUsage(System.err); @@ -574,7 +579,7 @@ public abstract class AbstractMet4jApplication { } } - if (this.h == true) { + if (this.h) { this.printLongHeader(); parser.printUsage(System.err); System.exit(0); diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/mapping/NameMatcher.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/mapping/NameMatcher.java index df16a96cc4092f21a3ee820e0b04f8f70e28bea7..69317ec0771bfe24544d67247b06109480436f8a 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/mapping/NameMatcher.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/mapping/NameMatcher.java @@ -10,13 +10,11 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Tsv; @@ -185,4 +183,9 @@ public class NameMatcher extends AbstractMet4jApplication { "substitutions of common patterns among synonyms, in order to create aliases on which classical fuzzy " + "matching can be run efficiently."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/mapping/ORApathwayEnrichment.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/mapping/ORApathwayEnrichment.java index d740aceabe0be5400312f6023b7a611534413af0..78f894affb878a211d0a0c266ce72d22afc5ef7c 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/mapping/ORApathwayEnrichment.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/mapping/ORApathwayEnrichment.java @@ -16,6 +16,7 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.FileWriter; @@ -188,6 +189,11 @@ public class ORApathwayEnrichment extends AbstractMet4jApplication { return "Perform Over Representation Analysis for Pathway Enrichment, using one-tailed exact Fisher Test."; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + @Override public String getLongDescription() { return "Perform Over Representation Analysis for Pathway Enrichment, using one-tailed exact Fisher Test.\n" + diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/BipartiteDistanceMatrix.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/BipartiteDistanceMatrix.java index dc267e1f87a1e1e7e6577c6c424958c659de0317..1e25be22afdea6f22d95cdeb0bef02a03d329e60 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/BipartiteDistanceMatrix.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/BipartiteDistanceMatrix.java @@ -19,6 +19,7 @@ import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.BioMatrix; import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.ExportMatrix; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; @@ -221,4 +222,9 @@ public class BipartiteDistanceMatrix extends AbstractMet4jApplication { public String getShortDescription() { return "Create a compound to reactions distance matrix."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java index 00a25c02b48ea8597b9693832c10a5c8357e1cf4..5173dbab4b5d66f399a541766f5364cf32b47e7a 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java @@ -23,6 +23,7 @@ import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.ExportMatrix; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.apache.commons.lang3.StringUtils; import org.kohsuke.args4j.Option; @@ -30,6 +31,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; +import java.util.Set; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml; @@ -226,5 +228,9 @@ public class CarbonSkeletonNet extends AbstractMet4jApplication { public String getShortDescription() { return "Create a carbon skeleton graph representation of a SBML file content, using GSAM atom-mapping file (see https://forgemia.inra.fr/metexplore/gsam)"; } + + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChemSimilarityWeighting.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChemSimilarityWeighting.java index 5b156659397722b3282a26957edfc645a7274c29..d64997c4568ff58bac278cf550b7e825c786ba14 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChemSimilarityWeighting.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChemSimilarityWeighting.java @@ -9,20 +9,24 @@ import fr.inrae.toulouse.metexplore.met4j_graph.core.WeightingPolicy; import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException; import fr.inrae.toulouse.metexplore.met4j_mapping.Mapper; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.EdgeWeighting; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; /** * App that provides tabulated compound graph edge list, with one column with reactant pair's chemical similarity */ public class ChemSimilarityWeighting extends EdgeWeighting { - enum strategy {EState,Extended,KlekotaRoth,MACCS,PubChem}; + enum strategy {EState, Extended, KlekotaRoth, MACCS, PubChem} + @Option(name = "-f", aliases = {"--fingerprint"}, usage = "The chemical fingerprint to use", required = false) public strategy type = strategy.Extended; @@ -37,41 +41,46 @@ public class ChemSimilarityWeighting extends EdgeWeighting { @Override public WeightingPolicy setWeightingPolicy() { SimilarityWeightPolicy wp = new SimilarityWeightPolicy(); - switch(type){ - case EState: wp.setFingerprintType(FingerprintBuilder.ESTATE); - case Extended: wp.setFingerprintType(FingerprintBuilder.EXTENDED); - case KlekotaRoth: wp.setFingerprintType(FingerprintBuilder.KLEKOTAROTH); - case MACCS: wp.setFingerprintType(FingerprintBuilder.MACCS); - case PubChem: wp.setFingerprintType(FingerprintBuilder.PUBCHEM); + switch (type) { + case EState: + wp.setFingerprintType(FingerprintBuilder.ESTATE); + case Extended: + wp.setFingerprintType(FingerprintBuilder.EXTENDED); + case KlekotaRoth: + wp.setFingerprintType(FingerprintBuilder.KLEKOTAROTH); + case MACCS: + wp.setFingerprintType(FingerprintBuilder.MACCS); + case PubChem: + wp.setFingerprintType(FingerprintBuilder.PUBCHEM); } wp.useDistance(dist); return wp; } @Override - public BioNetwork processNetwork(BioNetwork bn){ - if(inchiFile!=null){ + public BioNetwork processNetwork(BioNetwork bn) { + if (inchiFile != null) { Mapper m = new Mapper<>(bn, BioNetwork::getMetabolitesView) .columnSeparator("\t") .idColumn(1) .skipIfNotFound(); try { Map<BioMetabolite, List<String>> att = m.mapAttributes(new BufferedReader(new FileReader(inchiFile))); - for(Map.Entry<BioMetabolite, List<String>> entry : att.entrySet()){ + for (Map.Entry<BioMetabolite, List<String>> entry : att.entrySet()) { entry.getKey().setInchi(entry.getValue().get(0)); } } catch (IOException e) { System.err.println("Error reading InChI file"); throw new RuntimeException(e); } - } else if (smileFile!=null) { + } else if (smileFile != null) { Mapper m = new Mapper<>(bn, BioNetwork::getMetabolitesView) .columnSeparator("\t") .idColumn(1) .skipIfNotFound(); try { Map<BioMetabolite, List<String>> att = m.mapAttributes(new BufferedReader(new FileReader(smileFile))); - for(Map.Entry<BioMetabolite, List<String>> entry : att.entrySet()){ + for (Map.Entry<BioMetabolite, List<String>> entry : att.entrySet()) { entry.getKey().setSmiles(entry.getValue().get(0)); } } catch (IOException e) { @@ -81,13 +90,13 @@ public class ChemSimilarityWeighting extends EdgeWeighting { } int s = 0; int i = 0; - for(BioMetabolite m : bn.getMetabolitesView()){ - if(!StringUtils.isVoid(m.getSmiles())) s++; - if(!StringUtils.isVoid(m.getInchi())) i++; + for (BioMetabolite m : bn.getMetabolitesView()) { + if (!StringUtils.isVoid(m.getSmiles())) s++; + if (!StringUtils.isVoid(m.getInchi())) i++; } - System.out.println(s+"/"+bn.getMetabolitesView().size()+" metabolites with SMILE"); - System.out.println(i+"/"+bn.getMetabolitesView().size()+" metabolites with InChI"); - if((i+s)==0){ + System.out.println(s + "/" + bn.getMetabolitesView().size() + " metabolites with SMILE"); + System.out.println(i + "/" + bn.getMetabolitesView().size() + " metabolites with InChI"); + if ((i + s) == 0) { System.err.println("Error: no chemical structure provided, unable to compute chemical similarity"); System.exit(1); } @@ -113,12 +122,20 @@ public class ChemSimilarityWeighting extends EdgeWeighting { public String getLongDescription() { return "Provides tabulated compound graph edge list, with one column with reactant pair's chemical similarity." + "Chemical similarity has been proposed as edge weight for finding meaningful paths in metabolic networks," + - " using shortest (lightest) path search. See McSha et al. 2003 (https://doi.org/10.1093/bioinformatics/btg217)," + - " Rahman et al. 2005 (https://doi.org/10.1093/bioinformatics/bti116) and Pertusi et al. 2014 (https://doi.org/10.1093/bioinformatics/btu760)"; + " using shortest (lightest) path search."; } @Override public String getShortDescription() { return "Provides tabulated compound graph edge list, with one column with reactant pair's chemical similarity."; } + + @Override + public Set<Doi> getDois() { + Set<Doi> dois = new HashSet<>(); + dois.add(new Doi("https://doi.org/10.1093/bioinformatics/btg217")); + dois.add(new Doi("https://doi.org/10.1093/bioinformatics/bti116")); + dois.add(new Doi("https://doi.org/10.1093/bioinformatics/btu760")); + return dois; + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java index c6d43799969f38a44b89492a879185cc11f9b1b8..7f32735816d7e26306c52f850bffe2d185591371 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java @@ -14,6 +14,7 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderExcepti import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.BufferedReader; @@ -21,6 +22,7 @@ import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.HashSet; +import java.util.Set; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile; @@ -115,12 +117,18 @@ public class ChokePoint extends AbstractMet4jApplication { @Override public String getLongDescription() { return this.getShortDescription() + "\nChoke points constitute an indicator of lethality and can help identifying drug target " + - "Choke points are reactions that are required to consume or produce one compound. Targeting of choke point can lead to the accumulation or the loss of some metabolites, thus choke points constitute an indicator of lethality and can help identifying drug target \n" + - "See : Syed Asad Rahman, Dietmar Schomburg; Observing local and global properties of metabolic pathways: ‘load points’ and ‘choke points’ in the metabolic networks. Bioinformatics 2006; 22 (14): 1767-1774. doi: 10.1093/bioinformatics/btl181"; + "Choke points are reactions that are required to consume or produce one compound. Targeting of choke point can lead to the accumulation or the loss of some metabolites, thus choke points constitute an indicator of lethality and can help identifying drug target."; } @Override public String getShortDescription() { return "Compute the Choke points of a metabolic network."; } + + @Override + public Set<Doi> getDois() { + Set<Doi> dois = new HashSet<>(); + dois.add(new Doi("https://doi.org/10.1093/bioinformatics/btl181")); + return dois; + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java index e59a51b446f9331bcebc3515592a82c3fe50e677..5abc5499b6106a0e8165d16219caf9d4ccd07deb 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java @@ -25,60 +25,53 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; +import java.util.Set; public class CompoundNet extends AbstractMet4jApplication { - @Format(name= EnumFormats.Sbml) - @ParameterType(name= EnumParameterTypes.InputFile) + @Format(name = EnumFormats.Sbml) + @ParameterType(name = EnumParameterTypes.InputFile) @Option(name = "-s", usage = "input SBML file", required = true) public String inputPath = null; - @ParameterType(name= EnumParameterTypes.InputFile) - @Format(name= EnumFormats.Txt) + @ParameterType(name = EnumParameterTypes.InputFile) + @Format(name = EnumFormats.Txt) @Option(name = "-sc", usage = "input Side compound file", required = false) public String inputSide = null; - @ParameterType(name= EnumParameterTypes.OutputFile) - @Format(name= EnumFormats.Gml) + @ParameterType(name = EnumParameterTypes.OutputFile) + @Format(name = EnumFormats.Gml) @Option(name = "-o", usage = "output Graph file", required = true) public String outputPath = null; - - enum strategy {no, by_name,by_id} @Option(name = "-mc", aliases = {"--mergecomp"}, usage = "merge compartments. " + "Use names if consistent and unambiguous across compartments, or identifiers if compartment suffix is present (id in form \"xxx_y\" with xxx as base identifier and y as compartment label).") public strategy mergingStrat = strategy.no; public String idRegex = "^(\\w+)_\\w$"; - @Option(name = "-me", aliases = {"--simple"}, usage = "merge parallel edges to produce a simple graph", required = false) public boolean mergeEdges = false; - @Option(name = "-ri", aliases = {"--removeIsolatedNodes"}, usage = "remove isolated nodes", required = false) public boolean removeIsolated = false; - @Option(name = "-dw", aliases = {"--degreeWeights"}, usage = "penalize traversal of hubs by using degree square weighting", forbids = {"-cw"}) public Boolean degree = false; - - @ParameterType(name=EnumParameterTypes.InputFile) - @Format(name=EnumFormats.Tsv) + @ParameterType(name = EnumParameterTypes.InputFile) + @Format(name = EnumFormats.Tsv) @Option(name = "-cw", aliases = {"--customWeights"}, usage = "an optional file containing weights for compound pairs", forbids = {"-dw"}) public String weightFile = null; - @Option(name = "-un", aliases = {"--undirected"}, usage = "create as undirected", required = false) public boolean undirected = false; - @Option(name = "-tp", aliases = {"--transitionproba"}, usage = "set weight as random walk transition probability, normalized by reaction", required = false) public boolean computeWeight = false; - @Option(name = "-am", aliases = {"--asmatrix"}, usage = "export as matrix (implies simple graph conversion). Default export as GML file", required = false) public boolean asMatrix = false; - public static void main(String[] args) { + public static void main(String[] args) { CompoundNet app = new CompoundNet(); @@ -88,7 +81,6 @@ public class CompoundNet extends AbstractMet4jApplication { } - public void run() { System.out.print("Reading SBML..."); JsbmlReader reader = new JsbmlReader(this.inputPath); @@ -142,25 +134,25 @@ public class CompoundNet extends AbstractMet4jApplication { System.out.println(" Done."); //invert graph as undirected (copy edge weight to reversed edge) - if(undirected){ - System.out.print("Create Undirected..."); - graph.asUndirected(); - System.out.println(" Done."); - if(degree){ - //since degree weighting policy is not symmetric, for undirected case we create reversed edges, apply - //a corrected degree computation for each edge, and treat the graph as normal - System.err.println("Setting edge weights (target degree)..."); - int pow = 2; - wp = new DegreeWeightPolicy(1); - wp.setWeight(graph); - //adjust degree to ignore edges added for undirected case support - WeightUtils.process(graph, x -> StrictMath.pow((x/2),pow)); - System.out.println(" Done."); - } - } + if (undirected) { + System.out.print("Create Undirected..."); + graph.asUndirected(); + System.out.println(" Done."); + if (degree) { + //since degree weighting policy is not symmetric, for undirected case we create reversed edges, apply + //a corrected degree computation for each edge, and treat the graph as normal + System.err.println("Setting edge weights (target degree)..."); + int pow = 2; + wp = new DegreeWeightPolicy(1); + wp.setWeight(graph); + //adjust degree to ignore edges added for undirected case support + WeightUtils.process(graph, x -> StrictMath.pow((x / 2), pow)); + System.out.println(" Done."); + } + } //merge compartment - if(mergingStrat!=strategy.no){ + if (mergingStrat != strategy.no) { System.out.print("Merging compartments..."); VertexContraction vc = new VertexContraction(); VertexContraction.Mapper merger = mergingStrat.equals(strategy.by_name) ? new VertexContraction.MapByName() : new VertexContraction.MapByIdSubString(idRegex); @@ -169,19 +161,19 @@ public class CompoundNet extends AbstractMet4jApplication { } //remove isolated nodes - if(removeIsolated){ + if (removeIsolated) { System.out.println("Remove isolated nodes..."); HashSet<BioMetabolite> nodes = new HashSet<>(graph.vertexSet()); graph.removeIsolatedNodes(); nodes.removeAll(graph.vertexSet()); - for(BioMetabolite n : nodes){ + for (BioMetabolite n : nodes) { System.out.println("\tremoving " + n.getName()); } System.out.println(" Done."); } //compute transitions probability from weights - if(computeWeight) { + if (computeWeight) { System.out.print("Compute transition matrix..."); ReactionProbabilityWeight wp2 = new ReactionProbabilityWeight(); wp2.setWeight(graph); @@ -189,7 +181,7 @@ public class CompoundNet extends AbstractMet4jApplication { } //merge parallel edges - if(mergeEdges){ + if (mergeEdges) { System.out.print("Merging edges..."); EdgeMerger.mergeEdgesWithOverride(graph); System.out.println(" Done."); @@ -197,29 +189,41 @@ public class CompoundNet extends AbstractMet4jApplication { //export graph System.out.print("Exporting..."); - if(asMatrix){ + if (asMatrix) { ComputeAdjacencyMatrix adjBuilder = new ComputeAdjacencyMatrix(graph); - if(!computeWeight) adjBuilder.parallelEdgeWeightsHandling((u, v) -> Math.max(u,v)); - ExportMatrix.toCSV(this.outputPath,adjBuilder.getadjacencyMatrix()); - }else{ + if (!computeWeight) adjBuilder.parallelEdgeWeightsHandling((u, v) -> Math.max(u, v)); + ExportMatrix.toCSV(this.outputPath, adjBuilder.getadjacencyMatrix()); + } else { ExportGraph.toGmlWithAttributes(graph, this.outputPath, true); } System.out.println(" Done."); - return; } @Override - public String getLabel() {return this.getClass().getSimpleName();} + public String getLabel() { + return this.getClass().getSimpleName(); + } @Override public String getLongDescription() { return "Metabolic networks used for quantitative analysis often contain links that are irrelevant for graph-based structural analysis. For example, inclusion of side compounds or modelling artifacts such as 'biomass' nodes.\n" + "While Carbon Skeleton Graph offer a relevant alternative topology for graph-based analysis, it requires compounds' structure information, usually not provided in model, and difficult to retrieve for model with sparse cross-reference annotations.\n" + - "In contrary to the SBML2Graph app that performs a raw conversion of the SBML content, the present app propose a fine-tuned creation of compound graph from predefined list of side compounds and degree² weighting to get relevant structure without structural data."+ + "In contrary to the SBML2Graph app that performs a raw conversion of the SBML content, the present app propose a fine-tuned creation of compound graph from predefined list of side compounds and degree² weighting to get relevant structure without structural data." + "This app also enable Markov-chain based analysis of metabolic networks by computing reaction-normalized transition probabilities on the network."; } @Override - public String getShortDescription() {return "Advanced creation of a compound graph representation of a SBML file content";} + public String getShortDescription() { + return "Advanced creation of a compound graph representation of a SBML file content"; + } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } + + enum strategy {no, by_name, by_id} + + } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DegreeWeighting.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DegreeWeighting.java index a55cb91bd2435b0de47e97badb376f1f8eb77d8f..884799301243876898951837b9c260e902d17472 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DegreeWeighting.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DegreeWeighting.java @@ -4,9 +4,12 @@ import fr.inrae.toulouse.metexplore.met4j_graph.computation.connect.weighting.De import fr.inrae.toulouse.metexplore.met4j_graph.core.WeightingPolicy; import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.EdgeWeighting; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; +import java.util.HashSet; +import java.util.Set; /** * App that provides tabulated compound graph edge list, with one column with target's degree. @@ -41,12 +44,18 @@ public class DegreeWeighting extends EdgeWeighting { public String getLongDescription() { return "Provides tabulated compound graph edge list, with one column with target's degree." + "Degree has been proposed as edge weight for finding meaningful paths in metabolic networks," + - " using shortest (lightest) path search. See Croes et al. 2006 (https://doi.org/10.1016/j.jmb.2005.09.079) and" + - " Croes et al. 2005 (https://doi.org/10.1093/nar/gki437)"; + " using shortest (lightest) path search."; } @Override public String getShortDescription() { return "Provides tabulated compound graph edge list, with one column with target's degree."; } + + @Override + public Set<Doi> getDois() { + Set<Doi> dois = new HashSet<>(); + dois.add(new Doi("https://doi.org/10.1016/j.jmb.2005.09.079")); + return dois; + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java index 20a38175a15464496b301a20205d5cf478b21838..a87eb0fec4fc7ea97cccd7e99774a68ae4d7de40 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java @@ -19,6 +19,7 @@ import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.BioMatrix; import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.ExportMatrix; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; @@ -179,4 +180,9 @@ public class DistanceMatrix extends AbstractMet4jApplication { public String getShortDescription() { return "Create a compound to compound distance matrix."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubBipNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubBipNetwork.java index 34c151f13ac6bfd5cac85a6d9f16399d8395cd15..0a3b4e6e5fa8cad351e12940eb0705335787a4b8 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubBipNetwork.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubBipNetwork.java @@ -23,11 +23,13 @@ import fr.inrae.toulouse.metexplore.met4j_mapping.Mapper; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; import java.util.HashSet; import java.util.List; +import java.util.Set; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile; @@ -227,4 +229,9 @@ public class ExtractSubBipNetwork extends AbstractMet4jApplication { public String getShortDescription() { return "Create a subnetwork from a GSMN in SBML format, and two files containing lists of compounds and/or reactions of interests ids, one per row, plus one file of the same format containing side compounds ids."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } \ No newline at end of file diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java index 26b5635d2ad68adb80c0136fe6b5154e8d2c671a..898295a42b1aca33d77d2ea19e681157edd0bc9d 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java @@ -23,11 +23,13 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader; import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; import java.util.HashSet; import java.util.List; +import java.util.Set; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile; @@ -199,18 +201,24 @@ public class ExtractSubNetwork extends AbstractMet4jApplication { "The subnetwork correspond to part of the network that connects compounds from the first list to compounds from the second list.\n" + "Sources and targets list can have elements in common. The connecting part can be defined as the union of shortest or k-shortest paths between sources and targets, " + "or the Steiner tree connecting them. The relevance of considered path can be increased by weighting the edges using degree squared, chemical similarity (require InChI or SMILES annotations) or any provided weighting.\n" + - "\nSee previous works on subnetwork extraction for parameters recommendations:" + - "Frainay, C., & Jourdan, F. Computational methods to identify metabolic sub-networks based on metabolomic profiles. Bioinformatics 2016;1–14. https://doi.org/10.1093/bib/bbv115\n" + - "Faust, K., Croes, D., & van Helden, J. Prediction of metabolic pathways from genome-scale metabolic networks. Bio Systems 2011;105(2), 109–121. https://doi.org/10.1016/j.biosystems.2011.05.004\n" + - "Croes D, Couche F, Wodak SJ, et al. Metabolic PathFinding: inferring relevant pathways in biochemical networks. Nucleic Acids Res 2005;33:W326–30.\n" + - "Croes D, Couche F, Wodak SJ, et al. Inferring meaningful pathways in weighted metabolic networks. J Mol Biol 2006; 356:222–36.\n" + - "Rahman SA, Advani P, Schunk R, et al. Metabolic pathway analysis web service (Pathway Hunter Tool at CUBIC). Bioinformatics 2005;21:1189–93.\n" + - "Pertusi DA, Stine AE, Broadbelt LJ, et al. Efficient searching and annotation of metabolic networks using chemical similarity. Bioinformatics 2014;1–9.\n" + - "McShan DC, Rao S, Shah I. PathMiner: predicting metabolic pathways by heuristic search. Bioinformatics 2003;19:1692–8.\n"; + "\nSee previous works on subnetwork extraction for parameters recommendations."; } @Override public String getShortDescription() { return "Create a subnetwork from a GSMN in SBML format, and two files containing lists of compounds of interests ids, one per row."; } + + @Override + public Set<Doi> getDois() { + Set<Doi> dois = new HashSet<>(); + dois.add(new Doi("https://doi.org/10.1093/bib/bbv115")); + dois.add(new Doi("https://doi.org/10.1016/j.biosystems.2011.05.004")); + dois.add(new Doi("https://doi.org/10.1093/nar/gki437")); + dois.add(new Doi("https://doi.org/10.1093/bioinformatics/bti116")); + dois.add(new Doi("https://doi.org/10.1016/j.jmb.2005.09.079")); + dois.add(new Doi("https://doi.org/10.1093/bioinformatics/btg217")); + dois.add(new Doi("https://doi.org/10.1093/bioinformatics/btu760")); + return dois; + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java index f3f47e4bf06b570ab6b57cfb42e4c7d0c188f9c0..9ed45008a3e1e6bb4223e375a1cf78a32ef114b0 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java @@ -22,6 +22,7 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderExcepti import fr.inrae.toulouse.metexplore.met4j_mapping.Mapper; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; @@ -221,4 +222,9 @@ public class ExtractSubReactionNetwork extends AbstractMet4jApplication { public String getShortDescription() { return "Create a subnetwork from a GSMN in SBML format, and two files containing lists of reactions of interests ids, one per row, plus one file of the same format containing side compounds ids."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java index 6f20231d15255d9364a0f8a7eecdbbf029e2d031..be05a91c6af307ac299758f6da0be7b3f06d51ac 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java @@ -13,6 +13,7 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderExcepti import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.BufferedReader; @@ -21,6 +22,7 @@ import java.io.FileWriter; import java.io.IOException; import java.util.HashMap; import java.util.Map; +import java.util.Set; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile; @@ -160,4 +162,9 @@ public class LoadPoint extends AbstractMet4jApplication { public String getShortDescription() { return "Compute the Load points of a metabolic network. Load points constitute an indicator of lethality and can help identifying drug target."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java index 10fdef0e3c795a7b25906e90a460ef55be0b6cb1..86058c9ac1a12d05458033856154c4ad77d88c02 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java @@ -56,6 +56,7 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.*; @@ -520,11 +521,19 @@ public class MetaboRank extends AbstractMet4jApplication { "The MetaboRank can, from metabolomics results, be used to fuel a recommender system highlighting interesting compounds to investigate, retrieve missing identification and drive literature mining.\n" + "It is a two dimensional centrality computed from personalized PageRank and CheiRank, with special transition probability and normalization to handle the specificities of metabolic networks.\n" + "For convenience, a one dimensional centrality rank is also computed from the highest rank from PageRank or CheiRank, and using lowest rank as tie-breaker.\n" + - "See publication for more information: Frainay et al. MetaboRank: network-based recommendation system to interpret and enrich metabolomics results, Bioinformatics (35-2), https://doi.org/10.1093/bioinformatics/bty577"; + "See publication for more information."; } @Override public String getShortDescription() { return "Compute the MetaboRank, a custom personalized PageRank for metabolic network."; } + + @Override + public Set<Doi> getDois() { + Set<Doi> dois = new HashSet<>(); + dois.add(new Doi("https://doi.org/10.1093/bioinformatics/bty577")); + return dois; + } + } \ No newline at end of file diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java index 31af76e5a8cd1d65ad5c1389b9dd38b7d7ffa7bc..069be1361f5e294357bae0ad41ff9ad79cdead55 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java @@ -21,6 +21,7 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplicati import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; import org.kohsuke.args4j.Option; @@ -252,4 +253,9 @@ public class NetworkSummary extends AbstractMet4jApplication { return "Create a report summarizing several graph measures characterising the structure of the network."; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PathwayNet.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PathwayNet.java index 14bc91bb44c03db381d670ba8cbf79fc7af53c4e..a65f3f21d1ddc61dd0cf32eb9fb5775de76f0aad 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PathwayNet.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PathwayNet.java @@ -27,6 +27,7 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; @@ -169,5 +170,10 @@ public class PathwayNet extends AbstractMet4jApplication { @Override public String getShortDescription() {return "Creation of a Pathway Network representation of a SBML file content";} + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java index 5447180e41ad54b143fcff70904a8a61ac379749..f526215af0be31f0c5086c43a7bdb1483e6116ae 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java @@ -16,9 +16,11 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; +import java.util.Set; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Gml; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml; @@ -137,4 +139,9 @@ public class PrecursorNetwork extends AbstractMet4jApplication { public String getShortDescription() { return "Perform a network expansion from a set of compound targets to create a precursor network."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ReactionDistanceMatrix.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ReactionDistanceMatrix.java index 7aee70d6dd177435495261869e7b526b14b4e1f1..eb0c0524a8ca7a78b511847361d0a0f106c79a45 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ReactionDistanceMatrix.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ReactionDistanceMatrix.java @@ -21,6 +21,7 @@ import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.BioMatrix; import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.ExportMatrix; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; @@ -203,4 +204,9 @@ public class ReactionDistanceMatrix extends AbstractMet4jApplication { public String getShortDescription() { return "Create a reaction to reaction distance matrix."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } \ No newline at end of file diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java index 3d9ead6d5f02c9d0a4b42785fbcf0482b01d8058..a5f2e6fb3e9a79b753d6fc0694d4f6afb3ff953c 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java @@ -17,9 +17,12 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.IOException; +import java.util.HashSet; +import java.util.Set; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Gml; import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml; @@ -144,12 +147,18 @@ public class ScopeNetwork extends AbstractMet4jApplication { return this.getShortDescription() + "\n" + "The scope of a set of compounds (seed) refer to the maximal metabolic network that can be extended from them," + "where the extension process consist of adding a reaction to the network if and only if all of its substrates " + - "are either a seed or a product of a previously added reaction\n" + - "For more information, see Handorf, Ebenhöh and Heinrich (2005). *Expanding metabolic networks: scopes of compounds, robustness, and evolution.* Journal of molecular evolution, 61(4), 498-512. (https://doi.org/10.1007/s00239-005-0027-1)"; + "are either a seed or a product of a previously added reaction"; } @Override public String getShortDescription() { return "Perform a network expansion from a set of compound seeds to create a scope network"; } + + @Override + public Set<Doi> getDois() { + Set<Doi> dois = new HashSet<>(); + dois.add(new Doi("https://doi.org/10.1007/s00239-005-0027-1")); + return dois; + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SeedsAndTargets.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SeedsAndTargets.java index 8cba048a03d71e7ab3000e18be77ff7c5e9bb0ad..082e88ead8b9a929bec740c4bc586598509938c1 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SeedsAndTargets.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SeedsAndTargets.java @@ -17,10 +17,13 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.FileWriter; import java.io.IOException; +import java.util.HashSet; +import java.util.Set; public class SeedsAndTargets extends AbstractMet4jApplication { @@ -203,4 +206,11 @@ public class SeedsAndTargets extends AbstractMet4jApplication { public String getShortDescription() { return "Identify exogenously acquired compounds, producible compounds exogenously available and/or dead ends metabolites from metabolic network topology"; } + + @Override + public Set<Doi> getDois() { + Set<Doi> dois = new HashSet<>(); + dois.add(new Doi("https://doi.org/10.1073/pnas.0806162105")); + return dois; + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java index e3c15df680e0f965da1e5fc405cc8382ccf8e69e..426b75c5a1f93de0d59bed0e04e647d257d91393 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java @@ -13,6 +13,7 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderExcepti import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; import org.kohsuke.args4j.Option; @@ -25,6 +26,7 @@ import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Enu import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile; import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; @@ -265,4 +267,9 @@ public class SideCompoundsScan extends AbstractMet4jApplication { public String getShortDescription() { return "Scan a network to identify side-compounds."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/TopologicalPathwayAnalysis.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/TopologicalPathwayAnalysis.java index 716be26714c12d4435bc12dfb08a53d99c89c8b9..959e179fe6abbc41b0c2dd8f9238c3181a9109dd 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/TopologicalPathwayAnalysis.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/TopologicalPathwayAnalysis.java @@ -23,14 +23,12 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.FileWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Map; +import java.util.*; public class TopologicalPathwayAnalysis extends AbstractMet4jApplication { @@ -227,5 +225,10 @@ public class TopologicalPathwayAnalysis extends AbstractMet4jApplication { @Override public String getShortDescription() {return "Run a Topological Pathway Analysis to identify key pathways based on topological properties of its constituting compounds.";} + + @Override + public Set<Doi> getDois() { + return Set.of(); + } } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/reconstruction/CreateMetaNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/reconstruction/CreateMetaNetwork.java index a0ef3029a8ec4f2e421a4fee66a60a0e3f18d518..3b6985198c7de3defcfa9d597f9996bd6793145c 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/reconstruction/CreateMetaNetwork.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/reconstruction/CreateMetaNetwork.java @@ -15,6 +15,7 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormat import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.util.*; @@ -195,6 +196,11 @@ public class CreateMetaNetwork extends AbstractMet4jApplication { return "Create a Meta-Network from two sub-networks in SBML format."; } + @Override + public Set<Doi> getDois() { + return Set.of(); + } + @Override public String getLongDescription() { return "Create a Meta-Network from two sub-networks in SBML format. A meta-network is a single model which contains several sub-networks that remains individualized within" + diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/reconstruction/SbmlCheckBalance.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/reconstruction/SbmlCheckBalance.java index f01b4155296cec0f2ba0f7aa18da44c94df90d9c..7ca49f4b4278917fe1787bdb168e1bfb985e76da 100644 --- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/reconstruction/SbmlCheckBalance.java +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/reconstruction/SbmlCheckBalance.java @@ -45,6 +45,7 @@ import fr.inrae.toulouse.metexplore.met4j_reconstruction.check.balance.ReactionB import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format; import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType; +import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Doi; import org.kohsuke.args4j.Option; import java.io.FileWriter; @@ -155,4 +156,10 @@ public class SbmlCheckBalance extends AbstractMet4jApplication { public String getShortDescription() { return "Check balance of all the reactions in a SBML."; } + + @Override + public Set<Doi> getDois() { + return Set.of(); + } + } diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/utils/Doi.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/utils/Doi.java new file mode 100644 index 0000000000000000000000000000000000000000..edb72d28b1bc36fde374785bc959efd843b48ca6 --- /dev/null +++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/utils/Doi.java @@ -0,0 +1,227 @@ +/* + * Copyright INRAE (2024) + * + * contact-metexplore@inrae.fr + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + * + */ + +package fr.inrae.toulouse.metexplore.met4j_toolbox.utils; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import org.apache.commons.lang3.StringUtils; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; + +/** + * The Doi class represents a Digital Object Identifier (DOI) and fetches + * publication details associated with the DOI from the CrossRef API. + */ +public class Doi { + + private final String doi; + private String title; + private String journal; + private String date; + private String authors; + private ArrayList<String> authorList; + private final String url; + + private boolean detailsRetrieved = false; + + /** + * Constructs a Doi object and extracts the DOI from the provided URL. + * + * @param doi The DOI or URL containing the DOI. + */ + public Doi(String doi) { + String normalizedDoi = StringUtils.replaceIgnoreCase(doi,"https://doi.org/", "",1); + normalizedDoi = StringUtils.replaceIgnoreCase(normalizedDoi,"http:/dx.doi.org/", "",1); + normalizedDoi = StringUtils.replaceIgnoreCase(normalizedDoi,"doi:", "",1); + this.doi=normalizedDoi; + if(!this.doi.matches("10\\.[\\d\\.]+/.+")) throw new IllegalArgumentException("invalid DOI : "+this.doi); + this.url = "https://doi.org/"+this.getDoi(); + this.fetchPublicationDetails(); + } + + /** + * Fetches publication details from the CrossRef API and populates the class fields. + * Throws RuntimeException if the API response code is not 200. + * Logs other exceptions as "Doi not reachable." + */ + public void fetchPublicationDetails() { + String apiUrl = "https://api.crossref.org/works/" + doi; + + try { + URL url = new URL(apiUrl); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET"); + conn.setRequestProperty("Accept", "application/json"); + + if (conn.getResponseCode() != 200) { + throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); + } + + BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream()))); + StringBuilder sb = new StringBuilder(); + String output; + while ((output = br.readLine()) != null) { + sb.append(output); + } + conn.disconnect(); + + JsonObject json = JsonParser.parseString(sb.toString()).getAsJsonObject(); + JsonObject message = json.getAsJsonObject("message"); + + String title = message.getAsJsonArray("title").get(0).getAsString(); + String journal = message.getAsJsonArray("container-title").get(0).getAsString(); + String date = message.getAsJsonObject("published-print").getAsJsonArray("date-parts").get(0).getAsJsonArray().get(0).getAsString(); + JsonArray authors = message.getAsJsonArray("author"); + + ArrayList<String> authorList = new ArrayList<>(); + + int index = 0; + + for (JsonElement authorElement : authors) { + JsonObject author = authorElement.getAsJsonObject(); + String authorEntry = author.get("given") + " " + author.get("family"); + authorList.add(authorEntry.replace("\"", "")); + index++; + } + + this.title = title; + this.journal = journal; + this.date = date; + this.authors = String.join(", ", authorList); + this.authorList = authorList; + this.detailsRetrieved = true; + + } catch (Exception e) { + System.err.println("Doi not reachable"); + } + } + + /** + * Returns the title of the publication. + * + * @return The title of the publication. + */ + public String getTitle() { + return title; + } + + /** + * Returns the journal name of the publication. + * + * @return The journal name of the publication. + */ + public String getJournal() { + return journal; + } + + /** + * Returns the publication date. + * + * @return The publication date. + */ + public String getDate() { + return date; + } + + /** + * Returns the authors of the publication as a single string. + * + * @return The authors of the publication. + */ + public String getAuthors() { + return authors; + } + + /** + * Returns the list of authors. + * + * @return The list of authors. + */ + public ArrayList<String> getAuthorList() { + return authorList; + } + + /** + * Returns a complete reference of the publication including authors, title, journal, and date. + * If no publication details has been successfully fetched from DOI, returns url + * @return The complete reference of the publication, or the url. + */ + public String getCompleteReference() { + if(detailsRetrieved) return this.getAuthors() + "; " + this.getTitle() + "; " + this.getJournal() + "; " + this.getDate(); + return this.url; + } + + /** + * Returns an abbreviated reference with the first author's last name, "et al.", + * title, journal, and date. + * If no publication details has been successfully fetched from DOI, returns url + * @return The abbreviated reference of the publication, or the url. + */ + public String getAbbreviatedReference() { + if(detailsRetrieved){ + String firstAuthor = this.getAuthorList().get(0); + String[] detailsFirstAuthor = firstAuthor.split("\s"); + String lastName = detailsFirstAuthor[detailsFirstAuthor.length - 1]; + + return lastName + " et al.; " + this.getTitle() + "; " + this.getJournal() + "; " + this.getDate(); + } + return this.url; + } + + /** + * Returns the DOI of the publication. + * + * @return The DOI of the publication. + */ + public String getDoi() { + return doi; + } + + /** + * Returns if the publication details have been successfully retrieved + * @return if details have been retrieved + */ + public boolean isDetailsRetrieved() { + return detailsRetrieved; + } +}