-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REFERENCE.SAMPLE.SET.SELECTOR package (#64)
* init REFERENCE.SAMPLE.SET.SELECTOR package * function for selecting reference sample set from CANOES cnv caller * function for selecting reference sample set from ExomeDepth cnv caller * select reference set sdded to EXOMEDEPTHCOV package * bugfix and add fields to parameters sql model
- Loading branch information
Showing
20 changed files
with
270 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,16 @@ | ||
library('CODEXCOV') | ||
|
||
#' Function Description | ||
#' | ||
#' Function description. | ||
#' @param K_from | ||
#' @param K_to | ||
#' @param lmax | ||
#' @param cov_table | ||
#' @keywords | ||
#' @export | ||
#' @examples | ||
#' run_wrapper_CODEXCOV | ||
run_wrapper_CODEXCOV <- function(K_from, | ||
K_to, | ||
lmax, | ||
reference_set_select_method, | ||
num_of_samples_in_reference_set, | ||
cov_table){ | ||
calls <- run_CODEXCOV(strtoi(K_from), | ||
strtoi(K_to), | ||
strtoi(lmax), | ||
cov_table | ||
) | ||
reference_set_select_method, | ||
strtoi(num_of_samples_in_reference_set), | ||
cov_table) | ||
calls | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
library('EXOMEDEPTHCOV') | ||
|
||
run_wrapper_EXOMEDEPTHCOV <- function(cov_table){ | ||
calls <- run_EXOMEDEPTHCOV(cov_table | ||
) | ||
run_wrapper_EXOMEDEPTHCOV <- function(reference_set_select_method, | ||
num_of_samples_in_reference_set, | ||
cov_table){ | ||
calls <- run_EXOMEDEPTHCOV(reference_set_select_method, | ||
num_of_samples_in_reference_set, | ||
cov_table) | ||
calls | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Package: REFERENCE.SAMPLE.SET.SELECTOR | ||
Title: Package For Selecting Reference Sample Set | ||
Version: 0.0.1 | ||
Authors@R: c( | ||
person("Tomasz", "Gambin", email = "[email protected]", role = c("aut", "cre")), | ||
person("Marek", "Wiewiórka", email = "[email protected]", role = c("aut")), | ||
person("Wiktor", "Kuśmirek", email = "[email protected]", role = c("aut"))) | ||
Description: An implementation of the package with multiple function | ||
for selecting reference sample set. | ||
Depends: | ||
R (>= 3.2.3), | ||
ExomeDepth (>= 1.1.10) | ||
License: GPL-3 | ||
Encoding: UTF-8 | ||
LazyData: true | ||
RoxygenNote: 6.0.1.9000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Generated by roxygen2: fake comment so roxygen2 overwrites silently. | ||
exportPattern("^[^\\.]") |
32 changes: 32 additions & 0 deletions
32
R/REFERENCE.SAMPLE.SET.SELECTOR/R/functions_REFERENCE.SAMPLE.SET.SELECTOR.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
library(ExomeDepth) | ||
|
||
canoes_method <- function(investigated_sample, Y, num_refs){ | ||
if (num_refs == 0) { | ||
num_refs <- 30 # in CANOES application num_refs is default set to 30 | ||
} | ||
samples <- colnames(Y) | ||
cov <- cor(Y[, samples], Y[, samples]) | ||
reference_samples <- setdiff(samples, investigated_sample) | ||
covariances <- cov[investigated_sample, reference_samples] | ||
reference_samples <- names(sort(covariances, | ||
decreasing=T)[1:min(num_refs, length(covariances))]) | ||
return(list(reference_samples=reference_samples)) | ||
} | ||
|
||
exomedepth_method <- function(investigated_sample, Y, num_refs, target_length){ | ||
samples <- colnames(Y) | ||
reference_samples <- setdiff(samples, investigated_sample) | ||
reference_set <- select.reference.set(test.counts = Y[,investigated_sample], | ||
reference.counts = Y[,reference_samples], | ||
bin.length = target_length, | ||
n.bins.reduced = 10000) | ||
if (num_refs == 0) { | ||
reference_samples <- reference_set$reference.choice | ||
} else { | ||
reference <- reference_set$summary.stats[1:num_refs,'ref.samples'] | ||
reference_samples <- c() | ||
for (s in reference) | ||
reference_samples <- c(reference_samples, c(s)) | ||
} | ||
return(list(reference_samples=reference_samples)) | ||
} |
16 changes: 16 additions & 0 deletions
16
R/REFERENCE.SAMPLE.SET.SELECTOR/R/run_REFERENCE.SAMPLE.SET.SELECTOR.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
run_REFERENCE.SAMPLE.SET.SELECTOR <- function(investigated_sample, | ||
Y, | ||
select_method, | ||
num_refs, | ||
target_length){ | ||
if(select_method == "canoes") { | ||
reference_samples <- canoes_method(investigated_sample, Y, num_refs)$reference_samples | ||
} else if(select_method == "codex") { | ||
#reference_samples <- codex_method(investigated_sample, Y, num_refs)$reference_samples | ||
} else if(select_method == "exomedepth") { | ||
reference_samples <- exomedepth_method(investigated_sample, Y, num_refs, target_length)$reference_samples | ||
} else if(select_method == "clamms") { | ||
#reference_samples <- clamms_method(investigated_sample, Y, num_refs)$reference_samples | ||
} | ||
reference_samples | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
library(testthat) | ||
library(REFERENCE.SAMPLE.SET.SELECTOR) | ||
|
||
context("Testing canoes_method function") | ||
|
||
test_that("basic test for canoes_method function with num_refs equal to 5",{ | ||
investigated_sample <- "sample_1" | ||
num_refs <- 5 | ||
Y = matrix(as.integer(c(52, 53, 54, 56, 70, 147, 58, 51, | ||
25, 22, 39, 31, 27, 217, 17, 27, | ||
57, 61, 66, 65, 64, 177, 67, 59, | ||
101, 100, 90, 85, 98, 182, 92, 103, | ||
149, 154, 140, 160, 165, 213, 149, 162, | ||
95, 90, 90, 98, 88, 262, 93, 103, | ||
50, 55, 45, 52, 59, 135, 65, 55, | ||
79, 57, 63, 90, 71, 216, 69, 66)), nrow=8, ncol=8, byrow = TRUE) | ||
colnames(Y) <- c("sample_1", "sample_2", "sample_3", "sample_4", "sample_5", "sample_6", "sample_7", "sample_8") | ||
reference_samples <- canoes_method(investigated_sample, | ||
Y, | ||
num_refs) | ||
expect_equal(length(reference_samples), 1) | ||
expect_equal(length(reference_samples$reference_samples), num_refs) | ||
expect_equal(reference_samples$reference_samples[1], 'sample_8') | ||
expect_equal(reference_samples$reference_samples[2], 'sample_4') | ||
expect_equal(reference_samples$reference_samples[3], 'sample_2') | ||
expect_equal(reference_samples$reference_samples[4], 'sample_3') | ||
expect_equal(reference_samples$reference_samples[5], 'sample_7') | ||
}) | ||
|
||
test_that("basic test for canoes_method function with num_refs equal to 0",{ | ||
investigated_sample <- "sample_1" | ||
num_refs <- 0 | ||
Y = matrix(as.integer(c(52, 53, 54, 56, 70, 147, 58, 51, | ||
25, 22, 39, 31, 27, 217, 17, 27, | ||
57, 61, 66, 65, 64, 177, 67, 59, | ||
101, 100, 90, 85, 98, 182, 92, 103, | ||
149, 154, 140, 160, 165, 213, 149, 162, | ||
95, 90, 90, 98, 88, 262, 93, 103, | ||
50, 55, 45, 52, 59, 135, 65, 55, | ||
79, 57, 63, 90, 71, 216, 69, 66)), nrow=8, ncol=8, byrow = TRUE) | ||
colnames(Y) <- c("sample_1", "sample_2", "sample_3", "sample_4", "sample_5", "sample_6", "sample_7", "sample_8") | ||
reference_samples <- canoes_method(investigated_sample, | ||
Y, | ||
num_refs) | ||
expect_equal(length(reference_samples), 1) | ||
expect_equal(length(reference_samples$reference_samples), 7) | ||
expect_equal(reference_samples$reference_samples[1], 'sample_8') | ||
expect_equal(reference_samples$reference_samples[2], 'sample_4') | ||
expect_equal(reference_samples$reference_samples[3], 'sample_2') | ||
expect_equal(reference_samples$reference_samples[4], 'sample_3') | ||
expect_equal(reference_samples$reference_samples[5], 'sample_7') | ||
expect_equal(reference_samples$reference_samples[6], 'sample_5') | ||
expect_equal(reference_samples$reference_samples[7], 'sample_6') | ||
}) | ||
|
||
|
||
context("Testing exomedepth_method function") | ||
|
||
test_that("basic test for exomedepth_method function with num_refs equal to 5",{ | ||
investigated_sample <- "sample_1" | ||
num_refs <- 5 | ||
target_length <- c(1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000) | ||
Y = matrix(as.integer(c(52, 53, 54, 56, 70, 147, 58, 51, | ||
25, 22, 39, 31, 27, 217, 17, 27, | ||
57, 61, 66, 65, 64, 177, 67, 59, | ||
101, 100, 90, 85, 98, 182, 92, 103, | ||
149, 154, 140, 160, 165, 213, 149, 162, | ||
95, 90, 90, 98, 88, 262, 93, 103, | ||
50, 55, 45, 52, 59, 135, 65, 55, | ||
79, 57, 63, 90, 71, 216, 69, 66)), nrow=8, ncol=8, byrow = TRUE) | ||
colnames(Y) <- c("sample_1", "sample_2", "sample_3", "sample_4", "sample_5", "sample_6", "sample_7", "sample_8") | ||
reference_samples <- exomedepth_method(investigated_sample, | ||
Y, | ||
num_refs, | ||
target_length) | ||
expect_equal(length(reference_samples), 1) | ||
expect_equal(length(reference_samples$reference_samples), num_refs) | ||
expect_equal(reference_samples$reference_samples[1], 'sample_8') | ||
expect_equal(reference_samples$reference_samples[2], 'sample_4') | ||
expect_equal(reference_samples$reference_samples[3], 'sample_5') | ||
expect_equal(reference_samples$reference_samples[4], 'sample_2') | ||
expect_equal(reference_samples$reference_samples[5], 'sample_3') | ||
}) | ||
|
||
test_that("basic test for exomedepth_method function with num_refs equal to 0 (auto)",{ | ||
investigated_sample <- "sample_1" | ||
num_refs <- 0 | ||
target_length <- c(1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000) | ||
Y = matrix(as.integer(c(52, 53, 54, 56, 70, 147, 58, 51, | ||
25, 22, 39, 31, 27, 217, 17, 27, | ||
57, 61, 66, 65, 64, 177, 67, 59, | ||
101, 100, 90, 85, 98, 182, 92, 103, | ||
149, 154, 140, 160, 165, 213, 149, 162, | ||
95, 90, 90, 98, 88, 262, 93, 103, | ||
50, 55, 45, 52, 59, 135, 65, 55, | ||
79, 57, 63, 90, 71, 216, 69, 66)), nrow=8, ncol=8, byrow = TRUE) | ||
colnames(Y) <- c("sample_1", "sample_2", "sample_3", "sample_4", "sample_5", "sample_6", "sample_7", "sample_8") | ||
reference_samples <- exomedepth_method(investigated_sample, | ||
Y, | ||
num_refs, | ||
target_length) | ||
expect_equal(length(reference_samples), 1) | ||
expect_equal(length(reference_samples$reference_samples), 6) | ||
expect_equal(reference_samples$reference_samples[1], 'sample_8') | ||
expect_equal(reference_samples$reference_samples[2], 'sample_4') | ||
expect_equal(reference_samples$reference_samples[3], 'sample_5') | ||
expect_equal(reference_samples$reference_samples[4], 'sample_2') | ||
expect_equal(reference_samples$reference_samples[5], 'sample_3') | ||
expect_equal(reference_samples$reference_samples[6], 'sample_7') | ||
}) | ||
|
Oops, something went wrong.