Found 71134 results in 3529 files, showing top 50 files (show more).
ExploreModelMatrix:R/ExploreModelMatrix.R: [ ] |
---|
177: class = "fa fa-question-circle",
|
658: class = "fa fa-question-circle",
|
55: ExploreModelMatrix <- function(sampleData = NULL, designFormula = NULL) {
|
199: class = "fa fa-question-circle",
|
224: class = "fa fa-question-circle",
|
252: class = "fa fa-question-circle",
|
283: class = "fa fa-question-circle",
|
306: class = "fa fa-question-circle",
|
333: class = "fa fa-question-circle",
|
355: class = "fa fa-question-circle",
|
23: #' app <- ExploreModelMatrix(
|
90: title = paste0("Design matrix visualization (ExploreModelMatrix v",
|
91: utils::packageVersion("ExploreModelMatrix"), ")"),
|
612: designMatrix = NULL)
|
1109: package = "ExploreModelMatrix"),
|
1131: package = "ExploreModelMatrix"),
|
VariantAnnotation:R/methods-VCF-class.R: [ ] |
---|
20: class <- "CollapsedVCF"
|
522: .showVCFSubclass <- function(object)
|
466: SnpMatrixToVCF <- function(from, seqSource)
|
2: ### VCF class methods
|
29: class <- "ExpandedVCF"
|
39: new(class, SummarizedExperiment(assays=geno, rowRanges=rowRanges,
|
403: if (!.compare(lapply(args, class)))
|
404: stop("'...' objects must be of the same VCF class")
|
441: if (!.compare(lapply(args, class)))
|
442: stop("'...' objects must be of the same VCF class")
|
565: cat("class:", classNameForDisplay(object), "\n")
|
545: cat(margin, classNameForDisplay(x), " with ",
|
553: cat(margin, classNameForDisplay(x), " with ",
|
561: cat(margin, classNameForDisplay(x), " of length ", lo,
|
GenomicRanges:R/GPos-class.R: [ ] |
---|
189: Class <- sub("IPos$", "GPos", as.character(class(pos)))
|
395: .COL2CLASS <- c(
|
400: classinfo <- makeClassinfoRowForCompactPrinting(x, .COL2CLASS)
|
35: "Starting with BioC 3.10, the class attribute of all ",
|
43: if (class(x) == "GPos")
|
64: ### IRanges/R/IPos-class.R for what that means), they are also on the same
|
188: ## class name returned by class(pos).
|
191: new_GRanges(Class, seqnames=seqnames, ranges=pos, strand=strand,
|
220: class(from) <- "UnstitchedGPos" # temporarily broken instance!
|
228: class(from) <- "StitchedGPos" # temporarily broken instance!
|
252: ### FROM THE TARGET CLASS! (This is a serious flaw in as() current
|
264: class(from) <- "GRanges" # temporarily broken instance!
|
277: ### CTSS class in the CAGEr package) need to define a coercion method to
|
315: if (class(object) != "GPos")
|
330: message("[updateObject] ", class(object), " object ",
|
341: if (class(object) == "GPos") {
|
343: message("[updateObject] Settting class attribute of GPos ",
|
345: class(object) <- class(new("StitchedGPos"))
|
351: class(object), " object is current.\n",
|
384: stop(c(wmsg("This ", class(x), " object uses internal representation ",
|
7: setClass("GPos",
|
15: setClass("UnstitchedGPos",
|
22: setClass("StitchedGPos",
|
380: print.classinfo=FALSE, print.seqinfo=FALSE)
|
394: if (print.classinfo) {
|
402: stopifnot(identical(colnames(classinfo), colnames(out)))
|
403: out <- rbind(classinfo, out)
|
419: show_GPos(object, print.classinfo=TRUE, print.seqinfo=TRUE)
|
375: setMethod("makeNakedCharacterMatrixForDisplay", "GPos",
|
391: ## makePrettyMatrixForCompactPrinting() assumes that head() and tail()
|
393: out <- makePrettyMatrixForCompactPrinting(x)
|
GRaNIE:R/core.R: [ ] |
---|
6302: d = tibble::add_row(d, r_positive = r_pos, class = classCur, peak_gene.p.raw.class = pclassCur, n = 0)
|
762: peak.GC.class = cut(.data$`G|C`, breaks = seq(0,1,1/nBins), include.lowest = TRUE, ordered_result = TRUE)) %>%
|
973: peaks_GC_class = cut(GC_data.df$peak.GC.perc, breaks = seq(0,1,1/nBins), include.lowest = TRUE, ordered_result = T...(4 bytes skipped)...
|
480: .storeAsMatrixOrSparseMatrix <- function(GRN, df, ID_column, slotName, threshold = 0.1) {
|
798: .normalizeCountMatrix <- function(GRN, data, normalization, additionalParams =list()) {
|
5240: classPeaks = class(GRN@data$peaks$counts)
|
5253: classRNA = class(GRN@data$RNA$counts)
|
6297: for (classCur in networkType_details) {
|
6350: classAll = c(as.character(d2$class), d3$r_positive),
|
3110: GC.class.cur = GC_classes_foreground.df$peak.GC.class[i]
|
6379: peak_gene.p.raw.class.bin = as.numeric(.data$peak_gene.p.raw.class)) %>%
|
774: GC_classes.df = GC.data %>%
|
1807: TFBS_bindingMatrix.df = .intersectTFBSPeaks_JASPAR(GRN, consensus.gr, verbose = FALSE, ...)
|
2318: AR_classification_wrapper <- function(GRN, significanceThreshold_Wilcoxon = 0.05,
|
2751: GC_classes_perTF.l = list()
|
2780: GC_classes_foreground.df = peaksForeground %>%
|
2788: GC_classes_background.df = peaksBackground %>%
|
2835: GC_classes_all.df = dplyr::full_join(GC_classes_foreground.df, GC_classes_background.df, suffix = c(".fg",".bg"), by = "peak.GC.class") %>%
|
3065: GC_classes_all.l = list()
|
6390: .classFreq_label <- function(tbl_freq) {
|
1585: PFMatrixList <- TFBSTools::getMatrixSet(JASPAR2022::JASPAR2022, opts = options_JASPAR)
|
1936: PFMatrixList = GRN@config$parameters$internal$PFMatrixList
|
6298: for (pclassCur in levels(peakGeneCorrelations.all.cur$peak_gene.p.raw.class)) {
|
3: #' Create and initialize an empty \code{\linkS4class{GRN}} object.
|
15: #' @return Empty \code{\linkS4class{GRN}} object
|
126: #' Add data to a \code{\linkS4class{GRN}} object.
|
128: #' This function adds both RNA and peak data to a \code{\linkS4class{GRN}} object, along with data normalization.
|
169: #' @return An updated \code{\linkS4class{GRN}} object, with added data from this function(e.g., slots \code{GRN@data$peaks} and \code{GRN@da...(8 bytes skipped)...
|
438: columnTypes = sapply(counts_df, class) %>% table()
|
493: fractionZero = (length(df.m) - Matrix::nnzero(df.m)) / length(df.m)
|
775: dplyr::group_by(.data$peak.GC.class) %>%
|
778: tidyr::complete(.data$peak.GC.class, fill = list(n = 0)) %>%
|
782: #ggplot2::ggplot(GC.data, ggplot2::aes(GC.class)) + geom_histogram(stat = "count") + ggplot2::theme_bw()
|
784: #ggplot2::ggplot(GC_classes.df , ggplot2::aes(GC.class, n_rel)) + geom_bar(stat = "identity") + ggplot2::theme_bw()
|
976: GC_class = peaks_GC_class,
|
1044: .gcqn <- function(data, GC_class, summary= 'mean', round= FALSE) {
|
1048: for (ii in 1:nlevels(GC_class)) {
|
1050: id <- which(GC_class == levels(GC_class)[ii])
|
1084: # for(ii in 1:nlevels(peaksAnnotation$peak.GC.class)) {
|
1085: # id <- which(peaksAnnotation$peak.GC.class==levels(peaksAnnotation$peak.GC.class)[ii])
|
1177: #' Filter RNA-seq and/or peak data from a \code{\linkS4class{GRN}} object
|
1183: ...(166 bytes skipped)...s_peak_gene}}. \strong{This function does NOT (re)filter existing connections when the \code{\linkS4class{GRN}} object already contains connections. Thus, upon re-execution of this function with different ...(60 bytes skipped)...
|
1208: #' @return An updated \code{\linkS4class{GRN}} object, with added data from this function.
|
1459: #' Add TFBS to a \code{\linkS4class{GRN}} object.
|
1482: #' @return An updated \code{\linkS4class{GRN}} object, with additional information added from this function(\code{GRN@annotation$TFs} in par...(8 bytes skipped)...
|
1735: #' Overlap peaks and TFBS for a \code{\linkS4class{GRN}} object
|
1743: #' @return An updated \code{\linkS4class{GRN}} object, with added data from this function (\code{GRN@data$TFs$TF_peak_overlap} in particular...(1 bytes skipped)...
|
1952: #overlapsAll_mtx <- overlapsAll_mtx[,Matrix::colSums(motifmatchr::motifMatches(overlapsAll_mtx))!=0]
|
2088: #' @return An updated \code{\linkS4class{GRN}} object, with added data from this function
|
2188: #' @return An updated \code{\linkS4class{GRN}} object, with added data from this function.
|
2302: #' Run the activator-repressor classification for the TFs for a \code{\linkS4class{GRN}} object
|
2312: #' @return An updated \code{\linkS4class{GRN}} object, with additional information added from this function.
|
2439: fileCur = paste0(outputFolder, .getOutputFileName("plot_class_density"), "_", connectionTypeCur, suffixFile, ".pdf")
|
2449: fileCur = paste0(outputFolder, .getOutputFileName("plot_class_medianClass"), "_", connectionTypeCur, suffixFile, ".pdf")
|
2462: fileCur = paste0(outputFolder, .getOutputFileName("plot_class_densityClass"), "_", connectionTypeCur, suffixFile, ".pdf")
|
2523: #' Add TF-peak connections to a \code{\linkS4class{GRN}} object
|
2541: #' @return An updated \code{\linkS4class{GRN}} object, with additional information added from this function.
|
2601: if (!"peak.GC.class" %in% colnames(GRN@annotation$peaks)) {
|
2734: cols_select = c("peak.ID", "peak.GC.class", "peak.GC.perc", "peak.width")
|
2781: dplyr::group_by(.data$peak.GC.class) %>%
|
2784: tidyr::complete(.data$peak.GC.class, fill = list(n = 0)) %>%
|
2789: dplyr::group_by(.data$peak.GC.class) %>%
|
2792: tidyr::complete(.data$peak.GC.class, fill = list(n = 0)) %>%
|
2852: peaksBackgroundGCCur = peaksBackground %>% dplyr::filter(.data$peak.GC.class == GC_classes_foreground.df$peak.GC.class[i])
|
2867: #futile.logger::flog.info(paste0("Resampling for bin ", GC_classes_foreground.df$peak.GC.class[i],
|
3115: dplyr::filter(.data$peak.GC.class == GC.class.cur) %>%
|
3123: futile.logger::flog.info(paste0(" GC.class ", GC.class.cur, ": Required: ", requiredNoPeaks, ", available: ", availableNoPeaks, ignoredStr))
|
3128: futile.logger::flog.info(paste0(" Mimicking distribution FAILED (GC class ", GC.class.cur, " could not be mimicked."))
|
3151: #' Add peak-gene connections to a \code{\linkS4class{GRN}} object
|
3174: #' @return An updated \code{\linkS4class{GRN}} object, with additional information added from this function.
|
3722: #' @return An updated \code{\linkS4class{GRN}} object, with additional information added from this function.
|
4428: #' Add TF-gene correlations to a \code{\linkS4class{GRN}} object.
|
4437: #' @return An updated \code{\linkS4class{GRN}} object, with additional information added from this function.
|
4552: #' Add SNP data to a \code{\linkS4class{GRN}} object and associate SNPs to peaks.
|
4590: #' @return An updated \code{\linkS4class{GRN}} object, with additional information added from this function.
|
4817: ...(4 bytes skipped)...enerate a summary for the number of connections for different filtering criteria for a \code{\linkS4class{GRN}} object.
|
4836: #' @return An updated \code{\linkS4class{GRN}} object, with additional information added from this function.
|
5136: #' @return An small example \code{\linkS4class{GRN}} object
|
5203: #' Get counts for the various data defined in a \code{\linkS4class{GRN}} object
|
5205: #' Get counts for the various data defined in a \code{\linkS4class{GRN}} object.
|
5206: ...(10 bytes skipped)...{Note: This function, as all \code{get} functions from this package, does NOT return a \code{\linkS4class{GRN}} object.}
|
5220: ...(37 bytes skipped)... the type as indicated by the function parameters. This function does **NOT** return a \code{\linkS4class{GRN}} object.
|
5246: message = paste0("Unsupported class for GRN@data$peaks$counts. Contact the authors.")
|
5259: message = paste0("Unsupported class for GRN@data$RNA$counts. Contact the authors.")
|
5309: #' Extract connections or links from a \code{\linkS4class{GRN}} object as a data frame.
|
5313: ...(10 bytes skipped)...{Note: This function, as all \code{get} functions from this package, does NOT return a \code{\linkS4class{GRN}} object.}
|
5326: ...(5 bytes skipped)...eturn A data frame with the requested connections. This function does **NOT** return a \code{\linkS4class{GRN}} object. Depending on the arguments, the
|
5528: ...(0 bytes skipped)...#' Retrieve parameters for previously used function calls and general parameters for a \code{\linkS4class{GRN}} object.
|
5530: ...(10 bytes skipped)...{Note: This function, as all \code{get} functions from this package, does NOT return a \code{\linkS4class{GRN}} object.}
|
5536: #' @return The requested parameters. This function does **NOT** return a \code{\linkS4class{GRN}} object.
|
5583: #' Summarize a \code{\linkS4class{GRN}} object to a named list for comparison with other \code{\linkS4class{GRN}} objects.
|
5585: ...(10 bytes skipped)...{Note: This function, as all \code{get} functions from this package, does NOT return a \code{\linkS4class{GRN}} object.}
|
5589: ...(1 bytes skipped)...' @return A named list summarizing the GRN object. This function does **NOT** return a \code{\linkS4class{GRN}} object, but instead a named lsit with the
|
5635: scarcity_peaks_all = (length(GRN@data$peaks$counts) - Matrix::nnzero(GRN@data$peaks$counts)) / length(GRN@data$peaks$counts)
|
5637: scarcity_peaks_filt = (length(peaks.filt) - Matrix::nnzero(peaks.filt)) / length(peaks.filt)
|
5652: scarcity_RNA_all = (length(GRN@data$RNA$counts) - Matrix::nnzero(GRN@data$RNA$counts)) / length(GRN@data$RNA$counts)
|
5654: scarcity_RNA_filt = (length(RNA.filt) - Matrix::nnzero(RNA.filt)) / length(RNA.filt)
|
5847: #' @return An updated \code{\linkS4class{GRN}} object, with some slots being deleted (\code{GRN@data$TFs$classification} as well as \code{GRN@stats$connectionDetails.l})
|
5881: #' @return An updated \code{\linkS4class{GRN}} object, with the output directory being adjusted accordingly
|
6164: "plot_class_density" = "TF_classification_densityPlots",
|
6165: "plot_class_medianClass" = "TF_classification_stringencyThresholds",
|
6166: "plot_class_densityClass" = "TF_classification_summaryHeatmap",
|
6291: dplyr::group_by(.data$r_positive, class, .data$peak_gene.p.raw.class) %>%
|
6300: row = which(d$r_positive == r_pos & d$class == classCur & as.character(d$peak_gene.p.raw.class) == as.character(pclassCur))
|
6308: # Restore the "ordered" factor for class
|
6309: d$peak_gene.p.raw.class = factor(d$peak_gene.p.raw.class, ordered = TRUE, levels = levels(peakGeneCorrelations.all.cur$peak_gene.p.raw.class))
|
6314: dplyr::group_by(.data$r_positive, .data$class) %>%
|
6320: dplyr::group_by(class, .data$peak_gene.p.raw.class) %>%
|
6329: normFactor_real = dplyr::filter(dsum, class == !! (networkType_details[1])) %>% dplyr::pull(.data$sum_n) %>% sum() /
|
6330: dplyr::filter(dsum, class == !! (networkType_details[2])) %>% dplyr::pull(.data$sum_n) %>% sum()
|
6334: dplyr::group_by(.data$peak_gene.p.raw.class, .data$r_positive) %>%
|
6335: dplyr::summarise(n_real = .data$n[class == !! (names(colors_vec)[1]) ],
|
6336: n_background = .data$n[class == !! (names(colors_vec)[2]) ]) %>%
|
6344: stopifnot(identical(levels(d2$peak_gene.p.raw.class), levels(d3$peak_gene.p.raw.class)))
|
6347: d_merged <- tibble::tibble(peak_gene.p.raw.class = c(as.character(d2$peak_gene.p.raw.class),
|
6348: as.character(d3$peak_gene.p.raw.class)),
|
6353: peak_gene.p.raw.class = factor(.data$peak_gene.p.raw.class, levels = levels(d2$peak_gene.p.raw.class)))
|
6355: d4 = tibble::tibble(peak_gene.p.raw.class = unique(d$peak_gene.p.raw.class),
|
6362: row_d2 = which(d2$class == networkType_details[1] & d2$peak_gene.p.raw.class == d4$peak_gene.p.raw.class[i])
|
6366: row_d2 = which(d2$class == paste0("random_",range) & d2$peak_gene.p.raw.class == d4$peak_gene.p.raw.class[i])
|
6370: row_d3 = which(d3$r_positive == TRUE & d3$peak_gene.p.raw.class == d4$peak_gene.p.raw.class[i])
|
6372: row_d3 = which(d3$r_positive == FALSE & d3$peak_gene.p.raw.class == d4$peak_gene.p.raw.class[i])
|
6380: dplyr::arrange(.data$peak_gene.p.raw.class.bin)
|
6382: d4_melt = reshape2::melt(d4, id = c("peak_gene.p.raw.class.bin", "peak_gene.p.raw.class")) %>%
|
6435: ...(36 bytes skipped)...ources of biological and technical variation for features (TFs, peaks, and genes) in a \code{\linkS4class{GRN}} object
|
6455: #' @return An updated \code{\linkS4class{GRN}} object, with additional information added from this function to \code{GRN@stats$varianceParti...(111 bytes skipped)...
|
6513: coltypes = meta %>% dplyr::summarise_all(class)
|
87: # Stringencies for AR classification
|
93: # Colors for the different classifications
|
192: checkmate::assertClass(GRN, "GRN")
|
310: countsPeaks.norm.df = .normalizeCountMatrix(GRN, data = counts_peaks %>% tibble::column_to_rownames("peakID") %>% as.matrix(),
|
317: countsRNA.norm.df = .normalizeCountMatrix(GRN, data = counts_rna %>% tibble::column_to_rownames("ENSEMBL") %>% as.matrix(),
|
384: GRN@data$peaks$counts = .storeAsMatrixOrSparseMatrix(GRN, df = data.l[["peaks"]], ID_column = "peakID", slotName = "GRN@data$peaks$counts")
|
387: GRN@data$peaks$counts_raw = .storeAsMatrixOrSparseMatrix(GRN, df = counts_peaks %>% dplyr::select("peakID", tidyselect::one_of(GRN@config$sharedSamples)),
|
391: GRN@data$RNA$counts = .storeAsMatrixOrSparseMatrix(GRN, df = data.l[["RNA"]], ID_column = "ENSEMBL", slotName = "GRN@data$RNA$counts")
|
394: GRN@data$RNA$counts_raw = .storeAsMatrixOrSparseMatrix(GRN, df = counts_rna %>% dplyr::select("ENSEMBL", tidyselect::one_of(GRN@config$sharedSamples)),
|
498: df.m = .asSparseMatrix(df.m, convertNA_to_zero = FALSE,
|
614: countsPeaks.clean = getCounts(GRN, type = "peaks", permuted = FALSE, asMatrix = TRUE, includeFiltered = TRUE)
|
710: countsRNA.m = getCounts(GRN, type = "rna", permuted = FALSE, asMatrix = TRUE, includeFiltered = TRUE)
|
790: GRN@stats$GC$peaks = GC_classes.df
|
800: checkmate::assertMatrix(data)
|
811: dd <- suppressMessages(DESeq2::DESeqDataSetFromMatrix(countData = data,
|
1073: # counts = getCounts(GRN, type = "peaks", asMatrix = TRUE, includeFiltered = TRUE)
|
1137: # dd <- DESeq2::DESeqDataSetFromMatrix(countData = countDataNew,
|
1225: checkmate::assertClass(GRN, "GRN")
|
1493: checkmate::assertClass(GRN, "GRN")
|
1753: checkmate::assertClass(GRN, "GRN")
|
1811: TFBS_bindingMatrix.df = cbind(TFBS_bindingMatrix.df, rep(FALSE, nrow(TFBS_bindingMatrix.df)))
|
1812: colnames(TFBS_bindingMatrix.df)[ncol(TFBS_bindingMatrix.df)] = "isFiltered"
|
1813: GRN@data$TFs$TF_peak_overlap = TFBS_bindingMatrix.df %>% methods::as("dMatrix")
|
1826: TFBS_bindingMatrix.df = tibble::as_tibble(res.l)
|
1828: if (!all(colnames(TFBS_bindingMatrix.df) %in% GRN@config$allTF)) {
|
1840: GRN@data$TFs$TF_peak_overlap = TFBS_bindingMatrix.df %>%
|
1846: GRN@data$TFs$TF_peak_overlap = .asSparseMatrix(as.matrix(GRN@data$TFs$TF_peak_overlap),
|
2093: checkmate::assertClass(GRN, "GRN")
|
2120: countsPeaks = .normalizeCountMatrix(GRN, data = GRN@data$peaks$counts_orig, normalization = normalization)
|
2191: checkmate::assertClass(GRN, "GRN")
|
2246: countsNorm = .normalizeCountMatrix(GRN, data = data %>% dplyr::select(-"ENSEMBL"), normalization = normalization)
|
2300: ######## AR classification ########
|
2305: ...(47 bytes skipped)...c[0,1]. Default 0.05. Significance threshold for Wilcoxon test that is run in the end for the final classification. See the Vignette and *diffTF* paper for details.
|
2316: #' # GRN = AR_classification_wrapper(GRN, outputFolder = ".", forceRerun = FALSE)
|
2326: checkmate::assertClass(GRN, "GRN")
|
2340: GRN@data$TFs$classification$TF.translation.orig = GRN@annotation$TFs
|
2362: if (is.null(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]])) {
|
2363: if (is.null(GRN@data$TFs$classification[[permIndex]])) {
|
2364: GRN@data$TFs$classification[[permIndex]] = list()
|
2366: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]] = list()
|
2369: if (is.null(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_cor_median_foreground) |
|
2370: is.null(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_cor_median_background) |
|
2371: is.null(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_foreground) |
|
2372: is.null(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_background) |
|
2373: is.null(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor) |
|
2377: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]] = list()
|
2400: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_cor_median_foreground = res.l[["median_foreground"]]...(0 bytes skipped)...
|
2401: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_cor_median_background = res.l[["median_background"]]...(0 bytes skipped)...
|
2402: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_foreground = res.l[["foreground"]]
|
2403: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_background = res.l[["background"]]
|
2405: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor = TF_peak_cor
|
2408: # Final classification: Calculate thresholds by calculating the quantiles of the background and compare the real ...(24 bytes skipped)...
|
2410: if (is.null(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$act.rep.thres.l) | forceRerun) {
|
2411: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$act.rep.thres.l =
|
2412: .calculate_classificationThresholds(.asMatrixFromSparse(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_background),
|
2416: if (is.null(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF.classification) | forceRerun) {
|
2418: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF.classification =
|
2420: output.global.TFs = GRN@data$TFs$classification$TF.translation.orig %>% dplyr::mutate(TF = .data$TF.ID),
|
2421: median.cor.tfs = GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_cor_median_foreground,
|
2422: act.rep.thres.l = GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$act.rep.thres.l,
|
2424: t.cor.sel.matrix = .asMatrixFromSparse(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_foreground),
|
2425: t.cor.sel.matrix.non = .asMatrixFromSparse(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_background),
|
2430: # PLOTS FOR THE RNA-SEQ CLASSIFICATION
|
2441: .plot_density(.asMatrixFromSparse(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_foreground),
|
2442: .asMatrixFromSparse(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_background),
|
2452: median.cor.tfs = .asMatrixFromSparse(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_cor_median_foreground),
|
2453: median.cor.tfs.non = .asMatrixFromSparse(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_cor_median_background),
|
2455: act.rep.thres.l = GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$act.rep.thres.l,
|
2465: TF_peak_cor = GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor
|
2467: .plot_heatmapAR(TF.peakMatrix.df = peak_TF_overlapCur.df,
|
2472: median.cor.tfs = .asMatrixFromSparse(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_cor_median_foreground),
|
2473: median.cor.tfs.non = .asMatrixFromSparse(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_cor_median_background),
|
2474: act.rep.thres.l = GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$act.rep.thres.l,
|
2475: finalClassification = GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF.classification,
|
2485: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_cor_median_foreground = NULL
|
2486: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_cor_median_background = NULL
|
2487: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_foreground = NULL
|
2488: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_background = NULL
|
2489: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$act.rep.thres.l = NULL
|
2493: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_foreground =
|
2494: .asSparseMatrix(as.matrix(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_foreground), convertNA_to_zero = TRUE)
|
2495: GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_background =
|
2496: .asSparseMatrix(as.matrix(GRN@data$TFs$classification[[permIndex]] [[connectionTypeCur]]$TF_peak_cor_background), convertNA_to_zero = TRUE)
|
2558: checkmate::assertClass(GRN, "GRN")
|
2803: minPerc = .findMaxBackgroundSize(GC_classes_foreground.df, GC_classes_background.df, peaksBackground,
|
2840: GC_classes_perTF.l[[TFCur]] = GC_classes_all.df
|
2850: for (i in seq_len(nrow(GC_classes_foreground.df))) {
|
2858: #Select the minimum, which for low % GC classes is smaller than the required number to mimic the foreground 100%
|
2861: nPeaksCur = GC_classes_all.df$n.bg.needed[i]
|
2863: nPeaksCur = min(GC_classes_all.df$n.bg.needed[i], nrow(peaksBackgroundGCCur))
|
2866: if (GC_classes_all.df$n.bg.needed[i] > nrow(peaksBackgroundGCCur)) {
|
2868: #": Needed: ", GC_classes_all.df$n.bg.needed[i], ", available: ", nrow(peaksBackgroundGCCur)))
|
2884: plots_GC.l[[connectionTypeCur]][[TFCur]] = .generateTF_GC_diagnosticPlots(TFCur, GC_classes_foreground.df, GC_classes_background.df, GC_classes_all.df, peaksForeground, peaksBackground, peaksBackgroundGC)
|
3066: GC_classes_all.l[[connectionTypeCur]] = GC_classes_perTF.l %>%
|
3073: GC_classes_all.l = NULL
|
3084: GC_details = GC_classes_all.l
|
3088: .findMaxBackgroundSize <- function(GC_classes_foreground.df, GC_classes_background.df, peaksBackground, threshold_percentage = 0.05) {
|
3107: for (i in seq_len(nrow(GC_classes_foreground.df))) {
|
3109: n_rel = GC_classes_foreground.df$n_rel[i]
|
3114: availableNoPeaks = GC_classes_background.df %>%
|
3132: if (i == nrow(GC_classes_foreground.df)) {
|
3138: } # end of for (i in 1:nrow(GC_classes_foreground.df)) {
|
3191: checkmate::assertClass(GRN, "GRN")
|
3767: checkmate::assertClass(GRN, "GRN")
|
4446: checkmate::assertClass(GRN, "GRN")
|
4602: checkmate::assertClass(GRN, "GRN")
|
4773: # Some SNPs may now be classified as "LD" although they ALSO overlap the peak in fact
|
4855: checkmate::assertClass(GRN, "GRN")
|
5210: #' @param asMatrix Logical. \code{TRUE} or \code{FALSE}. Default \code{FALSE}. If set to \code{FALSE}, counts are retu...(167 bytes skipped)...
|
5211: ...(10 bytes skipped)...includeIDColumn Logical. \code{TRUE} or \code{FALSE}. Default \code{TRUE}. Only relevant if \code{asMatrix = FALSE}. If set to \code{TRUE}, an explicit ID column is returned (no row names). If set to \code{...(45 bytes skipped)...
|
5221: getCounts <- function(GRN, type, permuted = FALSE, asMatrix = FALSE, includeIDColumn = TRUE, includeFiltered = FALSE) {
|
5223: checkmate::assertClass(GRN, "GRN")
|
5228: checkmate::assertFlag(asMatrix)
|
5241: if ("matrix" %in% classPeaks) {
|
5243: } else if ("dgCMatrix" %in% classPeaks) {
|
5254: if ("matrix" %in% classRNA) {
|
5256: } else if ("dgCMatrix" %in% classRNA) {
|
5288: if (!asMatrix) {
|
5327: ...(2 bytes skipped)... data frame that is returned has different columns, which however can be divided into the following classes according to their name:
|
5382: checkmate::assertClass(GRN, "GRN")
|
5543: checkmate::assertClass(GRN, "GRN")
|
5619: checkmate::assertClass(GRN, "GRN")
|
5636: peaks.filt = getCounts(GRN, type = "peaks", asMatrix = TRUE)
|
5653: RNA.filt = getCounts(GRN, type = "rna", asMatrix = TRUE)
|
5844: #' Optional convenience function to delete intermediate data from the function \code{\link{AR_classification_wrapper}} and summary statistics that may occupy a lot of space
|
5854: checkmate::assertClass(GRN, "GRN")
|
5862: GRN@data$TFs$classification[[permIndex]]$TF_cor_median_foreground = NULL
|
5863: GRN@data$TFs$classification[[permIndex]]$TF_cor_median_background = NULL
|
5864: GRN@data$TFs$classification[[permIndex]]$TF_peak_cor_foreground = NULL
|
5865: GRN@data$TFs$classification[[permIndex]]$TF_peak_cor_background = NULL
|
5866: GRN@data$TFs$classification[[permIndex]]$act.rep.thres.l = NULL
|
5887: checkmate::assertClass(GRN, "GRN")
|
5973: GRN@data$peaks[["counts"]] = .storeAsMatrixOrSparseMatrix(GRN, df = GRN@data$peaks$counts_norm %>% dplyr::select(-"isFiltered"),
|
6001: GRN@data$RNA[["counts"]] = .storeAsMatrixOrSparseMatrix(GRN, df = GRN@data$RNA$counts_norm.l[["0"]] %>% dplyr::select(-"isFiltered"),
|
6295: # Some classes might be missing, add them here with explicit zeros
|
6352: dplyr::mutate(classAll = factor(.data$classAll, levels = c(paste0("real_",range), paste0("random_",range), "TRUE", "FALSE")),
|
6397: checkmate::assertClass(GRN, "GRN")
|
6408: expMeans.m = getCounts(GRN, type = "rna", permuted = FALSE, asMatrix = TRUE)
|
6419: ...(5 bytes skipped)... mean = rowMeans(getCounts(GRN, type = "peaks", permuted = FALSE, asMatrix = TRUE))) %>%
|
6472: checkmate::assertClass(GRN, "GRN")
|
88: par.l$internal$allClassificationThresholds = c(0.1, 0.05, 0.01, 0.001)
|
1475: ...(15 bytes skipped)...ode{NULL}, the specific genome version as provided in the object is used within \code{TFBSTools::getMatrixSet} in the \code{opts} list for \code{species},
|
1477: #' For more details, see \code{?TFBSTools::getMatrixSet}.
|
1480: ...(4 bytes skipped)...param ... Additional named elements for the \code{opts} function argument from \code{?TFBSTools::getMatrixSet} that is used to query the JASPAR database.
|
1588: GRN@config$parameters$internal$PFMatrixList = PFMatrixList
|
1592: TFsWithTFBSPredictions <- unlist(lapply(PFMatrixList, function(x) {return(TFBSTools::name(x))}), use.names = FALSE)
|
1593: IDsWithTFBSPredictions <- unlist(lapply(PFMatrixList, function(x) {return(TFBSTools::ID(x))}), use.names = FALSE)
|
1717: GRN@config$parameters$internal$PFMatrixList = GRN@config$parameters$internal$PFMatrixList[allTF]
|
1932: if (is.null(GRN@config$parameters$internal$PFMatrixList)) {
|
1933: message = paste0(" GRN@config$parameters$internal$PFMatrixList is NULL but shouldnt be. Rerun the function addTFBS.")
|
1939: TF_names <- unlist(lapply(PFMatrixList, function(x) {return(TFBSTools::name(x))}), use.names = FALSE)
|
1940: TF_IDs <- unlist(lapply(PFMatrixList, function(x) {return(TFBSTools::ID(x))}), use.names = FALSE)
|
1942: overlapsAll <- motifmatchr::matchMotifs(PFMatrixList, consensusPeaks, out = 'matches',
|
2060: peak_TF_overlapCur.df = .asMatrixFromSparse(GRN@data$TFs$TF_peak_overlap, convertZero_to_NA = FALSE) %>%
|
2419: .finalizeClassificationAndAppend(
|
5244: result = .asMatrixFromSparse(GRN@data$peaks$counts, convertZero_to_NA = FALSE)
|
5257: result = .asMatrixFromSparse(GRN@data$RNA$counts, convertZero_to_NA = FALSE)
|
cTRAP:R/shinyInterface.R: [ ] |
---|
27: alert <- tags$div(class=paste0("alert alert-", type), role="alert", ...)
|
115: tags$div(class="container-fluid", style="padding-top: 15px;")
|
274: class <- class(dataset)[[1]]
|
1153: class <- "danger"
|
1584: tags$span(class="help-block", style="margin-top: -10px;",
|
11: .filterDatasetsByClass <- function(data, class, expected=FALSE) {
|
1388: corMatrix <- input$corMatrix
|
1404: selectedCorMatrix <- loadExpressionDrugSensitivityAssociation(
|
1742: elemClasses <- sapply(lapply(list(...), class), "[[", 1)
|
12: selected <- sapply(data, is, class)
|
14: # Return values that are expected to turn into the given class
|
15: expected <- sapply(data, is, paste0("expected", capitalize(class)))
|
34: class(data) <- c("diffExpr", class(data))
|
51: title <- div(class="panel-heading", h3(class="panel-title", title))
|
55: if (length(body) > 0) body <- div(class="panel-body", ...)
|
57: body <- div(id="collapseOne", class="panel-collapse collapse in",
|
60: if (!is.null(footer)) footer <- div(class="panel-footer", footer)
|
61: div(class=paste0("panel panel-", type), title, body, footer)
|
132: cols <- cols[!sapply(table, class)[cols] %in% c("character", "logical")]
|
162: .prepareReferenceComparisonDT <- function(data, class) {
|
163: data <- .filterDatasetsByClass(req(data), class, expected=TRUE)
|
276: tags <- paste0("#", c(class, source), collapse=" ")
|
287: # Update dataset choices (optionally, filter datasets by class)
|
288: .updateDatasetChoices <- function(session, id, data, class=NULL) {
|
289: if (!is.null(class)) data <- .filterDatasetsByClass(data, class)
|
332: actionButton(ns("load"), "Load data", class="btn-primary"))
|
409: actionButton(ns("load"), "Load data", class="btn-primary"))
|
573: actionButton(ns("load"), "Load data", class="btn-primary"),
|
925: class="compact hover stripe")
|
1158: class <- "danger"
|
1163: class <- "default"
|
1168: class <- "warning"
|
1173: class <- "success"
|
1180: class <- NULL
|
1183: class <- paste0(c("label label-"), class)
|
1185: html <- tags$span(style=colour, icon, state, ..., class=class)
|
1222: class(ranking) <- c(paste0("expected", capitalize(mode)), "expected",
|
1223: class(ranking))
|
1260: actionButton(ns("analyse"), "Rank by similarity", class="btn-primary"))
|
1370: class="btn-primary"))
|
1587: class="btn-primary"))
|
100: rapply(tag, FUN, how="replace", classes="character")
|
1207: selectedDiffExpr, selectedCorMatrix, method,
|
1355: selectizeInput(ns("corMatrix"),
|
1389: if (!is.null(corMatrix) || corMatrix != "") {
|
1390: dataset <- paste(corMatrix, tolower(dataset))
|
1397: corMatrix <- req(input$corMatrix)
|
1405: corMatrix, path=path)
|
1409: selectedDiffExpr, selectedCorMatrix, method,
|
1415: selectedDiffExpr, selectedCorMatrix, method,
|
1424: "Gene expression and drug sensitivity association"=corMatrix,
|
1484: sets <- .filterDatasetsByClass(x(), "drugSets")
|
1510: drugSets <- .filterDatasetsByClass(x(), "drugSets")
|
1743: hasSimilarPerts <- "similarPerturbations" %in% elemClasses
|
1744: hasTargetingDrugs <- "targetingDrugs" %in% elemClasses
|
trio:R/qingInternal.R: [ ] |
---|
7782: class = unlist(lapply(elm, FUN=class))
|
7773: class.last = NULL
|
9892: anyMatrix = inMatrix[,colVec]
|
3071: if(class(data[,m[i]])=="factor") data[,i]=as.character(data[,m[i]])
|
3074: if(class(data[,m[i]])=="factor") data[,i]=as.numeric(as.character(data[,m[i]]))
|
3077: if(class(data[,m[i]])=="factor") data[,i]=as.numeric(as.character(data[,m[i]]))
|
7793: if(length(class.last)==length(class)){
|
7794: all.m = class.last==class
|
7795: if(sum(all.m)!=length(class)) search=FALSE
|
7809: class.last=class
|
7810: class=NULL
|
7818: reStr = paste(c("name", "class", "length"),
|
7819: c("", class.last[1], len.last[1]),
|
7822: reStr = paste(c("name", "class", "length"),
|
7823: c(names.last[1], class.last[1], len.last[1]),
|
9415: if(class(data[,i])=="factor") data[,i]=as.numeric(as.character(data[,i]))
|
9836: util.listMatrix.2matrix <-
|
9890: function(inMatrix, colVec, discIn=NULL, discVec=NULL, delimVec, digitVec, missingVec=NULL){
|
9893: mRow = dim(anyMatrix)[1]
|
9894: mCol = dim(anyMatrix)[2]
|
9899: re[,1]= inMatrix[,discIn]
|
9906: num = anyMatrix[row, col]
|
Pi:R/xMLcaret.r: [ ] |
---|
88: class <- as.factor(gs_targets[!is.na(ind)])
|
87: df_predictor_class <- as.data.frame(df_predictor[ind[!is.na(ind)],])
|
102: ...(4 bytes skipped)...Control <- caret::trainControl(method=c("repeatedcv","cv","oob")[1], number=nfold, repeats=nrepeat, classProbs=TRUE, summaryFunction=caret::twoClassSummary, allowParallel=FALSE)
|
3: ...(348 bytes skipped)... in rows and predictors in columns, with their predictive scores inside it. It returns an object of class 'sTarget'.
|
10: ...(71 bytes skipped)...idataion. Per fold creates balanced splits of the data preserving the overall distribution for each class (GSP and GSN), therefore generating balanced cross-vallidation train sets and testing sets. By defa...(44 bytes skipped)...
|
18: #' an object of class "sTarget", a list with following components:
|
20: #' \item{\code{model}: an object of class "train" as a best model}
|
29: #' \item{\code{evidence}: an object of the class "eTarget", a list with following components "evidence" and "metag"}
|
85: ## predictors + class
|
89: levels(class) <- c("GSN","GSP")
|
90: df_predictor_class$class <- class
|
94: ...(40 bytes skipped)...ds (%d in GSP, %d in GSN) are used for supervised integration of %d predictors/features (%s).", sum(class=="GSP"), sum(class=="GSN"), ncol(df_predictor), as.character(now)), appendLF=TRUE)
|
119: fit_gbm <- caret::train(class ~ .,
|
120: data = df_predictor_class,
|
158: fit_svm <- caret::train(class ~ .,
|
159: data = df_predictor_class,
|
195: fit_rda <- caret::train(class ~ .,
|
196: data = df_predictor_class,
|
231: fit_knn <- caret::train(class ~ .,
|
232: data = df_predictor_class,
|
267: fit_pls <- caret::train(class ~ .,
|
268: data = df_predictor_class,
|
305: suppressMessages(fit_nnet <- caret::train(class ~ .,
|
306: data = df_predictor_class,
|
346: fit_rf <- caret::train(class ~ .,
|
347: data = df_predictor_class,
|
384: class = c("numeric", 'numeric'),
|
446: fit_myrf <- caret::train(class ~ .,
|
447: data = df_predictor_class,
|
486: fit_crf <- caret::train(class ~ .,
|
487: data = df_predictor_class,
|
524: fit_glmnet <- caret::train(class ~ .,
|
525: data = df_predictor_class,
|
556: fit_glm <- caret::train(class ~ .,
|
557: data = df_predictor_class,
|
589: fit_bglm <- caret::train(class ~ .,
|
590: data = df_predictor_class,
|
627: fit_blr <- caret::train(class ~ .,
|
628: data = df_predictor_class,
|
669: fit_xgbl <- caret::train(class ~ .,
|
670: data = df_predictor_class,
|
712: fit_xgbt <- caret::train(class ~ .,
|
713: data = df_predictor_class,
|
792: ...(54 bytes skipped)...atrix of %d rows/genes X %d columns/repeats*folds, aggregated via '%s' (%s) ...", nrow(df_predictor_class), nfold*nrepeat, aggregateBy, as.character(now)), appendLF=TRUE)
|
917: class(sTarget) <- "sTarget"
|
34: #' @seealso \code{\link{xPierMatrix}}, \code{\link{xPredictROCR}}, \code{\link{xPredictCompare}}, \code{\link{xSparseMatrix}}, \code{\link{xSymbol2GeneID}}
|
57: df_predictor <- xPierMatrix(list_pNode, displayBy="score", combineBy="union", aggregateBy="none", RData.location=RData.location...(12 bytes skipped)...
|
61: eTarget <- xPierMatrix(list_pNode, displayBy="evidence", combineBy="union", aggregateBy="none", verbose=FALSE, RData.locat...(30 bytes skipped)...
|
103: fitControl_withoutParameters <- caret::trainControl(method="none", classProbs=TRUE, allowParallel=FALSE)
|
381: type = "Classification",
|
394: fit = function(x, y, wts, param, lev, last, classProbs, ...) {
|
432: levels = function(x) x$classes,
|
818: df_full <- as.matrix(xSparseMatrix(df_full, verbose=FALSE))
|
pcaExplorer:R/pcaExplorer.R: [ ] |
---|
2684: class = "footer",
|
84: class = "btn_no_border",
|
225: # class = "btn btn-info"),
|
307: downloadButton("downloadData", "Download", class = "btn btn-success"),
|
318: actionButton("compute_pairwisecorr", "Run", class = "btn btn-primary"),
|
735: actionButton("composemat", "Compose the matrix", icon = icon("spinner"), class = "btn btn-primary"),
|
818: actionButton("updatepreview_button", "Update report", class = "btn btn-primary"), p()
|
820: column(3, downloadButton("saveRmd", "Generate & Save", class = "btn btn-success"))
|
971: class = "btn btn-primary", icon = icon("spinner")),
|
974: class = "btn btn-primary", icon = icon("spinner")),
|
977: class = "btn btn-primary", icon = icon("spinner"))
|
1130: actionButton(inputId = "show_cm", label = HTML("Show </br>count matrix"), class = "btn btn-success")
|
1139: actionButton(inputId = "show_metadata", label = HTML("Show </br>sample metadata"), class = "btn btn-success")
|
1148: actionButton(inputId = "show_dds", label = HTML("Show </br><code>dds</code> object"), class = "btn btn-success")
|
1157: actionButton(inputId = "show_annotation", label = HTML("Show </br>gene annotation"), class = "btn btn-success")
|
1207: actionButton("button_diydds", label = HTML("Generate the dds and </br>dst objects"), class = "btn btn-success"),
|
2008: actionButton("computepca2go", "Compute the PCA2GO object", icon = icon("spinner"), class = "btn btn-primary")
|
2140: class(input$pc_x)
|
2142: class(datatable(values$mypca2go[[paste0("PC", input$pc_x)]][["posLoad"]]))
|
2687: class = "foot-inner",
|
31: #' dds_airway <- DESeq2::DESeqDataSetFromMatrix(assay(airway),
|
1239: values$mydds <- DESeqDataSetFromMatrix(countData = values$mycountmatrix,
|
1295: values$mydds <- DESeqDataSetFromMatrix(countData = values$mycountmatrix,
|
psichomics:R/analysis.R: [ ] |
---|
888: warn <- tags$div(class="alert alert-warning", role="alert",
|
969: error <- tagList(h4("t-test"), tags$div(class="alert alert-danger",
|
118: #' @param match Matrix: match between samples and subjects
|
254: class(survTime) <- c("data.frame", "survTime")
|
407: class(res) <- c("survTerms", class(res))
|
556: if ("simpleError" %in% class(survTerms)) {
|
686: if ("simpleError" %in% class(survTerms)) return(NA)
|
975: warn <- tags$div(class="alert alert-warning", role="alert",
|
1220: type <- sapply(cols, function(i) class(df[[i]]))
|
2064: #' @return A list with class \code{"htest"} containing the following components:
|
2103: class(rval) <- "htest"
|
2710: type <- sapply(cols, function(i) class(stats[[i]]))
|
3178: div(class="col-sm-6 col-md-4",
|
3179: div(class="thumbnail", style="background:#eee;",
|
3180: div(class="caption", uiOutput(ns(id)))))
|
3193: class="btn-info btn-md btn-block", class="visible-lg visible-md"),
|
3196: class="btn-info btn-xs btn-block", class="visible-sm visible-xs"))
|
3214: actionButton(ns("analyse"), "Perform analyses", class="btn-primary"),
|
3224: div(class="row", card("ttest"), card("levene")),
|
3226: div(class="row", card("wilcox"), card("kruskal"), card("fligner")))
|
3307: event, class=NULL, showPath=FALSE, showText=FALSE,
|
3315: event, class=NULL, showPath=FALSE, showText=FALSE,
|
geNetClassifier:R/functions.public.R: [ ] |
---|
389: class <- names(x)[largest]
|
71: classes <- factor(apply(prob, 2, function(x) {assignment.conditions(x, minProb, minDiff)}))
|
97: classes<-unique(c(rownames(mxcf),colnames(mxcf)))
|
133: byClass <- matrix(nrow=nclasses, ncol=4)
|
176: externalValidation.probMatrix<- function(queryResult, realLabels, numDecimals=2)
|
209: probMatrix <- matrix(0,nrow=length(levels(realLabels)), ncol=length(predClasses))
|
215: classAssignments <- globalQueryResult$class[names(realLabels)[which(realLabels==label)]] #Prob for the class samples, even if the prediction was wrong
|
249: classes <- rownames(globalQueryResult$probabilities)
|
289: highestProbClass...(9 bytes skipped)...mes(globalQueryResult$probabilities)[apply(globalQueryResult$probabilities[,which(globalQueryResult$class == "NotAssigned"), drop=FALSE], 2, function(x) which(order(x, decreasing=TRUE)==1))] #Clase con la ...(18 bytes skipped)...
|
293: nextClass...(17 bytes skipped)...mes(globalQueryResult$probabilities)[apply(globalQueryResult$probabilities[,which(globalQueryResult$class == "NotAssigned"), drop=FALSE], 2, function(x) which(order(x, decreasing=TRUE)==2))]
|
608: exprMatrix <- eset
|
695: classes <- levels(sampleLabels)
|
718: classLabels <- stats::setNames(paste("C", sapply(classes,function(x) which(classes==x)), sep=""), classes)
|
795: if(!is.null(colnames(genes))) { geneClass <- unique(colnames(genes)[which(genes == genesVector[i],arr.ind=TRUE)[,2]])
|
815: classMean <- mean(matriz[genesVector[i], (prevLim+1):j])
|
931: classificationGenesRanking <- classificationGenes
|
1084: geneClass<-NULL
|
1156: tempDpMatrix <- discrPwDF
|
1307: classificationGenesInfo <- genesDetails(classificationGenes)[nwClasses]
|
1382: classGeneLabels <- as.vector(genesInfoList[[cl]][,"GeneName"])[availableNames]
|
1395: classGenes <- getNodes(genesNetwork[[cl]])
|
1412: classificationGenesNetwork <- NULL
|
1413: classificationGenesID <- NULL
|
1489: if(length(genesNetwork[[nw]]@nodes)>0) { classGraph <- igraph::graph.data.frame(as.data.frame(genesNetwork[[nw]]@edges[,ntwColnames,drop=FALSE]), ...(68 bytes skipped)...
|
31: queryGeNetClassifier <- function(classifier, eset, minProbAssignCoeff=1, minDiffAssignCoeff=0.8, verbose=TRUE)
|
42: numClasses <- length(classifier$levels)
|
99: nclasses <- length(classes)
|
105: missingClasses <- classes[which(!classes %in% colnames(mxcf))]
|
207: predClasses <- c(levels(realLabels), rownames(globalQueryResult$probabilities)[which(!rownames(globalQueryRes...(46 bytes skipped)...
|
250: numClasses <- length(classes)
|
337: if(is.null(totalNumberOfClasses)) {numClasses <- length(levels(realLabels))
|
509: numClasses <- length(gClasses(genesRanking))
|
697: numClasses <- length(classes)
|
991: longClassNames <- any(nchar(classNames)>6)
|
1000: numClasses <- ifelse(is.matrix(classificationGenes), length(classNames), length(classifier$levels))
|
1269: nwClasses <- names(genesNetwork)
|
1473: numClasses<-length(genesNetwork)
|
43: ...(52 bytes skipped)...obAssignCoeff' should be a coefficient to modify the probability required to assign the sample to a class.")
|
44: ...(72 bytes skipped)...d be a coefficient to modify the required difference between probabilites to assign the sample to a class.")
|
67: ...(86 bytes skipped)...etSelection)) esetSelection <- t(cbind(NULL,esetSelection)) #To avoid error when there is only 1gen/class
|
72: ret <- list(call=match.call(), class= classes, probabilities=prob)
|
77: ...(6 bytes skipped)...ulates stats from the confussion matrix. i.e. sensitivity and specificity of the predictor for each class, global accuracy and call rate (rate of assigned samples)
|
79: # 100% Sensitivity = Recognizes all positives for the class
|
80: # 100% Specificity = Recognizes all negatives for the class
|
82: #Renombrado de class.accuracy
|
93: warning("The confussion matrix should have the real class in rows and the assigned class in cols. The matrix provided didn't seem to be in the right order so it was transposed:")
|
174: # Returns the matrix with the average probabilities of assigning a sample to each class (only of assigned samples)
|
186: if (length(realLabels) == length( names(queryResult$class)))
|
188: names(realLabels) <- names(queryResult$class)
|
201: if(sum(!names(globalQueryResult$class) %in% names(realLabels)) >0) stop("There are samples for which the real label was not provided.")
|
203: if((length(globalQueryResult$class)!=dim(globalQueryResult$probabilities)[2]) || (sum(!names(globalQueryResult$class) %in% colnames(globalQueryResult$probabilities))>0 )) {stop("The samples in $class and in $probabilities do not match.")}
|
228: # Gives basic stats of the probabilities with wich the samples were assigned to the class
|
246: if(length(globalQueryResult$class)!=dim(globalQueryResult$probabilities)[2]) {}#El numero de samples no encaja
|
248: numSamples <- length(globalQueryResult$class)
|
262: if (globalQueryResult$class[i] == classes[c])
|
270: else if (c==1 && (globalQueryResult$class[i] == "NotAssigned")) notAssigned <- notAssigned+1
|
284: # Info about NotAssigned samples (most likely class & probs)
|
288: highestProb <- apply(globalQueryResult$probabilities[,which(globalQueryResult$class == "NotAssigned"), drop=FALSE], 2, function(x) round(max(x), numDecimals)) #--> mayor probabilid...(13 bytes skipped)...
|
291: nextProbIndex <- cbind(apply(globalQueryResult$probabilities[,which(globalQueryResult$class...(10 bytes skipped)...signed"), drop=FALSE], 2, function(x) which(order(x, decreasing=TRUE)==2)), which(globalQueryResult$class == "NotAssigned"))
|
302: ...(19 bytes skipped)...("The query contains ", samplesQueried=numSamples, " samples. ",sum(stats[,1])," were assigned to a class resulting on a call rate of ", callRate,"%. \n", sep=""))
|
331: if (length(realLabels) == length(names(queryResult$class)))
|
333: names(realLabels) <- names(queryResult$class)
|
342: ...(72 bytes skipped)...d be a coefficient to modify the required difference between probabilites to assign the sample to a class.")
|
363: plot(c(minX,1), c(0,1), type="n", xlab="Probability of the most likely class", ylab="Difference with next class", frame=FALSE, main="Thresholds to assign query samples")
|
380: ...(0 bytes skipped)... graphics::legend("bottomright", "(x,y)", legend=c("Correct", "Incorrect"), title = "Most likely class", text.width = strwidth("1,000,000"), xjust = 1, yjust = 1, lty = 0, pch=16, col=c(correctColor, i...(24 bytes skipped)...
|
393: class <- "NA"
|
395: return(c(biggestProb=x[largest], nextProb=nextProb, assignedClass=class))
|
466: if(class(sampleLabels) != "factor") {
|
480: if(class(sampleLabels) != "factor") { warning("The argument 'sampleLabels' had to be converted into a factor...(27 bytes skipped)...
|
599: if(class(sampleLabels) != "factor") { warning("The argument 'sampleLabels' had to be converted into a factor...(27 bytes skipped)...
|
638: if(class(sampleLabels) != "factor") { warning("The argument 'sampleLabels' had to be converted into a factor...(4 bytes skipped)...
|
671: # Default class colors for boxplot
|
719: warning(paste("Some class names are longer than 10 characters. The following labels will be used in plots:\n",paste(classLabels, names(classLabels), sep=": ", collapse="\n"), sep=""))
|
746: geneTitles <- matrix(ncol=3, dimnames=list(genesVector,c("class","label","labelShort")),nrow=length(genesVector))
|
749: # Class
|
752: # Gene class, from genes table
|
753: geneTitles[g,"class"] <- unique(colnames(genes)[which(genes == g,arr.ind=TRUE)[,2]])
|
754: if(nchar(geneTitles[g,"class"])>10) geneTitles[g,"class"] <- paste(geneTitles[g,"class"], " (C",which(classes==geneTitles[g,"class"]), ")", sep="")
|
757: geneTitles[g,"class"]<-""
|
799: title(paste(geneTitles[genesVector[i],"class"], geneTitles[genesVector[i],"label"], sep="\n" ))
|
811: if (any(nchar(classes)>10) ) {graphics::text(prevLim+((j-prevLim)/2), ylim[2]-(ylim[2]*0.04), labels=classLabels[sampleLabels[j]]) # Class title
|
812: ...(52 bytes skipped)...evLim+((j-prevLim)/2)+0.5, y=ylim[2]-(ylim[2]*0.04), labels=paste(sampleLabels[j],sep=""), pos=3) # Class title
|
845: title(paste(geneTitles[gen,"class"], geneTitles[gen,"label"], sep="\n" ))
|
926: if(any(class(classificationGenes) == "GenesRanking"))
|
988: warning(paste("The number of classes provided don't match the classifier's. The default class names will be used instead.",sep=""), immediate. = TRUE) }
|
1002: if(!is.matrix(classificationGenes)) { #if(verbose) warning("The 'classification genes' are not sorted by colums and classes, the gene class will not be shown .")
|
1010: classificationGenes <- classificationGenes[,apply(classificationGenes, 2, function(x) !all(is.na(x)))] # Is there any class without genes?
|
1259: warning(paste("Plotting up to ", max(numGenes(genesRanking)), " genes of each class.", sep=""))
|
1272: if(!class(genesNetwork) == "GenesNetwork") stop("genesNetwork should be either a list or a GenesNetwork.")
|
1273: if((sum(c("class1", "class2") %in% colnames(genesNetwork@edges)) == 2 ) && nrow(genesNetwork@edges)>0)
|
1275: nwClasses <- unique(as.vector(genesNetwork@edges[,c("class1", "class2")]))
|
1291: if(any(class(classificationGenes) == "GenesRanking") && all(numGenes(classificationGenes) == 0)) classificationGenes <- NULL
|
1298: if(class(genesRanking) != "GenesRanking") stop("genesRanking should be an object of type GenesRanking.")
|
1305: if(class(classificationGenes)[1] != "GenesRanking") stop("classificationGenes should be an object of type GenesRanking (the classificationGenes object returned by the classifier).")
|
1345: if(any(! names(genesNetwork) %in% names(genesInfo))) { stop("The class names in genesInfo and genesNetwork do not match.")
|
1481: # For each class...
|
4: # clasificador (in file: classifier.main.r)
|
7: # externalValidation.probMatrix
|
24: # classifier:
|
30: # WARNING!: The arrays should have been normalized with the samples used for the classifier training.
|
36: if(is(classifier, "GeNetClassifierReturn")){
|
37: if("classifier" %in% names(classifier)) { classifier <- classifier@classifier$SVMclassifier
|
38: }else stop("'classifier' doesn't contain a trained classifier.")
|
40: if(!is(classifier, "svm")) classifier <- classifier$SVMclassifier
|
41: if(!is(classifier, "svm")) stop("The first argument should be the classifier returned by geNetClassifier.")
|
45: if(minProbAssignCoeff<0 || ((numClasses != 2) &&(minProbAssignCoeff>(numClasses/2)))) stop("'minProbAssignCoeff' should be between 0 and half of the number of classes.")
|
46: if(minDiffAssignCoeff<0 || minDiffAssignCoeff>numClasses) stop("'minDiffAssignCoeff' should be between 0 and the number of classes.")
|
47: genes <- colnames(classifier$SV)
|
59: rand <- 1/length(classifier$levels)
|
60: if(length(classifier$levels)>2) { minProb <- 2*rand * minProbAssignCoeff
|
63: ...(147 bytes skipped)..., "(default)",""),".\n Minimum difference between the probabilities of first and second most likely classes = ", round(minDiff,2),ifelse(minDiffAssignCoeff==1, "(default)",""), sep="")) ; utils::flush.co...(8 bytes skipped)...
|
68: prob <- t(attributes(stats::predict(classifier, esetSelection, probability=TRUE ))$probabilities)
|
69: if(is.null(names(prob))) colnames(prob)<-rownames(esetTdf) # if 2 classes... not labeled. Needed for mxcf...
|
83: externalValidation.stats <- function(confussionMatrix, numDecimals=2) #Confussion matrix
|
85: mxcf <- confussionMatrix
|
98: if(any(classes=="NotAssigned")) classes <- classes[-which(classes=="NotAssigned")]
|
103: if (any(!classes %in% colnames(mxcf)))
|
111: if (any(!classes %in% rownames(mxcf)))
|
113: missingClasses <- classes[which(!classes %in% rownames(mxcf))]
|
120: #Just in case they are not in order (Diagonal=hits). Will use only the real classes.
|
121: mxcf<- mxcf[,c(classes,"NotAssigned")] ...(22 bytes skipped)...
|
122: mxcf<- mxcf[c(classes),]
|
134: rownames(byClass)<- classes
|
135: colnames(byClass)<-c("Sensitivity","Specificity", "MCC", "CallRate")
|
159: byClass[i,1] <- round(100*(truePositives[i]/(truePositives[i]+falseNegatives[i])) ,numDecimals)
|
161: byClass[i,2] <- round(100*(trueNegatives[i]/(trueNegatives[i]+falsePositives[i])) ,numDecimals)
|
163: byClass[i,3] <- round(100*( ((truePositives[i]*trueNegatives[i])-(falsePositives[i]*falseNegatives[i])) / ...(175 bytes skipped)...
|
165: if(i <= dim(mxcf)[1]) byClass[i,4] <- round(100*( (sum(mxcf[i,])- mxcf[i,dim(mxcf)[2]])/sum(mxcf[i,])) ,numDecimals)
|
171: return( list(byClass=byClass, global=global, confMatrix=mxcf) )
|
210: rownames(probMatrix)<- levels(realLabels)
|
211: colnames(probMatrix)<- predClasses
|
216: assignedSamples <- names(classAssignments)[ which( classAssignments!= "NotAssigned")]
|
219: if(length(assignedSamples)>1) probMatrix...(8 bytes skipped)... <- apply(globalQueryResult$probabilities[,assignedSamples], 1, function(x) {mean(x)})[colnames(probMatrix)]
|
220: else probMatrix[label,] <- globalQueryResult$probabilities[,assignedSamples][colnames(probMatrix)]
|
224: ret<- round(probMatrix,numDecimals)
|
253: rownames(stats)<-c(classes)
|
295: notAssignedSamples <- cbind(highestProbClass=highestProbClass, as.data.frame(highestProb), nextProb=nextProb, nextClass=nextClass)
|
339: if(!is.numeric(totalNumberOfClasses) || (totalNumberOfClasses<length(levels(realLabels)))) stop ("totalNumberOfClasses should be the number of classes for which the classifier was originaly trained.")
|
343: if(minProbAssignCoeff<0 || ((numClasses != 2) &&(minProbAssignCoeff>(numClasses/2)))) stop("'minProbAssignCoeff' should be between 0 and half of the number of classes.")
|
344: if(minDiffAssignCoeff<0 || minDiffAssignCoeff>numClasses) stop("'minDiffAssignCoeff' should be between 0 and the number of classes.")
|
397: rownames(prob) <- c("biggestProb", "nextProb", "assignedClass")
|
400: correct <- which(prob["assignedClass",] == prob["realLabels",])
|
401: incorrect <- which(prob["assignedClass",] != prob["realLabels",])
|
467: #warning("The argument 'classification sampleLabels' had to be converted into a factor.", immediate. = TRUE)
|
533: numClasses <- ncol(postProb) # If there are only 2 classes, postProb only has 1 column
|
575: ...(55 bytes skipped)...leName=NULL, geneLabels=NULL, type="lines", sampleLabels=NULL, sampleColors=NULL, labelsOrder=NULL, classColors=NULL, sameScale=TRUE, showSampleNames=FALSE, showMean= FALSE, identify=TRUE, verbose=TRUE)
|
610: if(is(exprMatrix, "ExpressionSet")) exprMatrix <- exprs(exprMatrix) else if (!is.matrix(exprMatrix)) stop("The first argument should be an expression matrix or an ExpressionSet.")
|
615: genes <- rownames(exprMatrix)
|
618: if(is(genes, "GeNetClassifierReturn") && "classificationGenes" %in% names(genes)) {
|
619: genes <- genes@classificationGenes
|
620: warning("Plotting expression profiles of the classification genes. To plot other genes, set i.e. genes=...@genesRanking")
|
629: if(sum(!genes[which(genes!="NA")] %in% rownames(exprMatrix))!=0) stop ("The expression matrix doesn't contain all the genes.")
|
632: if(!is.null(geneLabels)) geneLabels<-extractGeneLabels(geneLabels, rownames(exprMatrix[genesVector,]))
|
635: numSamples <- dim(exprMatrix)[2]
|
643: if(sum(!names(sampleLabels) %in% colnames(exprMatrix))>0 ) stop("The names of the labels do not match the samples.")
|
646: names(sampleLabels)<-colnames(exprMatrix)
|
659: if(!is.null(sampleColors) && !is.null(classColors)) stop("Provide either 'sampleColors' or 'classColors'")
|
662: if(is.null(classColors))
|
672: if(is.null(classColors))
|
674: if(!is.null(sampleLabels)) classColors <- rev(hcl(h=seq(0,360, length.out=length(levels(sampleLabels))+1))[1:length(levels(sampleLab...(7 bytes skipped)...
|
675: if(is.null(sampleLabels)) classColors <- "white"
|
680: if(is.null(sampleLabels)) stop("Cannot use 'classColors' if 'sampleLabels' is not provided.")
|
681: if(length(levels(sampleLabels)) != length(classColors))stop("Length of 'classColors' should match the number of classes in the samples.")
|
683: if(any(type%in%"lines")) sampleColors <- classColors[sampleLabels]
|
696: if(!is.null(labelsOrder)) classes <- labelsOrder
|
702: indexes <- c(indexes, which(sampleLabels==classes[i]))
|
704: matriz <- exprMatrix[genesVector, indexes, drop=FALSE]
|
709: classes <- colnames(genes)
|
710: numClasses <- length(classes)
|
711: matriz <- exprMatrix[genesVector,, drop=FALSE]
|
716: if(any(nchar(classes)>10))
|
796: } else { geneClass<-"" } #classes[which(genes == genesVector[i], arr.ind=TRUE)[2]]
|
810: ...(21 bytes skipped)... if(!is.na((sampleLabels[j] != sampleLabels[j+1]) ) ) abline(v=j+0.5, col="black") # Separate classes
|
816: graphics::lines(c(prevLim+1, j), c(classMean, classMean) , col="grey")
|
834: names(esetXclases) <- classLabels[names(esetXclases)] #paste("C", sapply(names(esetXclases),function(x) which(classes==x)), sep="")
|
844: ...(12 bytes skipped)... boxplot(Expression~sampleLabel, esetExprSamplesMelted, ylim=ylim, ylab="Expression values", col=classColors, las=2, outpch=16, outcex=0.5)
|
879: # discriminant.power.plot(classifier, classificationGenes, classNames=c("ALL","AML","CLL","CML","NoLeu"), fileName="test.pdf",correctedAlpha=TRUE)
|
880: # discriminant.power.plot(classifier, classificationGenes, fileName="test.pdf")
|
881: # Classification genes: Genes por columnas (nombrecolumna= clase)
|
882: # discriminant.power.plot(classifier, colnames(classif$SV), fileName="test.pdf")
|
888: # classifier: puede ser un svm o el objeto devuelto por la funcion principal
|
889: # classificationGenes: puede ser un c(), una matriz o un GenesRanking
|
891: plotDiscriminantPower <- function(classifier, classificationGenes=NULL , geneLabels=NULL, classNames=NULL, plotDP = TRUE, fileName= NULL, returnTable=FALSE, verbose=TRUE)
|
904: # Classifier
|
905: if(is(classifier, "GeNetClassifierReturn")){
|
906: if("classificationGenes" %in% names(classifier))
|
908: if(is.null(classificationGenes))
|
910: classificationGenes <- classifier@classificationGenes
|
912: if(is.null(geneLabels) && is.character(classificationGenes))
|
914: if(length(classifier@classificationGenes@geneLabels) > 0 && any(!is.na(classifier@classificationGenes@geneLabels[classificationGenes])))
|
915: geneLabels <- classifier@classificationGenes@geneLabels[classificationGenes]
|
919: if("classifier" %in% names(classifier)) {classifier <- classifier@classifier$SVMclassifier
|
920: }else stop("'classifier' doesn't contain a trained classifier.")
|
922: if(is.list(classifier) && ("SVMclassifier" %in% names(classifier))) classifier <- classifier$SVMclassifier
|
923: if(!is(classifier,"svm")) stop("The first argument should be a svm classifier or the object returned by geNetClassifier.")
|
925: # ClassificationGenes (GenesRanking)
|
928: if(sum(numGenes(classificationGenes)))
|
930: if(is.null(geneLabels) && (length(classificationGenes@geneLabels) > 0 && any(!is.na(classificationGenes@geneLabels)))) geneLabels <- classificationGenes@geneLabels
|
932: classificationGenes <- getRanking(classificationGenes, showGeneLabels=FALSE, showGeneID=TRUE)$geneID
|
934: classificationGenes <- NULL
|
935: classificationGenesRanking<-NULL
|
938: classificationGenesRanking<-NULL
|
941: # If classificationGenes is not provided/valid, use the classifier's SV
|
942: missingGenes <- !as.vector(classificationGenes[!is.na(classificationGenes)]) %in% colnames(classifier$SV)
|
945: missingGenes <- as.vector(classificationGenes[!is.na(classificationGenes)])[which(missingGenes)]
|
951: missingGenes <- missingGenes[which(!missingGenes %in% colnames(classifier$SV))]
|
953: classificationGenes[which(classificationGenes %in% missingGenes)] <- NA
|
955: if(all(is.na(classificationGenes))) stop("The given 'classificationGenes' are not used by the classifier. Their Discriminant Power cannot be calculated.")
|
956: if(length(missingGenes)>0) warning(paste("The following classificationGenes are not used by the classifier. Their Discriminant Power cannot be calculated: ", missingGenes, sep=""))
|
958: if(is.null(classificationGenes)) classificationGenes <- colnames(classifier$SV)
|
981: ...(35 bytes skipped)...ull(names(geneLabels))) stop("names(geneLabels) can't be empty. It should contain the names used in classification genes.")
|
982: #if(!is.null(geneLabels) && sum(!names(geneLabels) %in% classificationGenes[which(classificationGenes!="NA")] )>0) warning("Some geneLabels will not be used.")
|
983: if(!is.null(geneLabels) && sum(!classificationGenes[which(class...(9 bytes skipped)...Genes!="NA")] %in% names(geneLabels))>0) warning("geneLabels doesn't contain the symbol for all the classification genes.")
|
985: # classNames
|
986: if(is.null(classNames) || (length(classifier$levels) != length(classNames))){
|
987: if (!is.null(classNames) && length(classifier$levels) != length(classNames)) {
|
989: classNames <-classifier$levels
|
994: for( i in 1:length(classNames)) #Add "C1:..."
|
996: if (nchar(classNames[i])>10 ) classNames[i] <- paste(substr(classNames[i] ,1,10), "...",sep="")
|
997: classNames[i] <- paste("C", i, ": ", classNames[i], sep="")
|
1005: if(length(classifier$levels) == 2) {
|
1006: if (dim(classificationGenes)[2] != 1) stop("The classes of the classifier and the classification genes provided don't match.")
|
1008: if(sum(!colnames(classificationGenes) %in% classifier$levels)>0) stop("The classes of the classifier provided and the classification genes don't match.")
|
1013: nGenes <- length(classificationGenes[which(!is.na(classificationGenes))]) #sum(numGenes(classifier$classificationGenes))
|
1014: if(nGenes>dim(classifier$SV)[2]){ warning(paste("The given number of genes is bigger than the classifier's.",sep=""), immediate. = TRUE)}
|
1021: if(is.matrix(classificationGenes)) # If it contains the genes by classes (columns)
|
1023: for(cl in 1:dim(classificationGenes)[2])
|
1025: discrPwList <- c(discrPwList, discrPwList=list(sapply(as.character(classificationGenes[which(classificationGenes[,cl]!="NA"),cl]), function(x) SV.dif(classifier, x, correctedAlpha=correctedAlpha))))
|
1026: names(discrPwList)[cl] <- colnames(classificationGenes)[cl]
|
1030: classificationGenes <- classificationGenes[which(!is.na(classificationGenes))]
|
1031: discrPwList <- list(sapply(as.character(classificationGenes), function(x) SV.dif(classifier, x, correctedAlpha=correctedAlpha)))
|
1032: classificationGenes <- as.matrix(classificationGenes)
|
1042: numRows <- numGenesPlot/dim(classificationGenes)[2]
|
1043: while ((numRows < dim(classificationGenes)[1]) && (length(classificationGenes[which(!is.na(classificationGenes[1:numRows,, drop=FALSE]))]) < numGenesPlot))
|
1048: if(length(classificationGenes[which(!is.na(classificationGenes[1:numRows,, drop=FALSE]))]) <= numGenesPlot)
|
1050: classificationGenes <- classificationGenes[1:numRows,, drop=FALSE]
|
1052: classificationGenes <- classificationGenes[1:(numRows-1),, drop=FALSE]
|
1068: mycols <- colorRampPalette(c("blue","white"))(max(classifier$nSV+2))
|
1070: for(c in 1:dim(classificationGenes)[2]) #numClasses
|
1072: for(g in 1:dim(classificationGenes)[1])
|
1075: gene <- classificationGenes[g,c]
|
1087: geneClass <- names(gene)
|
1088: if(nchar(geneClass)>70) geneClass<- substr(geneClass,1,70)
|
1101: tit<- paste(geneClass,"\n", geneName, "\n", sep="")
|
1104: ...(31 bytes skipped)...(tit, abs(round(discrPwList[[c]][,gene]$discriminantPower,2)), " (", discrPwList[[c]][,gene]$discrPwClass, ")", sep="")
|
1125: ...(0 bytes skipped)... barplot(pos,add=TRUE, col=mycols, width=0.9, space=0.1, names.arg=rep("",length(classNames)))
|
1126: ...(0 bytes skipped)... barplot(neg,add=TRUE, col=mycols, width=0.9, space=0.1, names.arg=rep("",length(classNames)))
|
1128: if(!correctedAlpha) graphics::text(seq(1, length(classNames), by=1)-0.5, par("usr")[3] - 0.2, labels = classNames, srt = 90, pos = 4, xpd = TRUE)
|
1129: if(correctedAlpha) graphics::text(seq(1, length(classNames), by=1)-0.5, par("usr")[3], labels = classNames, srt = 90, pos = 4, xpd = TRUE)
|
1148: discrPwDF<- rbind(discrPwDF, cbind(t(discrPwList[[cl]][c("discriminantPower","discrPwClass"),]), originalClass=rep(names(discrPwList)[cl],dim(discrPwList[[cl]])[2])))
|
1153: discrPwDF[,"discrPwClass"] <- as.character(discrPwDF[,"discrPwClass"])
|
1157: tempDpMatrix[,"discriminantPower"] <- abs (tempDpMatrix[,"discriminantPower"] )
|
1159: for(cl in classifier$levels)
|
1161: clGenes <- which(tempDpMatrix[,"discrPwClass"]==cl)
|
1162: discrPwDF <- rbind(discrPwDF, tempDpMatrix[clGenes[order(as.numeric(tempDpMatrix[clGenes,"discriminantPower"]),decreasing=TRUE)],])
|
1166: if(is.null(classificationGenesRanking))
|
1171: gDetails<-genesDetails(classificationGenesRanking)
|
1177: genesDetailsDF <- cbind(discrPwClass=rep(NA,dim(discrPwDF)[1]), discriminantPower=rep(NA,dim(discrPwDF)[1]), genesDetailsDF[rownames(dis...(39 bytes skipped)...
|
1178: genesDetailsDF[,"discrPwClass"] <- as.character(discrPwDF[,"discrPwClass"])
|
1187: # plotType="dynamic" (each can be modified), plotType="static" (1 image divided into classes), plotType="pdf"
|
1189: # genesInfo: Data.frame containing info about the genes. Can be replaced by classificationGenes or genesRanking (recommended).
|
1190: # If classificationGenes + genesRanking:
|
1191: # classificationGenes: Tiene q ser un genesRanking
|
1193: plotNetwork <- function(genesNetwork, class...(96 bytes skipped)...tType="dynamic", fileName=NULL, plotAllNodesNetwork=TRUE, plotOnlyConnectedNodesNetwork=FALSE, plotClassifcationGenesNetwork=FALSE, labelSize=0.5, vertexSize=NULL, width=NULL, height=NULL, verbose=TRUE)
|
1254: if(is.null(classificationGenes) && ("classificationGenes" %in% names(genesNetwork))) classificationGenes <- genesNetwork@classificationGenes
|
1257: nGenes <- max( 100, numGenes(genesNetwork@classificationGenes))
|
1277: }else nwClasses <- "geneClass"
|
1289: # Check classificationGenes and Genes ranking format and EXTRACT its genes INFO.
|
1290: if(is.matrix(classificationGenes) && nrow(classificationGenes)==0) classificationGenes <- NULL
|
1292: if(plotClassifcationGenesNetwork && is.null(classificationGenes)) warning("The classifcation genes network can only be plotted if the classification genes are provided.")
|
1293: if((!is.null(class...(30 bytes skipped)...nesRanking)) && !is.null(genesInfo)) stop("Please, provide either 'genesInfo' OR a genesRanking and classificationGenes.")
|
1294: if(!is.null(genesRanking) || !is.null(classificationGenes))
|
1303: if(!is.null(classificationGenes))
|
1308: clGenes <- lapply(classificationGenesInfo, rownames)
|
1310: if(showWarning) warning("Not all the classificationGenes are available in the genesNetwork. They will be represented, but there may be missing...(29 bytes skipped)...
|
1314: genesInfo <- classificationGenesInfo
|
1317: missingColumnsInGlobal <- colnames(classificationGenesInfo[[1]])[which(!colnames(classificationGenesInfo[[1]]) %in% colnames(genesInfo[[1]]))]
|
1328: ...(30 bytes skipped)... if((is.factor(temp[,tempCol]))) levels(temp[,tempCol]) <- unique(c(levels(temp[,tempCol]), levels(classificationGenesInfo[[cl]][,tempCol])))
|
1331: temp[rownames(classificationGenesInfo[[cl]]), ] <- classificationGenesInfo[[cl]][,colnames(temp)]
|
1364: ...(143 bytes skipped)...lot, but there may be missing relationships.") # showWarning: The warning was already shown for the classification genes.
|
1383: names(classGeneLabels) <- rownames(genesInfoList[[cl]])[availableNames]
|
1384: geneLabels <- c(geneLabels, classGeneLabels)
|
1396: missingGenes <- classGenes[which(!classGenes %in% rownames(genesInfoList[[cl]]))]
|
1408: # - Add classification nodes Network
|
1411: # Extract CLASSIFICATIONgenesNetwork if available/needed & add to list
|
1414: if(!is.null(classificationGenes) && plotClassifcationGenesNetwork)
|
1416: classificationGenesID <- getRanking(classificationGenes, showGeneLabels=FALSE, showGeneID=TRUE)$geneID[, nwClasses, drop=FALSE]
|
1417: classificationGenesNetwork <- getSubNetwork(genesNetwork, classificationGenesID)
|
1418: names(classificationGenesNetwork) <- paste(names(classificationGenesNetwork), " - Classification Genes",sep="")
|
1420: clToAdd <- which(sapply(genesNetwork, function(x){length(getNodes(x))}) - sapply(classificationGenesNetwork, function(x){length(getNodes(x))}) != 0)
|
1423: warning("Only the classification genes network was provided. Only 'AllNodesNetwork' will be plotted.")
|
1431: genesNetwork <- c(genesNetwork[1:pos], classificationGenesNetwork[clToAdd[i]], genesNetwork[-(1:pos)])
|
1433: genesInfoList <- c(genesInfoList[1:pos], list(genesInfoList[[i]][classificationGenesID[,clToAdd[i]][!is.na(classificationGenesID[,i])],] ), genesInfoList[-(1:pos)])
|
1434: names(genesInfoList)[pos+1] <- names(classificationGenesNetwork[clToAdd[i]])
|
1440: # (Needs to be added after classific. in order to add it right after the "full" network)
|
1474: if( numClasses>25 ) stop("Too many classes to draw in a single plot. Use 'pdf' instead.")
|
1485: classGenes <- unique(c(genesNetwork[[nw]]@edges[,"gene1"],genesNetwork[[nw]]@edges[,"gene2"]))
|
1487: if((is.null(genesInfoList) || nrow(genesInfoList[[nw]])==0 ) || any(!classGenes %in% rownames(genesInfoList[[nw]])))
|
1490: } else classGraph <- igraph::graph.data.frame(as.data.frame(genesNetwork[[nw]]@edges[,ntwColnames,drop=FALSE]), ...(15 bytes skipped)...
|
1493: classGraph <- igraph::graph.data.frame(as.data.frame(genesNetwork[[nw]]@edges[,ntwColnames,drop=FALSE]), ...(101 bytes skipped)...
|
1495: if (igraph::vcount(classGraph) != 0)
|
1501: graphLayout <- igraph::layout.fruchterman.reingold(classGraph) # .grid is faster, but the result looks far worse.
|
1509: vertexLabels <- igraph::get.vertex.attribute(classGraph,"name")
|
1515: if(!is.null(igraph::get.vertex.attribute(classGraph,"exprsMeanDiff")))
|
1517: exprsDiff <- as.numeric(igraph::get.vertex.attribute(classGraph,"exprsMeanDiff"))
|
1539: if(!is.null(igraph::get.vertex.attribute(classGraph,"discriminantPower")))
|
1541: discPower<-round(as.numeric(igraph::get.vertex.attribute(classGraph,"discriminantPower")))
|
1552: # Shape: Classification gene
|
1555: if(!is.null(igraph::get.vertex.attribute(classGraph,"discriminantPower")))
|
1560: if(!is.null(classificationGenes)) # alguna comprobacion mas?
|
1562: vertexShape[which(igraph::get.vertex.attribute(classGraph,"name")%in% as.vector(getRanking(classificationGenes, showGeneID=TRUE)$geneID))] <- "square"
|
1567: relColors <- ifelse( igraph::get.edge.attribute(classGraph,"relation")==levels(factor(igraph::get.edge.attribute(classGraph,"relation")))[1], relColors[1],relColors[2])
|
1571: if(igraph::ecount(classGraph) > 0)
|
1573: igraph::tkplot(classGraph, layout=graphLayout, vertex.label=vertexLabels, vertex.label.family="sans", vertex.color=vert...(178 bytes skipped)...
|
1583: plot(classGraph, layout=graphLayout, vertex.label=vertexLabels, vertex.label.family="sans", vertex.label.cex=...(219 bytes skipped)...
|
1586: graphList <- c(graphList, graph=list(classGraph))
|
1607: text(0,0.6,"Node shape: Chosen/Not chosen for classification", pos=4, font=2)
|
5: # queryGeNetClassifier
|
21: # queryGeNetClassifier:
|
106: mxcf <- cbind(mxcf, matrix(ncol=length(missingClasses), nrow=dim(mxcf)[1], data=0))
|
107: colnames(mxcf)[which(colnames(mxcf)=="")]<-missingClasses
|
114: mxcf <- rbind(mxcf, matrix(nrow=length(missingClasses), ncol=dim(mxcf)[2], data=0))
|
115: rownames(mxcf)[which(rownames(mxcf)=="")]<-missingClasses
|
129: #nclasses <- dim(mxcf)[1]
|
131: numNA <- sum(mxcf[,nclasses+1])
|
137: falseNegatives <- array(0,dim=nclasses)
|
138: falsePositives <- array(0,dim=nclasses)
|
139: trueNegatives <- array(0,dim=nclasses)
|
140: truePositives <- array(0,dim=nclasses)
|
144: for(j in 1:nclasses) #dim(mxcf)[2]) Para incluir NA
|
156: for (i in 1:nclasses) #We need another loop in order to have the whole trueNegatives ready
|
175: # Can receive the result from executing queryGeNetClassifier, or a list of several: queryResult<-c(assignment1, assignment2)
|
229: # Can receive the result from executing queryGeNetClassifier, or a list of several: queryResult<-c(prediction1, prediction2)
|
252: stats <- cbind(c(rep(0,numClasses)), c(rep(1,numClasses)), c(rep(0,numClasses)),c(rep(NA,numClasses)),c(rep(NA,numClasses)))
|
257: for (c in 1:numClasses)
|
321: ...(12 bytes skipped)...nts <- function(queryResult, realLabels, minProbAssignCoeff=1, minDiffAssignCoeff=0.8, totalNumberOfClasses=NULL, pointSize=0.8, identify=FALSE)
|
340: numClasses <- totalNumberOfClasses
|
357: rand <- 1/numClasses
|
358: if(numClasses>2) { minProb <- 2*rand * minProbAssignCoeff
|
364: if(numClasses>2)
|
377: if(numClasses>2) graphics::text(0.3, 0.95, labels="Not Assigned", col="#606362", cex=0.8)
|
513: colnames(meanExprDiff) <- gClasses(genesRanking)
|
526: if (length(gClasses(genesRanking)) > 2){ ord <- genesRanking@ord[1:numGenesPlot,]
|
535: if((numClasses>3 && numClasses<10) && ("RColorBrewer" %in% rownames(utils::installed.packages())))
|
537: cols <- RColorBrewer::brewer.pal(numClasses,"Set1")
|
538: }else cols <- grDevices::rainbow(numClasses)
|
547: for(i in 1:numClasses)
|
555: legend("bottomleft", paste( gClasses(genesRanking)," (",lp," genes)",sep=""), lty=1, col=cols, pch=pchs)
|
700: for(i in 1:numClasses) #Por si no estan agrupados
|
731: if( numClasses == 0 || !is.matrix(genes) ) {
|
992: if(longClassNames)
|
1102: if(longClassNames){ tit<- paste(tit,"DP: ", sep="")
|
1105: barplot(rep(0,numClasses),add=FALSE, ylim=lims, main=tit, col=mycols, width=0.9, space=0.1, cex.main=1)
|
1217: if(!is.logical(plotClassifcationGenesNetwork)) stop("plotClassifcationGenesNetwork should be either TRUE or FALSE.")
|
1248: if(!(returniGraphs || plotAllNodesNetwork || plotOnlyConnectedNodesNetwork || plotClassifcationGenesNetwork)) stop("No network plots have been requested.")
|
1249: if(!(plotAllNodesNetwork || plotOnlyConnectedNodesNetwork || plotClassifcationGenesNetwork)) warning("No network plots have been requested, only the iGraph will be return...(13 bytes skipped)...
|
1252: if(is(genesNetwork, "GeNetClassifierReturn"))
|
1264: }else stop("'genesNetwork' is the return of geNetClassifier, but doesn't contain a genesNetwork.")
|
1276: # if (nwClasses[1] == nwClasses[2]) nwClasses <- nwClasses[1]
|
1280: names(genesNetwork) <- nwClasses[1]
|
1320: for( cl in nwClasses)
|
1460: genesNetwork <- genesNetwork[-which(names(genesNetwork) %in% nwClasses)]
|
1475: cols <- ceiling(sqrt(numClasses))
|
1476: rows <- ifelse(sqrt(numClasses)<round(sqrt(numClasses)), ceiling(sqrt(numClasses)),round(sqrt(numClasses)))
|
discordant:R/discordant.R: [ ] |
---|
114: class <- cbind(.assignClass(v1, param1, components),
|
236: classMatrix <- discordPPMatrix
|
128: sub.class <- cbind(.assignClass(subSamples$v1, param1, components),
|
163: classVector <- finalResult$class
|
227: discordClass <- c(2,3,4,6,7,8)
|
235: discordPPMatrix <- matrix(NA, nrow = featureSize, ncol = featureSize)
|
269: .assignClass <- function(x, param, components) {
|
34: #' \item{discordPPMatrix}{Matrix of differentially correlated posterior
|
38: #' \item{classMatrix}{Matrix of classes that have hte highest posterior
|
40: #' \item{probMatrix}{Matrix of posterior probabilities where rows are each
|
54: #' The posterior probabilities for each class are generated and outputted into
|
56: #' class and each row is a feature pair. The values discordPPVector and
|
58: #' probability for each feature pair. The values classVector and classMatrix
|
59: #' are the class with the highest posterior probability for each feature pair.
|
131: pd <- tryCatch({em.normal.partial.concordant(sub.pdata, sub.class,
|
160: finalResult <- .subSampleData(pdata, class, mu, sigma, nu, tau, pi,
|
165: pd <- tryCatch({em.normal.partial.concordant(pdata, class, components)},
|
172: classVector <- pd$class
|
178: em.normal.partial.concordant <- function(data, class, components) {
|
184: g <- as.integer(nlevels(as.factor(class)))
|
190: zx <- .unmap(class[,1], components = components)
|
191: zy <- .unmap(class[,2], components = components)
|
219: class = apply(array(results[[3]], dim = c(n,g*g)),
|
239: classMatrix[diag] <- classVector
|
241: colnames(classMatrix) <- rownames(x)
|
246: classMatrix <- matrix(classVector, nrow = featureSize, byrow = FALSE)
|
248: colnames(classMatrix) <- rownames(y)
|
253: rownames(classMatrix) <- rownames(x)
|
261: classMatrix = classMatrix, classVector = classVector,
|
266: # Internal function to assign class to vector based on number of components and
|
36: #' \item{classVector}{Vector of classes that have the highest posterior
|
41: #' molecular feature pair and columns are nine different classes}
|
48: #' are five components, then there are two more classes for very negative
|
50: #' combinations for these components are made into classes. If there are three
|
51: #' components, there are 9 classes. If there are five components, there are 25
|
52: #' classes.
|
55: #' the value probMatrix. The value probMatrix is a matrix where each column is a
|
57: #' discordPPMatrix are the summed differential correlation posterior
|
115: .assignClass(v2, param2, components))
|
129: .assignClass(subSamples$v2, param2, components))
|
175: rtn <- .prepareOutput(x, y, pd, zTable, classVector, components)
|
224: .prepareOutput <- function(x, y, pd, zTable, classVector, components) {
|
229: discordClass <- setdiff(1:25, c(1, 7, 13, 19, 25))
|
232: discordPPV <- apply(zTable, 1, function(x) sum(x[discordClass]) / sum(x))
|
237: diag <- lower.tri(discordPPMatrix, diag = FALSE)
|
238: discordPPMatrix[diag] <- discordPPV
|
240: colnames(discordPPMatrix) <- rownames(x)
|
244: discordPPMatrix <- matrix(discordPPV, nrow = featureSize,
|
247: colnames(discordPPMatrix) <- rownames(y)
|
252: rownames(discordPPMatrix) <- rownames(x)
|
255: names(classVector) <- vector_names
|
260: return(list(discordPPMatrix = discordPPMatrix, discordPPVector = discordPPV,
|
262: probMatrix = zTable, loglik = pd$loglik))
|
HiCBricks:R/Brick_functions.R: [ ] |
---|
2168: Matrix <- Brick_get_matrix(Brick = Brick, chr1 = chr1, chr2 = chr2,
|
2255: Matrix <- Brick_get_vector_values(Brick = Brick, chr1=chr1, chr2=chr2,
|
554: Matrix_info <- return_configuration_matrix_info(Brick)
|
776: Matrix.list.df <- do.call(rbind,chr1.list)
|
1613: Matrix.list <- Brick_list_matrices(Brick = Brick, chr1 = chr1,
|
1657: Matrix.list <- Brick_list_matrices(Brick = Brick, chr1 = chr1, chr2 = chr2,
|
1713: Matrix.list <- Brick_list_matrices(Brick = Brick, chr1 = chr1, chr2 = chr2,
|
1803: Matrix.list <- Brick_list_matrices(Brick = Brick, chr1 = chr1, chr2 = chr2,
|
1898: Matrix.list <- Brick_list_matrices(Brick = Brick, chr1 = chr1, chr2 = chr2,
|
2364: Class.type <- ._Check_numeric
|
2365: Class.exp <- c("numeric","integer")
|
10: #' project. At the end, this function will return a S4 object of class
|
74: #' A value of length 1 of class character or numeric specifying the resolution
|
138: #' the function will return an object of class BrickContainer.
|
555: current_resolution <- vapply(Matrix_info, function(a_list){
|
561: chrom1_binned_length <- vapply(Matrix_info[current_resolution],
|
565: chrom1s <- vapply(Matrix_info[current_resolution],
|
569: chrom1_max_sizes <- vapply(Matrix_info[current_resolution],
|
646: #' An object of class ranges specifying the ranges to store in the Brick.
|
652: #' When an object of class BrickContainer is provided, resolution defines the
|
661: #' When an object of class BrickContainer is provided, num_cpus defines the
|
692: if(!(class(ranges) %in% "GRanges") | ("list" %in% class(ranges))){
|
693: stop("Object of class Ranges expected")
|
777: rownames(Matrix.list.df) <- NULL
|
778: return(Matrix.list.df)
|
954: BrickContainer_class_check(Brick)
|
1127: #' Indexes is a column of class \code{IRanges::IntegerList}, which is
|
1169: stop("Provided chr, start, end do not match expected class ",
|
1314: #' Matrix_file <- system.file(file.path("extdata",
|
1319: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
1326: BrickContainer_class_check(Brick)
|
1367: Matrix.file = matrix_file, delim = delim, Group.path = Group.path,
|
1411: #' Matrix_file <- system.file(file.path("extdata",
|
1416: #' chr = "chr2L", resolution = 100000, matrix_file = Matrix_file,
|
1462: Matrix.file = matrix_file, delim = delim, Group.path = Group.path,
|
1596: #' Matrix_file <- system.file(file.path("extdata",
|
1601: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
1615: return(Matrix.list[Matrix.list$chr1 == chr1 &
|
1616: Matrix.list$chr2 == chr2, "done"])
|
1640: #' Matrix_file <- system.file(file.path("extdata",
|
1645: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
1659: return(Matrix.list[Matrix.list$chr1 == chr1 &
|
1660: Matrix.list$chr2 == chr2, "sparsity"])
|
1692: #' Matrix_file <- system.file(file.path("extdata",
|
1697: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
1715: return((Matrix.list[Matrix.list$chr1 == chr1 &
|
1716: Matrix.list$chr2 == chr2, "distance"]))
|
1747: #' Matrix_file <- system.file(file.path("extdata",
|
1752: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
1786: #' Matrix_file <- system.file(file.path("extdata",
|
1791: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
1805: Filter <- Matrix.list$chr1 == chr1 & Matrix.list$chr2 == chr2
|
1806: Extent <- c(Matrix.list[Filter, "min"],Matrix.list[Filter, "max"])
|
1832: #' Matrix_file <- system.file(file.path("extdata",
|
1837: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
1881: #' Matrix_file <- system.file(file.path("extdata",
|
1886: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
1900: Filter <- Matrix.list$chr1 == chr1 & Matrix.list$chr2 == chr2
|
1901: Extent <- Matrix.list[Filter, "filename"]
|
1947: #' Matrix_file <- system.file(file.path("extdata",
|
1952: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
2098: #' Matrix_file <- system.file(file.path("extdata",
|
2103: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
2136: " found x_coords class ", class(x_coords), " and y_coords class ",
|
2137: class(y_coords))
|
2154: stop(chr1," ",chr2," matrix is yet to be loaded into the class.")
|
2171: return(Matrix)
|
2211: #' Matrix_file <- system.file(file.path("extdata",
|
2216: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
2245: stop(chr1,chr2," matrix is yet to be loaded into the class.\n")
|
2258: return(Matrix)
|
2260: return(FUN(Matrix))
|
2320: #' Matrix_file <- system.file(file.path("extdata",
|
2325: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
2357: stop("Provided Chromosomes does not appear to be of class character")
|
2368: Class.type <- is.character
|
2369: Class.exp <- "character"
|
2371: if(!Class.type(vector)){
|
2372: stop("vector must be of class ",
|
2373: ifelse(length(Class.exp)>1,paste(Class.exp,collapse=" or "),
|
2374: paste(Class.exp))," when by has value ",by)
|
2477: #' Matrix_file <- system.file(file.path("extdata",
|
2482: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
2501: stop("Provided Chromosomes does not appear to be of class character")
|
2539: #' chromosome pair provided an object of class BrickContainer, and values for
|
2546: #' @return Returns an object of class matrix with dimensions corresponding to
|
2563: #' Matrix_file <- system.file(file.path("extdata",
|
2568: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
2579: stop("Provided Chromosomes does not appear to be of class character")
|
2636: #' Matrix_file <- system.file(file.path("extdata",
|
2641: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
2653: BrickContainer_class_check(Brick)
|
2659: stop("Matrix for this chromsome pair does not exist.\n")
|
2663: stop("Matrix for this chromsome pair is yet to be loaded.\n")
|
2716: #' `Brick_export_to_sparse` will accept as input an object of class
|
2746: #' Matrix_file <- system.file(file.path("extdata",
|
2751: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
2833: #' Matrix_file <- system.file(file.path("extdata",
|
2838: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
2847: BrickContainer_class_check(Brick)
|
2900: #' Matrix_file <- system.file(file.path("extdata",
|
2905: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ",
|
2921: BrickContainer_class_check(Brick)
|
173: Reference.object <- GenomicMatrix$new()
|
330: Reference.object <- GenomicMatrix$new()
|
426: Reference.object <- GenomicMatrix$new()
|
468: Reference.object <- GenomicMatrix$new()
|
549: Reference.object <- GenomicMatrix$new()
|
617: Reference.object <- GenomicMatrix$new()
|
691: Reference.object <- GenomicMatrix$new()
|
756: Reference.object <- GenomicMatrix$new()
|
810: Reference.object <- GenomicMatrix$new()
|
892: Reference.object <- GenomicMatrix$new()
|
953: Reference.object <- GenomicMatrix$new()
|
1086: Reference.object <- GenomicMatrix$new()
|
1325: Reference.object <- GenomicMatrix$new()
|
1366: RetVar <- ._ProcessMatrix_(Brick = Brick_filepath,
|
1423: Reference.object <- GenomicMatrix$new()
|
1535: Reference.object <- GenomicMatrix$new()
|
1608: Reference.object <- GenomicMatrix$new()
|
1652: Reference.object <- GenomicMatrix$new()
|
1704: Reference.object <- GenomicMatrix$new()
|
1798: Reference.object <- GenomicMatrix$new()
|
1848: Reference.object <- GenomicMatrix$new()
|
1893: Reference.object <- GenomicMatrix$new()
|
1977: Reference.object <- GenomicMatrix$new()
|
2494: Reference.object <- GenomicMatrix$new()
|
2575: Reference_object <- GenomicMatrix$new()
|
2651: Reference.object <- GenomicMatrix$new()
|
2707: Reference.object <- GenomicMatrix$new()
|
2760: Reference.object <- GenomicMatrix$new()
|
2920: Reference.object <- GenomicMatrix$new()
|
CancerSubtypes:R/internal.R: [ ] |
---|
427: class <- unique(x)
|
169: affinityMatrix <- function(Diff,K=20,sigma=0.5) {
|
406: classx <- unique(x)
|
407: classy <- unique(y)
|
105: .distanceWeighted2<-function(X,weight) ##X is the expression Matrix(Row is sample, column is feature)
|
155: #' This is the affinity Matrix function extracted from SNFtool package.
|
429: nc <- length(class)
|
433: prob[i] <- sum(x == class[i])/nx
|
653: ## Generalized Inverse of a Matrix
|
12: #' #W1 = affinityMatrix(Dist1, 20, 0.5)
|
163: #' W1 = affinityMatrix(Dist1, 20, 0.5)
|
196: ###You can do various applications on this graph, such as clustering(subtyping), classification, prediction.
|
409: ncx <- length(classx)
|
410: ncy <- length(classy)
|
415: probxy[i, j] <- sum((x == classx[i]) & (y == classy[j])) / nx
|
CHETAH:R/Utils_CHETAH.R: [ ] |
---|
877: class <- class(toplot[,1])
|
680: Classify <- function(input, thresh = 0.1, return_clas = FALSE) {
|
695: classification <- nodeDown(conf = conf, prof = prof, node = 1,
|
984: classification <- input$celltype_CHETAH
|
1143: ClassifyReference <- function(ref_cells, ref_ct = "celltypes",
|
1277: classification <- input$celltype_CHETAH
|
118: CHETAHclassifier <- function (input,
|
624: ## as.matrix: in cases were a sparse Matrix is used
|
880: if(class == "factor") {
|
888: if(class == "numeric" | class == 'integer') {
|
909: # Plot boxplots grouped by a class variable
|
910: PlotBox <- function(toplot, class, col = NULL, grad_col = NULL,
|
914: class <- data.frame(class, stringsAsFactors = TRUE)
|
915: col <- col[levels(class[,1])]
|
920: data <- cbind.data.frame(toplot, class)
|
921: colnames(data) <- c("score", "class")
|
924: plot <- ggplot(data, aes_string(x = 'class', y = 'score')) +
|
937: plot <- plot + geom_jitter(aes_string(color = 'class'), size = 0.1)
|
945: plot <- plot + geom_boxplot(aes_string(color = 'class'),
|
9: #' CHETAH classifies an input dataset by comparing it to
|
27: #' by \code{\link{Classify}})
|
60: #' @param plot.tree Plot the classification tree.
|
74: #' \item \strong{classification} a named vector: the classified types
|
76: #' \item \strong{tree} the hclust object of the classification tree
|
78: #' \item \strong{nodecoor} the coordinates of the nodes of the classification tree
|
93: #' to produce a classification tree (ct).
|
99: #' If this is not the case, classification for the cell will stop in the current node.
|
101: #' these classifications are called \strong{final types}
|
102: #' For other cells, assignment will stop in a node. These classifications
|
174: message("Running without reference cells: classification will only be based on correlations \n")
|
212: ## Make an environment to store the classification information and variables in
|
221: tree = NULL, # will be filled with the classification tree
|
246: ## For plotting purposes, find the x coordinates of the nodes of the classification tree
|
294: ## Add the (visible) classification meta-data
|
295: input <- Classify(input = input, thresh = thresh)
|
303: # of the current node of the classification tree,
|
312: ## (Re)construct the classification tree and cut at the highest node
|
653: #' (Re)classify after running \code{\link{CHETAHclassifier}} using a confidence threshold \cr
|
659: #' Selecting 0 will classify all cells, whereas 2 will result i
|
660: #' n (almost) no cells to be classified. \cr
|
662: #' @param return_clas Instead of returning the SingleCellExperiment, only return the classification vector
|
669: #' ## Classify all cells
|
670: #' input_mel <- Classify(input_mel, 0)
|
672: #' ## Classify only cells with a very high confidence
|
673: #' input_mel <- Classify(input_mel, 1)
|
676: #' input_mel <- Classify(input_mel)
|
678: #' ## Return only the classification vector
|
679: #' celltypes <- Classify(input_mel, 1, return_clas = TRUE)
|
697: names(classification) <- rownames(prof[[1]])
|
698: input$celltype_CHETAH <- classification
|
699: if (return_clas) return(classification) else return(input)
|
728: #' Plots the chetah classification tree with nodes numbered
|
739: #' A ggplot object of the classification tree
|
806: ggtitle("Classification Tree")
|
871: theme_classic() +
|
926: theme_classic() +
|
951: #' Plot the CHETAH classification on 2D visulization like t-SNE
|
952: #' + the corresponding classification tree,
|
958: #' @param tree plot the tree, along with the classification
|
959: #' @param pt.size the point-size of the classication plot
|
961: #' the classification plot should be returned
|
999: extra_nodes <- unique(classification)[!(unique(classification) %in% names(meta_data$nodetypes[[1]]))]
|
1025: toplot <- classification
|
1115: #' Use a reference dataset to classify itself.
|
1128: #' the columns the classifion labels.
|
1131: #' classified to the type of the column name.
|
1133: #' that is classified to an intermediate type
|
1135: #' A good reference would classify nearly 100% of cells of type A to type A.
|
1142: #' ClassifyReference(ref_cells = headneck_ref)
|
1146: ## Classify
|
1190: } ## ClassifyReference
|
1194: ## Do the classification of this node
|
1253: #' In the CHETAH classification, replace the name of a Node
|
1262: #' @param return_clas Instead of returning the SingleCellExperiment, only return the classification vector
|
1265: #' The SingleCellExperiment with the new classification or if `return_clas = TRUE` the classification vector.
|
1282: classification[classification == nodename] <- replacement
|
1295: classification[classification %in% replace] <- replacement
|
1296: input$celltype_CHETAH <- classification
|
1297: if (return_clas) return(classification) else return(input)
|
1304: #' Launch a web page to interactively go trough the classification
|
117: #' input_mel <- CHETAHclassifier(input = input_mel, ref_cells = headneck_ref)
|
299: } ### CHETAHclassifier
|
302: # Called by the CHETAHclassifier. Determines the branches
|
346: # Called by the CHETAHclassifier via SplitNode.
|
657: #' @param input a SingleCellExperiment on which \code{\link{CHETAHclassifier}} has been run
|
730: #' @param input a SingleCellExperiment on which \code{\link{CHETAHclassifier}} has been run
|
820: #' @param input a SingleCellExperiment on which \code{\link{CHETAHclassifier}} has been run
|
955: #' @param input a SingleCellExperiment on which \code{\link{CHETAHclassifier}} has been run
|
1045: #' \code{\link{CHETAHclassifier}}'s ref_cells
|
1047: #' \code{\link{CHETAHclassifier}}'s ref_profiles
|
1051: #' @param n_genes as in \code{\link{CHETAHclassifier}}
|
1052: #' @param fix_ngenes as in \code{\link{CHETAHclassifier}}
|
1053: #' @param print_steps as in \code{\link{CHETAHclassifier}}
|
1054: #' @param only_pos as in \code{\link{CHETAHclassifier}}
|
1120: #' \code{\link{CHETAHclassifier}}'s ref_cells
|
1125: #' \code{\link{CHETAHclassifier}}
|
1147: input <- CHETAHclassifier(input = ref_cells,
|
1256: #' @param input a SingleCellExperiment on which \code{\link{CHETAHclassifier}} has been run
|
1306: #' @param input a SingleCellExperiment on which \code{\link{CHETAHclassifier}} has been run
|
1342: if (is.null(input@int_metadata$CHETAH)) stop('Please run CHETAHclassifier on the SingleCellExperiment object before calling this funtion')
|
ISAnalytics:R/internal-functions.R: [ ] |
---|
134: rlang::warn(warn, class = "missing_crit_tags")
|
259: ), class = "missing_req_col_err")
|
290: ), class = "missing_req_col_err")
|
478: rlang::inform(warn_empty_iss, class = "warn_empty_iss")
|
587: class = "warn_empty_iss"
|
649: rlang::abort(error_msg(tags_names), class = "missing_tags_err")
|
758: rlang::abort(single_err, class = "tag_dupl_err")
|
823: rlang::abort(compact_msg, class = "tag_type_err")
|
1279: rlang::abort(add_types_err, class = "add_types_err")
|
1434: class = "xls_file"
|
1612: class = "na_concat"
|
1716: class = "filter_warn"
|
2078: class = "missing_path_col"
|
2542: rlang::inform(missing_msg, class = "auto_mode_miss")
|
2741: class = "coll_matrix_issues"
|
2807: rlang::abort(not_date_err, class = "not_date_coll_err")
|
4156: rlang::abort(err_msg, class = "genomic_file_char")
|
4246: rlang::warn(warn_miss, class = "warn_miss_genes")
|
4609: class = "missing_cols_key"
|
4659: rlang::inform(flag_msg, class = "flag_logic_long")
|
4991: rlang::abort(format_err, class = "outlier_format_err")
|
5012: rlang::abort(err_length, class = "pop_size_err_length")
|
4576: KnownGeneClass = ifelse(
|
1097: colClasses = col_types,
|
653: rlang::abort(error_msg(missing_tags), class = "missing_tags_err")
|
776: rlang::inform(single_warn, class = "tag_dupl_warn")
|
799: err <- c(paste("Wrong col class for tag '", sub_df$tag[1], "'"),
|
986: # @param x A data.frame object (or any extending class)
|
1005: # @param x A data.frame object (or any extending class)
|
1057: #---- USED IN : import_single_Vispa2Matrix ----
|
1276: "?import_single_Vispa2Matrix"
|
1291: class = "im_single_miss_mand_vars"
|
1313: class = "unsup_comp_format"
|
1389: class = "ism_import_summary"
|
2565: rlang::inform(dupl_msg, class = "auto_mode_dupl")
|
4628: class = "missing_cols_pool"
|
4682: class = "flag_logic_short"
|
4700: rlang::abort(unknown_logi_op_err, class = "unsupp_logi_op")
|
4994: rlang::abort(format_err, class = "outlier_format_err")
|
820: "Wrong column classes for some tags",
|
1131: col_types <- .mandatory_IS_types("classic")
|
1135: .annotation_IS_types("classic")
|
1297: mode <- "classic"
|
1308: ### If not, switch to classic for reading
|
1309: mode <- "classic"
|
scone:R/sconeReport.R: [ ] |
---|
837: Class = factor(strat_col())
|
113: # Matrix nodes in scone_res
|
310: "Row Class",
|
319: label = "Column Class",
|
840: ggplot(data.frame(Class,Val ),aes(x = Class,y = Val)) +
|
841: geom_violin(scale = "width", trim = TRUE, aes(fill = Class))+
|
888: Class = factor(strat_col())
|
891: ggplot(data.frame(Class,Val ),aes(x = Class,y = Val)) +
|
892: geom_violin(scale = "width", trim = TRUE, aes(fill = Class))+
|
944: colnames(datt) = c("Class-Bio","Class-Batch","Class-Pam")
|
101: ## ----- If NULL classifications, Replace with NA ------
|
745: text(0,labels = "Stratify plots by a multi-level classification.")
|
792: text(0,labels = "Stratify plots by a multi-level classification.")
|
820: text(0,labels = "Stratify plots by a multi-level classification.")
|
928: text(0,labels = "Stratify plots by a multi-level classification.")
|
singleCellTK:inst/shiny/server.R: [ ] |
---|
4123: shinyjs::addClass(id = "cv_button1", class = "btn-block")
|
5021: classes <- names(colData(hmTemp$sce))
|
6121: classCol <- colData(vals$counts)[[input$deC1Class]]
|
6122: classChoices <- sort(as.vector(unique(classCol)))
|
98: updateSelectInput(session, "deC1Class",
|
245: label = "Select Input Matrix:",
|
249: label = "Select Input Matrix:",
|
255: label = "Select Input Matrix:",
|
2710: shinyjs::show(selector = ".dimRedPCAICA_plotTabset_class")
|
4124: shinyjs::addClass(id = "cv_button2", class = "btn-block")
|
4125: shinyjs::addClass(id = "cv_button3", class = "btn-block")
|
4545: pltVars$class <- "factor"
|
4547: pltVars$class <- "numeric"
|
4600: conditionClass = pltVars$class, defaultTheme = as.logical(pltVars$defTheme))
|
4616: ...(28 bytes skipped)... legendSize = input$adjustlegendsize,legendTitleSize = input$adjustlegendtitlesize,conditionClass = pltVars$class)
|
5082: ...(7 bytes skipped)... p("Since more than 12 unique values detected, discrete colors will be assigned for this class")
|
5105: p(paste0("Totally ", nUniq, " unique values in this class of annotation, which is too many to provide manual selection. Coloring will be provided by default....(3 bytes skipped)...
|
5138: p("No effective category found for the class.")
|
5464: selectInput("batchCheckCorrName", "Corrected Matrix",
|
6120: !input$deC1Class == "None"){
|
6133: !input$deC1Class == "None"){
|
6134: classCol <- colData(vals$counts)[[input$deC1Class]]
|
6147: g1Idx <- colData(vals$counts)[[input$deC1Class]] %in% input$deC1G1
|
6161: g2Idx <- colData(vals$counts)[[input$deC1Class]] %in% input$deC1G2
|
6343: class = input$deC1Class,
|
9694: removeTab(inputId = "scanpyFindMarkerPlotTabset", target = "Matrix Plot")
|
9720: tabPanel(title = "Matrix Plot",
|
9721: panel(heading = "Matrix Plot",
|
3461: conditionClass = "factor",
|
3510: conditionClass = "factor",
|
5022: selectInput('hmCellAnn', 'Add cell annotation', classes,
|
5029: classes <- names(rowData(hmTemp$sce))
|
5030: selectInput('hmGeneAnn', 'Add feature annotation', classes,
|
5547: conditionClass = "character",
|
5555: conditionClass = "character",
|
6124: choices = classChoices, multiple = TRUE)
|
6135: classChoices <- sort(as.vector(unique(classCol)))
|
6137: choices = classChoices, multiple = TRUE)
|
6344: classGroup1 = input$deC1G1,
|
6345: classGroup2 = input$deC1G2,
|
7336: vals$effectSizes <- calcEffectSizes(countMatrix = expData(vals$counts, input$snapshotAssay), condition = colData(vals$counts)[, input$selectSnapsho...(12 bytes skipped)...
|
9723: plotOutput(outputId = "scanpyFindMarkerMatrixPlot")
|
9790: output$scanpyFindMarkerMatrixPlot <- renderPlot({
|
9791: plotScanpyMatrixPlot(inSCE = vals$counts,
|
ChromSCape:inst/server.R: [ ] |
---|
2229: buttonType = "default", class = NULL) %>%
|
3120: MSIG.classes <- reactive({
|
52: req(input$options.bpparam_class, input$options.nb_workers)
|
53: BPPARAM = BiocParallel::bpparam(input$options.bpparam_class)
|
454: you have to input a single Dense Matrix."),
|
656: title = shiny::HTML(paste0("<span style='color: white'><h4> <i class='far fa-caret-square-down'",
|
668: title = shiny::HTML(paste0("<span style='color: white'><h4> <i class='far fa-caret-square-down'",
|
995: df = data.frame(coverage = sort(unname(Matrix::colSums(init$datamatrix))))
|
1029: df = data.frame(coverage = sort(unname(Matrix::rowSums(init$datamatrix)),decreasing = TRUE))
|
2518: # return( as.character(icon("check-circle", class = "large_icon")))}
|
2520: # return( as.character(icon("times-circle", class = "large_icon")))
|
3027: DT::datatable(diff, options = list(dom='tpi'), class = "display",
|
3198: output$enr_class_sel <- renderUI({
|
3201: inputId = "enr_class_sel", inline = TRUE,
|
3209: ...(4 bytes skipped)... if(!is.null(scExp_cf()@metadata$enr) && !is.null(input$GSA_group_sel) && !is.null(input$enr_class_sel) &&
|
3215: enr_class_sel = input$enr_class_sel) %>%
|
3220: options = list(pageLength = 10, dom = 'tpi'), class = 'display', rownames = FALSE)
|
3234: enr_class_sel = input$enr_class_sel) %>%
|
3239: options = list(pageLength = 10, dom = 'tpi'), class = 'display', rownames = FALSE)
|
3254: enr_class_sel = input$enr_class_sel) %>%
|
3259: options = list(pageLength = 10, dom = 'tpi'), class = 'display', rownames = FALSE)
|
3299: most_diff[,"qval"] = Matrix::rowMeans(as.matrix(most_diff[,-1]))
|
3509: options = list(pageLength = 10, dom = 'tpi'), class = 'display', rownames = FALSE)
|
3524: options = list(pageLength = 10, dom = 'tpi'), class = 'display', rownames = FALSE)
|
3539: options = list(pageLength = 10, dom = 'tpi'), class = 'display', rownames = FALSE)
|
187: if(input$data_choice_box == "DenseMatrix"){
|
195: else if (input$data_choice_box == "SparseMatrix"){
|
232: Example of folder structure (for scBED, but applies in a similar manner for SparseMatrix, Fragment File & scBAM) : <br>
|
264: if(input$data_choice_box != "DenseMatrix"){
|
283: if(input$data_choice_box != "DenseMatrix"){
|
284: if(input$data_choice_box == "SparseMatrix"){
|
336: if(input$data_choice_box %in% c("DenseMatrix", "SparseMatrix"))
|
447: if(type_file == "DenseMatrix" & !is.null(input$datafile_matrix)){
|
480: if(type_file == "SparseMatrix") {
|
495: if(type_file == "SparseMatrix"){
|
3176: GeneSetClasses = MSIG.classes(), progress = progress))
|
3199: req(MSIG.classes())
|
3202: label = "Select classes to display:",
|
3203: selected = MSIG.classes(), choiceNames = MSIG.classes(),
|
3204: choiceValues = MSIG.classes())
|
3353: req(pathways(), annotation_id(), MSIG.classes())
|
3362: database <- load_MSIGdb(annotation_id(), MSIG.classes())
|
psichomics:R/groups.R: [ ] |
---|
342: class="btn-group", role="group",
|
1674: panel <- tags$div(class="panel panel-info",
|
2039: class="table table-condensed",
|
168: div(class="alert alert-danger", role="alert",
|
335: id=ns("setOperations"), class="btn-group",
|
343: tags$button("More", id=ns(moreId), tags$span(class="caret"),
|
344: class="btn btn-default dropdown-toggle",
|
347: tags$ul(class="dropdown-menu dropdown-menu-right",
|
352: icon("user"), class=NULL, "Save selected groups",
|
356: icon("users"), class=NULL, "Save all groups", id=ns(saveAllGroupsId),
|
364: class="btn-group", role="group",
|
367: tags$span(class="caret"),
|
368: class="btn btn-default dropdown-toggle",
|
371: tags$ul(class="dropdown-menu dropdown-menu-right",
|
373: tags$li(role="separator", class="divider"), loadGroupsLink))
|
386: class="btn-group", role="group",
|
389: tags$span(class="caret"),
|
390: class="btn btn-default dropdown-toggle",
|
393: tags$ul(class="dropdown-menu dropdown-menu-right",
|
398: class="btn-danger",
|
403: class="li-danger",
|
409: class="pull-right", icon=icon("pencil-alt"))
|
421: colourSelector, class="groups-colourpicker",
|
424: class="pull-right", disable=FALSE,
|
428: id=ns("singleGroupSelected"), class="alert", role="alert",
|
429: class="alert-info",
|
434: div(class="input-group", nameField,
|
435: div(class="input-group-btn", renameButton))),
|
437: div(class="input-group", colourSelector,
|
438: div(class="input-group-btn", setColourButton)))))
|
441: class="btn-group pull-right",
|
444: tags$button(type="button", tags$span(class="caret"),
|
445: class="btn btn-danger dropdown-toggle",
|
449: tags$ul(class="dropdown-menu",
|
490: class ="btn-primary"))
|
510: class="btn-primary")
|
582: class="btn-primary")
|
615: class="btn-primary")
|
631: class="btn-primary"))
|
658: #' @param new Matrix: groups to which colours will be assigned
|
659: #' @param groups Matrix: groups to check which colours are already assigned
|
807: #' @return Matrix with the group names and respective elements
|
827: if ("simpleError" %in% class(set)) {
|
844: if ("simpleError" %in% class(set)) {
|
891: #' @param dataset Matrix or data frame: dataset
|
966: #' @param new Matrix: new groups
|
967: #' @param old Matrix: pre-existing groups
|
988: #' @param groups Matrix: groups
|
1003: #' @return Matrix containing groups (new group is in the first row)
|
1181: #' @return Matrix with groups ordered (or \code{NULL} if there are no groups)
|
1279: #' @param groups Matrix with groups
|
1379: #' @return Matrix with groups
|
1671: class="table table-condensed table-striped")
|
1676: tags$div(class="panel-heading", title), htmlTable)
|
1693: plus <- '<i class="fa fa-plus-circle" aria-hidden="true"></i>'
|
2033: class="well-sm",
|
2291: class(res) <- c(class(res), "groupIndependenceTest")
|
2375: class(df) <- c(class(df), "multiGroupIndependenceTest")
|
89: #' @importFrom shinyjs enable disable onclick toggleClass runjs
|
1710: orderable=FALSE, className='details-control', targets=0)),
|
1397: groups <- fread(file, colClasses="character")
|
Prostar:inst/ProstarApp/global.R: [ ] |
---|
505: class = "progress",
|
575: class = "progress-group",
|
730: textEl <- tags$p(class = "navbar-text", text)
|
742: form <- tags$form(class = "navbar-form", inputs)
|
304: classID <- getOption("shiny.table.id", "example")
|
719: actionBtnClass <- "btn-primary"
|
721: PrevNextBtnClass <- "btn-info"
|
722: optionsBtnClass <- "info"
|
303: getOption("shiny.table.class", "table table-striped table-bordered")
|
314: paste("class=\"", classNames, "\" id=\"", classID, "\"",
|
454: div(class = "busy-indicator", p(text), img(src = img)),
|
506: class = if (!is.null(size)) paste0("progress-", size),
|
507: class = if (vertical) "vertical",
|
508: class = if (active) "active",
|
510: class = "progress-bar",
|
511: class = paste0("progress-bar-", color),
|
512: class = if (striped) "progress-bar-striped",
|
521: class = if (!label) "sr-only",
|
576: tags$span(class = "progress-text", text),
|
577: tags$span(class = "progress-number", sprintf("%d / %d", value, max)),
|
162: "Whole matrix" = "WholeMatrix",
|
169: gFiltersListAnaDiff[["Whole matrix"]] <- "WholeMatrix"
|
302: classNames <-
|
355: "corrMatrix" = "corrMatrix",
|
380: corrMatrix = "corrMatrix.png",
|
457: if ($('html').hasClass('shiny-busy')) {
|
459: if ($('html').hasClass('shiny-busy')) {
|
752: "intensity", "pca", "varDist", "corrMatrix",
|
401: GOClassificationImg1 = "GOClassification_img1.png",
|
402: GOClassificationImg2 = "GOClassification_img2.png",
|
403: GOClassificationImg3 = "GOClassification_img3.png",
|
musicatk:inst/shiny/server.R: [ ] |
---|
15: class = "inactiveLink")
|
17: class = "inactiveLink")
|
19: class = "inactiveLink")
|
21: class = "inactiveLink")
|
23: class = "inactiveLink")
|
25: class = "inactiveLink")
|
27: class = "inactiveLink")
|
29: class = "inactiveLink")
|
31: class = "inactiveLink")
|
33: class = "inactiveLink")
|
35: class = "inactiveLink")
|
73: class = "inactiveLink")
|
118: class = "inactiveLink")
|
162: class = "inactiveLink")
|
164: class = "inactiveLink")
|
226: class = "inactiveLink")
|
228: class = "inactiveLink")
|
230: class = "inactiveLink")
|
232: class = "inactiveLink")
|
234: class = "inactiveLink")
|
246: class = "inactiveLink")
|
254: class = "inactiveLink")
|
256: class = "inactiveLink")
|
258: class = "inactiveLink")
|
262: class = "inactiveLink")
|
264: class = "inactiveLink")
|
272: class = "inactiveLink")
|
274: class = "inactiveLink")
|
276: class = "inactiveLink")
|
280: class = "inactiveLink")
|
282: class = "inactiveLink")
|
290: class = "inactiveLink")
|
292: class = "inactiveLink")
|
294: class = "inactiveLink")
|
296: class = "inactiveLink")
|
298: class = "inactiveLink")
|
300: class = "inactiveLink")
|
2290: label = "Method for Dissimilarity Matrix",
|
14: shinyjs::addCssClass(selector = "a[data-value='musica']",
|
16: shinyjs::addCssClass(selector = "a[data-value='annotations']",
|
18: shinyjs::addCssClass(selector = "a[data-value='tables']",
|
20: shinyjs::addCssClass(selector = "a[data-value='discover']",
|
22: shinyjs::addCssClass(selector = "a[data-value='predict']",
|
24: shinyjs::addCssClass(selector = "a[data-value='visualization']",
|
26: shinyjs::addCssClass(selector = "a[data-value='compare']",
|
28: shinyjs::addCssClass(selector = "a[data-value='differentialanalysis']",
|
30: shinyjs::addCssClass(selector = "a[data-value='cluster']",
|
32: shinyjs::addCssClass(selector = "a[data-value='heatmap']",
|
34: shinyjs::addCssClass(selector = "a[data-value='download']",
|
72: removeCssClass(selector = "a[data-value='musica']",
|
117: removeCssClass(selector = "a[data-value='tables']",
|
161: removeCssClass(selector = "a[data-value='discover']",
|
163: removeCssClass(selector = "a[data-value='predict']",
|
225: removeCssClass(selector = "a[data-value='visualization']",
|
227: removeCssClass(selector = "a[data-value='compare']",
|
229: removeCssClass(selector = "a[data-value='differentialanalysis']",
|
231: removeCssClass(selector = "a[data-value='cluster']",
|
233: removeCssClass(selector = "a[data-value='heatmap']",
|
245: removeCssClass(selector = "a[data-value='musica']",
|
253: removeCssClass(selector = "a[data-value='tables']",
|
255: removeCssClass(selector = "a[data-value='annotations']",
|
257: removeCssClass(selector = "a[data-value='download']",
|
261: removeCssClass(selector = "a[data-value='discover']",
|
263: removeCssClass(selector = "a[data-value='predict']",
|
271: removeCssClass(selector = "a[data-value='tables']",
|
273: removeCssClass(selector = "a[data-value='annotations']",
|
275: removeCssClass(selector = "a[data-value='download']",
|
279: removeCssClass(selector = "a[data-value='discover']",
|
281: removeCssClass(selector = "a[data-value='predict']",
|
289: removeCssClass(selector = "a[data-value='annotations']",
|
291: removeCssClass(selector = "a[data-value='visualization']",
|
293: removeCssClass(selector = "a[data-value='compare']",
|
295: removeCssClass(selector = "a[data-value='differentialanalysis']",
|
297: removeCssClass(selector = "a[data-value='cluster']",
|
299: removeCssClass(selector = "a[data-value='heatmap']",
|
hermes:R/differential.R: [ ] |
---|
227: Class = "HermesDataDiffExpr",
|
105: modelMatrixType = "standard",
|
222: Class = "HermesDataDiffExpr",
|
216: setOldClass("data.frame")
|
220: #' @exportClass HermesDataDiffExpr
|
221: .HermesDataDiffExpr <- setClass( # nolint
|
MotifDb:misc/hocomoco-v11/importV11.R: [ ] |
---|
382: class <- substr(x, 12, 12)
|
302: rawMatrixList <- readRawMatrices("./", dataDir)
|
384: tbl.secondary$dataSource[unmapped.secondary.only] <- paste0("HOCOMOCOv11-secondary-", class[unmapped.secondary.only])
|
385: tbl.secondary$dataSource[mapping] <- paste0("HOCOMOCOv11-core-", class[mapping])
|
303: length(rawMatrixList)
|
304: matrices <- extractMatrices (rawMatrixList)
|
Pi:R/xMLrandomforest.r: [ ] |
---|
89: class <- as.factor(gs_targets[!is.na(ind)])
|
88: df_predictor_class <- as.data.frame(df_predictor[ind[!is.na(ind)],])
|
3: ...(283 bytes skipped)... in rows and predictors in columns, with their predictive scores inside it. It returns an object of class 'sTarget'.
|
9: ...(71 bytes skipped)...idataion. Per fold creates balanced splits of the data preserving the overall distribution for each class (GSP and GSN), therefore generating balanced cross-vallidation train sets and testing sets. By defa...(44 bytes skipped)...
|
20: #' an object of class "sTarget", a list with following components:
|
32: #' \item{\code{evidence}: an object of the class "eTarget", a list with following components "evidence" and "metag"}
|
86: ## predictors + class
|
90: df_predictor_class$class <- class
|
94: ...(40 bytes skipped)...ds (%d in GSP, %d in GSN) are used for supervised integration of %d predictors/features (%s).", sum(class==1), sum(class==0), ncol(df_predictor), as.character(now)), appendLF=TRUE)
|
104: message(sprintf("2. GS matrix of %d rows/genes X %d columns (predictors+class) are used as train set (%s) ...", nrow(df_predictor_class), ncol(df_predictor_class), as.character(now)), appendLF=TRUE)
|
106: message(sprintf("2. GS matrix of %d rows/genes X %d columns (predictors+class...(102 bytes skipped)...e remaining '1/%d' as test set. These spits are repeated over %d times (%s) ...", nrow(df_predictor_class), ncol(df_predictor_class), nfold, nfold-1, nfold, nfold, nrepeat, as.character(now)), appendLF=TRUE)
|
112: # preserve the overall class distribution
|
116: index_sets <- caret::createMultiFolds(y=df_predictor_class$class, k=nfold, times=nrepeat)
|
121: res_ls <- caret::createFolds(y=df_predictor_class$class, k=nfold, list=TRUE, returnTrain=TRUE)
|
143: trainset <- df_predictor_class[index_sets[[i]],]
|
146: message(sprintf("\tFold %d: %d GSP + %d GSN", i, table(trainset$class)[2], table(trainset$class)[1]), appendLF=TRUE)
|
159: #suppressMessages(rf.model <- randomForest::randomForest(class ~ ., data=trainset, importance=TRUE, ntree=ntree, mtry=mtry, ...))
|
160: suppressMessages(rf.model <- randomForest::randomForest(class ~ ., data=trainset, importance=TRUE, ntree=ntree, mtry=mtry))
|
166: trainset <- df_predictor_class[trainindex,]
|
169: message(sprintf("\tRepeatFold %d: %d GSP + %d GSN", i, table(trainset$class)[2], table(trainset$class)[1]), appendLF=TRUE)
|
183: #suppressMessages(rf.model <- randomForest::randomForest(class ~ ., data=trainset, importance=TRUE, ntree=ntree, mtry=mtry, ...))
|
184: suppressMessages(rf.model <- randomForest::randomForest(class ~ ., data=trainset, importance=TRUE, ntree=ntree, mtry=mtry))
|
194: ...(51 bytes skipped)...eature importance matrix of %d rows/predictors X %d columns/repeats*folds (%s).", ncol(df_predictor_class)-1, nfold*nrepeat, as.character(now)), appendLF=TRUE)
|
229: trainset <- df_predictor_class
|
240: suppressMessages(rf.model.overall <- randomForest::randomForest(class ~ ., data=trainset, importance=TRUE, ntree=ntree, mtry=mtry))
|
241: rf.model.overall.importance <- randomForest::importance(rf.model.overall, type=NULL, class=NULL, scale=TRUE)[,3:4]
|
249: ...(38 bytes skipped)...OC matrix of %d rows (Supervised + predictors) X %d columns/repeats*folds (%s).", ncol(df_predictor_class), nfold*nrepeat, as.character(now)), appendLF=TRUE)
|
259: testset <- df_predictor_class[-trainindex,]
|
351: ...(54 bytes skipped)...atrix of %d rows/genes X %d columns/repeats*folds, aggregated via '%s' (%s) ...", nrow(df_predictor_class), nfold*nrepeat, fold.aggregateBy, as.character(now)), appendLF=TRUE)
|
473: class(sTarget) <- "sTarget"
|
37: #' @seealso \code{\link{xPierMatrix}}, \code{\link{xSparseMatrix}}, \code{\link{xPredictROCR}}, \code{\link{xPredictCompare}}, \code{\link{xSymbol2GeneID}}
|
58: df_predictor <- xPierMatrix(list_pNode, displayBy="score", combineBy="union", aggregateBy="none", RData.location=RData.location...(12 bytes skipped)...
|
62: eTarget <- xPierMatrix(list_pNode, displayBy="evidence", combineBy="union", aggregateBy="none", verbose=FALSE, RData.locat...(30 bytes skipped)...
|
206: df_res <- as.matrix(xSparseMatrix(df_res, verbose=FALSE))
|
294: df_res <- as.matrix(xSparseMatrix(df_res[,-4], verbose=FALSE))
|
317: df_res <- as.matrix(xSparseMatrix(df_res[,-3], verbose=FALSE))
|
362: df_full <- as.matrix(xSparseMatrix(df_full, verbose=FALSE))
|
spatialHeatmap:inst/extdata/shinyApp/R/global.R: [ ] |
---|
334: lapply(ft, function(i) { tag("span", list(class = class(i), tags$span(class = "glyphicon glyphicon-move"), i)) }
|
343: span(class = "panel panel-default",
|
344: div(class = "panel-heading", x),
|
345: div(class = "panel-body", id = ns(x))
|
350: span(class = "panel panel-default",
|
351: div(class = "panel-heading", names(x)),
|
352: div(class = "panel-body", id = ns(names(x)), ft2tag(x[[1]]))
|
372: span(class = "panel panel-default", style = 'margin-left:0px',
|
373: div(class = "panel-heading", strong(to.div.tit)),
|
374: div(class = "panel-body", id = ns(to.div.id), ft2tag(to.ft))
|
376: div(class = "panel panel-default",
|
377: div(class = "panel-heading", strong(from.div.tit)),
|
223: if (is(input, 'dgCMatrix')|is(input, 'matrix')|is(input, 'data.frame')|is(input, 'DFrame')|is(input, 'DelayedMatrix')) input <- as.data.frame(as.matrix(input))
|
ISAnalytics:R/utility-functions.R: [ ] |
---|
43: purrr::walk(desc_msg, ~ rlang::inform(.x, class = "tag_inspect"))
|
499: rlang::inform(warn_msg, class = "missing_quant_specs")
|
643: rlang::inform(err_msg, class = "skip_col_transform")
|
743: rlang::inform(.nas_introduced_msg(), class = "comp_nas")
|
992: rlang::inform(msg, class = "launch_af_empty")
|
1209: rlang::inform(no_stats_msg, class = "no_stats_warn")
|
509: rlang::abort(err_msg, class = "miss_annot_suff_specs")
|
521: rlang::inform("Matrix suffixes specs successfully changed")
|
537: rlang::inform("Matrix suffixes specs reset to default")
|
1338: rlang::inform("Matrix suffixes specs successfully changed")
|
debrowser:R/funcs.R: [ ] |
---|
278: tags$button(id = inputId, type = "button", class = paste("btn action-button",
|
264: btn.css.class <- paste("btn", styleclass, sep = "-")
|
268: btn.size.class <- paste("btn", size, sep = "-")
|
299: getNormalizedMatrix <- function(M = NULL, method = "TMM") {
|
246: #' @param styleclass The Bootstrap styling class of the button--options are
|
251: #' @param css.class Any additional CSS class one wishes to add to the action
|
261: block = FALSE, icon = NULL, css.class = "", ...) {
|
265: } else btn.css.class = ""
|
269: } else btn.size.class = ""
|
276: icon.code <- HTML(paste0("<i class='fa fa-", icon, "'></i>"))
|
279: btn.css.class, btn.size.class, btn.block, css.class, collapse = " "),
|
486: if($('#dataprepMenu').attr('class')!='active'){
|
491: if($('#dataprepMethod').attr('class')!='active'){
|
497: if($('#discoveryMenu').attr('class')!='active'){
|
181: actionButtonDE(paste0("show",tablename), "Show Data", styleclass = "primary", icon="show"),
|
260: actionButtonDE <- function(inputId, label, styleclass = "", size = "",
|
262: if (styleclass %in% c("primary", "info", "success", "warning",
|
284: #' getNormalizedMatrix
|
289: #' @note \code{getNormalizedMatrix}
|
295: #' x <- getNormalizedMatrix(mtcars)
|
313: dds <- DESeqDataSetFromMatrix(countData = as.matrix(M),
|
355: styleclass="info", size="small")
|
HiCBricks:R/backend_functions.R: [ ] |
---|
467: Matrix <- NULL
|
600: Matrix <- as.matrix(fread(file = Matrix.file, sep=delim, nrows=Iter,
|
374: Matrix.return <- rbind(Matrix.top,Matrix.bottom)
|
460: Matrix.range <- c(NA,NA)
|
563: Matrix.range <- c(NA,NA)
|
1: GenomicMatrix <- R6Class("GenomicMatrix",
|
548: ._ProcessMatrix_ <- function(Brick = NULL, Matrix.file = NULL, delim = NULL,
|
150: Matrix.range=NA,
|
357: ._Do_rbind_on_matrices_of_different_sizes_ <- function(Matrix.top = NULL,
|
358: Matrix.bottom = NULL, row.length = NULL, col.length = NULL,
|
360: if(is.null(Matrix.top)){
|
361: return(Matrix.bottom)
|
365: Matrix.top <- cbind(Matrix.top,matrix(NA,
|
366: nrow = nrow(Matrix.top), ncol = Makeup.col))
|
370: Matrix.bottom <- cbind(matrix(NA,
|
371: nrow = nrow(Matrix.bottom),
|
372: ncol = Makeup.col),Matrix.bottom)
|
375: return(Matrix.return)
|
388: ._Compute_various_matrix_metrics <- function(Matrix = NULL,
|
392: Bin.coverage <- vapply(seq_len(nrow(Matrix)),function(x){
|
393: Vec.sub <- Matrix[x,]
|
396: Row.sums <- vapply(seq_len(nrow(Matrix)),function(x){
|
397: Vec.sub <- Matrix[x,]
|
401: Sparsity.Index <- vapply(seq_len(nrow(Matrix)),function(x){
|
402: Vec.sub <- Matrix[x,]
|
411: Row.extent <- ._Do_on_vector_ComputeMinMax_(Matrix)
|
422: ._Compute_various_col_matrix_metrics <- function(Matrix = NULL,
|
424: Matrix[is.na(Matrix) | is.infinite(Matrix)] <- 0
|
426: metrics.list[["bin.coverage"]] + colSums(Matrix > 0)
|
428: colSums(Matrix)
|
446: ._Process_matrix_by_distance <- function(Brick = NULL, Matrix.file = NULL,
|
454: Handler <- .create_file_connection(Filename = Matrix.file, mode = "r")
|
473: if(is.null(Matrix)){
|
478: Matrix <- matrix(data = 0, nrow = num.rows,
|
485: Matrix[Row.loc, Col.loc] <- Vector[Col.lower.limit:Col.upper.limit]
|
489: Count <- c(nrow(Matrix),ncol(Matrix))
|
490: Metrics.list <- ._Compute_various_matrix_metrics(Matrix = Matrix,
|
492: sparsity.bins = sparsity.bins, range = Matrix.range,
|
494: Matrix.range <- Metrics.list[["extent"]]
|
504: data = Matrix, Start = Start, Stride = Stride, Count = Count)
|
507: Object.size <- object.size(Matrix)
|
508: Matrix <- NULL
|
538: Attr.vals <- c(basename(Matrix.file),as.double(Matrix.range),
|
605: Metrics.list <- ._Compute_various_matrix_metrics(Matrix = Matrix,
|
607: range = Matrix.range, distance = distance,
|
610: Matrix = Matrix,
|
612: Matrix.range <- Metrics.list[["extent"]]
|
617: Cumulative.data <- rbind(Cumulative.data,Matrix)
|
661: Attr.vals <- c(basename(Matrix.file),
|
662: as.double(Matrix.range),
|
91: TerrificNumberOfHiCFormats = c("NxNMatrix","PAIRIX","Cooler","HOMER",
|
230: Reference.object <- GenomicMatrix$new()
|
255: Reference.object <- GenomicMatrix$new()
|
309: Reference.object <- GenomicMatrix$new()
|
349: Reference.object <- GenomicMatrix$new()
|
450: Reference.object <- GenomicMatrix$new()
|
552: Reference.object <- GenomicMatrix$new()
|
678: Reference.object <- GenomicMatrix$new()
|
772: # Reference.object <- GenomicMatrix$new()
|
781: # Reference.object <- GenomicMatrix$new()
|
787: # Reference.object <- GenomicMatrix$new()
|
decoupleR:R/utils-dataset-converters.R: [ ] |
---|
89: class = "quo_missing_error"
|
209: class = "different_set_columns"
|
95: class = "quo_null_error"
|
231: #' @param mat Matrix in matrix format.
|
pRolocGUI:R/pRolocVis_explore.R: [ ] |
---|
538: ui <- tags$body(class="skin-blue right-sidebar-mini control-sidebar-open",
|
918: profByClass <- plotFacetProfiles(profs, fcol, fd, pd, col = cols_user())
|
132: getMyClasses <- getMarkerClasses(object, fcol = fcol)
|
220: myclasses <- colnames(pmarkers)
|
22: ##' individual class profile plots should be displayed. Default is \code{FALSE}.
|
56: else stop(paste("Object must be of class MSnSet or matrix"))
|
84: # stop(paste("Matrix rownames and feature names don't match"))
|
254: or add the class labels on the spatial map click
|
256: name. All class labels can be added back to the plot
|
346: tabPanel("Profiles (by class)", value = "profilesPanel2",
|
451: # tabPanel("Profiles (by class)", value = "profilesPanel2",
|
566: ## Get coords for proteins according to selectized marker class(es)
|
703: ## Class specific/faceted plots
|
996: # addClass(selector = "body", class = "sidebar-collapse")
|
997: # removeClass(selector = "body", class = "control-sidebar-open")
|
999: # removeClass(selector = "body", class = "sidebar-collapse")
|
1000: # addClass(selector = "body", class = "control-sidebar-open")
|
1003: # observeEvent(input$openright, {addClass(selector = "body", class = "control-sidebar-open")})
|
21: ##' @param classProfiles A \code{logical} indicating if a tab displaying
|
25: classProfiles = FALSE,
|
245: p(strong("Subcellular classes")),
|
253: belong to pre-defined subcellular classes. To remove
|
278: if (classProfiles) {
|
653: ## get quantiles for subcellular classes
|
654: ...(12 bytes skipped)...fs <- lapply(mrkSel(), function(z) profs[z, , drop = FALSE]) # 5% and 95% quantiles for all other classes
|
704: if (classProfiles) {
|
862: ## get quantiles for subcellular classes
|
863: ...(2 bytes skipped)... mrkProfs <- lapply(mrkSel(), function(z) profs[z, ]) # 5% and 95% quantiles for all other classes
|
919: ggsave(filename = file, plot = profByClass, device = "pdf", width = w, height = h)
|
133: cn <- sapply(getMyClasses,
|
144: diffNam1 <- setdiff(getMyClasses, cn)
|
145: diffNam2 <- setdiff(cn, getMyClasses)
|
221: colPicker <- function(x) {colourpicker::colourInput(col_ids[x], myclasses[x], value = appStockcol()[x])}
|
576: names(cols_user) <- myclasses
|
qmtools:R/reduceFeatures-functions.R: [ ] |
---|
113: res <- pcaMethods::nipalsPca(Matrix = x, nPcs = ncomp, ...)
|
48: ##' \linkS4class{SummarizedExperiment}-friendly wrapper for this function.
|
95: class(out) <- c("reduced.pca", class(out))
|
170: ##' \linkS4class{SummarizedExperiment}-friendly wrapper for this function.
|
214: class(out) <- c("reduced.tsne", class(out))
|
271: ##' \linkS4class{SummarizedExperiment}-friendly wrapper for this function.
|
331: class(out) <- c("reduced.plsda", "matrix", class(out))
|
223: ##' This function performs standard PLS for classification with the transpose of
|
fastreeR:R/tree2clusters.R: [ ] |
---|
58: class="ciat/agrobio/hcluster/HierarchicalCluster",
|
59: class.loader = .rJava.class.loader
|
90: distancesMatrix <- ape::cophenetic.phylo(tree)
|
92: distancesMatrix <- distancesReordered
|
95: rownames(distancesMatrix) <- rawLabels
|
96: colnames(distancesMatrix) <- colLabels
|
103: distM = distancesMatrix, deepSplit = 1, verbose = 2, indent = 0
|
109: distM = distancesMatrix, deepSplit = 1, maxCoreScatter = NULL,
|
119: treecut.hybrid, rownames(distancesMatrix)
|
metaseqR2:R/main.R: [ ] |
---|
2768: invisible(knitr::knit_meta(class=NULL,clean=TRUE))
|
1580: tempMatrix <- round(counts(normGenes,normalized=TRUE))
|
1609: classes <- asClassVector(sampleList)
|
1577: switch(class(normGenes)[1],
|
1608: # Dribble for taking a mtx out of SeqCountSet class
|
1659: switch(class(normGenes)[1],
|
1896: switch(class(normGenesExpr)[1],
|
1579: #tempMatrix <- round(DESeq::counts(normGenes,normalized=TRUE))
|
1583: tempMatrix <- round(DESeq2::counts(normGenes,normalized=TRUE))
|
1589: tempMatrix <- round(t(t(normGenes$counts)/scl)*mean(scl))
|
1592: tempMatrix <- normGenes
|
1595: tempMatrix <- as.matrix(normGenes)
|
1598: tempMatrix <- as.matrix(round(sweep(normGenes$counts,2,
|
1602: tempMatrix <- as.matrix(round(normGenes$pseudo.counts))
|
1605: tempMatrix <- as.matrix(round(excounts(normGenes)))
|
1610: theDesign <- data.frame(condition=classes,
|
1616: #tempMatrix <- as.matrix(round(DESeq::counts(cds,
|
1618: tempMatrix <- as.matrix(round(counts(cds,normalized=TRUE)))
|
1624: geneFilterOut <- filterGenes(tempMatrix,geneData,geneFilters,
|
1652: geneCountsDead <- tempMatrix[theDead,]
|
1658: theDeadInd <- match(theDead,rownames(tempMatrix))
|
1709: classes <- asClassVector(sampleList)
|
1710: theDesign <- data.frame(condition=classes,
|
1934: classes <- asClassVector(sampleList)
|
1935: theDesign <- data.frame(condition=classes,
|
hipathia:R/stats.R: [ ] |
---|
212: class <- "0"
|
354: class <- "0"
|
391: class <- "0"
|
51: #' @return Matrix of gene expression whose values are in [0,1].
|
218: class <- "DOWN" ## regarding DISEASE
|
220: class <- "UP" ## regarding DISEASE
|
223: class <- "UP"
|
225: class <- "DOWN"
|
227: class <- 0
|
231: result <- data.frame(pvalue, class, esti, stringsAsFactors = FALSE)
|
244: #' including the classes to compare, or a character vector with the class to
|
338: data2$class == "0" &
|
360: class <- "UP"
|
362: class <- "DOWN"
|
364: class <- "0"
|
368: class = class,
|
398: class <- "DOWN" ## regarding DISEASE
|
400: class <- "UP" ## regarding DISEASE
|
403: class <- "UP"
|
405: class <- "DOWN"
|
407: class <- 0
|
411: result <- data.frame(pvalue, class, stat,stringsAsFactors=FALSE)
|
427: #' @return \code{do_pca} returns a list with class \code{princomp}.
|
77: stop("Only SummarizedExperiment or matrix classes accepted as data")
|
288: stop("Only SummarizedExperiment or matrix classes accepted as data")
|
443: stop("Only SummarizedExperiment or matrix classes accepted as data")
|
469: stop("Only SummarizedExperiment or matrix classes accepted as data")
|
pcaMethods:R/pca.R: [ ] |
---|
122: Matrix <- as.matrix(object[,num])
|
125: Matrix <- t(exprs(object))
|
127: Matrix <- as.matrix(object, rownames.force=TRUE)
|
130: Matrix <- Matrix[,subset]
|
135: if (nPcs > ncol(Matrix)) {
|
137: nPcs <- min(dim(Matrix))
|
139: if (nPcs > nrow(Matrix)) {
|
141: nPcs <- min(dim(Matrix))
|
144: if (!checkData(Matrix, verbose=interactive()))
|
148: missing <- is.na(Matrix)
|
162: prepres <- prep(Matrix, scale=scale, center=center, simple=FALSE, ...)
|
196: rownames(res@scores) <- rownames(Matrix)
|
197: if(all(dim(loadings(res)) == c(ncol(Matrix), nPcs))) {
|
199: rownames(res@loadings) <- colnames(Matrix)
|
205: res@nObs <- nrow(Matrix)
|
206: res@nVar <- ncol(Matrix)
|
217: cObs <- Matrix
|
219: cObs[missing] <- fitted(res, Matrix, pre=TRUE, post=TRUE)[missing]
|
225: res@cvstat <- Q2(res, Matrix, nruncv=1, ...)
|
344: ##' @param Matrix Pre-processed (centered and possibly scaled)
|
364: svdPca <- function(Matrix, nPcs=2,
|
367: pcs <- prcomp(Matrix, center=FALSE, scale.=FALSE)
|
4: ##' methods based on the classical model where the fitted data is a
|
31: ##' \describe{\item{svd:}{Uses classical \code{prcomp}. See
|
HPiP:R/FSmethod.R: [ ] |
---|
185: x$class
|
2: function(features, class, cor.cutoff = 0.7) {
|
23: cbind(class, .)
|
33: .rfeFS <- function(features, class, cor.cutoff = 0.7,
|
49: y = as.factor(class),
|
68: dataset_rfe <- cbind(class, dataset_rfe)
|
79: #' @title Feature Selection via Matrix Correlation and
|
82: #' class labels and features.
|
164: if (all(colnames(x) != "class") == TRUE) {
|
165: stop("class attribute is absent from the data.frame")
|
182: dplyr::select(-PPI, -class)
|
184: class <-
|
188: result <- .filter.corr(features, class, cor.cutoff)
|
190: result <- .rfeFS(features, class,
|
197: .filter.corr(features, class, cor.cutoff)
|
204: dplyr::select(-PPI, -class)
|
206: df.class <-
|
207: df$class
|
210: .rfeFS(df.features, df.class,
|
42: caretFuncs$summary <- twoClassSummary
|
129: #' @importFrom caret twoClassSummary
|
splatter:R/SCE-functions.R: [ ] |
---|
312: class <- ifelse(is.logical(mat), "lgCMatrix", "dgCMatrix")
|
313: as(mat, class)
|
338: warning("matrix '", mat.name, "' is class '", class(mat),
|
28: checkmate::assertClass(sce, "SingleCellExperiment")
|
53: if (is(values, "dgCMatrix")) {
|
126: checkmate::assertClass(sce, "SingleCellExperiment")
|
160: checkmate::assertClass(sce, "SingleCellExperiment")
|
329: } else if (is(mat, "dgCMatrix")) {
|
332: "' as it is already a dgCMatrix")
|
349: mat <- as(mat, "lgCMatrix")
|
351: mat <- as(mat, "dgCMatrix")
|
tomoseqr:R/masker.R: [ ] |
---|
114: tags$div(class = "table_button",
|
130: tags$div(class="tmp_canvas",
|
156: dataMatrix = data_matrix,
|
170: dataMatrix = data_matrix,
|
183: dataMatrix = data_matrix,
|
210: dataMatrix = data_matrix,
|
223: dataMatrix = data_matrix,
|
235: dataMatrix = data_matrix,
|
interactiveDisplay:R/ExpressionSet.R: [ ] |
---|
9: shiny::tags$input(id = inputId1, class = "color", value = "EDF8B1",
|
16: shiny::tags$input(id = inputId2, class = "color", value = "7FCDBB",
|
23: shiny::tags$input(id = inputId3, class = "color", value = "2C7FB8",
|
252: if(class(pkg)=="ChipDb"){
|
285: if(class(pkg)=="ChipDb"){
|
483: "<div id=\"net\" class=\"shiny-network-output\"><svg /></div>",
|
554: # Distance Matrix
|
QUBIC:src/matrix.h: [ ] |
---|
7: template<typename T> class Matrix {
|
12: Matrix(std::size_t reserved_count) {
|
DiscoRhythm:inst/app/code/ui/rowReplicateAnalysis.R: [ ] |
---|
66: ", class = "text-muted")
|
39: p(class="text-muted","Results for this section were
|
80: class = "text-muted")
|
91: title = "Inspect Final Averaged Data Matrix",
|
102: class = "text-muted"
|
89: id = "rowRepMatrixDiv",
|
HDF5Array:R/H5SparseMatrixSeed-class.R: [ ] |
---|
322: ans_class <- "CSC_H5SparseMatrixSeed"
|
702: .from_CSC_H5SparseMatrixSeed_to_dgCMatrix <- function(from)
|
718: .from_CSR_H5SparseMatrixSeed_to_dgCMatrix <- function(from)
|
61: t.CSC_H5SparseMatrixSeed <- function(x)
|
70: t.CSR_H5SparseMatrixSeed <- function(x)
|
300: H5SparseMatrixSeed <- function(filepath, group, subdata=NULL,
|
528: .extract_array_from_H5SparseMatrixSeed <- function(x, index)
|
572: .OLD_extract_sparse_array_from_H5SparseMatrixSeed <- function(x, index)
|
595: .read_sparse_block_from_H5SparseMatrixSeed <- function(x, viewport)
|
64: class(x) <- "CSR_H5SparseMatrixSeed"
|
73: class(x) <- "CSC_H5SparseMatrixSeed"
|
95: stop(wmsg("changing the path of a ", class(object), " object ",
|
149: ## We pass 'shape' thru as.vector() to drop its class attribute in case
|
328: ans_class <- "CSR_H5SparseMatrixSeed"
|
342: new2(ans_class, filepath=filepath, group=group,
|
6: setClass("H5SparseMatrixSeed",
|
52: setClass("CSC_H5SparseMatrixSeed", contains="H5SparseMatrixSeed")
|
53: setClass("CSR_H5SparseMatrixSeed", contains="H5SparseMatrixSeed")
|
209: msg2 <- c("H5ADMatrix() constructor if you are trying ",
|
699: ### Coercion to dgCMatrix
|
707: sparseMatrix(i=row_indices, p=indptr, x=data, dims=dim(from),
|
711: setAs("CSC_H5SparseMatrixSeed", "dgCMatrix",
|
712: .from_CSC_H5SparseMatrixSeed_to_dgCMatrix
|
714: setAs("CSC_H5SparseMatrixSeed", "sparseMatrix",
|
715: .from_CSC_H5SparseMatrixSeed_to_dgCMatrix
|
723: sparseMatrix(j=col_indices, p=indptr, x=data, dims=dim(from),
|
727: setAs("CSR_H5SparseMatrixSeed", "dgCMatrix",
|
728: .from_CSR_H5SparseMatrixSeed_to_dgCMatrix
|
730: setAs("CSR_H5SparseMatrixSeed", "sparseMatrix",
|
731: .from_CSR_H5SparseMatrixSeed_to_dgCMatrix
|
2: ### H5SparseMatrixSeed objects
|
33: ## ------------- populated by specialized subclasses -------------
|
60: ### S3/S4 combo for t.CSC_H5SparseMatrixSeed
|
67: setMethod("t", "CSC_H5SparseMatrixSeed", t.CSC_H5SparseMatrixSeed)
|
69: ### S3/S4 combo for t.CSR_H5SparseMatrixSeed
|
76: setMethod("t", "CSR_H5SparseMatrixSeed", t.CSR_H5SparseMatrixSeed)
|
84: setMethod("path", "H5SparseMatrixSeed", function(object) object@filepath)
|
88: setReplaceMethod("path", "H5SparseMatrixSeed",
|
108: setMethod("dim", "H5SparseMatrixSeed", function(x) x@dim)
|
110: setMethod("dimnames", "H5SparseMatrixSeed",
|
298: ### Returns an H5SparseMatrixSeed derivative (can be either a
|
299: ### CSC_H5SparseMatrixSeed or CSR_H5SparseMatrixSeed object).
|
411: ### H5SparseMatrixSeed objects.
|
507: setMethod(".load_sparse_data", "CSC_H5SparseMatrixSeed",
|
515: setMethod(".load_sparse_data", "CSR_H5SparseMatrixSeed",
|
541: setMethod("extract_array", "H5SparseMatrixSeed",
|
542: .extract_array_from_H5SparseMatrixSeed
|
551: setMethod("chunkdim", "CSC_H5SparseMatrixSeed", function(x) c(nrow(x), 1L))
|
553: setMethod("chunkdim", "CSR_H5SparseMatrixSeed", function(x) c(1L, ncol(x)))
|
560: setMethod("sparsity", "H5SparseMatrixSeed",
|
570: setMethod("is_sparse", "H5SparseMatrixSeed", function(x) TRUE)
|
578: setMethod("OLD_extract_sparse_array", "H5SparseMatrixSeed",
|
579: .OLD_extract_sparse_array_from_H5SparseMatrixSeed
|
583: ### work just fine on an H5SparseMatrixSeed derivative (thanks to the
|
584: ### OLD_extract_sparse_array() method for H5SparseMatrixSeed objects defined
|
590: ### OLD_extract_sparse_array() method for H5SparseMatrixSeed objects would
|
599: ## Unlike the OLD_extract_sparse_array() method for H5SparseMatrixSeed
|
605: setMethod("read_sparse_block", "H5SparseMatrixSeed",
|
606: .read_sparse_block_from_H5SparseMatrixSeed
|
673: setMethod("extractNonzeroDataByCol", "CSC_H5SparseMatrixSeed",
|
688: setMethod("extractNonzeroDataByRow", "CSR_H5SparseMatrixSeed",
|
739: setMethod("show", "H5SparseMatrixSeed",
|
DaMiRseq:R/Classif_2_Classes.R: [ ] |
---|
156: class_level <- levels(classes)
|
160: min_sample_each_class <- min(min_sub)
|
168: acc.Class<-matrix()
|
236: class_level2 <- levels(trainingSetClasses)
|
276: model_class <- list()
|
471: MCC.Class <- acc.Class
|
472: TP.Class <- acc.Class
|
473: TN.Class <- acc.Class
|
474: FP.Class <- acc.Class
|
475: FN.Class <- acc.Class
|
476: Sensit.Class <- acc.Class
|
477: Specif.Class <- acc.Class
|
478: PPV.Class <- acc.Class
|
479: NPV.Class <- acc.Class
|
486: TP_Class <- colSums(tPred[
|
488: TN_Class <- colSums(tPred[
|
490: FP_Class <- colSums(tPred[
|
492: FN_Class <- colSums(tPred[
|
183: independentClasses <- classes[index_indep, drop=FALSE]
|
188: datasetClasses <- classes[sample_index_list, drop=FALSE]
|
215: trainingSetClasses <- datasetClasses[sample_index_train,
|
223: testSetClasses <- datasetClasses[sample_index_test]
|
248: trainingSetClasses2 <- trainingSetClasses[sample_index_train2,
|
256: testSetClasses2 <- trainingSetClasses[sample_index_test2,
|
12: #' @param classes A class vector with \code{nrow(data)} elements.
|
13: #' Each element represents the class label for each observation.
|
14: #' Two different class labels are allowed
|
16: #' (but without 'class' column). Each column represents a different
|
72: #' # classes=df$class, fSample.tr=0.6, fSample.tr.w=0.6, iter=3,
|
154: # find the min number of sample per class
|
157: for (i in seq_len(length(class_level))){
|
158: min_sub[i] <- length(which(class_level[i]==classes))
|
161: if (min_sample_each_class < 3 )
|
172: for (i in seq_len(length(class_level))){
|
173: sample_index <- sample(which(class_level[i]==classes),replace = FALSE)
|
174: sample_index <- sample_index[seq_len(min_sample_each_class)]
|
198: acc.Class<- matrix()
|
204: class_level <- levels(datasetClasses)
|
205: tr_sample <- round(dim(dataset)[1]*fSample.tr/length(class_level))
|
206: for (i in seq_len(length(class_level))){
|
207: sample_index <- sample(which(class_level[i]==datasetClasses),
|
238: dim(trainingSet)[1]*fSample.tr.w/length(class_level2))
|
239: for (i in seq_len(length(class_level2))){
|
240: sample_index2 <- sample(which(class_level2[i]==trainingSetClasses),
|
291: model_class[[kk]] <- model_rf
|
316: model_class[[kk]] <- model_svm
|
331: model_class[[kk]] <- model_nb
|
341: predict(model_lda, testSet_DM)$class,
|
345: model_class[[kk]] <- model_lda
|
361: model_class[[kk]] <- model_lr
|
376: model_class[[kk]] <- model_nn
|
390: model_class[[kk]] <- model_pls
|
432: if(predict(model_lda,testSet[ii,])$class == levels(testSetClasses)[1])
|
470: acc.Class <- matrix(nrow=iter, ncol = length(colMeans(tPred)))
|
495: TP.Class[jj,] <- TP_Class
|
496: TN.Class[jj,] <- TN_Class
|
497: FP.Class[jj,] <- FP_Class
|
498: FN.Class[jj,] <- FN_Class
|
500: acc.Class[jj,] <- (TP_Class + TN_Class)/(
|
501: TP_Class + TN_Class + FP_Class + FN_Class)
|
503: MCC.Class[jj,] <- (TP_Class * TN_Class - FP_Class * FN_Class) /
|
504: sqrt((TP_Class + FP_Class) * (TP_Class + FN_Class) *
|
505: (TN_Class + FP_Class) * (TN_Class + FN_Class))
|
508: Sensit.Class[jj,] <- TP_Class / (TP_Class + FN_Class)
|
509: Specif.Class[jj,] <- TN_Class / (TN_Class + FP_Class)
|
512: PPV.Class[jj,] <- TP_Class / (TP_Class + FP_Class)
|
513: NPV.Class[jj,] <- TN_Class / (TN_Class + FN_Class)
|
517: MCC.Class[which(is.nan(MCC.Class))] <- 0
|
519: colnames(acc.Class) <- colnames(tPred)
|
520: colnames(MCC.Class) <- colnames(tPred)
|
521: colnames(Sensit.Class) <- colnames(tPred)
|
522: colnames(Specif.Class) <- colnames(tPred)
|
523: colnames(PPV.Class) <- colnames(tPred)
|
524: colnames(NPV.Class) <- colnames(tPred)
|
526: acc.Class<-round(acc.Class,2)
|
527: MCC.Class<-round(MCC.Class,2)
|
528: Sensit.Class<-round(Sensit.Class,2)
|
529: Specif.Class<-round(Specif.Class,2)
|
530: PPV.Class<-round(PPV.Class,2)
|
531: NPV.Class<-round(NPV.Class,2)
|
534: acc_dotplot <- melt(as.data.frame(acc.Class),
|
535: measure.vars = colnames(acc.Class))
|
549: coord_cartesian(ylim=c(min(acc.Class)-0.05,1))
|
553: mcc_dotplot <- melt(as.data.frame(MCC.Class),
|
554: measure.vars = colnames(MCC.Class))
|
568: coord_cartesian(ylim=c(min(MCC.Class)-0.05,1))
|
572: spe_dotplot <- melt(as.data.frame(Specif.Class),
|
573: measure.vars = colnames(Specif.Class))
|
588: coord_cartesian(ylim=c(min(Specif.Class)-0.05,1))
|
592: sen_dotplot <- melt(as.data.frame(Sensit.Class),
|
593: measure.vars = colnames(Sensit.Class))
|
608: coord_cartesian(ylim=c(min(Sensit.Class)-0.05,1))
|
613: ppv_dotplot <- melt(as.data.frame(PPV.Class),
|
614: measure.vars = colnames(PPV.Class))
|
629: coord_cartesian(ylim=c(min(PPV.Class)-0.05,1))
|
633: npv_dotplot <- melt(as.data.frame(NPV.Class),
|
634: measure.vars = colnames(NPV.Class))
|
649: coord_cartesian(ylim=c(min(NPV.Class)-0.05,1))
|
654: colnames(acc.Class),
|
656: "Mean:",round(colMeans(acc.Class),2),"\n","St.Dev.",
|
657: round(colSds(acc.Class),digits = 2),"\n")
|
660: colnames(MCC.Class),
|
662: "Mean:",round(colMeans(MCC.Class),2),"\n","St.Dev.",
|
663: round(colSds(MCC.Class),digits = 2),"\n")
|
666: colnames(Specif.Class),
|
668: "Mean:",round(colMeans(Specif.Class),2),"\n","St.Dev.",
|
669: round(colSds(Specif.Class),digits = 2),"\n")
|
672: colnames(Sensit.Class),
|
674: "Mean:",round(colMeans(Sensit.Class),2),"\n","St.Dev.",
|
675: round(colSds(Sensit.Class),digits = 2),"\n")
|
678: colnames(PPV.Class),
|
680: "Mean:",round(colMeans(PPV.Class),2),"\n","St.Dev.",
|
681: round(colSds(PPV.Class),digits = 2),"\n")
|
684: colnames(NPV.Class),
|
686: "Mean:",round(colMeans(NPV.Class),2),"\n","St.Dev.",
|
687: round(colSds(NPV.Class),digits = 2),"\n")
|
689: return(list(accuracy = acc.Class,
|
690: MCC = MCC.Class,
|
691: Specif = Specif.Class,
|
692: Sensit = Sensit.Class,
|
693: PPV = PPV.Class,
|
694: NPV = NPV.Class))
|
1: #' @title Build a Binary Classifier using 'Staking' Learning strategy.
|
7: #' classification model building. A 'two-classes' classification task is
|
22: #' @param iter Number of iterations to assess classification accuracy;
|
24: #' @param cl_type List of weak classifiers that will compose the
|
30: #' \item A matrix of accuracies of each classifier in each iteration.
|
31: #' \item A matrix of weights used for each classifier in each iteration.
|
47: #' Regression (LR) classifiers, whereas TS2 is used to test their accuracy
|
49: #' The decision rule of 'Stacking' classifier is made by a linear
|
51: #' product between weigths (w) and predictions (Pr) of each classifier;
|
57: #' Performance of 'Stacking' classifier is evaluated by using TS1. This
|
71: #' # Classification_res <- DaMiR.EnsembleLearning(selected_features,
|
79: classes,
|
95: if (missing(classes))
|
96: stop("'classes' argument must be provided")
|
110: if(!(is.factor(classes)))
|
111: stop("'classes' must be a factor")
|
124: stop("A Test Set is not available to weight classifiers.
|
126: if(length(classes) != dim(data)[1])
|
127: stop("length(classes) must be equal to dim(data)[1]")
|
192: cat("You select:",cl_type, "weak classifiers for creating
|
194: cat("Ensemble classification is running. ",
|
264: colnames(trainingSet_DM) <- c(varNames, "classes")
|
266: formula_DM <- as.formula(paste("classes", varNames1, sep = " ~ "))
|
270: colnames(testSet_DM) <- c(varNames, "classes")
|
274: ############### Weak classifiers ##################
|
286: acc_model[kk] <- caret::confusionMatrix(
|
287: table(predict(model_rf, testSet_DM),testSet_DM$classes),
|
288: reference = testSet_DM$classes)$overall['Accuracy']
|
311: acc_model[kk] <- caret::confusionMatrix(
|
313: reference = testSet_DM$classes)$overall['Accuracy']
|
326: acc_model[kk] <- caret::confusionMatrix(
|
328: reference = testSet_DM$classes)$overall['Accuracy']
|
340: acc_model[kk] <- caret::confusionMatrix(
|
342: reference = testSet_DM$classes)$overall['Accuracy']
|
356: acc_model[kk] <- caret::confusionMatrix(
|
358: reference = testSet_DM$classes)$overall['Accuracy']
|
371: acc_model[kk] <- caret::confusionMatrix(
|
373: reference = testSet_DM$classes)$overall['Accuracy']
|
385: acc_model[kk] <- caret::confusionMatrix(
|
387: reference = testSet_DM$classes)$overall['Accuracy']
|
397: acc_model[kk] <- caret::confusionMatrix(
|
399: reference = testSet_DM$classes)$overall['Accuracy']
|
537: colnames(acc_dotplot) <- c("Classifiers","Accuracy")
|
538: print(ggplot(acc_dotplot, aes(x=Classifiers,y=Accuracy)) +
|
539: geom_violin(aes(fill=factor(Classifiers)),na.rm = TRUE)+
|
556: colnames(mcc_dotplot) <- c("Classifiers","MCC")
|
557: print(ggplot(mcc_dotplot, aes(x=Classifiers,y=MCC)) +
|
558: geom_violin(aes(fill=factor(Classifiers)),na.rm = TRUE)+
|
575: colnames(spe_dotplot) <- c("Classifiers","Specificity")
|
576: print(ggplot(spe_dotplot, aes(x=Classifiers,y=Specificity)) +
|
578: geom_violin(aes(fill=factor(Classifiers)),na.rm = TRUE)+
|
595: colnames(sen_dotplot) <- c("Classifiers","Sensitivity")
|
596: print(ggplot(sen_dotplot, aes(x=Classifiers,y=Sensitivity)) +
|
598: geom_violin(aes(fill=factor(Classifiers)),na.rm = TRUE)+
|
616: colnames(ppv_dotplot) <- c("Classifiers","PPV")
|
617: print(ggplot(ppv_dotplot, aes(x=Classifiers,y=PPV)) +
|
619: geom_violin(aes(fill=factor(Classifiers)),na.rm = TRUE)+
|
636: colnames(npv_dotplot) <- c("Classifiers","NPV")
|
637: print(ggplot(npv_dotplot, aes(x=Classifiers,y=NPV)) +
|
639: geom_violin(aes(fill=factor(Classifiers)),na.rm = TRUE)+
|
184: independentClasses <- droplevels(independentClasses)
|
189: datasetClasses <- droplevels(datasetClasses)
|
217: trainingSetClasses <- droplevels(trainingSetClasses)
|
224: testSetClasses <- droplevels(testSetClasses)
|
229: testSetClasses <- as.factor(c(as.character(independentClasses),
|
230: as.character(testSetClasses)))
|
231: testSetClasses <- droplevels(testSetClasses)
|
250: trainingSetClasses2 <- droplevels(trainingSetClasses2)
|
258: testSetClasses2 <- droplevels(testSetClasses2)
|
262: trainingSet_DM <- cbind(trainingSet2,trainingSetClasses2)
|
268: testSet_DM <- cbind(testSet2,testSetClasses2)
|
417: if(predict(model_rf,testSet[ii,]) == levels(testSetClasses)[1])
|
422: if(predict(model_svm,testSet[ii,]) == levels(testSetClasses)[1])
|
427: if(predict(model_nb,testSet[ii,]) == levels(testSetClasses)[1])
|
437: if(predict(model_lr,testSet[ii,]) == levels(testSetClasses)[1])
|
442: if(predict(model_nn,testSet[ii,]) == levels(testSetClasses)[1])
|
447: if(predict(model_pls,testSet[ii,]) == levels(testSetClasses)[1])
|
456: k=3)$CL[,3] == levels(testSetClasses)[1])
|
487: which(testSetClasses == levels(testSetClasses)[1]),,drop=FALSE] == 1)
|
489: which(testSetClasses == levels(testSetClasses)[2]),,drop=FALSE] == 0)
|
491: which(testSetClasses == levels(testSetClasses)[1]),,drop=FALSE] == 0)
|
493: which(testSetClasses == levels(testSetClasses)[2]),,drop=FALSE] == 1)
|
GenomicTuples:R/GTuples-class.R: [ ] |
---|
280: ans_class <- class(x[[1L]])
|
252: ### From GenomicRanges-class.R "For an object with a pure S4 slot
|
292: new(ans_class,
|
314: # NOTE: "c" will error if there is no common class, e.g.
|
318: # stop("Cannot combine ", paste0(unique(sapply(args, class)),
|
324: paste0(unique(vapply(args, class, character(1L))),
|
328: # "c" silently coerces to lowest common class, e.g., c(1, "next")
|
331: # if (!all(sapply(args, class) == class(args[[1]]))) {
|
333: # paste0("Not all elements are same class: ",
|
334: # paste0(unique(sapply(args, class)),
|
337: # "class: ",
|
454: stop("Cannot compute IPD from an empty '", class(x), "'.")
|
480: # (copied from GenomicRanges/GenomicRanges-class.R).
|
500: stop("replacement value must be a '", class(x), "' object")
|
647: cat(class(x), " object with ", lx, " x ",
|
653: cat(class(x), " with 0 tuples and 0 metadata columns:\n", sep = "")
|
9: setClass("GTuples",
|
253: ### representation, these both map to initialize. Reference classes will want
|
635: # the print.classinfo argument.
|
638: showGTuples <- function(x, margin = "", print.classinfo = FALSE,
|
640: if (!identical(print.classinfo, FALSE)) {
|
641: stop("'print.classinfo' not implemented")
|
6: setClassUnion(name = "matrixOrNULL", members = c("matrix", "NULL"))
|
270: #' @importClassesFrom S4Vectors DataFrame
|
637: #' @importFrom S4Vectors makePrettyMatrixForCompactPrinting
|
656: out <- makePrettyMatrixForCompactPrinting(x, .makeNakedMatFromGTuples)
|
S4Vectors:R/DataFrame-class.R: [ ] |
---|
935: to_class <- class(to)[[1L]]
|
998: make_class_info_for_DataFrame_display <- function(x)
|
20: ## class, as well as some of its methods e.g. names(), as.list() and lapply().
|
58: ## class attribute.
|
59: if (class(object) == "DataFrame") {
|
62: ## change of the internals, only a change of the class attribute.
|
64: message("[updateObject] Setting class attribute of DataFrame ",
|
66: class(object) <- class(new("DFrame"))
|
71: message("[updateObject] ", class(object), " object ",
|
210: "Note that starting with BioC 3.10, the class attribute ",
|
219: ## class() is broken when used within a validity method. See:
|
221: #if (class(x) == "DataFrame")
|
319: stop("cannot coerce class \"", class(var)[[1L]], "\" to a DataFrame")
|
500: if (class(x)[[1L]] == "DataFrame")
|
757: hasNonDefaultMethod(droplevels, class(xi)[[1L]]) ||
|
758: hasS3Method("droplevels", class(xi)[[1L]])
|
823: col <- I(col) # set AsIs class to protect column
|
826: df[[1L]] <- unclass(df[[1L]]) # drop AsIs class
|
856: class(from) <- NULL
|
881: class(from) <- "table"
|
937: if (class(from)[[1L]] == "list") {
|
941: if (is(ans, to_class))
|
943: ans <- as(ans, to_class, strict=FALSE)
|
944: ## Even though coercion from DataFrame to 'class(to)' "worked", it
|
961: if (is(from, to_class))
|
963: ans <- as(from, to_class, strict=FALSE)
|
965: stop(wmsg("coercion of ", class(from)[[1L]], " object ",
|
966: "to ", to_class, " didn't preserve its dimensions"))
|
986: function(x) if (class(x) == "DFrame") "DataFrame" else class(x)
|
1029: m <- rbind(make_class_info_for_DataFrame_display(x), m)
|
1038: if (class(object) == "DataFrame") {
|
9: setClass("DataFrame",
|
18: ## DFrame is a concrete DataFrame subclass for representation of in-memory
|
24: setClass("DFrame",
|
305: if (is(listData[[1L]], getClass("Annotated")))
|
854: ### But unclass() causes deep copy
|
878: setOldClass(c("xtabs", "table"))
|
950: ## DataFrame to a DataFrame subclass is that it will set the
|
985: setMethod("classNameForDisplay", "DFrame",
|
1000: vapply(x, function(xi) paste0("<", classNameForDisplay(xi), ">"),
|
1010: cat(classNameForDisplay(x), " with ",
|
989: setMethod("makeNakedCharacterMatrixForDisplay", "DataFrame",
|
1018: m <- makeNakedCharacterMatrixForDisplay(x)
|
1022: m <- rbind(makeNakedCharacterMatrixForDisplay(head(x, nhead)),
|
1024: makeNakedCharacterMatrixForDisplay(tail(x, ntail)))
|
GenomicRanges:R/GenomicRanges-class.R: [ ] |
---|
664: .COL2CLASS <- c(
|
671: classinfo <- makeClassinfoRowForCompactPrinting(x, .COL2CLASS)
|
6: ### TODO: The 'constraint' slot could be moved to the Vector class (or to the
|
7: ### Annotated class) so any Vector object could be constrained.
|
116: msg <- c(class(x), " object contains ", length(idx), " out-of-bound ",
|
134: ### class(ranges(x) == "IRanges")) instead of just an IRanges *object* (i.e.
|
155: if (!(class(ranges(x)) %in% c("IRanges", "StitchedIPos", "UnstitchedIPos")))
|
351: if (class(value) != "IRanges")
|
384: class(x), " objects"))
|
511: ### (d) 'class(ans)' is 'relistToClass(x[[1]])' e.g. CompressedRleList if
|
582: stop(wmsg(class(x), " objects don't support [[, as.list(), ",
|
670: .COL2CLASS <- c(.COL2CLASS, getSlots(class(x))[extra_col_names])
|
708: class(x), " object"))
|
8: setClass("GenomicRanges",
|
27: setClass("GenomicPos",
|
454: ### initialize. Reference classes will want to override 'update'. Other
|
651: print.classinfo=FALSE, print.seqinfo=FALSE,
|
663: if (print.classinfo) {
|
673: stopifnot(identical(colnames(classinfo), colnames(out)))
|
674: out <- rbind(classinfo, out)
|
690: show_GenomicRanges(object, print.classinfo=TRUE, print.seqinfo=TRUE)
|
21: setClassUnion("GenomicRanges_OR_missing", c("GenomicRanges", "missing"))
|
48: ### Extra column slots (added by GRanges subclasses)
|
50: ### The "extra column slots" are parallel slots added by GRanges subclasses
|
640: setMethod("makeNakedCharacterMatrixForDisplay", "GenomicRanges",
|
655: ## makePrettyMatrixForCompactPrinting() assumes that head() and tail()
|
662: out <- makePrettyMatrixForCompactPrinting(xx)
|
DaMiRseq:R/Classif_2_Classes_Training.R: [ ] |
---|
121: class_lev_ckeck <- levels(classes)
|
164: acc.Class<- matrix()
|
181: class_level2 <- levels(classes)
|
222: model_class <- list()
|
419: MCC.Class <- acc.Class
|
420: TP.Class <- acc.Class
|
421: TN.Class <- acc.Class
|
422: FP.Class <- acc.Class
|
423: FN.Class <- acc.Class
|
424: Sensit.Class <- acc.Class
|
425: Specif.Class <- acc.Class
|
426: PPV.Class <- acc.Class
|
427: NPV.Class <- acc.Class
|
430: TP_Class <- colSums(tPred[
|
433: TN_Class <- colSums(tPred[
|
436: FP_Class <- colSums(tPred[
|
439: FN_Class <- colSums(tPred[
|
193: trainingSetClasses2 <- classes[sample_index_train2,
|
201: testSetClasses2 <- classes[sample_index_test2,
|
358: testSetClasses <- testSet_DM$classes
|
14: #' @param classes A class vector with \code{nrow(data)} elements.
|
15: #' Each element represents the class label for each observation.
|
16: #' Two different class labels are allowed. Note. this argument should
|
19: #' (but without 'class' column). Each column represents a different
|
50: #' # selected_features,classes=df$class, fSample.tr.w=0.6, iter=3,
|
86: if(!("class" %in% colnames(colData(data))))
|
87: stop("'class' info is lacking! Include the variable 'class'
|
88: in colData(data) and label it 'class'!")
|
90: classes <- colData(data)$class
|
122: count_cl1 <- length(which(classes %in% class_lev_ckeck[1]))
|
123: count_cl2 <- length(which(classes %in% class_lev_ckeck[2]))
|
183: dim(data)[1]*fSample.tr.w/length(class_level2))
|
184: for (i in seq_len(length(class_level2))){
|
185: sample_index2 <- sample(which(class_level2[i]==classes),
|
237: model_class[[kk]] <- model_rf
|
263: model_class[[kk]] <- model_svm
|
278: model_class[[kk]] <- model_nb
|
287: predict(model_lda, testSet_DM)$class,
|
291: model_class[[kk]] <- model_lda
|
306: model_class[[kk]] <- model_lr
|
321: model_class[[kk]] <- model_nn
|
336: model_class[[kk]] <- model_pls
|
381: if(predict(model_lda,testSet_DM[ii,])$class == levels(testSetClasses)[1])
|
418: acc.Class <- matrix(nrow=1, ncol = ncol(tPred))
|
443: TP.Class <- TP_Class
|
444: TN.Class <- TN_Class
|
445: FP.Class <- FP_Class
|
446: FN.Class <- FN_Class
|
448: acc.Class <- 100 * (TP_Class + TN_Class)/(
|
449: TP_Class + TN_Class + FP_Class + FN_Class)
|
451: MCC.Class <- (TP_Class * TN_Class - FP_Class * FN_Class) /
|
452: sqrt((TP_Class + FP_Class) * (TP_Class + FN_Class) *
|
453: (TN_Class + FP_Class) * (TN_Class + FN_Class))
|
455: Sensit.Class <- TP_Class / (TP_Class + FN_Class)
|
456: Specif.Class <- TN_Class / (TN_Class + FP_Class)
|
457: PPV.Class <- TP_Class / (TP_Class + FP_Class)
|
458: NPV.Class <- TN_Class / (TN_Class + FN_Class)
|
461: acc.Class[which(is.nan(acc.Class))] <- 0
|
462: MCC.Class[which(is.nan(MCC.Class))] <- 0
|
463: Sensit.Class[which(is.nan(Sensit.Class))] <- 0
|
464: Specif.Class[which(is.nan(Specif.Class))] <- 0
|
465: PPV.Class[which(is.nan(PPV.Class))] <- 0
|
466: NPV.Class[which(is.nan(NPV.Class))] <- 0
|
468: acc.Class <- as.data.frame(t(acc.Class))
|
469: MCC.Class <- as.data.frame(t(MCC.Class))
|
470: Sensit.Class <- as.data.frame(t(Sensit.Class))
|
471: Specif.Class <- as.data.frame(t(Specif.Class))
|
472: PPV.Class <- as.data.frame(t(PPV.Class))
|
473: NPV.Class <- as.data.frame(t(NPV.Class))
|
541: output_data_list$classes <- as.factor(class_level2)
|
1: #' @title Train a Binary Classifier using 'Staking' Learning strategy.
|
8: #' classification model building. A 'two-classes' classification task
|
23: #' @param cl_type List of weak classifiers that will compose the
|
29: #' \item The models of each classifier used to build the Ensemble
|
31: #' (over the iteration) for the Ensemble classifier;
|
32: #' \item the weights associated to each weak classifier;
|
49: #' # Classification_res <- DaMiR.EnsL_Train(
|
57: classes,
|
71: # if (missing(classes))
|
72: # stop("'classes' argument must be provided")
|
94: if(missing(classes))
|
95: stop("'classes' argument must be provided when
|
105: if(!(is.factor(classes)))
|
106: stop("'classes' must be a factor")
|
117: if(length(classes) != dim(data)[1])
|
118: stop("length(classes) must be equal to dim(data)[1]")
|
126: # both classes)")
|
159: # cat("You select:",cl_type, "weak classifiers for creating
|
209: colnames(trainingSet_DM) <- c(varNames, "classes")
|
211: formula_DM <- as.formula(paste("classes", varNames1, sep = " ~ ")
|
216: colnames(testSet_DM) <- c(varNames, "classes")
|
220: ############### Weak classifiers ##################
|
232: acc_model[kk] <- caret::confusionMatrix(
|
233: table(predict(model_rf, testSet_DM),testSet_DM$classes),
|
234: reference = testSet_DM$classes)$overall['Accuracy']
|
258: acc_model[kk] <- caret::confusionMatrix(
|
260: reference = testSet_DM$classes)$overall['Accuracy']
|
273: acc_model[kk] <- caret::confusionMatrix(
|
275: reference = testSet_DM$classes)$overall['Accuracy']
|
286: acc_model[kk] <- caret::confusionMatrix(
|
288: reference = testSet_DM$classes)$overall['Accuracy']
|
301: acc_model[kk] <- caret::confusionMatrix(
|
303: reference = testSet_DM$classes)$overall['Accuracy']
|
316: acc_model[kk] <- caret::confusionMatrix(
|
318: reference = testSet_DM$classes)$overall['Accuracy']
|
331: acc_model[kk] <- caret::confusionMatrix(
|
333: reference = testSet_DM$classes)$overall['Accuracy']
|
344: # acc_model[kk] <- caret::confusionMatrix(
|
347: # reference = testSet_DM$classes)$overall['Accuracy']
|
542: output_data_list$positiveClass <- levels(classes)[1]
|
195: trainingSetClasses2 <- droplevels(trainingSetClasses2)
|
203: testSetClasses2 <- droplevels(testSetClasses2)
|
207: trainingSet_DM <- cbind(trainingSet2,trainingSetClasses2)
|
214: testSet_DM <- cbind(testSet2,testSetClasses2)
|
366: if(predict(model_rf,testSet_DM[ii,]) == levels(testSetClasses)[1])
|
371: if(predict(model_svm,testSet_DM[ii,]) == levels(testSetClasses)[1])
|
376: if(predict(model_nb,testSet_DM[ii,]) == levels(testSetClasses)[1])
|
386: if(predict(model_lr,testSet_DM[ii,]) == levels(testSetClasses)[1])
|
391: if(predict(model_nn,testSet_DM[ii,]) == levels(testSetClasses)[1])
|
396: if(predict(model_pls,testSet_DM[ii,]) == levels(testSetClasses)[1])
|
405: k=3)$CL[,3] == levels(testSetClasses)[1])
|
431: which(testSetClasses == levels(testSetClasses)[1]),
|
434: which(testSetClasses == levels(testSetClasses)[2]),
|
437: which(testSetClasses == levels(testSetClasses)[1]),
|
440: which(testSetClasses == levels(testSetClasses)[2]),
|
GenomicAlignments:R/GAlignmentPairs-class.R: [ ] |
---|
700: .PAIR_COL2CLASS <- c(
|
704: .HALVES_COL2CLASS <- c(
|
707: .COL2CLASS <- c(.PAIR_COL2CLASS,
|
23: ### Combine the new "parallel slots" with those of the parent class. Make
|
24: ### sure to put the new parallel slots **first**. See R/Vector-class.R file
|
53: ### x[i] - GAlignmentPairs object of the same class as 'x'
|
335: ### GAlignmentPairs class is changed to derive from CompressedList.
|
355: ### class is changed to derive from CompressedList.
|
691: cat(class(x), " object with ",
|
709: .HALVES_COL2CLASS,
|
711: .HALVES_COL2CLASS)
|
713: S4Vectors:::makeClassinfoRowForCompactPrinting(x, .COL2CLASS)
|
7: setClass("GAlignmentPairs",
|
686: print.classinfo=FALSE,
|
699: if (print.classinfo) {
|
712: classinfo <-
|
715: stopifnot(identical(colnames(classinfo), colnames(out)))
|
716: out <- rbind(classinfo, out)
|
733: print.classinfo=TRUE, print.seqinfo=TRUE)
|
697: out <- S4Vectors:::makePrettyMatrixForCompactPrinting(x,
|
SparseArray:R/COO_SparseArray-class.R: [ ] |
---|
210: ans_class <- "COO_SparseMatrix"
|
321: .make_sparseMatrix_from_COO_SparseMatrix <- function(from, to_type,
|
350: .from_COO_SparseMatrix_to_dgCMatrix <- function(from)
|
353: .from_COO_SparseMatrix_to_lgCMatrix <- function(from)
|
359: .from_COO_SparseMatrix_to_dgRMatrix <- function(from)
|
362: .from_COO_SparseMatrix_to_lgRMatrix <- function(from)
|
14: ### - The SparseArray API (see SparseArray-class.R)
|
17: ### - Back and forth coercion between COO_SparseArray and [d|l]g[C|R]Matrix
|
18: ### objects from the Matrix package
|
75: ### altering (and breaking) our class hierarchy. This is not only conceptually
|
212: ans_class <- "COO_SparseArray"
|
215: new2(ans_class, dim=dim, dimnames=dimnames,
|
318: ### Going back and forth between COO_SparseMatrix and [d|l]g[C|R]Matrix objects
|
319: ### from the Matrix package:
|
401: setAs("Matrix", "COO_SparseArray", function(from) as(from, "COO_SparseMatrix"))
|
21: setClass("COO_SparseArray",
|
35: setClass("COO_SparseMatrix",
|
36: contains=c("COO_SparseArray", "SparseMatrix"),
|
46: ### Going back and forth between COO_SparseArray and COO_SparseMatrix
|
49: ### --- From COO_SparseArray to COO_SparseMatrix ---
|
52: ### COO_SparseMatrix. Problem is that the automatic coercion method from
|
53: ### COO_SparseArray to COO_SparseMatrix silently returns a broken object
|
56: ### will fail (as expected) thanks to the validity method for SparseMatrix
|
58: setAs("COO_SparseArray", "COO_SparseMatrix",
|
59: function(from) new("COO_SparseMatrix", from)
|
62: ### --- From COO_SparseMatrix to COO_SparseArray ---
|
64: ### The user should NOT be able to demote a COO_SparseMatrix object to
|
66: ### should fail or do nothing when 'x' is a COO_SparseMatrix object, even
|
70: setAs("COO_SparseMatrix", "COO_SparseArray", function(from) from) # no-op
|
74: ### make COO_SparseMatrix a **direct** extension of SparseArray, thus
|
77: ### COO_SparseMatrix object 'x' does not find the method for SparseArray
|
81: setMethod("coerce", c("COO_SparseMatrix", "SparseArray"),
|
314: setAs("ANY", "COO_SparseMatrix",
|
315: function(from) as(.dense2sparse(from), "COO_SparseMatrix")
|
324: stopifnot(is(from, "COO_SparseMatrix"))
|
330: ## in the "x" slot of the resulting dgCMatrix or lgCMatrix object.
|
344: CsparseMatrix(dim(from), i, j, nzdata, dimnames=dimnames(from))
|
346: RsparseMatrix(dim(from), i, j, nzdata, dimnames=dimnames(from))
|
351: .make_sparseMatrix_from_COO_SparseMatrix(from, "double", "C")
|
354: .make_sparseMatrix_from_COO_SparseMatrix(from, "logical", "C")
|
356: setAs("COO_SparseMatrix", "dgCMatrix", .from_COO_SparseMatrix_to_dgCMatrix)
|
357: setAs("COO_SparseMatrix", "lgCMatrix", .from_COO_SparseMatrix_to_lgCMatrix)
|
360: .make_sparseMatrix_from_COO_SparseMatrix(from, "double", "R")
|
363: .make_sparseMatrix_from_COO_SparseMatrix(from, "logical", "R")
|
365: setAs("COO_SparseMatrix", "dgRMatrix", .from_COO_SparseMatrix_to_dgRMatrix)
|
366: setAs("COO_SparseMatrix", "lgRMatrix", .from_COO_SparseMatrix_to_lgRMatrix)
|
368: .make_COO_SparseMatrix_from_dgCMatrix_or_lgCMatrix <-
|
378: .make_COO_SparseMatrix_from_dgRMatrix_or_lgRMatrix <-
|
388: setAs("dgCMatrix", "COO_SparseMatrix",
|
389: function(from) .make_COO_SparseMatrix_from_dgCMatrix_or_lgCMatrix(from)
|
391: setAs("lgCMatrix", "COO_SparseMatrix",
|
392: function(from) .make_COO_SparseMatrix_from_dgCMatrix_or_lgCMatrix(from)
|
394: setAs("dgRMatrix", "COO_SparseMatrix",
|
395: function(from) .make_COO_SparseMatrix_from_dgRMatrix_or_lgRMatrix(from)
|
397: setAs("lgRMatrix", "COO_SparseMatrix",
|
398: function(from) .make_COO_SparseMatrix_from_dgRMatrix_or_lgRMatrix(from)
|
IRanges:R/IPos-class.R: [ ] |
---|
495: object_class <- classNameForDisplay(object)
|
534: .COL2CLASS <- c(pos="integer")
|
535: classinfo <- makeClassinfoRowForCompactPrinting(x, .COL2CLASS)
|
15: ### Combine the new "parallel slots" with those of the parent class. Make
|
16: ### sure to put the new parallel slots **first**. See R/Vector-class.R file
|
30: ### Combine the new "parallel slots" with those of the parent class. Make
|
31: ### sure to put the new parallel slots **first**. See R/Vector-class.R file
|
52: "Starting with BioC 3.10, the class attribute of all ",
|
60: if (class(x) == "IPos")
|
110: if (class(object) != "IPos")
|
121: message("[updateObject] ", class(object), " object is current.\n",
|
127: message("[updateObject] ", class(object), " object ",
|
132: if (class(object) == "UnstitchedIPos") {
|
379: stop(wmsg("all the ranges in the ", class(from), " object to ",
|
499: paste0(object_class, " object with ", object_len, " ",
|
522: stop(c(wmsg("This ", class(x), " object uses internal representation ",
|
7: setClass("IPos",
|
23: setClass("UnstitchedIPos",
|
38: setClass("StitchedIPos",
|
518: show_IPos <- function(x, margin="", print.classinfo=FALSE)
|
533: if (print.classinfo) {
|
537: stopifnot(identical(colnames(classinfo), colnames(out)))
|
538: out <- rbind(classinfo, out)
|
549: function(object) show_IPos(object, print.classinfo=TRUE)
|
514: setMethod("makeNakedCharacterMatrixForDisplay", "IPos",
|
529: ## makePrettyMatrixForCompactPrinting() assumes that head() and tail()
|
532: out <- makePrettyMatrixForCompactPrinting(xx)
|