How to use system2 function properly

459 Views Asked by At

I am writing the script for analyzing data in which I am using the system2 function. I should hope, that my function is proper.

My function returns the problem:

Class 'try-error'  atomic [1:1] Error in system2(file.path(script.dir, "script1.sh"), c(matlab.dir,  :
  error in running command

  ..- attr(*, "condition")=List of 2
  .. ..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
NULL
Error occurred: Error in system2(file.path(script.dir, "script1.sh"), c(matlab.dir,  :
  error in running command

runPicnic <- function(sample.name, sample.type, sample.sex, sample.chip, script.dir, matlab.dir) {
  pre.res = system2(file.path(script.dir, 'script1.sh'), c(matlab.dir, sample.name, 'outdir', sample.type, sample.sex, sample.chip), stdout=TRUE, stderr=TRUE)
  post.res = system2(file.path(script.dir, 'script2.sh'), c(matlab.dir, sample.name, 'outdir'), stdout=TRUE, stderr=TRUE)
  return( list(pre.res, post.res) )
}

I am using this code for sending jobs to the queue on the cluster.

0

There are 0 best solutions below