Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed plotrange #115

Merged
merged 5 commits into from
Dec 3, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions R/concRespPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,31 @@ concRespPlot <- function(row,ymin=-120,ymax=120,draw.error.arrows=FALSE) {
conc <- as.numeric(str_split(row[1,"conc"],"\\|")[[1]])
resp <- as.numeric(str_split(row[1,"resp"],"\\|")[[1]])

# replace untreated controls with pseudo value
if (any(conc==0)) warning("Data contains untreated controls (conc = 0). A pseudo value replaces -Inf after log-transform. The pseudo value is set to one log-unit below the lowest experimental `conc`.")
logconc <- log10(conc)
# replace the negative infinity with a number that is one log-10 unit
# less than the second lowest dose (in log).
logconc <- replace(logconc, logconc == -Inf, sort(unique(logconc))[2]-1)
conc <- 10**logconc

#some deprecated code; later will use j =1 and col.list[j] to mean black
col.list <- c("black","cyan","red")

#empty plot to start with
plotrange = c(0.001,100)
plotrange = c(min(conc),max(conc))
plot(c(1,1),type="n",xlab="conc (uM)",ylab="Response",xlim=plotrange,ylim=c(ymin,ymax),
log="x",main=paste(name,"\n",assay),cex.main=0.9)

#cutoffs and gray rectangular noise region
rect(xleft=0.001,ybottom=-cutoff,xright=100,ytop=cutoff,col="lightgray")
lines(c(0.001,100),c(cutoff,cutoff),lwd=1)
lines(c(0.001,100),c(-cutoff,-cutoff),lwd=1)
rect(xleft=plotrange[1],ybottom=-cutoff,xright=plotrange[2],ytop=cutoff,col="lightgray")
lines(plotrange,c(cutoff,cutoff),lwd=1)
lines(plotrange,c(-cutoff,-cutoff),lwd=1)

#thick line at 0 and bmrs
lines(c(0.001,100),c(0,0),lwd=2)
lines(c(0.001,100),c(bmr,bmr),lwd=1)
lines(c(0.001,100),c(-bmr,-bmr),lwd=1)
lines(plotrange,c(0,0),lwd=2)
lines(plotrange,c(bmr,bmr),lwd=1)
lines(plotrange,c(-bmr,-bmr),lwd=1)

#height for top labels
yplot <- ymax*0.95
Expand Down