Skip to content

Instantly share code, notes, and snippets.

View cplaisier's full-sized avatar

Christopher L Plaisier, PhD cplaisier

View GitHub Profile
cd /Users/baileyquinn/Desktop/BT145/
docker run -it -v "/Users/baileyquinn/Desktop/BT145:/files" cplaisier/scrna_seq_velocity
cd /files
pip3 install clusim
pip3 install statsmodels
python3
#import statsmodels.formula.api as sm
#import numpy as np
from sklearn.linear_model import LinearRegression
from scipy import stats
import pandas as pd
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import seaborn as sns
import json
@cplaisier
cplaisier / clustersOfBiclusters.R
Created May 8, 2020 17:42
Example code to conduct AM and MDM analyses:
# Set working directory
#setwd('C:/Users/cplaisie/Dropbox/Urdahl/Ag85B_ESAT6_ts/network')
#setwd('/home/cplaisier/Dropbox (ASU)/Urdahl/macs/cMonkey')
setwd('C:/Users/plais/Dropbox (ASU)/Urdahl/macs/cMonkey')
#setwd('C:/Users/Christopher/Dropbox/Urdahl/Ag85B_ESAT6_ts/network')
# Get eigengenes
d1 = read.csv('eigengenes/biclusterEigengenes_tfbs_db.csv',header=T, row.names=1)
rownames(d1) = paste('TFBS_DB_',rownames(d1),sep='')
d2 = read.csv('eigengenes/biclusterEigengenes_pita.csv',header=T, row.names=1)
@cplaisier
cplaisier / scanpy_clp_3_3_2020.py
Created March 3, 2020 19:37
Scanpy code for BT145.
# docker run -it -v "/home/cplaisier/Dropbox (ASU):/files" cplaisier/scrna_seq_velocity
# docker run -it -v "/home/swilferd:/files/scRNA_seq_Mehta" cplaisier/scrna_seq_velocity
# docker run -it -v "/home/swilferd:/files" cplaisier/scrna_seq_velocity
# pip3 intall mygene
#python3 entry:
import numpy as np
import pandas as pd
import scanpy as sc
import mygene as mg
@cplaisier
cplaisier / ccAF.R
Last active February 12, 2020 15:35
R script to apply cell cycle ccAF classifier to single cell dataset.
library(Seurat)
library(ranger)
# Modified function from Seurat V2
ClassifyCells = function (classifier, training.genes = NULL, training.classes = NULL,
new.data = NULL, ...)
{
features <- classifier$forest$independent.variable.names
genes.to.add <- setdiff(x = features, y = rownames(x = new.data))
data.to.add <- matrix(data = 0, nrow = length(x = genes.to.add),
@cplaisier
cplaisier / 6.1_Intro_to_Data_and_GEOquery.R
Created October 15, 2019 14:52
Example code form Systems Biology of Disease course
####################################################
## Systems Biology of Disease: Intro to LUSC Data ##
## ______ ______ __ __ ##
## /\ __ \ /\ ___\ /\ \/\ \ ##
## \ \ __ \ \ \___ \ \ \ \_\ \ ##
## \ \_\ \_\ \/\_____\ \ \_____\ ##
## \/_/\/_/ \/_____/ \/_____/ ##
## @Developed by: Plaisier Lab ##
## (https://plaisierlab.engineering.asu.edu/) ##
## Arizona State University ##
@cplaisier
cplaisier / stemCell.py
Created October 10, 2019 00:08
Stem Cell Changes
from __future__ import division
##########################################################
## Consistilator: plotNetworkMotifs_SCD.py ##
## ______ ______ __ __ ##
## /\ __ \ /\ ___\ /\ \/\ \ ##
## \ \ __ \ \ \___ \ \ \ \_\ \ ##
## \ \_\ \_\ \/\_____\ \ \_____\ ##
## \/_/\/_/ \/_____/ \/_____/ ##
## @Developed by: Plaisier Lab ##
import pandas as pd # May not need this or may have already done this but so you know where pd comes from
#### Two possible solutions
##############################################################################
### 1. Calculate all possible values which is what you are doing currently ###
##############################################################################
corrDF_R = pd.DataFrame(index=df.index, columns=df.index)
corrDF_p = pd.DataFrame(index=df.index, columns=df.index)
for i in corrDF_p.index:
# Import libraries up front
import json
# From Table S13 in Plaisier et al., Cell Systems 2016
# These are Entrez IDs (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3013746/)
input = ['430', '1052', '1053', '1385', '84699', '9586', '1871', '1874', '144455', '79733', '1960', '1997', '2002', '2004', '80712', '2114', '2115', '2120', '51513', '2551', '2623', '2624', '2625', '9421', '3232', '10320', '3659', '3662', '3670', '91464', '3726', '10661', '11278', '128209', '10365', '9314', '1316', '51176', '9935', '23269', '4602', '4774', '4790', '7025', '9480', '5468', '5914', '5916', '3516', '5971', '864', '6257', '4093', '6659', '6660', '6662', '25803', '347853', '30009', '9496', '6929', '6925', '8463', '7022', '29842', '10155', '6935', '132625', '23051', '85416', '7707', '7764', '23528', '201516']
# Loading JSON file
# https://www.safaribooksonline.com/library/view/python-cookbook-3rd/9781449357337/ch06s02.html
# Example:
@cplaisier
cplaisier / tcgaReplicationDataCollection.py
Created October 22, 2018 20:08
Python script to download gene expression datasets from GEO.
import GEOparse
import pandas as pd
import matplotlib.pyplot as plt
import numpy
from matplotlib.backends.backend_pdf import PdfPages
gseNums = ['GSEXXXXX1','GSEXXXXX2']
with PdfPages('GSE_boxplots.pdf') as pdf:
for gse1 in gseNums: