Skip to content

Commit

Permalink
add seed arg for DNAcopy (#101)
Browse files Browse the repository at this point in the history
* add seed arg for DNAcopy
* lint code with black
  • Loading branch information
matthdsm committed Apr 19, 2024
1 parent 8bd41b5 commit ea6342c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wisecondorX/include/CBS.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions wisecondorX/main.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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:])
Expand Down
1 change: 1 addition & 0 deletions wisecondorX/predict_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down

0 comments on commit ea6342c

Please sign in to comment.