File size: 885 Bytes
bfe6079
 
 
 
 
87ccc93
bfe6079
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
Runtime test: verify the rpy2-limma bridge is functional.

Run this in the Space terminal or locally after installing R and rpy2:

    python scripts/check_limma_runtime.py

Expected output:
    R version: R version 4.x.x (...)
    limma version: x.x.x
    rpy2-limma bridge OK
"""

import sys

try:
    import rpy2.robjects as ro
except ImportError:
    print("FAIL: rpy2 is not installed. Add 'rpy2' to requirements.txt.", file=sys.stderr)
    sys.exit(1)

try:
    ro.r("suppressPackageStartupMessages(library(limma))")
except Exception as exc:
    print(f"FAIL: could not load limma in R: {exc}", file=sys.stderr)
    print("Run scripts/install_r_packages.R via Rscript to install limma.", file=sys.stderr)
    sys.exit(1)

print("R version:", ro.r("R.version.string")[0])
print("limma version:", ro.r("as.character(packageVersion('limma'))")[0])
print("rpy2-limma bridge OK")