messageU("state.brewer")
### Test first case without replicates ###
message("First test case")
strains <- c('BN','SHR','BN','SHR')
marks <- c('H3K4me3','H3K4me3','H3K27me3','H3K27me3')
replicates <- paste0(marks,':',strains)
states2use <- state.brewer(replicates=replicates)
states2use <- states2use[order(as.numeric(as.character(states2use$state))),]
expect_that(states2use, is_a('data.frame'))
expect_that(states2use$state, is_a('factor'))
expect_that(mode(states2use$state), equals('numeric'))
expect_that(as.numeric(as.character(states2use$state)), equals(0:15))
expect_that(as.character(states2use$combination),equals(c("[]", "[H3K27me3:SHR]", "[H3K27me3:BN]", "[H3K27me3:BN+H3K27me3:SHR]", "[H3K4me3:SHR]", "[H3K4me3:SHR+H3K27me3:SHR]", "[H3K4me3:SHR+H3K27me3:BN]", "[H3K4me3:SHR+H3K27me3:BN+H3K27me3:SHR]", "[H3K4me3:BN]", "[H3K4me3:BN+H3K27me3:SHR]", "[H3K4me3:BN+H3K27me3:BN]", "[H3K4me3:BN+H3K27me3:BN+H3K27me3:SHR]", "[H3K4me3:BN+H3K4me3:SHR]", "[H3K4me3:BN+H3K4me3:SHR+H3K27me3:SHR]", "[H3K4me3:BN+H3K4me3:SHR+H3K27me3:BN]", "[H3K4me3:BN+H3K4me3:SHR+H3K27me3:BN+H3K27me3:SHR]")))
diff.states <- state.brewer(replicates=replicates, differential.states=TRUE, conditions=strains, tracks2compare=marks)
diff.states <- diff.states[order(as.numeric(as.character(diff.states$state))),]
expect_that(nrow(diff.states), equals(12))
expect_that(as.character(diff.states$combination),equals(c("[H3K27me3:SHR]", "[H3K27me3:BN]", "[H3K4me3:SHR]", "[H3K4me3:SHR+H3K27me3:SHR]", "[H3K4me3:SHR+H3K27me3:BN]", "[H3K4me3:SHR+H3K27me3:BN+H3K27me3:SHR]", "[H3K4me3:BN]", "[H3K4me3:BN+H3K27me3:SHR]", "[H3K4me3:BN+H3K27me3:BN]", "[H3K4me3:BN+H3K27me3:BN+H3K27me3:SHR]", "[H3K4me3:BN+H3K4me3:SHR+H3K27me3:SHR]", "[H3K4me3:BN+H3K4me3:SHR+H3K27me3:BN]")))
expect_that(as.numeric(as.character(diff.states$state)), equals(c(1:2, 4:11, 13:14)))
diff.states <- state.brewer(replicates=replicates, differential.states=TRUE, min.diff=2, conditions=strains, tracks2compare=marks)
diff.states <- diff.states[order(as.numeric(as.character(diff.states$state))),]
expect_that(nrow(diff.states), equals(4))
expect_that(as.character(diff.states$combination),equals(c("[H3K4me3:SHR+H3K27me3:SHR]", "[H3K4me3:SHR+H3K27me3:BN]", "[H3K4me3:BN+H3K27me3:SHR]", "[H3K4me3:BN+H3K27me3:BN]")))
expect_that(as.numeric(as.character(diff.states$state)), equals(c(5:6, 9:10)))
common.states <- state.brewer(replicates=replicates, common.states=TRUE, conditions=strains, tracks2compare=marks)
common.states <- common.states[order(as.numeric(as.character(common.states$state))),]
expect_that(nrow(common.states), equals(4))
expect_that(as.character(common.states$combination),equals(c("[]", "[H3K27me3:BN+H3K27me3:SHR]", "[H3K4me3:BN+H3K4me3:SHR]", "[H3K4me3:BN+H3K4me3:SHR+H3K27me3:BN+H3K27me3:SHR]")))
expect_that(as.numeric(as.character(common.states$state)), equals(c(0,3,12,15)))
### Test second case without replicates ###
message("Second test case")
tissues <- c("Angular_Gyrus", "Anterior_Caudate", "Cingulate_Gyrus", "Hippocampus_Middle", "Inferior_Temporal_Lobe", "Mid_Frontal_Lobe", "Substantia_Nigra")
marks <- rep("H3K36me3", length(tissues))
replicates <- paste0(marks,':',tissues)
states2use <- state.brewer(replicates=replicates)
states2use <- states2use[order(as.numeric(as.character(states2use$state))),]
expect_that(states2use, is_a('data.frame'))
expect_that(states2use$state, is_a('factor'))
expect_that(mode(states2use$state), equals('numeric'))
expect_that(as.numeric(as.character(states2use$state)), equals(c(0:127)))
expect_that(as.character(states2use$combination),equals(c("[]", "[H3K36me3:Substantia_Nigra]", "[H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Hippocampus_Middle]", "[H3K36me3:Hippocampus_Middle+H3K36me3:Substantia_Nigra]", "[H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Cingulate_Gyrus]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Substantia_Nigra]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Substantia_Nigra]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate]", "[H3K36me3:Anterior_Caudate+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle]", "[H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus]", "[H3K36me3:Angular_Gyrus+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Hippocampus_Middle]", "[H3K36me3:Angular_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Substantia_Nigra]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]")))
diff.states <- state.brewer(replicates=replicates, differential.states=TRUE, conditions=tissues, tracks2compare=marks)
diff.states <- diff.states[order(as.numeric(as.character(diff.states$state))),]
expect_that(nrow(diff.states), equals(126))
# diff.states <- state.brewer(replicates=replicates, differential.states=TRUE, min.diff=6, conditions=tissues, tracks2compare=marks)
# diff.states <- diff.states[order(as.numeric(as.character(diff.states$state))),]
# expect_that(nrow(diff.states), equals(4))
# expect_that(as.character(diff.states$combination),equals(c("[H3K4me3:SHR+H3K27me3:SHR]", "[H3K4me3:SHR+H3K27me3:BN]", "[H3K4me3:BN+H3K27me3:SHR]", "[H3K4me3:BN+H3K27me3:BN]")))
# expect_that(as.numeric(as.character(diff.states$state)), equals(c(5:6, 9:10)))
common.states <- state.brewer(replicates=replicates, common.states=TRUE, conditions=tissues, tracks2compare=marks)
common.states <- common.states[order(as.numeric(as.character(common.states$state))),]
expect_that(nrow(common.states), equals(2))
expect_that(as.character(common.states$combination),equals(c("[]", "[H3K36me3:Angular_Gyrus+H3K36me3:Anterior_Caudate+H3K36me3:Cingulate_Gyrus+H3K36me3:Hippocampus_Middle+H3K36me3:Inferior_Temporal_Lobe+H3K36me3:Mid_Frontal_Lobe+H3K36me3:Substantia_Nigra]")))
expect_that(as.numeric(as.character(common.states$state)), equals(c(0,127)))
### Test third case ###
message("Third test case")
countries <- c("Bre", "Bre", "Bre", "Bre", "Bre", "Bre", "Bre", "Bre", "Bre", "Bre", "Bre", "Bre", "Gua", "Gua", "Gua", "Gua", "Gua", "Gua", "Gua", "Gua", "Gua")
marks <- c("H3K27Ac", "H3K27me3", "H3K4me3", "H4K20me1", "H3K27Ac", "H3K27me3", "H3K4me3", "H4K20me1", "H3K27Ac", "H3K27me3", "H3K4me3", "H4K20me1", "H3K27Ac", "H3K27me3", "H3K4me3", "H4K20me1", "H3K27Ac", "H3K27Ac", "H3K27me3", "H3K4me3", "H4K20me1")
replicates <- paste0(marks,':',countries)
states2use <- state.brewer(replicates=replicates)
states2use <- states2use[order(as.numeric(as.character(states2use$state))),]
expect_that(states2use, is_a('data.frame'))
expect_that(states2use$state, is_a('factor'))
expect_that(mode(states2use$state), equals('numeric'))
expect_that(nrow(states2use), equals(256))
expect_that(sort(as.numeric(as.character(states2use$state))),equals(c(0,33,66,99,132,165,198,231,280,313,346,379,412,445,478,511,139776,139809,139842,139875,139908,139941,139974,140007,140056,140089,140122,140155,140188,140221,140254,140287,279552,279585,279618,279651,279684,279717,279750,279783,279832,279865,279898,279931,279964,279997,280030,280063,419328,419361,419394,419427,419460,419493,419526,419559,419608,419641,419674,419707,419740,419773,419806,419839,559104,559137,559170,559203,559236,559269,559302,559335,559384,559417,559450,559483,559516,559549,559582,559615,698880,698913,698946,698979,699012,699045,699078,699111,699160,699193,699226,699259,699292,699325,699358,699391,838656,838689,838722,838755,838788,838821,838854,838887,838936,838969,839002,839035,839068,839101,839134,839167,978432,978465,978498,978531,978564,978597,978630,978663,978712,978745,978778,978811,978844,978877,978910,978943,1118208,1118241,1118274,1118307,1118340,1118373,1118406,1118439,1118488,1118521,1118554,1118587,1118620,1118653,1118686,1118719,1257984,1258017,1258050,1258083,1258116,1258149,1258182,1258215,1258264,1258297,1258330,1258363,1258396,1258429,1258462,1258495,1397760,1397793,1397826,1397859,1397892,1397925,1397958,1397991,1398040,1398073,1398106,1398139,1398172,1398205,1398238,1398271,1537536,1537569,1537602,1537635,1537668,1537701,1537734,1537767,1537816,1537849,1537882,1537915,1537948,1537981,1538014,1538047,1677312,1677345,1677378,1677411,1677444,1677477,1677510,1677543,1677592,1677625,1677658,1677691,1677724,1677757,1677790,1677823,1817088,1817121,1817154,1817187,1817220,1817253,1817286,1817319,1817368,1817401,1817434,1817467,1817500,1817533,1817566,1817599,1956864,1956897,1956930,1956963,1956996,1957029,1957062,1957095,1957144,1957177,1957210,1957243,1957276,1957309,1957342,1957375,2096640,2096673,2096706,2096739,2096772,2096805,2096838,2096871,2096920,2096953,2096986,2097019,2097052,2097085,2097118,2097151)))
common.states <- state.brewer(replicates=replicates, common.states=TRUE, conditions=countries, tracks2compare=marks)
common.states <- common.states[order(as.numeric(as.character(common.states$state))),]
expect_that(nrow(common.states), equals(16))
expect_that(as.character(common.states$combination),equals(c("[]","[H4K20me1:Bre+H4K20me1:Gua]","[H3K4me3:Bre+H3K4me3:Gua]","[H3K4me3:Bre+H4K20me1:Bre+H3K4me3:Gua+H4K20me1:Gua]","[H3K27me3:Bre+H3K27me3:Gua]","[H3K27me3:Bre+H4K20me1:Bre+H3K27me3:Gua+H4K20me1:Gua]","[H3K27me3:Bre+H3K4me3:Bre+H3K27me3:Gua+H3K4me3:Gua]","[H3K27me3:Bre+H3K4me3:Bre+H4K20me1:Bre+H3K27me3:Gua+H3K4me3:Gua+H4K20me1:Gua]","[H3K27Ac:Bre+H3K27Ac:Gua]","[H3K27Ac:Bre+H4K20me1:Bre+H3K27Ac:Gua+H4K20me1:Gua]","[H3K27Ac:Bre+H3K4me3:Bre+H3K27Ac:Gua+H3K4me3:Gua]","[H3K27Ac:Bre+H3K4me3:Bre+H4K20me1:Bre+H3K27Ac:Gua+H3K4me3:Gua+H4K20me1:Gua]","[H3K27Ac:Bre+H3K27me3:Bre+H3K27Ac:Gua+H3K27me3:Gua]","[H3K27Ac:Bre+H3K27me3:Bre+H4K20me1:Bre+H3K27Ac:Gua+H3K27me3:Gua+H4K20me1:Gua]","[H3K27Ac:Bre+H3K27me3:Bre+H3K4me3:Bre+H3K27Ac:Gua+H3K27me3:Gua+H3K4me3:Gua]","[H3K27Ac:Bre+H3K27me3:Bre+H3K4me3:Bre+H4K20me1:Bre+H3K27Ac:Gua+H3K27me3:Gua+H3K4me3:Gua+H4K20me1:Gua]")))
### Test 4th case ###
message("4th test case")
marks <- rep("H3K4me1", 17)
tissues <- c("Angular_Gyrus","Angular_Gyrus","Anterior_Caudate","Anterior_Caudate","Cingulate_Gyrus","Cingulate_Gyrus","Hippocampus_Middle","Hippocampus_Middle","Hippocampus_Middle","Inferior_Temporal_Lobe","Inferior_Temporal_Lobe","Mid_Frontal_Lobe","Mid_Frontal_Lobe","Substantia_Nigra","Substantia_Nigra","Germinal_Matrix","Germinal_Matrix")
replicates <- paste0(marks,':',tissues)
states2use <- state.brewer(replicates=replicates)
expect_that(states2use, is_a('data.frame'))
expect_that(states2use$state, is_a('factor'))
expect_that(mode(states2use$state), equals('numeric'))
expect_that(nrow(states2use), equals(256))
common.states <- state.brewer(replicates=replicates, common.states=TRUE, conditions=tissues, tracks2compare=marks)
common.states <- common.states[order(as.numeric(as.character(common.states$state))),]
expect_that(nrow(common.states), equals(2))
expect_that(as.character(common.states$combination),equals(c("[]","[H3K4me1:Angular_Gyrus+H3K4me1:Anterior_Caudate+H3K4me1:Cingulate_Gyrus+H3K4me1:Hippocampus_Middle+H3K4me1:Inferior_Temporal_Lobe+H3K4me1:Mid_Frontal_Lobe+H3K4me1:Substantia_Nigra+H3K4me1:Germinal_Matrix]")))
diff.states <- state.brewer(replicates=replicates, differential.states=TRUE, min.diff=1, conditions=tissues, tracks2compare=marks)
expect_that(nrow(diff.states), equals(254))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.