Skip to content

Commit

Permalink
Merge pull request #18 from p2m2/develop
Browse files Browse the repository at this point in the history
1.0.1
  • Loading branch information
ofilangi authored Apr 5, 2023
2 parents c02c4c3 + 7e1dee0 commit 3559926
Show file tree
Hide file tree
Showing 48 changed files with 2,588 additions and 1,398 deletions.
21 changes: 17 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ workflows:
- DOCKER_CONTEXT

executors:

openjdk:
working_directory: ~/repo
docker:
- image: circleci/openjdk:8-jdk
- image: cimg/openjdk:19.0.2
auth:
username: ${DOCKER_USER}
password: ${DOCKER_PASS}
Expand All @@ -44,11 +43,25 @@ jobs:
steps:
- checkout
- setup_remote_docker
- node/install:
node-version: '19.6'
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.sbt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Compile - JVM
command: cat /dev/null | sbt positionalCarbonSourcesJVM/test
name: Compile/Tests
command: |
export NODE_OPTIONS=--openssl-legacy-provider
cat /dev/null | sbt test
# - run:
# name: Coverage
# command: |
# export NODE_OPTIONS=--openssl-legacy-provider
# cat /dev/null | sbt clean coverage test
# sbt coverageReport
# bash <(curl -s https://codecov.io/bash)
# bash <(curl -Ls https://coverage.codacy.com/get.sh) report
# - store_artifacts:
# path: positional-carbon13-enrichment/jvm/target/test-reports
69 changes: 44 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,65 @@
# positional-carbon13-enrichment
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/p2m2/positional-carbon13-enrichment/tree/develop.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/p2m2/positional-carbon13-enrichment/tree/develop)
# Calculations of <sup>13</sup>C-Positional Enrichments

https://p2m2.github.io/positional-carbon13-enrichment/
[![p2m2](https://circleci.com/gh/p2m2/positional-carbon13-enrichment.svg?style=shield)](https://app.circleci.com/pipelines/github/p2m2)
[![web](https://img.shields.io/badge/Web-Online-blue.svg)](https://p2m2.github.io/positional-carbon13-enrichment/)
[![doi](https://img.shields.io/badge/doi-10.3390/metabo13040466-blue.svg)](https://doi.org/10.3390/metabo13040466)

## install
<sup>13</sup>C-positional enrichments were calculated by combining mean <sup>13</sup>C enrichments
of several mass fragments that shared part of the carbon backbone from the same TMS
derivative. A workflow has been created to calculate these <sup>13</sup>C-positional enrichments
directly from the outputs of our <sup>13</sup>C-processing method

### Node.js with JSDOM
To use the software without prior installation and obtain a visual rendering, please visit the site https://p2m2.github.io/positional-carbon13-enrichment/

check [scala.js installation page](https://www.scala-js.org/doc/project/js-environments.html)
For a precise description of the method, refer to the publication [*"Evaluation of GC/MS-Based <sup>13</sup>C-Positional Approaches for TMS Derivatives of Organic and Amino Acids and Application to Plant <sup>13</sup>C-Labeled Experiments"*](https://doi.org/10.3390/metabo13040466)

```bash
runMain fr.inrae.p2m2.tools.PositionalCarbon13EnrichmentMain src/test/resources/galaxy430_res.tsv
```
## Software programming environment

### test app
- [SBT](https://www.scala-sbt.org/)
- [Scala](https://www.scala-lang.org/)
- [ScalaJS - Node.js with JSDOM](https://www.scala-js.org/doc/project/js-environments.html)
- [Node.js](https://nodejs.org/en)

```bash
sbt positionalCarbonSourcesJVM/test
sbt positionalCarbonSourcesJS/test
```
### Dependencies for HTML generation

- [Chart.js](https://www.chartjs.org/)
- [ScalaTags](https://com-lihaoyi.github.io/scalatags/)

### command line

#### run tests

```shell
sbt positionalCarbonSourcesJVM/run jvm/src/test/resources/galaxy430_res.tsv
sbt test
```

### jar
### Html

#### Development version

```
sbt positionalCarbonSourcesJVM/assembly
```shell
sbt fastOptJS::webpack
# open html/index.html
```

### Html
#### Release

```shell
sbt fastLinkJS
sbt fullOptJS::webpack
cp target/scala-2.13/scalajs-bundler/main/positional-carbon13-enrichment-opt-bundle.js docs/
# open docs/index.html
```

```main
fullOptJS
# --> js/target/scala-2.13/positionalcarbonsources-opt
```
## Information about the authors and the software

*Y. Dellero, O. Filangi, A . Bouchereau*

- [Institute for Genetics, Environment and Plant Protection (IGEPP), National Research Institute for Agriculture, Food and Environment (INRAE), Institut Agro, Université Rennes, 35650 Le Rheu, France](https://www6.rennes.inrae.fr/igepp)
- [Metabolic Profiling and Metabolomic Platform (P2M2), Biopolymers Interactions Assemblies, Institute for Genetics, Environment and Plant Protection, 35650 Le Rheu, France](https://www6.inrae.fr/p2m2/)
- [MetaboHUB, National Infrastructure of Metabolomics and Fluxomics, 35650 Le Rheu, France](https://www.metabohub.fr/)


This code is released under the MIT License.



open [index](./html/index.html)
92 changes: 35 additions & 57 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,18 @@ ThisBuild / developers := List(
Developer("ofilangi", "Olivier Filangi", "[email protected]",url("https://github.com/ofilangi"))
)

lazy val root = (project in file("."))
.aggregate(positionalCarbonSources.js, positionalCarbonSources.jvm)
lazy val root = (project in file(".")).
enablePlugins(ScalaJSPlugin).
enablePlugins(ScalaJSBundlerPlugin).
// add the `it` configuration
configs(IntegrationTest).
// add `it` tasks
settings(Defaults.itSettings: _*).
// add Scala.js-specific settings and tasks to the `it` configuration
settings(inConfig(IntegrationTest)(ScalaJSPlugin.testConfigSettings): _*)
.settings(
name := "positional-carbon13-enrichment",
version := "0.1.0-SNAPSHOT",
version := "1.0.0",
credentials += {

val realm = scala.util.Properties.envOrElse("REALM_CREDENTIAL", "")
Expand All @@ -45,63 +52,34 @@ lazy val root = (project in file("."))
publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true),
pomIncludeRepository := { _ => false },
publishMavenStyle := true,
coverageMinimumStmtTotal := 70,
coverageMinimumBranchTotal := 30,
coverageMinimumStmtPerPackage := 70,
coverageMinimumBranchPerPackage := 30,
coverageMinimumStmtPerFile := 70,
coverageMinimumBranchPerFile := 30,
coverageFailOnMinimum := true,
coverageHighlighting := true
)

// Project containing source code shared between the JS and JVM projects.
// This project should never be compiled or packages but is simply an IntelliJ IDEA
// friendly alternative to a shared code directory. Projects depending on this
// projects source code should declare a dependency as 'Provided' AND append
// this projects source directory manually to 'unmanagedSourceDirectories'.
lazy val PositionalCarbon13EnrichmentShared = project.in(file("shared"))

lazy val PositionalCarbon13EnrichmentSharedSettings = Seq(
name := "foo",
version := "0.1-SNAPSHOT",
// NOTE: The following line will generate a warning in IntelliJ IDEA, which can be ignored:
// "The following source roots are outside the corresponding base directories"
Compile / unmanagedSourceDirectories += ( (PositionalCarbon13EnrichmentShared / Compile) / scalaSource).value
)


lazy val positionalCarbonSources = crossProject(JSPlatform, JVMPlatform).in(file(".")).
settings(
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "utest" % "0.8.1" % Test
),
testFrameworks += new TestFramework("utest.runner.Framework")
).
jvmSettings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
coverageMinimumStmtTotal := 20,
coverageFailOnMinimum := false,
coverageHighlighting := true,
libraryDependencies ++= Seq(
"com.lihaoyi" %% "utest" % "0.8.1" % Test,
"com.github.scopt" %% "scopt" % "4.1.0"
"com.lihaoyi" %%% "utest" % "0.8.1" % Test,
"com.lihaoyi" %%% "scalatags" % "0.12.0",
),

// Compile / unmanagedSourceDirectories += baseDirectory.value.getParentFile.getParentFile / "shared"/"src"/"main"/"scala",
// Test / unmanagedSourceDirectories += baseDirectory.value.getParentFile.getParentFile / "shared"/"src"/"test"/"scala",

Compile / mainClass := Some("fr.inrae.p2m2.app.PositionalCarbon13EnrichmentMain") ,
testFrameworks += new TestFramework("utest.runner.Framework"),
assembly / target := file("assembly"),
assembly / assemblyJarName := s"${name.value}-${version.value}.jar"
)
.enablePlugins(BuildInfoPlugin)
.jsSettings(
// Add JS-specific settings here
scalaJSUseMainModuleInitializer := true,
jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv(),
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "utest" % "0.8.1" % Test,
"org.scala-js" %%% "scalajs-dom" % "2.1.0",
"com.lihaoyi" %%% "scalatags" % "0.12.0"
)
assembly / assemblyJarName := s"${name.value}-${version.value}.jar",
Compile / fastOptJS / scalaJSLinkerConfig ~= {
_.withOptimizer(false)
.withPrettyPrint(true)
.withSourceMap(true)
},
Compile / fullOptJS / scalaJSLinkerConfig ~= {
_.withSourceMap(false)
.withModuleKind(ModuleKind.CommonJSModule)
},
webpackBundlingMode := BundlingMode.LibraryAndApplication(),
Compile / npmDependencies ++= Seq(
"chart" -> "0.1.2",
),
Test / npmDevDependencies ++= Seq(
"jsdom" -> "21.1.1"
),
Compile / scalaJSUseMainModuleInitializer := true,
Test / requireJsDomEnv := true
)

Global / onChangedBuildSource := ReloadOnSourceChanges
76 changes: 71 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,90 @@
body {
background: #F5F5F5;
}
h1,h2 {
text-align: center;
}
.canvasChart {
text-align: center;
width: 350px;
width: 450px;
}
.gridCanvas {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: 10px;
}
.centered-element{
display: flex;
justify-content: center;
align-items: center;
}
footer {
text-align: center;
padding: 3px;
//background-color: Grey;
color: grey;
}
textarea {
white-space: pre;
}
</style>
</head>
<header>
<a href="https://github.com/p2m2/" target="_blank"><img src="https://img.shields.io/badge/github-p2m2-blue.svg"/></a>
</header>
<body>

<div id="positionInputFile"></div>
<!-- https://www.chartjs.org/docs/latest/getting-started/ -->
<div id="positionalCarbonChartCanvas"></div>
<h1><a href="javascript:window.location.reload(true)">Calculations of <sup>13</sup>C-Positional Enrichments</a></h1>
<div id="header">
<p>
<h2>Method</h2>
<sup>13</sup>C-positional enrichments were calculated by combining mean <sup>13</sup>C enrichments
of several mass fragments that shared part of the carbon backbone from the same TMS
derivative. This tool computes these <sup>13</sup>C-positional enrichments directly from the outputs of our
<sup>13</sup>C-processing method using the <a href="https://isocor.readthedocs.io/en/latest/" target="_blank">IsoCor</a> output format.
<br/>
For a precise description of the method, refer to the publication
<a href=""><i>"Evaluation of GC/MS-Based <sup>13</sup>C-Positional
Approaches for TMS Derivatives of Organic and Amino Acids and Application to Plant
- https://doi.org/10.3390/metabo13040466<sup>13</sup>C-Labeled Experiments"</i></a>
</p>

<h2>Metabolite name format</h2>
<p>The name of the metabolite must follow the format <i>MetaboliteName<b>C</b>&#60;x&#62<b>C</b>&#60;y&#62;&#60;fragment&#62;</i>
or <i>MetaboliteName<b>C</b>&#60;x&#62&#60;fragment&#62;</i></p>
<pre>
sample metabolite derivative isotopologue isotopic_inchi area corrected_area isotopologue_fraction residuum mean_enrichment
Prot13C_1_16 <b>GlycineC2m174</b> 2TMS 0 /a(C1+0) 410680.0 518131.0969722705 0.5205891530191978 0.0 0.47941084698080205
</pre>
<h2>Calculation rules</h2>
<p style="color:blue;text-align:center">
<i>The rules must follow the following form (The isotope A is built from the Metabolite B,C,D ...).
Metabolite refers to the label in the IsoCor file
<br/>
[Metabolite] -> A -> B, C, D,...
<br/>
If the rules are not defined for a compound, all combinations of calculations are proposed.</i>
</p>
<div class="centered-element">
<textarea id="positionalEnrichmentDependencies" cols="100" rows="10"></textarea>
</div>

</div>
<div id="display">
<h2>Input file (IsoCor)</h2>
<div id="positionInputFile" class="centered-element" ></div>
<!-- https://www.chartjs.org/docs/latest/getting-started/ -->
<div id="positionalCarbonChartCanvas">
</div>
<br/>
</div>
<!-- Include Scala.js compiled code -->
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript" src="positional-carbon13-enrichment-opt-bundle.js"></script>
</body>
<footer>
<a href="https://www6.inrae.fr/p2m2" target="_blank"><img src="p2m2.png" width="120"></a>
<a href="https://www.metabohub.fr/" target="_blank"><img src="metabohub.png" width="120"></a>
</footer>

</html>

Loading

0 comments on commit 3559926

Please sign in to comment.