Skip to content

Instantly share code, notes, and snippets.

View timedreamer's full-sized avatar

Ji Huang timedreamer

View GitHub Profile
@strengejacke
strengejacke / .lintr
Last active October 29, 2024 23:21
VS Code setup for R
// save to windows-user directory
linters: with_defaults(object_name_linter = NULL,
object_length_linter(50),
commented_code_linter = NULL,
object_usage_linter = NULL,
line_length_linter(120),
cyclocomp_linter = cyclocomp_linter(50))
@rohitfarmer
rohitfarmer / nvimr-demo.md
Last active August 12, 2024 17:46
Nvim-R Demo

How to use Neovim or VIM Editor as an IDE for R

Note: This tutorial is written for Linux based systems.

Requirements

R >= 3.0.0

To install the latest version of R please flollow the download and install instructions at https://cloud.r-project.org/

Neovim >= 0.2.0

Neovim (nvim) is the continuation and extension of Vim editor with the aim to keep the good parts of Vim and add more features. In this tutorial I will be using Neovim (nvim), however, most of the steps are equally applicable to Vim also. Please follow download and installation instructions on nvim's GitHub wiki https://github.com/neovim/neovim/wiki/Installing-Neovim.

@raryskin
raryskin / example_bar_plot.R
Created April 26, 2019 01:55
quick example of a (not ugly) ggplot bar graph with points for individual subjects and error bars
# example of bar plot with individual subject points for Anya -04/24/2019
# added error bars - 04/25/2019
library(tidyverse) #will need to install this first (run: install.packages("tidyverse"))
## fake data
data = tibble( # creating a dataframe (aka "tibble") called data
subject = rep(1:10,times = 2 ), # making a column/vector of subject numbers (1-10) x2
condition = rep(c("hard", "easy"), each = 10), # making a column/vector of condition names
@crazyhottommy
crazyhottommy / merge_feature_counts_table.md
Last active September 28, 2018 00:19
collate RNAseq feature counts table

R solution

library(purrr)
library(tidyverse)
f_files<- list.files("results/superEnhancer/rna_expression/MSTC", pattern = "featureCount.txt", full.names = T)

read_in_feature_counts<- function(file){
        cnt<- read_tsv(file, col_names =T, comment = "#")
        cnt<- cnt %>% dplyr::select(-Chr, -Start, -End, -Strand, -Length)
@tgirke
tgirke / _Nvim-R-Tmux.md
Last active October 13, 2023 05:29
Nvim-R-Tmux: An Integrated Working Environment for R

Nvim-R-Tmux: Neovim-based IDE for R

!!! This Gist tutorial is deprecated. Its new version is available here !!!

This is some red text.

  • Author: Thomas Girke
  • Last update: 18-Nov-2020

@conormm
conormm / r-to-python-data-wrangling-basics.md
Last active September 24, 2024 04:20
R to Python: Data wrangling with dplyr and pandas

R to python data wrangling snippets

The dplyr package in R makes data wrangling significantly easier. The beauty of dplyr is that, by design, the options available are limited. Specifically, a set of key verbs form the core of the package. Using these verbs you can solve a wide range of data problems effectively in a shorter timeframe. Whilse transitioning to Python I have greatly missed the ease with which I can think through and solve problems using dplyr in R. The purpose of this document is to demonstrate how to execute the key dplyr verbs when manipulating data using Python (with the pandas package).

dplyr is organised around six key verbs:

@bonzanini
bonzanini / search_biopython.py
Last active May 19, 2024 08:45
Searching PubMed with Biopython
# This code uses Biopython to retrieve lists of articles from pubmed
# you need to install Biopython first.
# If you use Anaconda:
# conda install biopython
# If you use pip/venv:
# pip install biopython
# Full discussion:
@stephenturner
stephenturner / deseq2-analysis-template.R
Created July 30, 2014 12:20
Template for analysis with DESeq2
## RNA-seq analysis with DESeq2
## Stephen Turner, @genetics_blog
# RNA-seq data from GSE52202
# http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=gse52202. All patients with
# ALS, 4 with C9 expansion ("exp"), 4 controls without expansion ("ctl")
# Import & pre-process ----------------------------------------------------
# Import data from featureCounts
@hieblmedia
hieblmedia / .gitignore
Last active September 11, 2024 13:03
Gitignore - Exclude all except specific subdirectory
#
# If all files excluded and you will include only specific sub-directories
# the parent path must matched before.
#
/**
!/.gitignore
###############################
# Un-ignore the affected subdirectory
@sedm0784
sedm0784 / CapsLockCtrlEscape.ahk
Last active October 22, 2024 02:07
AutoHotkey script to map Caps Lock to Escape when it's pressed on its own and Ctrl when used in combination with another key, à la Steve Losh. Adapted from one that does something similar with the Ctrl Key on the Vim Tips Wiki (http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows?oldid=32281). (Plus contribs from @randy909 & @mmikeww.)
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*CapsLock::
if (g_ControlRepeatDetected)
{
return
}