Go to file
この中二病に爆焔を! 71facea1c3 Merge branch 'master' of https://github.com/SMRUCC/R-sharp 2025-08-27 02:50:21 +08:00
.github Update sync_multiplegit.cmd 2023-02-20 11:33:47 +08:00
.visualstudio Update R_system.NET5.sln 2025-07-09 01:37:47 +08:00
.vscode make bugs fixed of the type cast error 2023-11-02 19:13:52 +08:00
Library try to fix of the method reference error 2025-08-26 18:37:13 +08:00
R# Merge branch 'master' of https://github.com/SMRUCC/R-sharp 2025-08-27 02:50:21 +08:00
REnv run package document msbuild 2025-08-21 21:45:40 +08:00
Rscript print info log 2025-08-26 18:40:49 +08:00
docs make document updates 2024-01-11 15:57:19 +08:00
snowFall fix of the config error 2025-08-17 02:44:22 +08:00
studio print debug infor 2025-08-26 18:43:54 +08:00
test sas xpt file reader test success 2025-08-25 16:13:59 +08:00
.gitattributes settings of the git 2016-01-12 23:57:37 +08:00
.gitignore read/write of the binary dataframe data file success 2025-04-19 16:30:46 +08:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2017-10-14 15:09:46 +08:00
CONTRIBUTING.md add license file 2017-06-06 18:20:40 +08:00
IL.sln removes errror reference module 2025-07-09 01:36:28 +08:00
LICENSE add license file 2017-06-06 18:20:40 +08:00
README.md Update README.md 2023-05-11 17:31:00 +08:00
R_system.NET5.sln Update R_system.NET5.sln 2025-06-09 09:14:28 +08:00
Rsharp.NET5.sln config for test 2022-07-12 18:29:30 +08:00
SECURITY.md Create SECURITY.md 2023-04-18 22:34:58 +08:00
icon.png update main page sections 2016-01-13 00:46:54 +08:00
proj_stats.csv update source file banner headers! 2025-08-15 10:53:21 +08:00
snowFall-netcore5.sln fix of the project reference 2025-07-09 01:31:34 +08:00

README.md

R# logo

The R# Programming Language

R# language is a kind of R liked language implements on .NET environment for the bioinformatics data analysis

[WARNING] This project is a work in progress and is not recommended for production use.

The latest sciBASIC.NET Framework runtime is also required

The R# language its syntax is original derived from the R language, but with more modernized programming styles. The R# language its interpreter and .NET compiler is original writen in VisualBasic language, with native support for the .NET runtime.

The R# language is not designed for the general data analysis purpose, but it is specialize designed for my works in the company, implements the bioinformatics data analysis system based on the GCModeller platform, for building the bioinformatics data science stack with R and VisualBasic language.

Directory structure

  • R# The R# language core runtime and scripting engine
  • Library The fundation library in R# scripting system
  • Rscript The R# scripting host
  • R-terminal The R# shell program
  • Rsharp_kit The R-sharp toolkit
  • njl The Julia language liked scripting engine
  • npy The Python language liked scripting engine
  • RData The R language data *.rda/*.rds file reader

Demo R# code

# declare a variable
let word as string = ['world', 'R# user', 'GCModeller user'];

# declare a function
let echo as function(words) {
    print( `Hello ${ words }!` );
}

# or declare a lambda function
let echo.lambda = words -> print( `Hello ${ words }!` );

# and then invoke function via pipeline operator
word :> echo;
# [3] "Hello world!" "Hello R# user!" "Hello GCModeller user!"
word :> echo.lambda;
# [3] "Hello world!" "Hello R# user!" "Hello GCModeller user!"

Used in VisualBasic.NET programming:

Dim R As New RInterpreter()

' Run script by invoke method
Call R.Evaluate("
    # test script
    let word as string = ['world', 'R# user', 'GCModeller user'];
    let echo as function(words) {
        print( `Hello ${ words }!` );
    }

    word :> echo;
")

' or assign variable
Call R.Add("word", {"world", "R# user", "GCModeller user"})

' then declare R function throught script
Call R.Add("echo", 
    Function(words As String()) As String()
        Return Internal.print(words)
    End Function)

' at last, invoke R function throught Invoke method
Call R.Invoke("echo", R!word)

High Performance Computing on Unix .NET 6

Graphics Library

# read scatter point data from a given table file
# and then assign to tuple variables
[x, y, cluster] = read.csv("./scatter.csv", row.names = NULL);

# umap scatter with class colors
bitmap(file = "./scatter.png") {
	plot(x, y,
		 padding      = "padding:200px 400px 200px 250px;",
		 class        = cluster,
		 title        = "UMAP 2D Scatter",
		 x.lab        = "dimension 1",
		 y.lab        = "dimension 2",
		 legend.block = 13,
		 colorSet     = "paper", 
		 grid.fill    = "transparent",
		 size         = [2600, 1600]
	);
};

ggplot for R#

A R language ggplot2 package liked grammar of graphics library for R# language programming.

The R# language is another scientific computing language which is designed for .NET runtime, R# is evolved from the R language. There is a famous graphics library called ggplot2 in R language, so keeps the same, there is a graphics library called ggplot was developed for R# language.

ggplot(myeloma, aes(x = "molecular_group", y = "DEPDC1"))
+ geom_boxplot(width = 0.65)
+ geom_jitter(width = 0.3)
# Add horizontal line at base mean 
+ geom_hline(yintercept = mean(myeloma$DEPDC1), linetype="dash", line.width = 6, color = "red")
+ ggtitle("DEPDC1 ~ molecular_group")
+ ylab("DEPDC1")
+ xlab("")
+ scale_y_continuous(labels = "F0")
# Add global annova p-value 
+ stat_compare_means(method = "anova", label.y = 1600) 
# Pairwise comparison against all
+ stat_compare_means(label = "p.signif", method = "t.test", ref.group = ".all.", hide.ns = TRUE)
+ theme(
	axis.text.x = element_text(angle = 45), 
	plot.title  = element_text(family = "Cambria Math", size = 16)
)
;

Polyglot programming Feature

The R# system is not only supports of the R# language, it also includes a python language scripting and Julia language scripting engine which is running upon the R# runtime.

Reference of the python script or julia script in R# language just like imports other R# script:

# imports an external R# script
imports "./script.R";
# imports an external python script in R#
imports "./script.py";
# imports an external julia script in R#
imports "./script.jl";

And also you can imports R script in python or julia scripting:

# example of import R#/julia script in python

# imports an external R# script in python
import "./script.R"
# imports an external julia script in python
import "./script.jl"

imports python and R# script in julia scripting is also keeps easy:

# example of imports R#/python script in julia

# imports an external R# script in julia
include("./script.R")
# imports an external python script in julia
include("./script.py")

R# runtime compatible with javascript

require("GCModeller");
// load the fastq module from rna-seq package 
// inside the GCModeller
import {FastQ} from "rnaseq";

// do short reads assembling via SCS algorithm
var assem = FastQ.assemble([
	"AACAAATGAGACGCTGTGCAATTGCTGA",
	"AACAAATGAGACGCTGTGCAATTGCAAA",
	"CAAATGAGACGCTGTGCAATTGCTGAGT",
	"GCAAATGATACGCTGTGCAATTGCTAGA",
	"ATGAGACGCTGTGCAATTGCTGAGTACC",
	"CTGTGCAATTGCTGAGAACAAATGAGAC",
	"CTGTGCAATTGCTAGAAACAAATGAGAC"
])

// view the short reads assemble result
console.table(assem)

// Loading required package: GCModeller
// Loading required package: igraph
// Attaching package: 'igraph'
//
// The following object is masked from 'package:igraph':
//
//     eval, class
//
//
//
//   GCModeller: genomics CAD(Computer Assistant Design) Modeller System
//                                 author by: xie.guigang@gcmodeller.org
//
//                            (c) 2023 | SMRUCC genomics - GuiLin, China
//
//                                                                                                AssembleResult
// --------------------------------------------------------------------------------------------------------------
// <mode>                                                                                               <string>
// [1, ]  "CTGTGCAATTGCTGAGAACAAATGAGACGCTGTGCAATTGCAAATGATACGCTGTGCAATTGCTAGAAACAAATGAGACGCTGTGCAATTGCTGAGTACC"
// [2, ]  "...................................................................AACAAATGAGACGCTGTGCAATTGCTGA....."
// [3, ]  "................AACAAATGAGACGCTGTGCAATTGCAAA........................................................"
// [4, ]  ".....................................................................CAAATGAGACGCTGTGCAATTGCTGAGT..."
// [5, ]  ".......................................GCAAATGATACGCTGTGCAATTGCTAGA................................."
// [6, ]  "........................................................................ATGAGACGCTGTGCAATTGCTGAGTACC"
// [7, ]  "CTGTGCAATTGCTGAGAACAAATGAGAC........................................................................"
// [8, ]  "...................................................CTGTGCAATTGCTAGAAACAAATGAGAC....................."

Packages that developed for the R# programming environment:

  • ggplot package is a R environment ggplot2 package liked data visualization package for R# language.
  • mzkit is a project developed for R# language for run data analysis of the mass spectrum raw data.
  • ms-imaging is a R# package for rendering the MSImaging based on the libraries from mzkit and ggplot packages.