Module: ViralSeq::R
- Defined in:
- lib/viral_seq/R.rb
Class Method Summary collapse
-
.check_R ⇒ Object
check if R is installed.
-
.check_R_packages ⇒ Object
check if required R packages is installed.
-
.get_sdrm_rscript ⇒ Object
read sdrm rscript as a string.
Class Method Details
.check_R ⇒ Object
check if R is installed. if R is installed, return the version number of R.
6 7 8 9 10 11 12 13 |
# File 'lib/viral_seq/R.rb', line 6 def self.check_R begin r_version = `R --version`.split("\n")[0] rescue Errno::ENOENT abort '"R" is not installed. Install R at https://www.r-project.org/' + "\n`tcs_sdrm` pipeline aborted." end end |
.check_R_packages ⇒ Object
check if required R packages is installed.
16 17 18 19 20 21 22 23 24 |
# File 'lib/viral_seq/R.rb', line 16 def self.check_R_packages file = File.join(ViralSeq.root, "viral_seq", "util", "check_env.r") safe_file = Shellwords.escape(file) if system "Rscript #{safe_file}" return 0 else raise "Non-zero exit code. Error happens when checking required R packages." end end |
.get_sdrm_rscript ⇒ Object
read sdrm rscript as a string.
28 29 30 |
# File 'lib/viral_seq/R.rb', line 28 def self.get_sdrm_rscript File.read(File.join(ViralSeq.root, "viral_seq", "util", "sdrm_r.r")) end |