Skip to content

Instantly share code, notes, and snippets.

@n-long
n-long / wgcna.R
Created October 21, 2016 21:48
Gene co-expression network analysis in R (WGCNA package)
library(WGCNA)
library(DESeq2)
library(cluster)
options(stringsAsFactors = FALSE);
setwd(dir = '/home/nlong/Public/clc')
x=read.csv("ccllcc", sep='\t', header=T)
datExpr = as.data.frame(x[, -c(1)]);
#names(datExpr) = names(x)[, -c(1)]
rownames(datExpr) = x$gene
datExpr=t(datExpr)
@n-long
n-long / lastz_to_pals.py
Created October 21, 2016 22:35
convert lastz alignment output format to PALS
import glob,re
csv=glob.glob('*.csv')
for filename in csv:
fi = open(filename, 'r')
fo = open(filename.replace('.csv','.gff'), 'w')
for line in fi:
if not line.startswith("#"):
cols=line.split('\t')
maxexp=float(re.sub("[^0-9\.]","", cols[9]))
@n-long
n-long / intro_unix.txt
Created October 21, 2016 22:39
intro to bash commands for data analysis
Here are commands for the Linux terminal that I have found useful for formatting data correctly and can be much faster than Excel. More options for each command can be found in the manual page by typing 'man programname' (without quotes) in the terminal window.
ls -la
list all files in current directory AND date of last access (some programs take days to run and you can track its progress this way)
top
view all active processes and memory usage
ps -feww | grep yourprocessname