diff --git a/wisecondorX/include/CBS.R b/wisecondorX/include/CBS.R index 6f4de52..fe25cf9 100644 --- a/wisecondorX/include/CBS.R +++ b/wisecondorX/include/CBS.R @@ -21,6 +21,7 @@ suppressMessages(library("jsonlite")) input <- read_json(in.file) ratio <- as.numeric(unlist(input$results_r)) weights <- as.numeric(unlist(input$results_w)) +seed <- as.numeric(input$seed) gender <- input$ref_gender alpha <- as.numeric(input$alpha) binsize <- as.numeric(input$binsize) @@ -63,6 +64,9 @@ for.cbs <- for.cbs[cbs.mask,] # CBS +if (is.na(seed) || seed == '') { + set.seed(seed) +} CNA.object <- CNA(for.cbs$y, for.cbs$chromosome, for.cbs$x, data.type = "logratio", sampleid = "X") f = file() sink(file=f) ## silence output diff --git a/wisecondorX/main.py b/wisecondorX/main.py old mode 100755 new mode 100644 index 6a1d3b9..c34f988 --- a/wisecondorX/main.py +++ b/wisecondorX/main.py @@ -474,6 +474,9 @@ def main(): action="store_true", help="Add the output name as plot title", ) + parser_test.add_argument( + "--seed", type=int, default=None, help="Seed for segmentation algorithm" + ) parser_test.set_defaults(func=tool_test) args = parser.parse_args(sys.argv[1:]) diff --git a/wisecondorX/predict_tools.py b/wisecondorX/predict_tools.py index 91a0548..5b57afe 100644 --- a/wisecondorX/predict_tools.py +++ b/wisecondorX/predict_tools.py @@ -247,6 +247,7 @@ def exec_cbs(rem_input, results): "ref_gender": str(rem_input["ref_gender"]), "alpha": str(rem_input["args"].alpha), "binsize": str(rem_input["binsize"]), + "seed": str(rem_input["args"].seed), "results_r": results["results_r"], "results_w": results["results_w"], "infile": str("{}_01.json".format(json_cbs_dir)),