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

overlays of different plots #54

Open
cpanse opened this issue Aug 20, 2019 · 0 comments
Open

overlays of different plots #54

cpanse opened this issue Aug 20, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@cpanse
Copy link
Contributor

cpanse commented Aug 20, 2019

code snippet by Dierk-Christoph Pöther

#Package handling
library(rawDiag)
library(ggplot2)
library(dplyr)
library(viridisLite)

#read .raw-file
raw<-read.raw(file.path("path","xy.raw"))

#BasePeak/TIC&InjectionTime
rawMS<-raw[raw$MSOrder=="Ms",]
ggplot(data=rawMS)+
  geom_line(aes(rawMS$StartTime,rawMS$BasePeakIntensity))+ #rawMS$TIC instead of BasePeakIntensity
  geom_jitter(aes(rawMS$StartTime,rawMS$IonInjectionTimems*5*10^6),size=0.1,col="red",alpha=0.2)+
  scale_y_continuous(sec.axis=sec_axis(~./(5*10^6)))

#BasePeak/TIC&CycleTime
CT<-calc.cycle.time(x = raw)
rawCT<-merge(x=raw[,c("StartTime","BasePeakIntensity","TIC")],y=CT[,c("StartTime","CycleTime")],by.x="StartTime",all.x=T)
ggplot(data=rawCT)+
  geom_line(aes(rawCT$StartTime,rawCT$BasePeakIntensity))+ #rawMS$TIC instead of BasePeakIntensity
  geom_jitter(aes(rawCT$StartTime,rawCT$CycleTime*1*10^9),size=0.1,col="red",alpha=0.2)+
  scale_y_continuous(sec.axis=sec_axis(~./(1*10^9)))

#BasePeak/TIC&CycleLoad
MSN<-na.omit(raw%>%dplyr::count(MasterScanNumber))
cycload<-merge(x=raw[,c("MasterScanNumber","StartTime","BasePeakIntensity","TIC")],y=MSN[,c("MasterScanNumber","n")],by.x="MasterScanNumber",all.x=T)
ggplot(data=cycload)+
  geom_line(aes(cycload$StartTime,cycload$BasePeakIntensity))+ #rawMS$TIC instead of BasePeakIntensity
  geom_jitter(aes(cycload$StartTime,cycload$n*1*10^8),size=0.1,col="red",alpha=0.2,height=0.1*10^8)+
  scale_y_continuous(sec.axis=sec_axis(~./(1*10^8)))

##BasePeak/TIC&precursor/RT
rawMS2<-raw[raw$MSOrder=="Ms2",]
MS2<-merge(x=raw[,c("StartTime","BasePeakIntensity","TIC")],y=rawMS2[,c("StartTime","PrecursorMass")],by.x="StartTime",all.x=T)
ggplot(data=MS2)+
  geom_line(aes(MS2$StartTime,MS2$BasePeakIntensity))+ #rawMS$TIC instead of BasePeakIntensity
  geom_hex(aes(MS2$StartTime,MS2$PrecursorMass*5*10^5),bins=50)+scale_fill_viridis_c(alpha=0.7)+
  scale_y_continuous(sec.axis=sec_axis(~./(5*10^5)))

pdf("C:/Users/Dierk/Desktop/overlays.pdf",paper="a4r",width=297/2.54,height=210/2.54)
print(Fig11)
print(Fig12)
print(Fig13)
print(Fig14)
dev.off()

overlays-3
overlays-2
overlays-1
overlays-0

@cpanse cpanse added the enhancement New feature or request label Aug 20, 2019
@cpanse cpanse self-assigned this Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant