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

call C# code from R #46

Open
cpanse opened this issue Dec 7, 2018 · 6 comments
Open

call C# code from R #46

cpanse opened this issue Dec 7, 2018 · 6 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@cpanse
Copy link
Contributor

cpanse commented Dec 7, 2018

current setup
screenshot 2018-12-07 at 10 18 47

exchange fileIO by linking

https://www.mono-project.com/docs/faq/technical/
screenshot 2018-12-07 at 10 19 38

https://www.mono-project.com/docs/about-mono/languages/cplusplus/

@cpanse cpanse added the enhancement New feature or request label Dec 7, 2018
@cpanse cpanse added this to the hello world milestone Dec 7, 2018
@cpanse cpanse self-assigned this Dec 7, 2018
@cpanse
Copy link
Contributor Author

cpanse commented May 28, 2019

https://CRAN.R-project.org/package=rDotNet

#R

require(rDotNet)

## initialize
.cinit(dll="/Users/cp//__checkouts/R/rawDiag/exec/fgcz_raw.dll")

rawfile <- file.path(Sys.getenv("HOME"), "Downloads/20180220_14_autoQC01.raw")
## create an object and call a method

(obj <- .cnew ("Rawfile", rawfile))

obj$check()
obj$getFirstScanNumber()
obj$IsCentroidScan(2)
(L <- obj$GetSpectrum(1, ""))
(L <- obj$GetSpectrum(2, ""))


@cpanse
Copy link
Contributor Author

cpanse commented May 28, 2019

kill -9 `ps aux | grep CLRServer| awk '{print $2}' | tail -n 1 ` && ./build_linux_fgcz_raw.bash 

@cpanse cpanse closed this as completed May 28, 2019
@cpanse
Copy link
Contributor Author

cpanse commented May 28, 2019

Screenshot 2019-05-28 at 17 47 49

@cpanse cpanse changed the title R Rcpp <-> /clr:pure or /clr:safe C# call C# code from R May 28, 2019
@cpanse cpanse reopened this May 28, 2019
@cpanse
Copy link
Contributor Author

cpanse commented May 28, 2019

public static void PrintScanAsRcode(this IRawDataPlus rawFile, string filename, List<int> L)

refactor readScans

cpanse added a commit that referenced this issue May 29, 2019
cpanse added a commit that referenced this issue May 29, 2019
@cpanse
Copy link
Contributor Author

cpanse commented May 29, 2019

Install and test Rcode snippet

install.packages('rDotNet')
install.packages('http://fgcz-ms.uzh.ch/~cpanse/rawDiag_0.0.35.tar.gz',  repo=NULL)

library(rawDiag)
(rawfile <- file.path(path.package(package = 'rawDiag'), 'extdata', 'sample.raw'))
S <- csReadScans(rawfile, 1:9)
S[1]

@cpanse cpanse changed the title call C# code from R call C# code from R https://CRAN.R-project.org/package=rDotNet May 29, 2019
@cpanse cpanse changed the title call C# code from R https://CRAN.R-project.org/package=rDotNet call C# code from R May 29, 2019
@tobiasko
Copy link
Collaborator

Works!

> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.2

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rawDiag_0.0.35 rDotNet_0.9.1 

loaded via a namespace (and not attached):
 [1] tidyselect_0.2.5 purrr_0.3.2      haven_2.1.0      lattice_0.20-38  colorspace_1.4-1
 [6] generics_0.0.2   testthat_2.1.1   yaml_2.2.0       blob_1.1.1       rlang_0.3.2     
[11] hexbin_1.27.2    pillar_1.3.1     glue_1.3.1       DBI_1.0.0        tidyverse_1.2.1 
[16] bit64_0.9-7      modelr_0.1.4     readxl_1.3.1     protViz_0.4.0    plyr_1.8.4      
[21] stringr_1.4.0    munsell_0.5.0    gtable_0.2.0     cellranger_1.1.0 rvest_0.3.2     
[26] codetools_0.2-16 memoise_1.1.0    forcats_0.4.0    parallel_3.5.3   broom_0.5.1     
[31] Rcpp_1.0.1       readr_1.3.1      backports_1.1.3  scales_1.0.0     jsonlite_1.6    
[36] bit_1.1-14       ggplot2_3.1.0    hms_0.4.2        digest_0.6.18    stringi_1.4.3   
[41] dplyr_0.8.0.1    grid_3.5.3       tools_3.5.3      magrittr_1.5     lazyeval_0.2.2  
[46] tibble_2.1.1     RSQLite_2.1.1    crayon_1.3.4     tidyr_0.8.3      pkgconfig_2.0.2 
[51] xml2_1.2.0       lubridate_1.7.4  assertthat_0.2.1 httr_1.4.0       rstudioapi_0.10 
[56] R6_2.4.0         nlme_3.1-137     compiler_3.5.3  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants