Commit 341994f6 authored by Holger Brandl's avatar Holger Brandl

changed rendr theme; add go and bm query tools to bioinfo commons; dplyr naming workaround

parent 9afdc5b7
......@@ -70,3 +70,32 @@ write_bed <- function(bedData, file){
## reload to fix rename overloading
#reload_dplyr()
fetch_go_term = function(termId){
paste0("http://golr.geneontology.org/select?defType=edismax&qt=standard&indent=on&wt=csv&rows=100000&start=0&fl=source,bioentity_internal_id,bioentity_label,qualifier,annotation_class,reference,evidence_type,evidence_with,aspect,bioentity_name,synonym,type,taxon,date,assigned_by,annotation_extension_class,bioentity_isoform&facet=true&facet.mincount=1&facet.sort=count&json.nl=arrarr&facet.limit=25&csv.encapsulator=&csv.separator=%09&csv.header=false&csv.mv.separator=%7C&fq=document_category:%22annotation%22&fq=regulates_closure:%22",termId, "%22&facet.field=aspect&facet.field=taxon_subset_closure_label&facet.field=evidence_subset_closure_label&facet.field=regulates_closure_label&facet.field=annotation_class_label&facet.field=qualifier&facet.field=annotation_extension_class_closure_label&facet.field=assigned_by&facet.field=panther_family_label&q=*:*") %>% read_tsv(col_names=F) %>%
set_names("source", "bioentity_internal_id", "bioentity_label", "qualifier", "annotation_class", "reference", "evidence_type", "evidence_with", "aspect", "bioentity_name", "synonym", "type", "taxon", "date", "assigned_by", "annotation_extension_class", "bioentity_isoform") %>% filter_count(source=="UniProtKB") %>% rename(uniprot_id= bioentity_internal_id)
}
## example
#ndc80 = fetch_go_term("GO:0031262")
read_bm = function(query){
query %>% paste0("wget -O - 'http://www.ensembl.org/biomart/martservice?query=", . , "' 2>/dev/null") %>% pipe %>% read_tsv %>% pretty_columns
}
## example
#ndc80Ens = read_bm('<?xml version="1.0" encoding="UTF-8"?>
#<!DOCTYPE Query>
#<Query virtualSchemaName = "default" formatter = "TSV" header = "1" uniqueRows = "0" count = "" datasetConfigVersion = "0.6" >
#<Dataset name = "hsapiens_gene_ensembl" interface = "default" >
#<Filter name = "go_parent_term" value = "GO:0031262"/>
#<Attribute name = "ensembl_gene_id" />
#<Attribute name = "description" />
#<Attribute name = "uniprot_genename" />
#<Attribute name = "external_gene_name" />
#</Dataset>
#</Query>')
......@@ -129,6 +129,9 @@ install_package("tibble")
## restore pre-tibble-v1.2 naming to creating data-frame in place
frame_data = function(...) tibble::tribble(...)
add_rownames = function(...) tibble::rownames_to_column(...)
########################################################################################################################
#### data.frame manipulation
......@@ -193,7 +196,7 @@ rify_names <- function(df){
pretty_columns <- function(df){
names(df) <- names(df) %>%
str_replace_all("[#=.()-]+", "_") %>%
str_replace_all("[#=.() -]+", "_") %>%
str_replace("[_]+$", "") %>%
str_replace("^[_]+", "") %>%
tolower;
......
......@@ -157,7 +157,7 @@ knitr::opts_knit$set(
rmarkdown::render(input=tmpScript,output_file=paste0(reportName, ".html"),
output_format=rmarkdown::html_document(toc = opts$toc, toc_float = opts$toc, code_folding = if(opts$e) "hide" else "show", keep_md=keep_markdown_files),
output_format=rmarkdown::html_document(toc = opts$toc, toc_float = opts$toc, code_folding = if(opts$e) "hide" else "show", keep_md=keep_markdown_files, theme="united", number_sections=T),
output_dir=getwd())
#spin(tmpScript, knit=T)
......
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