knitr::opts_chunk$set(warning = FALSE, message = FALSE, fig.width = 6, fig.height = 4)
library(ephys2)
library(magrittr)
library(dplyr)
library(ggplot2)
#library(ggDRC)
#library(ggEphysAnnotations)

ggsweeps

rm(CURSORS)

set_cursor('hERG-drc','peak',curMax_,c(2.3,2.4))
set_cursor('hERG-drc','peak2',curMax_,c(3.3,3.4))
set_cursor('hERG-drc','base',curMean_,c(0.18,0.22))
set_resultmethod("hERG-drc","corr", function(x) {x$corr<-x$peak-x$base;x})
theme_set(theme_classic())
#library(tidyr)
s <-  getSeries(examplefile("hergDRC"), 1,1,2)
s %>% ggsweeps()+ ggScalebar("s","nA", lwd=1)
s %>% ggsweeps(sweeps=c(1,12,33)) + ggScalebar("s","nA", lwd=1)
s %>% ggsweeps(sweeps=c(1,12,33), color = "swp") + ggScalebar("s","nA", lwd=1)
s %>% ggsweeps(sweeps=c(1,33,44), color = "conc") + ggScalebar("s","nA", lwd=1)
s %>% ggsweeps(sweeps="last_lp", color = "conc") + ggScalebar("s","nA", lwd=1)
s %>% ggsweeps(sweeps="last_lp", color = "swp") + ggScalebar("s","nA", lwd=1)
s %>% ggsweeps(sweeps=13, color="swp") + ggScalebar("s","nA", lwd=1) 


s %>% ggsweeps("labeled") 

showing cursor results

s %>% ggsweeps(sweeps=13) + ggScalebar("s","nA", lwd=1) + 
  geom_point(aes(peak.x, peak), data=s$results() %>% filter(swp==13), color="red", size=3)

s %>% ggsweeps("labeled") + 
  geom_point(aes(peak.x, peak, fill="peak"), pch=24, color="NA", data=s$results() %>% filter(swplabel!="")) + scale_fill_manual(values="red")

ggIt

s  %>% gg_itplot("corr") 

ggDRC

hergDRC<-get_treeinfo(examplefile("hergDRC"))
s1 <- getSeries(hergDRC, 1,1,2, CompoundName = "Quinidine1" )
s2 <- getSeries(hergDRC, 1,2,2, CompoundName = "Quinidine2" )
s3 <- getSeries(hergDRC, 1,3,2, CompoundName = "Quinidine3" )

c(s1,s2,s3) %>% 
  get_lpresults2(cursor="corr", normalize=T) %>%
  drc_fit() %>% 
  drc_plot()
# all cursors
 cursors <- s %>% ephys2:::tidy_cursorresults()
 s %>% ggsweeps("labeled") + 
   geom_point( data=cursors %>% filter(swplabel!=""), aes(x,y, pch=cursor),  color="black",  size=2)

.



tdanker/ephys2 documentation built on Aug. 11, 2019, 12:12 p.m.