Skip to content
Snippets Groups Projects
Commit bec9a9e6 authored by Sascha Meiers's avatar Sascha Meiers
Browse files

Make a check whether strand states are infact disjoint

parent 5d13c900
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,9 @@ source("utils/mosaiClassifier/generateHaploStates.R")
source("utils/mosaiClassifier/getDispParAndSegType.R")
source("utils/mosaiClassifier/haploAndGenoName.R")
library(GenomicRanges) # This is to test whether the given strand states
# are in fact disjoint intervals !
mosaiClassifierPrepare <- function(counts, info, strand, segs) {
......@@ -30,6 +33,7 @@ mosaiClassifierPrepare <- function(counts, info, strand, segs) {
"pass1" %in% colnames(info)) %>% invisible
setkey(info,sample,cell)
# check strand states
assert_that(is.data.table(strand),
"sample"%in% colnames(strand),
"cell" %in% colnames(strand),
......@@ -39,6 +43,14 @@ mosaiClassifierPrepare <- function(counts, info, strand, segs) {
"class" %in% colnames(strand)) %>% invisible
setkey(strand, sample, cell, chrom, start, end)
# -> test whether strand states are disjoint intervals
test_disjoint_intervals <- function(d) {
gr <- makeGRangesFromDataFrame(d)
end(gr) <- end(gr) -1
return(isDisjoint(gr))
}
strand[, assert_that(test_disjoint_intervals(.SD)), by = .(sample, cell)] %>% invisible
# segs
assert_that(is.data.table(segs),
"chrom" %in% colnames(segs),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment