GithubHelp home page GithubHelp logo

helpr's Introduction

helpr

tools to make r life easier

reference

devtools::install_github('ChristopherBarrington/helpr', ref='main', dependencies=FALSE)
   _          _            
  | |        | |           
  | |__   ___| |_ __  _ __ 
  | '_ \ / _ \ | '_ \| '__|
  | | | |  __/ | |_) | |   
  |_| |_|\___|_| .__/|_|   
               | |         
               |_|         

helpr's People

Contributors

christopherbarrington avatar

Watchers

 avatar

helpr's Issues

new dir function

dir.create(path='scratch/fgsea_results', recursive=TRUE, showWarnings=FALSE)
system(command='rm -r scratch/fgsea_results/*')

for example

software versions

eg

helpr::read_dotbabs()$Lims %>%
  sprintf(fmt='conda list -n %s --json') %>%
  system(intern=TRUE) %>%
  paste(collapse='') %>%
  fromJSON() %>%
  (function(x) sapply(x, pluck, 'name') %>% set_names(x=x)) %>%
  llply(pluck, 'version') -> project_conda_versions

archiving functions

system(command='cd scratch && zip - fgsea_results/*xlsx > ../files/fgsea_results.xlsx.zip')

for example

read msigdb file

'~/db/msigdb/h.all.v7.4.entrez.gmt' %>%
  {list(path=., ncol={count.fields(., sep='\t') %>% max()})} %>%
  {read.table(file=.$path, sep='\t', fill=TRUE, header=FALSE, col.names=c('pathway', 'url', str_c('id.', 1:.$ncol)))} %>%
  dlply(~pathway, function(x) list(url=x$url, ids=select(x, starts_with('id.')) %>% unlist(use.names=FALSE) %>% na.omit())) -> hallmark_pathways

filter dds for wald or lrt

all_dds %>%
  discard(function(x) metadata(x) %>% names() %>% is_in(x='reduced')) %>%
  names() %>%
  magrittr::extract(all_dds, .)

resizing patchworks

to build a patchwork object into a gtable:

> patchworkGrob(cplot) -> plot1

write params file function

#+ write_parameters_table_and_sbatch_parameters
parameter_sets %>% write.table(file='parameters.csv', sep=',', quote=FALSE, row.names=FALSE, col.names=FALSE)
sprintf(fmt='#SBATCH --array 1-%d:1', nrow(parameter_sets)) %>% message()
sprintf(fmt="IFS=',' read %s <<< $(head -n ${SLURM_ARRAY_TASK_ID} parameters.csv | tail -n 1)", {colnames(parameter_sets) %>% str_flatten(collapse=' ') %>% str_to_upper()}) %>% message()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.