Skip to content

Commit

Permalink
Use file index to plot chromatograms
Browse files Browse the repository at this point in the history
  • Loading branch information
jasenfinch committed Aug 11, 2023
1 parent d676f4b commit 07fc678
Showing 1 changed file with 6 additions and 33 deletions.
39 changes: 6 additions & 33 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,30 +128,14 @@ setMethod('plotChromatogram',signature = 'Binalysis',
scans <- x %>%
scans()
chromatograms <- chromatograms %>%
dplyr::select(FileName,
select(idx,
FileName,
acquisitionNum,
totIonCurrent,
polarity,
filterString) %>%
split(.$polarity) %>%
map(~{
f <- .
f %>%
split(.$FileName) %>%
map(~{
a <- .
a %>%
split(.$filterString) %>%
map(~{
b <- .
b %>%
mutate(acquisitionNum = seq_len(nrow(.)))
}) %>%
bind_rows()
}) %>%
bind_rows()
}) %>%
bind_rows() %>%
group_by(polarity,idx,filterString) %>%
mutate(acquisitionNum = seq_len(n())) %>%
group_by(polarity,acquisitionNum) %>%
summarise(totIonCurrent = mean(totIonCurrent))

Expand Down Expand Up @@ -182,19 +166,8 @@ plotChromFromFile <- function(files, scans = c()){
openMSfile(.,backend = 'pwiz') %>%
header() %>%
select(acquisitionNum,totIonCurrent,polarity,filterString) %>%
split(.$polarity) %>%
map(~{
a <- .
a %>%
split(.$filterString) %>%
map(~{
b <- .
b %>%
mutate(acquisitionNum = seq_len(nrow(.)))
}) %>%
bind_rows()
}) %>%
bind_rows() %>%
group_by(polarity,filterString) %>%
mutate(acquisitionNum = seq_len(n())) %>%
group_by(polarity,acquisitionNum) %>%
summarise(totIonCurrent = mean(totIonCurrent))
}) %>%
Expand Down

0 comments on commit 07fc678

Please sign in to comment.