{"id":43414632,"url":"https://github.com/p2m2/stream-reader-mzxml","last_synced_at":"2026-02-02T17:43:39.613Z","repository":{"id":203399606,"uuid":"695059779","full_name":"p2m2/stream-reader-mzxml","owner":"p2m2","description":"A Scala library specializing in stream processing of mzXML files, based on FS2","archived":false,"fork":false,"pushed_at":"2025-01-21T10:11:13.000Z","size":1308,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T11:23:47.134Z","etag":null,"topics":["fs2","mass-spectrometry","scala","stream"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/p2m2.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-22T09:09:24.000Z","updated_at":"2025-01-21T10:11:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2a623db-e58d-432f-84e6-c4c7d3602c51","html_url":"https://github.com/p2m2/stream-reader-mzxml","commit_stats":null,"previous_names":["p2m2/stream-reader-mzxml"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/p2m2/stream-reader-mzxml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2m2%2Fstream-reader-mzxml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2m2%2Fstream-reader-mzxml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2m2%2Fstream-reader-mzxml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2m2%2Fstream-reader-mzxml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/p2m2","download_url":"https://codeload.github.com/p2m2/stream-reader-mzxml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2m2%2Fstream-reader-mzxml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29016464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T16:17:30.374Z","status":"ssl_error","status_checked_at":"2026-02-02T15:58:50.469Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fs2","mass-spectrometry","scala","stream"],"created_at":"2026-02-02T17:43:34.519Z","updated_at":"2026-02-02T17:43:39.595Z","avatar_url":"https://github.com/p2m2.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stream-reader-mzxml\n[![Build Status](https://github.com/p2m2/stream-reader-mzxml/workflows/release/badge.svg)](https://github.com/p2m2/stream-reader-mzxml/actions?query=workflow%3Arelease)\n\nA Scala library specializing in stream processing of mzXML files, based on FS2. \n\n### mzXML specifications\n\nhttps://sashimi.sourceforge.net/schema_revision/mzXML_2.1/Doc/mzXML_2.0_tutorial.pdf\n\n## Installation using Docker\n\n### 1) First option : build docker image\n\n```bash\ndocker build . -t p2m2/stream-reader-mzxml\n```\n\n### 2) Second option : pull image from dockerhub\n\n```bash\ndocker pull inraep2m2/stream-reader-mzxml\n```\n\n### run command in the current directory\n\n```bash\ndocker run -v $(pwd):/data inraep2m2/stream-reader-mzxml \u003cMainClass\u003e /data/myfile.mzXML\n```\n\n### run command in specific path\n\n```bash\ndocker run -v \u003cpath-where-is-mzXMLfile\u003e:/data inraep2m2/stream-reader-mzxml \u003cMainClass\u003e /data/myfile.mzXML\n```\n\n## Installation using sbt\n\n```bash\nsbt assembly\n```\n### run command \n\n```bash\njava -cp ./assembly/pack.jar \u003cMainClass\u003e \n```\n| MainClass                            | Arguments | Description                                                                                                                                                          | \n|:-------------------------------------|:---------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| MainDistributionIntensityIons        |  | Number of ions by intensity thresholds                                                                                                                               | \n| MainDistributionMzIons               | *Minimum intensity*| Occurrences of the most frequent Mz (Ions)                                                                                                                           |  \n| MainDistributionDiffMzIons           | *Minimum intensity of peaks of interest* | Gives the occurrences of the difference between the Mz (mass on charge) of interest and the other ions in the same mass spectrum to detect the formation of adducts. |\n| MainPrecursorMzMatchingGlucosinolate | | Selects the precursorMz corresponding to an MS2 signature (diagnostic neutral and ion losses)                                                                        |\n\n### Examples\n\n```bash\njava -cp ./assembly/pack.jar MainDistributionIntensityIons\n```\n\n```bash\njava -cp ./assembly/pack.jar MainDistributionMzIons\n```\n\n```bash\njava -cp ./assembly/pack.jar MainDistributionDiffMzIons -i 50000\n```\n\n```bash\njava -cp ./assembly/pack.jar MainGlucosinolates src/test/resources/Orbitrap_Exploris_240_precision64.mzXML --output test.out --startRT 0   --endRT 2   --minIntensity 7500   --deltaMp0Mp2 1.9958   --carbonMin 3   --carbonMax 35   --sulfurMin 1.5   --sulfurMax 5   --precisionMz 0.0001\n```\n\n## ammonite example\n\n### Precursor Mz search\n\n```scala\nimport $cp.`assembly/pack.jar`\nimport cats.effect.{IO, IOApp}\nimport fs2.{Stream, text, Pipe}\nimport fs2.io.file.{Files, Path}\nimport java.nio.file.Paths\n\nimport cats.effect.unsafe.implicits._\nimport fr.inrae.p2m2.mzxml._\n\n\nval mzXMLFile = \"./src/test/resources/LTQ_Orbitrap_precision32.mzXML\"\nval outputFile = \"precursor_288p93.txt\"\n\n\nval formatPrecursorMz : Pipe[IO, Option[Seq[PrecursorMz]], String] = {\ninStream =\u003e\n    inStream.map {\n    case Some(p) =\u003e s\"Precursor ${p.head.value} with precursorIntensity ${p.head.precursorIntensity} \" +\n        s\"and precursorScanNum ${p.head.precursorScanNum}\\n\"\n    case _ =\u003e \"\"\n    }\n}\n\nSpectrumRequest(mzXMLFile).precursorMz(288.93,5000).map {\n    case Some(r) =\u003e Some(r.precursorMz)\n    case None =\u003e None\n}\n.filter(_.isDefined)\n.through(formatPrecursorMz)\n.through(text.utf8.encode)\n.through(Files[IO].writeAll(Path(outputFile)))\n.compile\n.drain\n.unsafeRunSync()\n\nprintln(outputFile)\n```\n\n\n###\n\n```scala\nimport $cp.`assembly/pack.jar`\nimport cats.effect.{IO, IOApp}\nimport fs2.{Stream, text, Pipe}\nimport fs2.io.file.{Files, Path}\nimport java.nio.file.Paths\n\nimport cats.effect.unsafe.implicits._\nimport fr.inrae.p2m2.mzxml._\nimport fr.inrae.p2m2.mzxml.utils.ChemicalConst\n\nval mzXMLFile = \"./src/test/resources/LTQ_Orbitrap_precision32.mzXML\"\nval deltaMp0Mp2     = 1.996 // Glucosinolate\nval numberCarbonMin = 3\nval numberCarbonMax = 35\nval numberSulfurMin = 1.5\nval numberSulfurMax = 5\nval startTime = 0\nval endTime = 5\n\n{\n  SpectrumRequest(mzXMLFile)\n    .msLevel(1)\n    .filter(_.isDefined)\n    .map( _.get)\n    .filter( _.retentionTimeInSeconds.getOrElse(0)\u003e=startTime)\n    .filter( _.retentionTimeInSeconds.getOrElse(Int.MaxValue)\u003c=endTime)\n    .map {\n      (spectrum: Spectrum) =\u003e {\n        spectrum.peaks.map {\n            case (mz0, int0) =\u003e\n              val mz_ms_p2 = mz0 + deltaMp0Mp2\n              val (mz1, int1) = spectrum.findClosestValueMz(mz0 + 1.0)\n              val (mz2, int2) = spectrum.findClosestValueMz(mz_ms_p2)\n              ((mz0, int0), (mz1, int1), (mz2, int2)) // isotopes\n\n          }.filter {\n            case (v0, v1, _) =\u003e\n              v1._2 \u003e= v0._2 *\n                (ChemicalConst.abundanceIsotope(\"C\")(1) * numberCarbonMin +\n                  ChemicalConst.abundanceIsotope(\"S\")(1) * numberSulfurMin)\n\n          }.filter {\n            case (v0, v1, _) =\u003e\n              v1._2 \u003c v0._2 *\n                (ChemicalConst.abundanceIsotope(\"C\")(1) * numberCarbonMax +\n                  ChemicalConst.abundanceIsotope(\"S\")(1) * numberSulfurMax)\n\n          } /* criteria M2 of Isotope S are present 4.4 % */\n          .filter {\n            case (v0, _, v2) =\u003e\n              v2._2 \u003e= v0._2 * ChemicalConst.abundanceIsotope(\"S\")(2) * numberSulfurMin\n          }\n          .filter {\n            case (v0, _, v2) =\u003e\n              v2._2 \u003c v0._2 * ChemicalConst.abundanceIsotope(\"S\")(2) * numberSulfurMax\n          }.map(\n            (spectrum.retentionTimeInSeconds.getOrElse(-1), _)\n          )\n      }\n    }\n    .map(x =\u003e x.map(y =\u003e y.toString()+\"\\n\").mkString(\"\\n\"))\n    .through(text.utf8.encode)\n    .through(Files[IO].writeAll(Path(outputFile)))\n    .compile\n    .drain\n    .unsafeRunSync()\n}\n\n```\n\n`amm example.sc`\n```bash\namm glucosinolateIons.sc ../mzxml-glucosinolate-analyser/src/test/resources/20181018-037.mzXML 100000\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp2m2%2Fstream-reader-mzxml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp2m2%2Fstream-reader-mzxml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp2m2%2Fstream-reader-mzxml/lists"}