Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#75 replace mono by dotnet #81

Merged
merged 20 commits into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rawrr
Type: Package
Title: Direct Access to Orbitrap Data and Beyond
Version: 1.15.1
Version: 1.15.3
Authors@R: c(person("Christian", "Panse",
email = "cp@fgcz.ethz.ch",
role = c("aut", "cre"),
Expand All @@ -25,20 +25,20 @@ Suggests:
rmarkdown,
tartare (>= 1.5),
testthat
Description: This package wraps the functionality
of the RawFileReader .NET assembly. Within the R environment,
Description: This package wraps the functionality of the
Thermo Fisher Scientic RawFileReader .NET 8.0 assembly.
Within the R environment,
spectra and chromatograms are represented by S3 objects.
The package provides basic functions to download and install
the required third-party libraries.
The package is developed, tested, and used at the Functional
Genomics Center Zurich, Switzerland.
License: GPL-3
SystemRequirements: mono-runtime 4.x or higher (including System.Data library)
on Linux/macOS, .Net Framework (>= 4.5.1) on Microsoft Windows.
SystemRequirements: .NET 8.0
URL: https://github.com/fgcz/rawrr/
BugReports: https://github.com/fgcz/rawrr/issues
Encoding: UTF-8
NeedsCompilation: no
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
biocViews: MassSpectrometry, Proteomics, Metabolomics, Infrastructure, Software
VignetteBuilder: knitr
80 changes: 35 additions & 45 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -1,83 +1,73 @@
# System requirements

## Linux (debian:10/ubuntu:20.04)
The `rawrr` executable will run out of the box.

In case you prefer to compile `rawrr.exe` from C# source code, please install
the mono compiler and xbuild by installing the following Linux packages:
I you want to build on your own follow the text below.

```{sh}
sudo apt-get install mono-mcs mono-xbuild
```
## Compile and Link yourself

Otherwise, to execute the precompiled code, the following Linux packages are
sufficient:
In case you prefer to compile `rawrr.exe` from C# source code, please install
the .NET 8.0

```{sh}
sudo apt-get install mono-runtime libmono-system-data4.0-cil -y
```
### Linux (debian:10/ubuntu:20.04) (debian:12/ubuntu:24)

## macOS (Catalina/BigSur)

```{sh}
## DEPRECIATED: sudo apt-get install mono-mcs mono-xbuild
sudo apt-get install dotnet-sdk-8.0
```
brew install mono
```

or install from

https://www.mono-project.com/
### macOS (Catalina/BigSur/.../Sequoia)

## Microsoft Windows
https://dotnet.microsoft.com/en-us/download

Running the `rawrr.exe` will run out of the box.
### Microsoft Windows

If the native C# compiler is not available install mono from:
https://dotnet.microsoft.com/en-us/download

https://www.mono-project.com/
## Install the .NET assemblies

assemblies aka Common Intermediate Language bytecode

# Install the .NET assemblies
In general, ThermoFisher.CommonCore dlls can be obtained through:

assemblies aka Common Intermediate Language bytecode
https://github.com/thermofisherlsms/RawFileReader

the following files are required in
`r tools::R_user_dir("rawrr", which='cache')`
or in the `MONO_PATH`
or

```
ThermoFisher.CommonCore.Data.dll
ThermoFisher.CommonCore.MassPrecisionEstimator.dll
ThermoFisher.CommonCore.RawFileReader.dll
```
by contacting Jim Shofstahl using

The download and install can be done on all platforms using the command:
`r rawrr::installRawFileReaderDLLs()`
jim.Shofstahl@thermofisher.com

The in the package included C# source code that can compile into a rawrr.exe
file by calling `r rawrr:::buildRawrrExe()`. (is executed when the package
is loaded)

if no C# compile and build tool is available, run
## build

`r rawrr::installRawrrExe()` to download the rawrr.exe assembly.
* source nuget pkgs

On Windows, the decimal symbol has to be configured as a '.'!
* add libraries

In general, ThermoFisher.CommonCore dlls can be obtained through:
* (cross)-dcompile and link

https://github.com/thermofisherlsms/RawFileReader
```
dotnet publish rawrr-dotnet.csproj --os osx -a x64 --output /Users/cp/Library/Caches/org.R-project.R/R/rawrr/rawrrassembly/osx-x64
dotnet publish rawrr-dotnet.csproj --os win -a x64 --output /Users/cp/Library/Caches/org.R-project.R/R/rawrr/rawrrassembly/win-x64
dotnet publish rawrr-dotnet.csproj --os linux -a x64 --output /Users/cp/Library/Caches/org.R-project.R/R/rawrr/rawrrassembly/linux-x64

or

by contacting Jim Shofstahl using
## generates a ~110MB BLOB
dotnet publish -c Release -r linux-x64 -p PublishReadyToRun=true
dotnet publish -c Release -r win-x64 -p PublishReadyToRun=true
```

jim.Shofstahl@thermofisher.com

## Docker

The `Dockerfile` performing `R CMD build` and `R CMD check` requires

```
from bioconductor/bioconductor_docker:devel
run apt-get update && apt-get install mono-mcs mono-xbuild -y
run apt-get install texlive-base texlive-latex-extra texinfo texlive-fonts-extra -y
run apt-get install dotnet-sdk-8.0
run R -q -e "BiocManager::install(c('BiocStyle', 'ExperimentHub', 'knitr', 'protViz', 'rmarkdown', 'tartare', 'testthat'))"
```

5 changes: 2 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ S3method(plot,rawrrSpectrum)
S3method(print,rawrrSpectrum)
S3method(summary,rawrrChromatogram)
S3method(summary,rawrrSpectrum)
export(.checkDllInMonoPath)
export(.thermofisherlsmsUrl)
export(basePeak)
export(buildRawrrExe)
export(dependentScan)
export(faimsVoltageOn)
export(installRawFileReaderDLLs)
export(installRawrrExe)
export(is.rawrrChromatogram)
export(is.rawrrSpectrum)
Expand All @@ -39,8 +36,10 @@ importFrom(graphics,text)
importFrom(stats,lm)
importFrom(stats,na.omit)
importFrom(stats,predict)
importFrom(tools,R_user_dir)
importFrom(utils,download.file)
importFrom(utils,head)
importFrom(utils,object.size)
importFrom(utils,packageVersion)
importFrom(utils,read.csv2)
importFrom(utils,read.table)
Expand Down
22 changes: 22 additions & 0 deletions R/benchmark.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#R

#' @importFrom utils object.size
# f <- "/Users/cp/Library/Caches/org.R-project.R/R/ExperimentHub/46314c3933e2_4590.raw"
.benchmark <- function(f){
stopifnot(file.exists(f))

rawrr::readFileHeader(f)$`Number of scans` -> n

2**(seq(0, floor(log(n, 2)))) |>
lapply(FUN = function(i){
sample(n, size = i) |> sort() -> idx
message("Reading ", i, "random scans from ", f)
start.time <- Sys.time()
rawrr::readSpectrum(f, scan = idx) -> S
end.time <- Sys.time()
message("in ", end.time - start.time)
data.frame(count = i,
size = object.size(S) |> as.integer(),
runTimeInSec = as.double(difftime(end.time, start.time, units='secs')))
}) |> Reduce(f = rbind)
}
Loading