This file contains hidden or 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
import numpy as np | |
import math | |
import matplotlib.pyplot as plt | |
import webbrowser | |
def makePlot(xvals,yvals,fname="harmonograph.png",fopen=False,w=50,h=50,width=0.1): | |
maxs=[np.max(np.abs(xvals)),np.max(np.abs(yvals))] | |
farthest=max(maxs) | |
drw=plt.figure(1) |
This file contains hidden or 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
# Demonstrating significant differences between a | |
# vector of measurements and a single value | |
# Using the statsmodels package for doing test | |
# Using numpy to generate some fake data | |
from statsmodels.stats import weightstats as stests | |
import numpy as np | |
data=np.random.normal(loc=3.4,scale=0.1,size=100) | |
singleValue=3.3 |
This file contains hidden or 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
data Cell = Cell {teloLength :: Double, birthDate :: Double, lifeSpan :: Double, seedCell :: Integer} | |
instance Eq Cell where (Cell t1 _ _ _) == (Cell t2 _ _ _) = t1 == t2 | |
instance Ord Cell where (Cell t1 _ _ _) `compare` (Cell t2 _ _ _) = t1 `compare` t2 | |
instance Show Cell where show (Cell t b _ _) = show t ++ " " ++ show b | |
data CellLine x = Senescent | Mother x (CellLine x) (CellLine x) deriving (Show, Read, Eq) | |
-- Functions modelling cell biology | |
shortenTelo :: Cell -> Cell | |
shortenTelo (Cell telo x y oldseed) = Cell (telo - delta) x y newseed |
This file contains hidden or 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
import Control.Parallel (par, pseq) | |
import Control.DeepSeq | |
import System.Environment (getArgs) | |
import Data.Time.Clock (diffUTCTime, getCurrentTime) | |
data Tree x = Empty | Node x (Tree x) (Tree x) deriving (Show, Read, Eq) | |
-- Create instance of NFData for Tree data type (defining "normal form") | |
instance NFData a => NFData (Tree a) where | |
rnf Empty = () |
This file contains hidden or 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
import Control.Parallel (par, pseq) | |
import Control.DeepSeq | |
import System.Environment (getArgs) | |
import Data.Time.Clock (diffUTCTime, getCurrentTime) | |
data Tree x = Empty | Node x (Tree x) (Tree x) deriving (Show, Read, Eq) | |
-- Create instance of NFData for Tree data type (defining "normal form") | |
instance NFData a => NFData (Tree a) where | |
rnf Empty = () |
This file contains hidden or 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(qfa) | |
numerical_r=function(obsdat,mkPlots=FALSE,span=0.5,nBrute=1000,cDiffDelta=0.0001){ | |
# Generate numerical (model-free) estimate for maximum intrinsic growth rate | |
tims=obsdat$Expt.Time | |
gdat=obsdat$Growth | |
tmax=max(tims) | |
# Smooth data, find slope as function of time and maximum slope | |
gdat=log(gdat) |
This file contains hidden or 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
f(!("qfa" %in% rownames(installed.packages()))) install.packages("qfa", repos="http://R-Forge.R-project.org") | |
library(qfa) | |
GISReport=function(qfolder,cfolder,qTrtMed,cTrtMed,colName="MDRMDP",GISdirn=NULL,normalised=FALSE,wctest=FALSE,qStripRep=0,cStripRep=0,bootstrap=NULL,froot="QFA_EXPERIMENTS",makeImBrowser=FALSE,imTime=2.0,hpath=NULL){ | |
cat("###### WORKING DIRECTORY MUST BE LOGS(2) ######\n") | |
cat("Query:",qfolder,qTrtMed,"Control:",cfolder,cTrtMed,"Directory:",GISdirn,"\n") | |
################################################################# | |
if(normalised){ | |
quer=file.path(froot,qfolder,"ANALYSISOUT",paste(qfolder,"NORM_FIT.txt",sep="_")) |
This file contains hidden or 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
from colonyzer2.functions import * | |
import time, sys, os, numpy, PIL | |
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") | |
print("Note that this script requires a Colonyzer.txt file (as generated by ColonyzerParametryzer) describing initial guess for culture array") | |
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") | |
# Lydall lab file naming convention | |
# First 15 characters in filename identify unique plates | |
# Remaining charaters can be used to store date, time etc. |
This file contains hidden or 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
# To execute this script manually, in parallel on multiple CPUs: | |
# Rscript Scripts/QFA_ANALYSIS_INDIVIDUAL.R QFA0028 QFA0029 & | |
# Rscript Scripts/QFA_ANALYSIS_INDIVIDUAL.R QFA0030 QFA0031 & | |
library(parallel) | |
source("Scripts/QFA_ANALYSIS.R") | |
PLOSGenetics=sprintf("QFA%04d",c(28,29,30,31,35,36)) | |
# NCPUs is the maximum number of CPUs the script can use on this node (should be less than 48 on cisban cluster) | |
NCPUs=47 | |
cisbanNodes=TRUE |
This file contains hidden or 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
fnames = list.files(pattern="*.out") | |
datlist = lapply(fnames, read.delim,sep="\t",header=TRUE,stringsAsFactors=FALSE) | |
dat = do.call("rbind", datlist) | |
dat$ID=paste(dat$Barcode,dat$Row,dat$Column,sep="_") | |
dat$time=as.numeric(sapply(strsplit(dat$Filename,'_'), "[", 4)) | |
dat=dat[order(dat$time),] | |
pdf("GrowthCurves.pdf") | |
by(dat,dat$ID,function(x) plot(x$time,x$Intensity,type="b",xlab="Time",ylab="Intensity",ylim=c(0,0.1),main=unique(x$ID))) | |
dev.off() |