Skip to content

Instantly share code, notes, and snippets.

@tractatus
Created June 12, 2020 00:32
Show Gist options
  • Save tractatus/04557e07725674b81cebc51b1b9a0893 to your computer and use it in GitHub Desktop.
Save tractatus/04557e07725674b81cebc51b1b9a0893 to your computer and use it in GitHub Desktop.
throw this
#load data
data<-read.table('/Users/danielfurth/Downloads/fisseq_output/results.tsv', sep='\t', header=TRUE )
#size select rolonies
data<-data[data$size>4,]
#extract single cycle info
intensity<-lapply(data$intensity,function(x)strsplit(x, ","))
read<-lapply(data$read,function(x)strsplit(x, ","))
comp<-lapply(data$component,function(x)strsplit(x, ","))
qual<-lapply(data$b_quality_pbm,function(x)strsplit(x, ","))
#make into vector format
base<-numeric()
light<-numeric()
component<-numeric()
quality<-numeric()
for(i in seq_along(intensity)){
light<-c(light, as.numeric(intensity[[i]][[1]][1]))
base<-c(base, as.numeric(read[[i]][[1]][1]))
component<-c(component, as.numeric(comp[[i]][[1]][1]))
quality<-c(quality, as.numeric(qual[[i]][[1]][1]))
}
#change so bases go form 0:4 instead of -1:3
base<-base+1
#plot
par(mfrow=c(1,2))
hist(acos(1-component[which(base>0)])*base[which(base>0)], breaks=100, xlab=expression(acos(1-theta)), main='')
angle<-acos(1-component[which(base>0)])*base[which(base>0)]
radius<-light[which(base>0)]
#rotate angle
angle<-angle-pi/4
plot(radius*cos(angle), radius*sin(angle), col=base[which(base>0)], pch=16, cex=0.5, axes=F, asp=1, xlab='', ylab='')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment