Commit 4849cd48 authored by Holger Brandl's avatar Holger Brandl
Browse files

added more easy to use expression filter

parent 6e553884
......@@ -35,6 +35,27 @@ guess_mart <- function(gene_id){
#guess_mart("ENSCAFG00000000043")
retainExprGenes <- function(df, id_col="ensembl_gene_id", ...){
## allows to filter for expressed genes
exprGenes <- df %>% column2rownames(id_col) %>%
## see https://github.com/hadley/dplyr/issues/497
#iris %>% select(., which(sapply(., is.numeric))) %>% head
select(., which(sapply(., is.numeric))) %>%
filterByExpression(...) %>%
rownames()
# exprGenes %>% head %>% print
# df %>% filter_(id_col %in% exprGenes)
## see http://stackoverflow.com/questions/26492280/non-standard-evaluation-nse-in-dplyrs-filter-pulling-data-from-mysql
which_column <- get(id_col, df)
df %>% filter_(~ which_column %in% exprGenes)
}
getGeneInfo <- function(gene_ids){
martName <- guess_mart(gene_ids[1])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment