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
#!/bin/bash | |
#this command takes the list of all files in the current directory, | |
#excludes all files that contain "Undetermined" in their filename | |
#gets the realpath for the given file | |
#and creates a symbolic link in the $newpath | |
export newpath="/this/is/the/new/path" | |
ls . | grep -v Undetermined | xargs -d $'\n' sh -c 'for arg do path=$(realpath "$arg"); ln -s ${path} ${newpath}"$arg"; 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
#!/bin/bash | |
function tar_md5 { | |
DIR=${1} | |
if [[ -d $DIR ]] | |
then | |
tar -cvpf ${DIR}.tar ${DIR}/| xargs -I '{}' sh -c "test -f '{}' && md5sum '{}'" | tee ${DIR}.md5 | |
fi |
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
#!/bin/bash | |
# from: https://serverfault.com/questions/120582/creating-a-tar-file-with-checksums-included#120597 | |
tar -cvpf mybackup.tar myfiles/| xargs -I '{}' sh -c "test -f '{}' && md5sum '{}'" | tee mybackup.md5 |
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
#!/bin/bash | |
eval "$(conda shell.bash hook)" | |
conda activate <env-name> | |
# https://github.com/conda/conda/issues/7980#issuecomment-492784093 |
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
# this is a simple illustration of the principle | |
# it does not implement e.g. loess fitting to ERCC data as sugessted by Loven et al | |
# but rather uses the geometric mean/scaling approach as implemented in sleuth/DESeq2 | |
# on the reduced matrix containing only ERCC spike in quantification | |
norm_factors_ercc <- function(mat) { | |
mat <- mat[grep('ERCC', rownames(mat)),] | |
nz <- apply(mat, 1, function(row) !any(round(row) == 0)) | |
mat_nz <- mat[nz, , drop = FALSE] | |
p <- ncol(mat) | |
geo_means <- exp(apply(mat_nz, 1, function(row) mean(log(row)))) |
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(clusterProfiler) | |
library(magrittr) | |
library(tidyverse) | |
library(qusage) | |
library(msigdbr) | |
library(biomaRt) | |
library(DOSE) | |
library(org.Mm.eg.db) | |
library(enrichplot) | |
library(data.table) |
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
gci -force 'C:\Users'-ErrorAction SilentlyContinue | ? { $_ -is [io.directoryinfo] } | % { | |
$len = 0 | |
gci -recurse -force $_.fullname -ErrorAction SilentlyContinue | % { $len += $_.length } | |
$_.fullname, '{0:N2} GB' -f ($len / 1Gb) | |
} |
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
#!/bin/bash | |
for i in $(find . -type d -name 'SE'); do new=$(echo $i | sed s/SE/se/); mv $i $new; 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
def isPairedSRA(filename): | |
filename = os.path.abspath(filename); | |
try: | |
contents = sp.check_output(["fastq-dump","-X","1","-Z","--split-spot", filename]); | |
except sp.CalledProcessError, e: | |
raise Exception("Error running fastq-dump on",filename); | |
if(contents.count("\n") == 4): | |
return False; | |
elif(contents.count("\n") == 8): |
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
#!/bin/bash | |
# find installation path of openssl-dev libraries and headers | |
ldconfig -p|grep ssl | |
# download openssl package source tarball | |
https://cran.r-project.org/src/contrib/openssl_1.4.1.tar.gz | |
# run installation from command line | |
sudo R CMD INSTALL --configure-vars='INCLUDE_DIR=/usr/local/openssl/include/ LIB_DIR=/usr/local/openssl/lib/' openssl_1.4.1.tar.gz |
NewerOlder