From 616b5be251dd8931efc2fb0310590ad55a0e4a94 Mon Sep 17 00:00:00 2001 From: "soel.micheletti" Date: Wed, 13 Nov 2024 00:27:51 +0100 Subject: [PATCH] Refactoring for Github actions --- DESCRIPTION | 17 ++++- NAMESPACE | 3 +- R/NetworkDataCompanion.R | 106 +++++++++----------------- man/NetworkDataCompanion.Rd | 2 +- man/convertBetaToM.Rd | 4 +- man/estimateCellCountsEpiSCORE.Rd | 4 +- man/extractSampleAndGeneInfo.Rd | 21 +---- man/filterBarcodesIntersection.Rd | 4 +- man/filterChromosome.Rd | 4 +- man/filterDuplicatesSeqDepth.Rd | 4 +- man/filterDuplicatesSeqDepthOther.Rd | 4 +- man/filterGenesByTPM.Rd | 4 +- man/filterGenesProteins.Rd | 10 +-- man/filterPurity.Rd | 4 +- man/filterSampleType.Rd | 4 +- man/filterTumorType.Rd | 4 +- man/geneNameToENSG.Rd | 4 +- man/getGeneInfo.Rd | 4 +- man/logCPMNormalization.Rd | 8 +- man/logTPMNormalization.Rd | 4 +- man/mapBarcodeToBarcode.Rd | 11 +-- man/mapProbesToGenes.Rd | 16 +--- man/probeToMeanPromoterMethylation.Rd | 8 +- 23 files changed, 92 insertions(+), 162 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1000500..b8e637a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,20 @@ Package: NetworkDataCompanion Title: Tools for Analyzing TCGA and GTEx Data Version: 0.0.0.9000 Authors@R: - person("First", "Last", , "first.last@example.com", role = c("aut", "cre"), - comment = c(ORCID = "YOUR-ORCID-ID")) + person("Soel", "Micheletti", , "smicheletti@hsph.harvard.edu", role = c("aut", "cre"), + comment = c(ORCID = "0000-0001-5402-9237")) + person("Chen", "Chen", + email = "",role = "aut", comment = c(ORCID = "0000-0002-8042-7201")), + person("Kate", "Shutta", + email = "",role = "aut", comment = c(ORCID = "0000-0003-0402-3771")), + person("Panagiotis", "Mandros", , "pmandros@hsph.harvard.edu", role = c("aut", "cre"), + comment = c(ORCID = "0009-0008-9638-9722")), + person("Viola", "Fanfani", , "vfanfani@hsph.harvard.edu", role = c("aut", "cre"), + comment = c(ORCID = "0000-0003-3852-6908")), + person("Jonas", "Fischer", , "jfischer@hsph.harvard.edu", role = c("aut", "cre"), + comment = c(ORCID = "0000-0000-0000-0000")), +Author: Soel Micheletti +Maintainer: Kate Hoff Shutta Description: An R library of utilities for performing analyses on TCGA and GTEx data using the Network Zoo (https://netzoo.github.io). License: GPL-3 biocViews: @@ -16,6 +28,7 @@ Depends: GenomicDataCommons, huge, magrittr, + methods, org.Hs.eg.db, presto, recount, diff --git a/NAMESPACE b/NAMESPACE index 06147fd..8c04023 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,4 +1,5 @@ # Generated by roxygen2: do not edit by hand -export("CreateNetworkDataCompanionObject") +export(CreateNetworkDataCompanionObject) exportClasses(NetworkDataCompanion) +import(methods) diff --git a/R/NetworkDataCompanion.R b/R/NetworkDataCompanion.R index 24b5ab8..cd67eb8 100644 --- a/R/NetworkDataCompanion.R +++ b/R/NetworkDataCompanion.R @@ -1,4 +1,5 @@ -#' @export +#' @import methods +#' @exportClass NetworkDataCompanion NetworkDataCompanion=setRefClass("NetworkDataCompanion", fields = list(TCGA_purities= "data.frame", @@ -11,7 +12,6 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ## Returns a named list with rds_sample_info corresponding to meta information about the samples (columns) ## and rds_gene_info corresponding to meta information about genes (rows) ## 20220913: man page done - #' @export extractSampleAndGeneInfo = function(expression_rds_obj){ return(list(rds_sample_info=as.data.frame(colData(expression_rds_obj)), rds_gene_info=as.data.frame(rowRanges(expression_rds_obj)))) @@ -28,7 +28,6 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ## exp1[,is_inter1] --- this will remove samples that are not in exp2 ## exp2[,idcs1[is_inter1]] --- this will remove samples that are not in exp1 and reorder to match exp1 ## 20220920 man page done - #' @export mapBarcodeToBarcode = function(bc1, bc2){ if(class(bc1) != "character" | class(bc2) != "character"){ stop("Error: barcodes need to be vectors of strings") @@ -42,7 +41,6 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ## returns a list of the two argument data frames, intersected, and the second frame ordered to match the first ## NOTE: Ordering is done based on columns, which are expected to be named by TCGA barcodes ## 20220920 man page done - #' @export filterBarcodesIntersection = function(exp1, exp2){ if(!("data.frame" %in% class(exp1) | "matrix" %in% class(exp1)) ){ stop("Error: argument 1 needs to be data.frame or matrix") @@ -60,7 +58,6 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ## TPM data.frame (useful for TPM based filtering, see filterGenesByNormExpression) ## and the actual logTPM which corresponds to log(TPM + 1) ## 20220920 man page done - #' @export logTPMNormalization = function(expression_rds_obj){ if(class(expression_rds_obj) != "RangedSummarizedExperiment"){ stop("Error: expression matrices need to be an RSE object") @@ -77,7 +74,6 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ## Returns a named list with the count data.frame (useful for duplicate filtering based on sequencing depth, see filterDuplicatesSeqDepth) ## CPM data.frame (useful for CPM based filtering, see filterGenesByCPM) ## and the actual logCPM which corresponds to log(CPM + 1) - #' @export logCPMNormalization = function(exp_count_mat){ if(sum(class(exp_count_mat) %in% c("data.frame", "matrix")) == 0){ stop("Error: expression must be a matrix") @@ -96,40 +92,33 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", #### more methods go here # maybe have this presaved in class - #' @export extractSampleOnly = function(TCGA_barcodes){ return(sapply(TCGA_barcodes, substr, 1, 12)) }, - #' @export - extractSampleAndType = function(TCGA_barcodes){ + extractSampleAndType = function(TCGA_barcodes){ return(sapply(TCGA_barcodes, substr, 1, 15)) }, - #' @export - extractSampleAndTypeAndVial = function(TCGA_barcodes){ + extractSampleAndTypeAndVial = function(TCGA_barcodes){ return(sapply(TCGA_barcodes, substr, 1, 16)) }, - #' @export extractSampleType = function(TCGA_barcodes){ return(sapply(TCGA_barcodes, substr, 14, 15)) }, - #' @export - extractVialOnly = function(TCGA_barcodes){ + extractVialOnly = function(TCGA_barcodes){ return(sapply(TCGA_barcodes, substr, 16, 16)) }, - #' @export findDuplicates = function(TCGA_barcodes){ dupPos = duplicated(extractSampleAndTypeAndVial(TCGA_barcodes)) return(TCGA_barcodes[dupPos]) }, # UUIDs is a character vector - #' @export - mapNewUUIDVersion = function(UUIDs) + mapNewUUIDVersion = function(UUIDs) { updateUUIDVersion = function(x){ newUUID = TCGAutils::UUIDhistory(x) %>% dplyr::filter(file_change != "superseded") %>% @@ -143,8 +132,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", }, # UUIDs is a character vector (can be of length 1) - #' @export - mapUUIDtoTCGA = function(UUIDs){ + mapUUIDtoTCGA = function(UUIDs){ if(class(UUIDs) != "character"){ stop("Error: Expected UUID argument to be a character vector") } @@ -181,8 +169,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", # long form: returns one row per gene, so if a probe maps # to the TSS of two different genes, each of those gets a row # default if probelist is NULL is to map all the probes in the manifest - #' @export - mapProbesToGenes = function(probelist = NULL, + mapProbesToGenes = function(probelist = NULL, rangeUp = 200, rangeDown = 0, localManifestPath=NA, @@ -290,8 +277,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 # not all genesOfInterest need to be in probe_gene_map, but if none are, then this is meaningless - #' @export - probeToMeanPromoterMethylation = function(methylation_betas, + probeToMeanPromoterMethylation = function(methylation_betas, probe_gene_map, genesOfInterest = NULL){ @@ -336,15 +322,13 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", # Input to convertBetaToM is a vector of methylation betas # User should use this function with `apply` to convert a matrix # 20220920 man page done - #' @export - convertBetaToM = function(methylation_betas){ + convertBetaToM = function(methylation_betas){ M = log2(methylation_betas/(1-methylation_betas)) return(M) }, ## Run EPISCORE to estimate cell counts - #' @export - estimateCellCountsEpiSCORE = function(methylation_betas, tissue, array = "450k"){ + estimateCellCountsEpiSCORE = function(methylation_betas, tissue, array = "450k"){ tissue_options = c("Bladder", "Brain", "Breast", @@ -447,8 +431,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", }, ## Extract AHRR methylation at probe site cg05575921 as a proxy for smoking status - #' @export - extractAHRRMethylation = function(methylation_betas) + extractAHRRMethylation = function(methylation_betas) { ahrr = methylation_betas %>% dplyr::filter(probeID == "cg05575921") %>% @@ -461,8 +444,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ## Filter out all duplicates based on sequencing depth ## Returns indices about which samples to KEEP ## 20220920 man page done - #' @export - filterDuplicatesSeqDepth = function(expression_count_matrix){ + filterDuplicatesSeqDepth = function(expression_count_matrix){ sample_barcodes <- extractSampleAndType(colnames(expression_count_matrix)) seq_depth <- colSums(expression_count_matrix) duplicate_throwout <- rep(NA, ncol(expression_count_matrix)) @@ -485,8 +467,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ## Filter out all duplicates based on sequencing depth, take random one if no info on seq depth for all vials ## Returns indices in given tcga barcodes to KEEP ## 20220920 man page done - #' @export - filterDuplicatesSeqDepthOther = function(expression_count_matrix, tcga_barcodes){ + filterDuplicatesSeqDepthOther = function(expression_count_matrix, tcga_barcodes){ sample_vials_ge <- extractSampleAndTypeAndVial(colnames(expression_count_matrix)) seq_depth <- colSums(expression_count_matrix) duplicate_throwout <- rep(NA, length(tcga_barcodes)) @@ -524,8 +505,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ## Filter samples indicated by *TCGA_barcodes* based on the method *method* and threshold *threshold* ## Returns a list of indices indicating which samples should be kept ## 20220920 Man page done - #' @export - filterPurity = function(TCGA_barcodes, method="ESTIMATE", threshold=.6){ + filterPurity = function(TCGA_barcodes, method="ESTIMATE", threshold=.6){ if(class(TCGA_barcodes) != "character"){ stop("Error: Expected TCGA_barcodes argument to be vector of strings") } @@ -545,8 +525,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", }, # return tissue type given an input barcode - #' @export - getTissueType = function(TCGA_barcode) + getTissueType = function(TCGA_barcode) { this_sample = substr(str_split(TCGA_barcode,"-",simplify=T)[1,4],1,2) if(!this_sample%in% sample_type_mapping$numcode) @@ -566,8 +545,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", return(sample_type_mapping) }, ## Filtering samples in an rds with particular sample types (e.g., "Primary Tumor", "Solid Tissue Normal", "Primary Blood Derived Cancer - Peripheral Blood") - #' @export - filterSampleType = function(TCGA_barcodes, types_of_samples){ + filterSampleType = function(TCGA_barcodes, types_of_samples){ if(class(TCGA_barcodes) != "character"){ stop("Error: TCGA_barcodes argument needs to be a character vector") } @@ -591,8 +569,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", }, ## Filtering all tumor samples (e.g. barcode sample types {01,..09}) - #' @export - filterTumorSamples = function(TCGA_barcodes){ + filterTumorSamples = function(TCGA_barcodes){ if(class(TCGA_barcodes) != "character"){ stop("Error: TCGA_barcodes argument needs to be a character vector") } @@ -606,8 +583,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", }, ## Filtering all normal samples (e.g. barcode sample types {10,..19}) - #' @export - filterNormalSamples = function(TCGA_barcodes){ + filterNormalSamples = function(TCGA_barcodes){ if(class(TCGA_barcodes) != "character"){ stop("Error: TCGA_barcodes argument needs to be a character vector") } @@ -621,8 +597,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", }, ## Filtering all control samples (e.g. barcode sample types {20,..29}) - #' @export - filterControlSamples = function(TCGA_barcodes){ + filterControlSamples = function(TCGA_barcodes){ if(class(TCGA_barcodes) != "character"){ stop("Error: TCGA_barcodes argument needs to be a character vector") } @@ -638,8 +613,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ## Filter out protein coding genes based on rds info - #' @export - filterGenesProteins = function(rds_gene_info){ + filterGenesProteins = function(rds_gene_info){ if(class(rds_gene_info) != "data.frame"){ stop("Error: gene info argument should be a data.frame. Best \ use extractSampleAndGeneInfo function to retrieve this information \ @@ -651,8 +625,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ## Filter all genes which have at least *norm_threshold* scores (of normalized gene expression) in at least *sample_fraction* of samples ## expression_matrix should be TPM or CPM values (NOT log scaled) ## sample_fraction should be in [0,1] - #' @export - filterGenesByNormExpression = function(expression_matrix, norm_threshold, sample_fraction){ + filterGenesByNormExpression = function(expression_matrix, norm_threshold, sample_fraction){ if(sum(class(expression_matrix) %in% c("data.frame","matrix")) == 0) { stop("Error: expression_matrix argument should be a data.frame") } @@ -668,8 +641,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", }, ## 20220921 man page done - #' @export - filterChromosome = function(rds_gene_info, chroms){ + filterChromosome = function(rds_gene_info, chroms){ if(class(rds_gene_info) != "data.frame"){ stop("Error: gene info argument should be a data.frame. Best \ use extractSampleAndGeneInfo function to retrieve this information \ @@ -684,8 +656,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ##gets gene information from gencode given a list of genes names or ids from the gene mapping variable ##automatically infers whether ensmbl ID or name or entrez ##automatically infers whether version (i.e., the dot) exists in ensemble ID - #' @export - getGeneInfo = function(gene_names_or_ids_or_entrezs){ + getGeneInfo = function(gene_names_or_ids_or_entrezs){ is_id <- any(grepl("ENSG", gene_names_or_ids_or_entrezs, fixed=TRUE)) is_entrez <- any(grepl("^\\d+$", gene_names_or_ids_or_entrezs)) @@ -712,8 +683,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", }, ## the version corresponds to whether we want the . and number after from gene ids - #' @export - geneEntrezToENSG = function(gene_entrezs, version = FALSE){ + geneEntrezToENSG = function(gene_entrezs, version = FALSE){ if(!("gene_entrez" %in% colnames(gene_mapping))) { stop('Column gene_entrez not found in gene mapping.') @@ -728,8 +698,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", return(to_return) }, - #' @export - geneENSGToName = function(gene_ids){ + geneENSGToName = function(gene_ids){ to_return <- getGeneInfo(gene_ids) if(anyNA(to_return$gene_name)){ print('Not all ensembl IDs were mapped to names') @@ -737,8 +706,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", return(to_return[c('gene_id_no_ver','gene_name')]) }, - #' @export - geneENSGToEntrez = function(gene_ids){ + geneENSGToEntrez = function(gene_ids){ if(!("gene_entrez" %in% colnames(gene_mapping))) { stop('Column gene_entrez not found in gene mapping.') @@ -750,8 +718,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", return(to_return[c('gene_id_no_ver','gene_entrez')]) }, - #' @export - geneNameToEntrez = function(gene_names){ + geneNameToEntrez = function(gene_names){ if(!("gene_entrez" %in% colnames(gene_mapping))) { stop('Column gene_entrez not found in gene mapping') @@ -765,8 +732,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", return(to_return) }, - #' @export - geneEntrezToName = function(gene_entrezs){ + geneEntrezToName = function(gene_entrezs){ if(!("gene_entrez" %in% colnames(gene_mapping))) { stop('Column gene_entrez not found in gene mapping') @@ -781,8 +747,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", }, ## the version corresponds to whether we want the . and number after from gene ids - #' @export - geneNameToENSG = function(gene_names, version = FALSE){ + geneNameToENSG = function(gene_names, version = FALSE){ to_return <- getGeneInfo(gene_names) if(version == TRUE){ to_return <- to_return[c('gene_name','gene_id')] @@ -793,8 +758,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", return(to_return) }, - #' @export - getGeneIdcs = function(gene_names, rds_gene_info){ + getGeneIdcs = function(gene_names, rds_gene_info){ if(class(rds_gene_info) != "data.frame"){ stop("Error: gene info argument should be a data.frame. Best \ use extractSampleAndGeneInfo function to retrieve this information \ @@ -806,16 +770,14 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", return(match(gene_names, rds_gene_info$gene_name)) }, - #' @export - getStage = function(TCGA_barcodes){ + getStage = function(TCGA_barcodes){ sample_names <- extractSampleOnly(TCGA_barcodes) stage_names <- clinical_patient_data$bcr_patient_barcode stages <- clinical_patient_data$ajcc_pathologic_tumor_stage[match(sample_names, stage_names)] return(stages) }, - #' @export - getSex = function(TCGA_barcodes){ + getSex = function(TCGA_barcodes){ sample_names <- extractSampleOnly(TCGA_barcodes) sex_names <- clinical_patient_data$bcr_patient_barcode sex <- clinical_patient_data$gender[match(sample_names, sex_names)] @@ -828,7 +790,7 @@ NetworkDataCompanion=setRefClass("NetworkDataCompanion", ### like preparing and creating your object before you can use the methods above ### the export decorator is for roxygen to know which methods to export -#' @export "CreateNetworkDataCompanionObject" +#' @export CreateNetworkDataCompanionObject CreateNetworkDataCompanionObject <- function(clinical_patient_file=NULL, project_name="default_project"){ ## Load purities for purity package diff --git a/man/NetworkDataCompanion.Rd b/man/NetworkDataCompanion.Rd index f3caf9d..af5e05b 100644 --- a/man/NetworkDataCompanion.Rd +++ b/man/NetworkDataCompanion.Rd @@ -1,5 +1,5 @@ \name{NetworkDataCompanion} -\alias{NetworkDataCompanion} +\alias{\S4method{NetworkDataCompanion}} \title{A package for easy and reproducible wrangling of TCGA and GTEx data.} diff --git a/man/convertBetaToM.Rd b/man/convertBetaToM.Rd index e78d6c6..db03476 100644 --- a/man/convertBetaToM.Rd +++ b/man/convertBetaToM.Rd @@ -1,12 +1,12 @@ \name{convertBetaToM} -\alias{convertBetaToM} +\alias{\S4method{convertBetaToM}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{Convert methylation beta values to M-values.} \description{ This function uses the typical logit base 2 transformation to convert from methylation beta values (in the [0,1] range) to m-values (on the real line). The formula is m = log2(beta/(1-beta)). } \usage{ -convertBetaToM(methylation_betas) +\S4method{convertBetaToM}{NetworkDataCompanion}(methylation_betas) } %- maybe also 'usage' for other objects documented here. \arguments{ diff --git a/man/estimateCellCountsEpiSCORE.Rd b/man/estimateCellCountsEpiSCORE.Rd index 1c9c84b..e071ee5 100644 --- a/man/estimateCellCountsEpiSCORE.Rd +++ b/man/estimateCellCountsEpiSCORE.Rd @@ -1,12 +1,12 @@ \name{estimateCellCountsEpiSCORE} -\alias{estimateCellCountsEpiSCORE} +\alias{\S4method{estimateCellCountsEpiSCORE}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{Run the EpiSCORE algorithm to estimate cell type proportions.} \description{ This function applies the `constAvBetaTSS` and `wRPC` functions from the EpiSCORE R package within the TCGA data structure. The `wRPC` parameters used are the defaults: `useW=TRUE`, `wth=0.4`, and `maxit=100`. } \usage{ -estimateCellCountsEpiSCORE(methylation_betas, tissue, array = "450k") +\S4method{estimateCellCountsEpiSCORE}{NetworkDataCompanion}(methylation_betas, tissue, array = "450k") } %- maybe also 'usage' for other objects documented here. \arguments{ diff --git a/man/extractSampleAndGeneInfo.Rd b/man/extractSampleAndGeneInfo.Rd index daa9c0d..e6523ff 100644 --- a/man/extractSampleAndGeneInfo.Rd +++ b/man/extractSampleAndGeneInfo.Rd @@ -1,22 +1,19 @@ \name{extractSampleAndGeneInfo} -\alias{extractSampleAndGeneInfo} +\alias{\S4method{extractSampleAndGeneInfo}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Extracts experiment-specific information and metadata from ranged summarized experiment object. } \description{ -%% ~~ A concise (1-5 lines) description of what the function does. ~~ +Extracts experiment-specific information and metadata from ranged summarized experiment object. } \usage{ -extractSampleAndGeneInfo(expression_rds_obj) +\S4method{extractSampleAndGeneInfo}{NetworkDataCompanion}(expression_rds_obj) } %- maybe also 'usage' for other objects documented here. \arguments{ \item{expression_rds_obj}{A ranged summarized experiment object} } -\details{ -%% ~~ If necessary, more details than the description above ~~ -} \value{ %% ~Describe the value returned %% If it is a LIST, use @@ -26,20 +23,8 @@ extractSampleAndGeneInfo(expression_rds_obj) \item{rds_sample_info}{metadata about the samples (columns)} \item{rds_gene_info}{metadata about the genes (rows)} } -\references{ -%% ~put references to the literature/web site here ~ -} \author{ Jonas Fischer (jfischer@hsph.harvard.edu) } -\note{ -%% ~~further notes~~ -} %% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ -} -\examples{ -} diff --git a/man/filterBarcodesIntersection.Rd b/man/filterBarcodesIntersection.Rd index 24c460a..f4f6049 100644 --- a/man/filterBarcodesIntersection.Rd +++ b/man/filterBarcodesIntersection.Rd @@ -1,5 +1,5 @@ \name{filterBarcodesIntersection} -\alias{filterBarcodesIntersection} +\alias{\S4method{filterBarcodesIntersection}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Convenience wrapper function for \code{mapBarcodeToBarcode} that applies the function directly to two data frames. @@ -8,7 +8,7 @@ Convenience wrapper function for \code{mapBarcodeToBarcode} that applies the fun This function returns a list of the two argument data frames, intersected, and the second frame ordered to match the first. NOTE: Ordering is done based on columns, which are expected to be named by TCGA barcodes. } \usage{ -filterBarcodesIntersection(exp1, exp2) +\S4method{filterBarcodesIntersection}{NetworkDataCompanion}(exp1, exp2) } %- maybe also 'usage' for other objects documented here. \arguments{ diff --git a/man/filterChromosome.Rd b/man/filterChromosome.Rd index a689321..0e2b6df 100644 --- a/man/filterChromosome.Rd +++ b/man/filterChromosome.Rd @@ -1,5 +1,5 @@ \name{filterChromosome} -\alias{filterChromosome} +\alias{\S4method{filterChromosome}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Filter for genes in a particular chromosome or chromosomes. @@ -8,7 +8,7 @@ Filter for genes in a particular chromosome or chromosomes. This function filters for genes in a particular chromosome or chromosomes. } \usage{ -filterChromosome(rds_gene_info, chroms) +\S4method{filterChromosome}{NetworkDataCompanion}(rds_gene_info, chroms) } %- maybe also 'usage' for other objects documented here. \arguments{ diff --git a/man/filterDuplicatesSeqDepth.Rd b/man/filterDuplicatesSeqDepth.Rd index 5b99117..f8fd201 100644 --- a/man/filterDuplicatesSeqDepth.Rd +++ b/man/filterDuplicatesSeqDepth.Rd @@ -1,5 +1,5 @@ \name{filterDuplicatesSeqDepth} -\alias{filterDuplicatesSeqDepth} +\alias{\S4method{filterDuplicatesSeqDepth}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{ A function to filter duplicates based on RNA sequencing depth. @@ -8,7 +8,7 @@ A function to filter duplicates based on RNA sequencing depth. This function filters out duplicates based on RNA-seq, keeping the samples with maximum read depth. Returns indices of samples to KEEP. } \usage{ -filterDuplicatesSeqDepth(expression_count_matrix) +\S4method{filterDuplicatesSeqDepth}{NetworkDataCompanion}(expression_count_matrix) } %- maybe also 'usage' for other objects documented here. \arguments{ diff --git a/man/filterDuplicatesSeqDepthOther.Rd b/man/filterDuplicatesSeqDepthOther.Rd index ef26db0..49f35b3 100644 --- a/man/filterDuplicatesSeqDepthOther.Rd +++ b/man/filterDuplicatesSeqDepthOther.Rd @@ -1,5 +1,5 @@ \name{filterDuplicatesSeqDepthOther} -\alias{filterDuplicatesSeqDepthOther} +\alias{\S4method{filterDuplicatesSeqDepthOther}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{A version of \code{filterDuplicatesSeqDepth} to handle the case when sequencing depth is not available. } @@ -8,7 +8,7 @@ This function takes a random duplicate if no info is available on sequencing dep } \usage{ -filterDuplicatesSeqDepthOther(expression_count_matrix, tcga_barcodes) +\S4method{filterDuplicatesSeqDepthOther}{NetworkDataCompanion}(expression_count_matrix, tcga_barcodes) } %- maybe also 'usage' for other objects documented here. \arguments{ diff --git a/man/filterGenesByTPM.Rd b/man/filterGenesByTPM.Rd index b3b7e7f..d85de45 100644 --- a/man/filterGenesByTPM.Rd +++ b/man/filterGenesByTPM.Rd @@ -1,5 +1,5 @@ \name{filterGenesByTPM} -\alias{filterGenesByTPM} +\alias{\S4method{filterGenesByTPM}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Filter genes based on minimum expression level (TPM) across samples. @@ -8,7 +8,7 @@ Filter genes based on minimum expression level (TPM) across samples. Filter all genes which have at least \code{tpm_threshold} TPM scores in at least \code{sample_fraction} of samples. } \usage{ -filterGenesByTPM(expression_tpm_matrix, tpm_threshold, sample_fraction) +\S4method{filterGenesByTPM}{NetworkDataCompanion}(expression_tpm_matrix, tpm_threshold, sample_fraction) } \arguments{ \item{expression_tpm_matrix}{A data frame extracted from a \code{RangedSummarizedExperiment} object containing expression data using the \code{extractSampleAndGeneInfo} function.} diff --git a/man/filterGenesProteins.Rd b/man/filterGenesProteins.Rd index 488637d..25203f6 100644 --- a/man/filterGenesProteins.Rd +++ b/man/filterGenesProteins.Rd @@ -1,5 +1,5 @@ \name{filterGenesProteins} -\alias{filterGenesProteins} +\alias{\S4method{filterGenesProteins}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{Filtering protein coding genes through an rds object. } @@ -7,15 +7,11 @@ Filtering protein coding genes through an rds object. } \usage{ -filterGenesProteins(rds_gene_info) +\S4method{filterGenesProteins}{NetworkDataCompanion}(rds_gene_info) } %- maybe also 'usage' for other objects documented here. \arguments{ \item{rds_gene_info}{rds info object of genes, usually extracted from row information from recount retrieved rds expression objects.} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ - } \value{ Array of indices that correspond to the protein coding genes in the rds gene info table. @@ -24,5 +20,3 @@ filterGenesProteins(rds_gene_info) \author{ Jonas Fischer (jfischer@hsph.harvard.edu) } -\references{ -} diff --git a/man/filterPurity.Rd b/man/filterPurity.Rd index 6b8015c..60c6878 100644 --- a/man/filterPurity.Rd +++ b/man/filterPurity.Rd @@ -1,5 +1,5 @@ \name{filterPurity} -\alias{filterPurity} +\alias{\S4method{filterPurity}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Filter samples based on tumor purity. @@ -8,7 +8,7 @@ Filter samples based on tumor purity. This function filters a character vector of TCGA barcodes for tumor purity based on a particular method and threshold. } \usage{ -filterPurity(TCGA_barcodes, method="ESTIMATE", threshold=.6) +\S4method{filterPurity}{NetworkDataCompanion}(TCGA_barcodes, method="ESTIMATE", threshold=.6) } \arguments{ \item{TCGA_barcodes}{Character vector of TCGA barcodes that the user wishes to filter based on tumor purity.} diff --git a/man/filterSampleType.Rd b/man/filterSampleType.Rd index f4b9258..f472eb1 100644 --- a/man/filterSampleType.Rd +++ b/man/filterSampleType.Rd @@ -1,5 +1,5 @@ \name{filterSampleType} -\alias{filterSampleType} +\alias{\S4method{filterSampleType}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Filter samples based on sample type. @@ -7,7 +7,7 @@ \description{This function filters samples based on TCGA sample types. } \usage{ - filterSampleType(TCGA_barcodes, types_of_samples) + \S4method{filterSampleType}{NetworkDataCompanion}(TCGA_barcodes, types_of_samples) } %- maybe also 'usage' for other objects documented here. \arguments{ diff --git a/man/filterTumorType.Rd b/man/filterTumorType.Rd index b693245..92d4b0c 100644 --- a/man/filterTumorType.Rd +++ b/man/filterTumorType.Rd @@ -1,5 +1,5 @@ \name{filterTumorType} -\alias{filterTumorType} +\alias{\S4method{filterTumorType}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Filter samples based on tumor type. @@ -7,7 +7,7 @@ Filter samples based on tumor type. \description{This function filters samples based on tumor type. Some examples are: "Primary Tumor", "Solid Tissue Normal", "Primary Blood Derived Cancer - Peripheral Blood". This function is particularly useful for excluding normal samples from analyses. } \usage{ -filterTumorType(TCGA_barcodes, type_of_tumor, rds_info) +\S4method{filterTumorType}{NetworkDataCompanion}(TCGA_barcodes, type_of_tumor, rds_info) } %- maybe also 'usage' for other objects documented here. \arguments{ diff --git a/man/geneNameToENSG.Rd b/man/geneNameToENSG.Rd index 31618ff..6efd7bc 100644 --- a/man/geneNameToENSG.Rd +++ b/man/geneNameToENSG.Rd @@ -1,5 +1,5 @@ \name{geneNameToENSG} -\alias{geneNameToENSG} +\alias{\S4method{geneNameToENSG}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Convert from gene name to Ensembl stable id. @@ -7,7 +7,7 @@ Convert from gene name to Ensembl stable id. \description{Given an input character vector of gene names, this function converts them to Ensembl stable IDs. Note from \url{https://useast.ensembl.org/Help/Faq?id=488}: "An Ensembl stable ID consists of five parts: ENS(species)(object type)(identifier).(version)."} \usage{ -geneNameToENSG(gene_names, version = FALSE) +\S4method{geneNameToENSG}{NetworkDataCompanion}(gene_names, version = FALSE) } \arguments{ \item{gene_names}{Character vector of gene names.} diff --git a/man/getGeneInfo.Rd b/man/getGeneInfo.Rd index 81d2c2c..68ec355 100644 --- a/man/getGeneInfo.Rd +++ b/man/getGeneInfo.Rd @@ -1,5 +1,5 @@ \name{getGeneInfo} -\alias{getGeneInfo} +\alias{\S4method{getGeneInfo}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Retrieve a variety of gene information based on gene name or Ensemble stable ID. @@ -7,7 +7,7 @@ Retrieve a variety of gene information based on gene name or Ensemble stable ID. \description{ This function uses the \code{gene_mapping} attribute of the NetworkDataCompanion object to provide information on \code{seqid}, \code{source},\code{start},\code{end},\code{strand}, \code{gene_id}, \code{gene_name}, \code{gene_type}, and \code{gene_id_no_ver}. } \usage{ -getGeneInfo(gene_names_or_ids) +\S4method{getGeneInfo}{NetworkDataCompanion}(gene_names_or_ids) } %- maybe also 'usage' for other objects documented here. \arguments{ diff --git a/man/logCPMNormalization.Rd b/man/logCPMNormalization.Rd index 9855b9f..261f828 100644 --- a/man/logCPMNormalization.Rd +++ b/man/logCPMNormalization.Rd @@ -1,5 +1,5 @@ \name{logCPMNormalization} -\alias{logCPMNormalization} +\alias{\S4method{logCPMNormalization}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{Function to compute CPM values from raw counts. } @@ -7,15 +7,11 @@ This function computes CPM values from raw expression counts using the edgeR package as a backend. } \usage{ -logCPMNormalization(exp_count_mat) +\S4method{logCPMNormalization}{NetworkDataCompanion}(exp_count_mat) } %- maybe also 'usage' for other objects documented here. \arguments{ \item{exp_count_mat}{Matrix or data.frame of raw expression counts.} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ - } \value{ \item{counts}{The original count matrix passed as argument to this function.} diff --git a/man/logTPMNormalization.Rd b/man/logTPMNormalization.Rd index bfbaa0b..54f48ae 100644 --- a/man/logTPMNormalization.Rd +++ b/man/logTPMNormalization.Rd @@ -1,5 +1,5 @@ \name{logTPMNormalization} -\alias{logTPMNormalization} +\alias{\S4method{logTPMNormalization}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Function for within-array normalization of a RangedSummarizedExperiment object with log transcripts per million (TPM) normalization. @@ -9,7 +9,7 @@ Returns a named list with raw counts (useful for duplicate filtering based on se and the actual log TPM. A pseudocount of 1 is added to each TPM value for this function, so returned "log TPM" values actually correspond to log(TPM + 1). } \usage{ -logTPMNormalization(expression_rds_obj) +\S4method{logTPMNormalization}{NetworkDataCompanion}(expression_rds_obj) } %- maybe also 'usage' for other objects documented here. \arguments{ diff --git a/man/mapBarcodeToBarcode.Rd b/man/mapBarcodeToBarcode.Rd index d23d348..0bc7118 100644 --- a/man/mapBarcodeToBarcode.Rd +++ b/man/mapBarcodeToBarcode.Rd @@ -1,5 +1,5 @@ \name{mapBarcodeToBarcode} -\alias{mapBarcodeToBarcode} +\alias{\S4method{mapBarcodeToBarcode}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{Helper function for mapping two sets of TCGA barcodes to each other. } @@ -13,16 +13,12 @@ There are 4 different pieces of information returned in a named list that are al The same information is provided for \code{bc2}. } \usage{ -mapBarcodeToBarcode(bc1,bc2) +\S4method{mapBarcodeToBarcode}{NetworkDataCompanion}(bc1,bc2) } %- maybe also 'usage' for other objects documented here. \arguments{ \item{bc1}{Character vector of barcodes in the first set.} \item{bc2}{Character vector of barcodes in the second set.} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ - } \value{ \item{is_inter1}{Boolean vector of the same length as \code{bc1} that indicates which elements of \code{bc1} are present in \code{bc2}.} @@ -30,9 +26,6 @@ mapBarcodeToBarcode(bc1,bc2) \item{is_inter2}{Boolean vector of the same length as \code{bc2} that indicates which elements of \code{bc2} are present in \code{bc1}.} \item{idcs2}{Integer vector of the same length as \code{bc2} that indicates where to find each barcode of \code{bc2} in \code{bc1}, returning \code{NA} if there is no match. That is, \code{idcs2[i] != NA}, then \code{bc2[i] == bc1[idcs2[i]]}.} } -\references{ -%% ~put references to the literature/web site here ~ -} \author{ Jonas Fischer (jfischer@hsph.harvard.edu) } diff --git a/man/mapProbesToGenes.Rd b/man/mapProbesToGenes.Rd index c8e290e..47579fe 100644 --- a/man/mapProbesToGenes.Rd +++ b/man/mapProbesToGenes.Rd @@ -1,12 +1,13 @@ \name{mapProbesToGenes} -\alias{mapProbesToGenes} +\alias{\S4method{mapProbesToGenes}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{Maps input probe IDs to gene TSS within a certain range upstream and downstream. } \description{ + Maps input probe IDs to gene TSS within a certain range upstream and downstream. } \usage{ -mapProbesToGenes(probelist, rangeUp, rangeDown, localManifestPath=NA) +\S4method{mapProbesToGenes}{NetworkDataCompanion}(probelist, rangeUp, rangeDown, localManifestPath=NA) } %- maybe also 'usage' for other objects documented here. \arguments{ @@ -15,9 +16,6 @@ mapProbesToGenes(probelist, rangeUp, rangeDown, localManifestPath=NA) \item{rangeDown}{The number of base pairs downstream to search for a TSS. Must be a non-negative number.} \item{localManifestPath}{If you wish to use a manifest file other than the Illumina manifest found at \url{https://zhouserver.research.chop.edu/InfiniumAnnotation/20210615/HM450/HM450.hg38.manifest.gencode.v36.tsv.gz}, you can pass a path to that file here. It should be formatted in the same way as the Illumina manifest.} } -\details{ -%% ~~ If necessary, more details than the description above ~~ -} \value{ A matrix with four columns: probeID, geneName, ensemblID, distToTSS. When a probe maps to more than one TSS within the upstream and downstream parameters provided, the geneName, ensemblID, and distToTSS columns wil contain lists of genes separated by a semicolon (";"). Ordering of the lists matches between the three columns. } @@ -29,13 +27,5 @@ https://zwdzwd.github.io/InfiniumAnnotation %% ~~who you are~~ Kate Hoff Shutta (kshutta@hsph.harvard.edu) } -\note{ -%% ~~further notes~~ -} %% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ -} -\examples{} diff --git a/man/probeToMeanPromoterMethylation.Rd b/man/probeToMeanPromoterMethylation.Rd index 682645c..7c63e16 100644 --- a/man/probeToMeanPromoterMethylation.Rd +++ b/man/probeToMeanPromoterMethylation.Rd @@ -1,9 +1,9 @@ \name{probeToMeanPromoterMethylation} -\alias{probeToMeanPromoterMethylation} +\alias{\S4method{probeToMeanPromoterMethylation}{NetworkDataCompanion}} %- Also NEED an '\alias' for EACH other topic documented here. \title{probeToMeanPromoterMethylation} \description{Calculates the average promoter methylation within a certain window around the transcription start site (TSS), as defined by the input probe_gene_map.} -\usage{probeToMeanPromoterMethylation(methylation_betas, probe_gene_map, genesOfInterest)} +\usage{\S4method{probeToMeanPromoterMethylation}{NetworkDataCompanion}(methylation_betas, probe_gene_map, genesOfInterest)} %- maybe also 'usage' for other objects documented here. \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.} @@ -14,10 +14,6 @@ \value{Matrix of samples in rows and genes in columns. row.names stores sample names and colnames stores gene names. } -\references{ - -} - \author{ Kate Hoff Shutta (kshutta@hsph.harvard.edu) }