Exemplo n.º 1
0
 public async Task <IActionResult> analyseMcode([FromBody] ModifierInputObject input)
 {
     return(await runAnalysis(input, "mcode"));
 }
Exemplo n.º 2
0
 public async Task <IActionResult> analysecorrelationClique([FromBody] ModifierInputObject input)
 {
     return(await runAnalysis(input, "correlationClique"));
 }
Exemplo n.º 3
0
 public async Task <IActionResult> analysediffCoEx([FromBody] ModifierInputObject input)
 {
     return(await runAnalysis(input, "diffCoEx"));
 }
Exemplo n.º 4
0
 public async Task <IActionResult> analyseCliqueSum([FromBody] ModifierInputObject input)
 {
     return(await runAnalysis(input, "cliqueSum"));
 }
Exemplo n.º 5
0
 public async Task <IActionResult> deleteFiles([FromBody] ModifierInputObject input)
 {
     RScriptRunner.deleteFiles(input.id);
     return(Ok(input.id));
 }
Exemplo n.º 6
0
        public async Task <IActionResult> saveFiles([FromBody] ModifierInputObject input)
        {
            string id = RScriptRunner.saveFiles(input.expressionMatrixContent, input.probeMapContent, input.networkContent);

            return(Ok(id));
        }
Exemplo n.º 7
0
 public async Task <IActionResult> analyseMd([FromBody] ModifierInputObject input)
 {
     return(Ok("Got some input!: " + input.group1Label));
 }
Exemplo n.º 8
0
        public static async Task <string> RunFromCmd(Config rconfig, string filename, ModifierInputObject modifierInputObject, string methodOfAnalysis, string id)
        {
            string sampleGroup1 = "";
            string sampleGroup2 = "";

            foreach (string s1 in modifierInputObject.sampleGroup1)
            {
                sampleGroup1 = sampleGroup1 + ";" + s1;
            }
            foreach (string s2 in modifierInputObject.sampleGroup2)
            {
                sampleGroup2 = sampleGroup2 + ";" + s2;
            }

            string result = string.Empty;
            string error  = string.Empty;

            try
            {
                var info = new ProcessStartInfo();
                info.FileName         = rconfig.rExePath; // @"C:\Program Files\R\R-3.4.1\bin\Rscript.exe";
                info.WorkingDirectory = rconfig.rLibPath; //@"C:\Program Files\R\R-3.4.1\bin";
                info.Arguments        =
                    Path.Combine(Directory.GetCurrentDirectory(), "RCode", filename) + " "
                    + sampleGroup1 + " " + sampleGroup2 + " "
                    + modifierInputObject.group1Label + " " + modifierInputObject.group2Label + " "
                    + methodOfAnalysis + " "
                    + Path.Combine(Directory.GetCurrentDirectory(), "RCode")
                    + " " + id;

                info.RedirectStandardInput  = false;
                info.RedirectStandardOutput = true;
                info.RedirectStandardError  = true;
                info.UseShellExecute        = false;
                info.CreateNoWindow         = true;

                using (var proc = new Process())
                {
                    proc.StartInfo = info;
                    proc.Start();

                    error  = proc.StandardError.ReadToEnd();
                    result = proc.StandardOutput.ReadToEnd();
                }
                if (error.ToUpper().Contains("ERROR") || result.ToUpper().Contains("ERROR"))
                {
                    throw new Exception("Error in R script: " + result + error);
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception("R Script failed: " + error, ex);
            }
        }