diff --git a/R/NetworkDataCompanion.R b/R/NetworkDataCompanion.R index 96c8162..2cccd5f 100644 --- a/R/NetworkDataCompanion.R +++ b/R/NetworkDataCompanion.R @@ -302,6 +302,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", # Function to map to probes to a gene-level measurement # probe_gene_map is in the format output from the mapProbesToGenes function + # genesOfInterest is a character vector, one gene per entry # not all genesOfInterest need to be in probe_gene_map, but if none are, then this is meaningless probeToMeanPromoterMethylation = function(methylation_betas, probe_gene_map, @@ -331,12 +332,6 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", data.frame(check.names=F) } - # ## split the probe map to a long form where there are multiple genes mapped to the same probe - # mappedBetasLong = mappedBetas %>% - # separate_rows(geneNames, sep = ";") %>% - # drop_na(geneNames) %>% - # data.frame(check.names = F) - ## map probe-level methylation to the mean for each gene betaMeans = mappedBetasLong %>% group_by(geneNames) %>% @@ -375,12 +370,8 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", # map methylation to gene level # methylation betas should be samples in rows # and CGs in columns - # luad for testing - # methylation_betas = fread("~/Desktop/tcga_luad_methylations.txt",data.table=F) - # row.names(methylation_betas) = methylation_betas$probeID - # array = "450k" - - row.names(methylation_betas) = methylation_betas$probeID + + row.names(methylation_betas) = methylation_betas$probeID geneLevelMeth = methylation_betas %>% dplyr::select(-probeID) %>% diff --git a/man/probeToMeanPromoterMethylation.Rd b/man/probeToMeanPromoterMethylation.Rd index 7c63e16..56eaafe 100644 --- a/man/probeToMeanPromoterMethylation.Rd +++ b/man/probeToMeanPromoterMethylation.Rd @@ -8,7 +8,9 @@ \arguments{ \item{methylation_betas}{A data frame of methylation beta values, with CGs in rows and samples in columns. The first column must be "probeID" and contain the Illumina probeIDs matching the probe_gene_map argument or a subset thereof.} \item{probe_gene_map}{Output from mapProbesToGenes, or otherwise a bespoke matrix with four columns: probeID, geneName, ensemblID, distToTSS.} - \item{genesOfInterest}{Character vector of gene names for which mean promoter methylation should be calculated.} + \item{genesOfInterest}{Character vector of gene names for which mean promoter methylation should be calculated. + Note that each entry in the vector should contain only one gene and that gene should not be repeated in the entry; e.g., \code{c("ASMTL","CRLF2")} is a correct input while \code{c("ASMTL;ASMTL", "CRLF2")} will fail to find probes mapping to ASMTL. + This could happen, for example, if you pull a column of genes from a resource that combines splice variants with a semicolon.} } \value{Matrix of samples in rows and genes in columns. row.names stores sample names and colnames stores gene names.