Skip to content

Commit

Permalink
filter chromosom started
Browse files Browse the repository at this point in the history
sebastianlieske committed Aug 30, 2019
1 parent a0e51ac commit 8472ea8
Showing 19 changed files with 297 additions and 57 deletions.
13 changes: 12 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -3,30 +3,39 @@
export(above_percentage)
export(add_assay_classification)
export(add_assay_norm)
export(add_coldata_classification)
export(calc_auc)
export(calc_prediction)
export(calculate_fit)
export(correct_output)
export(factorize_columns)
export(filter_duplicates)
export(filter_for_factor)
export(filter_rare)
export(filter_single_level)
export(filter_zero)
export(get_no_cores)
export(is_correct)
export(make_coeff_frame)
export(make_explicit_na)
export(make_model_matrix)
export(merge_duplicated)
export(methyl_frame)
export(not_zero)
export(plot_heatmap)
export(preprocess_assay)
export(preprocess_coldata)
export(reorder_all)
export(transform_assay)
export(use_cvglmnet)
export(use_glmnet)
export(use_p_adjust)
export(use_siber)
export(use_silvermantest)
import(AUC)
import(ComplexHeatmap)
import(GenomicRanges)
import(Heatmap)
import(SIBER)
import(SummarizedExperiment)
import(doParallel)
@@ -41,10 +50,12 @@ import(rlang)
import(snow)
import(survival)
import(survminer)
importFrom(ComplexHeatmap,Heatmap)
importFrom(Biobase,isUnique)
importFrom(ComplexHeatmap,HeatmapAnnotation)
importFrom(FactoMineR,catdes)
importFrom(RColorBrewer,brewer.pal)
importFrom(biomaRt,getBM)
importFrom(biomaRt,useMart)
importFrom(dplyr,"%>%")
importFrom(dplyr,group_by_)
importFrom(dplyr,mutate)
14 changes: 13 additions & 1 deletion R/preprocess_assay.R
Original file line number Diff line number Diff line change
@@ -116,7 +116,19 @@ above_percentage <- function(vector, min_counts, min_percentage) {
return(isAbove)
}

filter_chromosome <- function(summarized_experiment, chromosomes = NULL) {
#' Filter Specific Genes on Chromosome
#' @description This function filters genes that are located on specific chromosomes.
#' @param summarized_experiment SummarizedExperiment or matrix like object.
#' @param chromosome Name of chromosomes to be filtered out | 1-24, X, Y
#' @param df_biomart Data frame containing biomaRt results
#' @details Gene names have to be in rows and as ensembl gene IDs. e.g ENSG00000091831. If there is already a data frame with genes and their location on the chromosome, you can use that df instead.
#' That data frame needs to have the columns "ensembl_gene_id" and "chromosome_name".
#' @return
#' @import SummarizedExperiment
#' @importFrom biomaRt
#' @export

filter_chromosome <- function(summarized_experiment, chromosome = NULL, df_biomart) {

}

7 changes: 2 additions & 5 deletions R/use_biomaRt.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#' Use biomaRt
#' @description Short function get information from biomaRt.
#' @param summarized_experiment SE
#' @param gene_names Names of genes to be mapped
#'
#' @importFrom magrittr %>%
#' @param gene_names Vector of gene names as ensembl_gene_id
#' @examples
#
#' @return

#' @importFrom biomaRt useMart getBM
use_biomaRt <- function(gene_names, ... ) {
ensembl = useMart("ensembl", dataset="hsapiens_gene_ensembl")
ensg_de_lung <- getBM(mart=ensembl,
34 changes: 34 additions & 0 deletions example/DAVID_280819.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#DAVID Web Service 28.08
#http://bioconductor.org/packages/release/bioc/vignettes/RDAVIDWebService/inst/doc/RDavidWS-vignette.pdf
library("RDAVIDWebService")

david <-DAVIDWebService$new(email="sebastian.lieske@bioinfsys.uni-giessen.de") # does not work
david <- DAVIDWebService(email="sebastian.lieske@bioinfsys.uni-giessen.de", url="https://david.ncifcrf.gov/webservice/services/DAVIDWebService.DAVIDWebServiceHttpSoap12Endpoint/")
geneNames <- rownames(subBRCA)
result <- addList(david, geneNames, idType = "ENSEMBL_GENE_ID", listName = "bimodal", listType = "Gene")
#getIdTypes(david)
#do it again with ENTREZ
ensemblgene <- use_biomaRt(geneNames)
hgnc <- ensemblgene$hgnc_symbol %>% na.omit() %>% .[.!= ""]
entrez <- ensemblgene$entrezgene_id %>% na.omit()

result2 <- addList(david, entrez, idType = "ENTREZ_GENE_ID", listName = "bimodal1", listType = "Gene")
#adds directly to david

termCluster <- getClusterReport(david, type="Term") #terms or genes
getClusterReportFile(david, type="Term",
fileName="termClusterBimodalBRCA.tab")
plot2D(termCluster, 1)

davidGODag<-DAVIDGODag(members(termCluster)[[3]],
pvalueCutoff=0.1, "MF")
plotGOTermGraph(g=goDag(davidGODag),
r=davidGODag, max.nchar=40, node.shape="ellipse")

clust1 <- termCluster@cluster[1]
clust1df <- data.frame(clust1[[1]]$Members)

silver <- use_silvermantest(subBRCA, 2, filter = F, alpha = 0.05, k = 1)
silver2 <- use_silvermantest(subBRCA, 2, filter = F, alpha = 0.05, k = 2)

a <- filter_all(ensemblgene, "X" %in% chromosome_name)
13 changes: 2 additions & 11 deletions example/preprocessing.R
Original file line number Diff line number Diff line change
@@ -102,14 +102,5 @@ a <- t(assay(subBRCA, 2)[1:100,1:100])
b <- dist(scale(a), method = "euclidean")
c <- hclust(b, method = "ward.D2")

a <- apply(X = assay(subBRCA, 3), MARGIN = 2, FUN = function(x) table(x)) %>% t() #count occurence of each class in patient
colnames(a) <- paste("class", colnames(a), sep = "_") #change colnames
b <- data.frame(a)
b <- data.frame(a)
a <- add_coldata_classification(a, 3, to_coldata = F)
b <- apply(X = a, MARGIN = 2, FUN = function(x) table(x)) %>% t()
colnames(b) <- paste("class", colnames(b), sep = "_")
colnames(countMatrix) <- paste("class", colnames(b), sep = "_") #change colnames

c <- unnest_dataframe(colData(subBRCA))
c <- cbind(c, b)
a <- add_coldata_classification(subBRCA, 3, T)
b <- unnest_dataframe(colData(a)) %>% group_by()
25 changes: 25 additions & 0 deletions man/add_coldata_classification.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions man/correct_out.Rd → man/correct_output.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/filter_fold_change.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/filter_mean.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/filter_unimodal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/is_correct.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions man/plot_heatmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/rerun_mclust.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions man/transform_assay.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/use_biomaRt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/use_mclust.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions man/use_siber.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/verify_mclust.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

177 changes: 177 additions & 0 deletions termClusterBimodalBRCA.tab

Large diffs are not rendered by default.

0 comments on commit 8472ea8

Please sign in to comment.