Skip to content

Commit 405489a

Browse files
committed
disable upset plots
temporarily until dependency is fixed
1 parent 7cec1a9 commit 405489a

28 files changed

Lines changed: 126 additions & 103 deletions

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: MetMashR
22
Type: Package
33
Title: Metabolite Mashing with R
4-
Version: 1.3.0
4+
Version: 1.3.1
55
Authors@R: c(
66
person(
77
c("Gavin","Rhys"),
@@ -26,7 +26,7 @@ Description: A package to merge, filter sort, organise and otherwise mash
2626
License: GPL-3
2727
Encoding: UTF-8
2828
LazyData: false
29-
RoxygenNote: 7.3.1
29+
RoxygenNote: 7.3.3
3030
Depends:
3131
R (>= 4.3.0),
3232
struct

R/cd_source_class.R

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44
#' @family annotation tables
55
#' @rawNamespace import(dplyr, except = as_data_frame)
66
#' @export
7-
cd_source <- function(source,
8-
sheets = c(1, 1),
9-
tag = "CD",
10-
mz_column = "mz",
11-
rt_column = "rt",
12-
id_column = "id",
13-
data = NULL,
14-
...) {
7+
cd_source <- function(
8+
source,
9+
sheets = c(1, 1),
10+
tag = "CD",
11+
mz_column = "mz",
12+
rt_column = "rt",
13+
id_column = "id",
14+
data = NULL,
15+
...) {
1516
if (is.null(data)) {
1617
data <- data.frame()
1718
}
18-
19+
1920
if (nrow(data) == 0 & ncol(data) == 0) {
2021
data <- data.frame(
2122
id = character(0),
@@ -28,7 +29,7 @@ cd_source <- function(source,
2829
rt_column
2930
)
3031
}
31-
32+
3233
# new object
3334
out <- new_struct(
3435
"cd_source",
@@ -39,6 +40,7 @@ cd_source <- function(source,
3940
id_column = id_column,
4041
.required = c(mz_column, id_column, rt_column),
4142
data = data,
43+
sheets= sheets,
4244
...
4345
)
4446
return(out)
@@ -67,7 +69,7 @@ cd_source <- function(source,
6769
"The name or index of the sheets to read from the source ",
6870
"file(s). A sheet should be provided for each input file."
6971
),
70-
value = c(2, 2),
72+
value = c(1, 1),
7173
type = c("character", "numeric", "integer"),
7274
max_length = 2
7375
),
@@ -111,49 +113,49 @@ setMethod(
111113
# read files
112114
TB1 <- .read_cd_compounds_file(M, 1)
113115
TB2 <- .read_cd_isomers_file(M, 2)
114-
116+
115117
# join blue and orange
116118
L <- list()
117119
L[[1]] <- left_join(TB1$blue, TB1$orange,
118-
by = join_by(blue_id),
119-
suffix = c(".blue", ".orange")
120+
by = join_by(blue_id),
121+
suffix = c(".blue", ".orange")
120122
)
121123
L[[2]] <- left_join(TB2$blue, TB2$orange,
122-
by = join_by(blue_id),
123-
suffix = c(".blue", ".orange")
124+
by = join_by(blue_id),
125+
suffix = c(".blue", ".orange")
124126
)
125-
127+
126128
# join grey
127129
L[[1]] <- left_join(L[[1]], TB1$grey, by = join_by(
128130
blue_id == blue_id,
129131
orange_id == orange_id
130132
), suffix = c(".blueorange", ".grey"))
131-
133+
132134
# summarise
133135
L[[1]] <- L[[1]] %>%
134136
group_by(blue_id, Ion) %>%
135137
summarise(
136138
Compound = unique(Name),
137139
Formula = unique(Formula),
138140
RT = mean(as.numeric(.data[["RT [min].grey"]]) * 60,
139-
na.rm = TRUE
141+
na.rm = TRUE
140142
),
141143
mzcloud_score = mean(as.numeric(mzCloud.Best.Match),
142-
na.rm = TRUE
144+
na.rm = TRUE
143145
),
144146
Charge = unique(Charge),
145147
mz = mean(as.numeric(.data[["m/z.grey"]]), na.rm = TRUE),
146148
area = max(Area),
147149
file_count = n()
148150
)
149-
151+
150152
# join compounds and isomers
151153
OUT <- left_join(L[[1]], L[[2]],
152-
by = join_by(blue_id),
153-
relationship = "many-to-many", suffix = c(".cpd", ".iso")
154+
by = join_by(blue_id),
155+
relationship = "many-to-many", suffix = c(".cpd", ".iso")
154156
)
155-
156-
157+
158+
157159
OUT <- OUT %>%
158160
# select relevant columns
159161
select(
@@ -190,17 +192,17 @@ setMethod(
190192
"theoretical_mass"
191193
), as.numeric)
192194
)
193-
195+
194196
# calc theoretical mz
195197
OUT$theoretical_mz <- OUT$mz * 1e6 /
196198
(OUT$library_ppm_diff + 1e6)
197-
199+
198200
# id row id
199201
OUT$id <- as.character(seq_len(nrow(OUT)))
200-
202+
201203
# update object
202204
M$data <- as.data.frame(OUT)
203-
205+
204206
# return
205207
return(M)
206208
}
@@ -211,26 +213,26 @@ setMethod(
211213
# COMP FILE
212214
input_file <- M$source[idx]
213215
sheet <- M$sheets[idx]
214-
216+
215217
cd <- openxlsx::read.xlsx(
216218
input_file,
217219
sheet
218220
)
219-
221+
220222
# add some ids for joining later
221223
cd$blue_id <- NA
222224
cd$orange_id <- NA
223-
225+
224226
for (k in seq_len(nrow(cd))) {
225227
n <- sum(cd$Checked[seq_len(k)] %in% c("TRUE", "FALSE"), na.rm = TRUE)
226228
cd$blue_id[k] <- n
227229
n <- sum(cd$Name[seq_len(k)] %in% c("TRUE", "FALSE"), na.rm = TRUE)
228230
cd$orange_id[k] <- n
229231
}
230-
232+
231233
## blue rows
232234
blue <- cd %>% filter(Checked == "FALSE")
233-
235+
234236
## orange rows
235237
# find colnames
236238
w <- which(cd$Checked == "Tags")
@@ -243,7 +245,7 @@ setMethod(
243245
orange <- cd %>%
244246
select(all_of(x)) %>%
245247
filter(Checked %in% c("TRUE", "FALSE"))
246-
248+
247249
return(
248250
list(
249251
blue = blue,
@@ -258,23 +260,23 @@ setMethod(
258260
M$source[idx],
259261
M$sheets[idx]
260262
)
261-
263+
262264
# add some ids for joining later
263265
cd$blue_id <- NA
264266
cd$orange_id <- NA
265-
267+
266268
for (k in seq_len(nrow(cd))) {
267269
n <- sum(cd$Checked[seq_len(k)] %in% c("TRUE", "FALSE"), na.rm = TRUE)
268270
cd$blue_id[k] <- n
269271
n <- sum(cd$Name[seq_len(k)] %in% c("TRUE", "FALSE"), na.rm = TRUE)
270272
cd$orange_id[k] <- n
271273
}
272-
274+
273275
## blue rows
274276
blue <- cd %>%
275277
filter(Checked == "FALSE") %>%
276278
select(-orange_id)
277-
279+
278280
## orange rows
279281
# find colnames
280282
w <- which(cd$Checked == "Tags")
@@ -287,7 +289,7 @@ setMethod(
287289
orange <- cd %>%
288290
select(all_of(x)) %>%
289291
filter(Checked %in% c("TRUE", "FALSE"))
290-
292+
291293
## grey rows
292294
# find colnames
293295
w <- which(cd$Name == "Tags")
@@ -300,7 +302,7 @@ setMethod(
300302
grey <- cd %>%
301303
select(all_of(x)) %>%
302304
filter(Checked == "FALSE")
303-
305+
304306
return(
305307
list(
306308
blue = blue,

R/trim_whitespace_class.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ setMethod(
9999
}
100100

101101
# get trimws
102-
trimmed <- lapply(D$data[, cnames], trimws,
102+
trimmed <- lapply(D$data[, cnames,drop=FALSE], trimws,
103103
which = M$which, whitespace = M$whitespace
104104
)
105105

man/AnnotationDb_database.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/AnnotationDb_select.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/BiocFileCache_database.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/GO_database.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/MTox700plus_database.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/PathBank_metabolite_database.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/annotation_histogram2d.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)