Skip to content

Instantly share code, notes, and snippets.

View Loyale's full-sized avatar

Loyal Goff Loyale

  • Johns Hopkins University
  • Baltimore, MD
View GitHub Profile
@Loyale
Loyale / ternary.R
Last active December 22, 2015 06:29
Ternary plot with cummeRbund and ggplot2 (adapted from http://srmulcahy.github.io/2012/12/04/ternary-plots-r.html)
require(ggplot2)
require(grid)
require(scales)
ternary <- function(t, l, r, clr = clr, pts = pts, labels = c("top", "left", "right"), showGrid = TRUE){
library(ggplot2)
ddf <- data.frame(t, l, r)
# convert points to cartesian coordinates
@Loyale
Loyale / GSEA_cummeRbund.R
Last active December 22, 2015 16:18
GSEA from cummeRbund (work in progress)
library(cummeRbund)
library(limma)
library(GSA)
cuff<-readCufflinks()
Input_df<-data.frame("gene_id"=rownames(dat),"gene_short_name"=rownames(dat))
Input_df<-cbind(Input_df,fpkmMatrix(genes(cuff)))
Input_df$gene_short_name<-toupper(Input_df$gene_short_name)
@Loyale
Loyale / GSEA_plotting.R
Created April 8, 2015 21:20
GSEA 'standard' plots in R
library(ggplot2)
library(grid)
#############
#Utility Functions
#############
# multiplot <- function(..., plotlist=NULL, cols) {
# require(grid)
#
@Loyale
Loyale / Precocious_differentiation_simulation.py
Created January 19, 2017 02:26
Precocious_differentiation_simulation
#!/usr/bin/etc python
from numpy.random import choice
from itertools import count,chain
from copy import deepcopy
import sys
###############
# Globals
###############
possible_states = ["progenitor","differentiated"]
@Loyale
Loyale / retina_3d_umap_blender.py
Created June 2, 2019 00:36
3D UMAP in Blender: Data Import and Scene Setup
import bpy
import bmesh
import random
import csv
# Set render engine to cycles
bpy.context.scene.render.engine = 'CYCLES'
#Read in retina UMAP data
filename = "retina_pdata.csv"
@Loyale
Loyale / retina_3d_umap_blender.py
Last active April 21, 2024 21:26
Retina 3D UMAP in Blender: Data Import and Scene Setup
# Here is the workflow in a nutshell:
#
# 1) Annotate cells in your favorite single cell framework or system
# 2) Perform your favorite dimensionality reduction into 3D.
# 3) Export annotation and 3D coordinates to .csv.
# 4) I imported these data into Blender and created the objects using the below ‘retina_3d_umap_blender.py’ script. Some of it is automated, some of it is hard-coded and project specific.
# - For each age (since cells here are colored by developmental age) I create a new mesh and add each datapoint for a given age to the mesh as a vertex.
# 5) I then created a single ’sample object’ for each mesh consisting of a UV sphere primitive. Added a material to that to match the color scheme I had selected. These were the ’templates’ to be used and applied to each vertex in the mesh using a particle system
# 6) Next created a particle system for each age with the params indicated in the python script.
# 7) Finally I created an empty parent object to group all of the particles so I could track wi