Skip to content

Instantly share code, notes, and snippets.

View adomingues's full-sized avatar

A. Domingues adomingues

View GitHub Profile
@adomingues
adomingues / Terminal_shortcuts.md
Last active August 29, 2015 14:13
Useful Shortcuts

Terminal

(ubuntu 14.04)

switch between tabs

Ctrl+PgUp/PgDn

or:

Alt-n, where n is the tab ordinal number. *Does not work with numpad keys*
@adomingues
adomingues / createRNAInterval_list.sh
Last active August 29, 2015 14:13
Make a ribosomal RNA interval_list for Picard Tools
#!/usr/bin/env bash
# make_rRNA.sh
# Kamil Slowikowski
# Created: December 12, 2014
# Original: https://gist.github.com/slowkow/b11c28796508f03cdf4b
# Modified: January 22, 2014
# António Domingues
# Added arguments - easier to run and choose species
# rRNA coordinates can be in Bed format
@adomingues
adomingues / fromBamToFASTA.sh
Last active August 29, 2015 14:14
A simple way of converting bam files to fasta for testing purposes.
bedtools bamtofastq -i $bam -fq temp.fq
awk '{if(NR%4==1) {printf(">%s\n",substr($0,2));} else if(NR%4==2) print;}' temp.fq > ${bam/.bam/.fa}
rm temp.fp
@adomingues
adomingues / MartinWordCloud
Created July 12, 2015 15:19
Word cloud for Martin
#install.packages(c("wordcloud","tm"),repos="http://cran.r-project.org")
library("wordcloud")
library("tm")
message <- c(
rep("Good", 10),
rep("Luck", 9),
rep("Eyebrow", 3),
rep("Tatra Tea", 4),
rep("Sächsische Schweiz‎", 3),
@adomingues
adomingues / iwanthue.R
Created June 20, 2016 06:40 — forked from johnbaums/iwanthue.R
Palettes of distinct colours, generated through kmeans clustering of LAB colour space
swatch <- function(x) {
# x: a vector of colours (hex, numeric, or string)
par(mai=c(0.2, max(strwidth(x, "inch") + 0.4, na.rm = TRUE), 0.2, 0.4))
barplot(rep(1, length(x)), col=rev(x), space = 0.1, axes=FALSE,
names.arg=rev(x), cex.names=0.8, horiz=T, las=1)
}
# Example:
# swatch(colours()[1:10])
# swatch(iwanthue(5))
@adomingues
adomingues / bashrc_goodies.sh
Created February 7, 2017 10:41
My linux environment
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@adomingues
adomingues / multiplot.r
Created March 16, 2017 14:59 — forked from tonglu/multiplot.r
multiplot for ggplot
# Multiple plot function
#
# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)
# - cols: Number of columns in layout
# - layout: A matrix specifying the layout. If present, 'cols' is ignored.
#
# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
# then plot 1 will go in the upper left, 2 will go in the upper right, and
# 3 will go all the way across the bottom.
#
@adomingues
adomingues / themes.R
Last active March 22, 2017 11:03 — forked from Pakillo/themes.R
ggplot_themes
### My favourite ggplot2 themes, always accessible ###
## just source this gist from any project ##
#####################################################################################
# Noam's default ggplot2 styling #####
# Source: https://github.com/noamross/noamtools/blob/master/R/theme_nr.R
theme_nr <-theme(text=element_text(family="Helvetica", size=14),
panel.grid.major.x=element_blank(),
@adomingues
adomingues / hg19.rRNA.interval_list
Last active April 6, 2017 10:00 — forked from slowkow/hg19.rRNA.interval_list
Make a ribosomal RNA interval_list for Picard Tools CollectRnaSeqMetrics
@SQ SN:chrM LN:16571
@SQ SN:chr1 LN:249250621
@SQ SN:chr2 LN:243199373
@SQ SN:chr3 LN:198022430
@SQ SN:chr4 LN:191154276
@SQ SN:chr5 LN:180915260
@SQ SN:chr6 LN:171115067
@SQ SN:chr7 LN:159138663
@SQ SN:chr8 LN:146364022
@SQ SN:chr9 LN:141213431
@adomingues
adomingues / convert_tx_to_gene.R
Last active October 19, 2017 12:40 — forked from hussius/sleuth_commands.R
tximport functions
# A function (borrowed from the Sleuth documentation) for connecting Ensembl transcript names to common gene names
convert_tx_to_gene <- function(dat="drerio_gene_ensembl"){
mart <- biomaRt::useMart(
biomart = "ensembl",
dataset = dat
)
t2g <- biomaRt::getBM(
attributes = c("ensembl_transcript_id", "ensembl_gene_id", "external_gene_name"),
mart = mart