This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
split_tcga_barcode <- function(x, split.char="-"){ | |
tmp = strsplit(x, split.char)[[1]] | |
# default values | |
s.tss = "NA"; | |
s.participant = "NA"; | |
s.programcode = "NA"; | |
s.nucleic = "NA"; | |
s.portion = "NA"; | |
s.sampletype = "00"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install this cool tools from Heng Li (https://github.com/lh3/bioawk) | |
brew install bioawk | |
# information regarding exit_code: | |
# - NA: not started yet | |
# show lines where job started and had errors | |
bioawk -tc hdr '{if($exit_code!=0 && $started=="TRUE") print $jobname, $cmd, $exit_code}' flow_details.txt | |
# show lines which did not start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -printf "%f %s\n" | | |
awk '{ | |
PARTSCOUNT=split( $1, FILEPARTS, "." ); | |
EXTENSION=PARTSCOUNT == 1 ? "NULL" : FILEPARTS[PARTSCOUNT]; | |
FILETYPE_MAP[EXTENSION]+=$2 | |
} | |
END { | |
for( FILETYPE in FILETYPE_MAP ) { | |
print FILETYPE_MAP[FILETYPE], FILETYPE_MAP[FILETYPE]/10^6, FILETYPE; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sendmailR) | |
send_mail <- function(msg="", subject, tos = c("[email protected]"), attachment} | |
from <- sprintf("<abc@%s.inst.edu>", Sys.info()[4]) | |
if(missing(subject)) | |
subject <- paste("morning!") | |
salute <- paste("Hello there\n I just ran the tracker on ") | |
body <- c(salute, "\n", msg, "\n", mime_part(attachment)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# here is scratchpad on various steps which are helpful in using git submodules | |
# holy grail of details: https://git-scm.com/book/en/v2/Git-Tools-Submodules | |
# adding a submodule | |
git submodule add <URL> | |
# clone a repo with submodules | |
git clone --recursive <URL> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Do you want to display some code in a Keynote presentation? | |
It's easy. All you need is Homebrew installed. | |
First you need to install the program highlight. | |
brew install highlight | |
So you have a piece of code. For example some Python code. The take that snippet of code and save it to a file like code.py. Now all you need to do is run this: | |
highlight -O rtf code.py | pbcopy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install this cool tools from Heng Li (https://github.com/lh3/bioawk) | |
brew install bioawk | |
# information regarding exit_code: | |
# - NA: not started yet | |
# show lines where job started and had errors | |
bioawk -tc hdr '{if($exit_code!=0 && $started=="TRUE") print $jobname, $cmd, $exit_code}' flow_details.txt | |
# show lines which did not start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# issue: http://stackoverflow.com/questions/10575679/bundle-update-fails-on-ffi | |
# install apple commandline tools: | |
xcode-select --install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fqs=$(find . -name '*.fastq') | |
for fq in $fqs; do | |
echo "zipping $fq ...." | |
gzip $fq | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/Library/Containers/com.apple.iWork.Keynote/Data/Library/Application\ Support/User\ Templates/ |