Skip to content

Commit

Permalink
Try to solve the variableMetadata column problem v2
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienCode404 committed Nov 5, 2024
1 parent dd106f1 commit 04a9bdd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 4 additions & 2 deletions tools/camera/CAMERA_findAdducts.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,18 @@ ncols <- length(colnames(peakList))
sample_cols <- length(rownames(xdata@phenoData)) # Number of samples

# Indices for the columns of interest
main_cols <- 1:(ncols - sample_cols) # Main columns before sample columns
main_cols <- 1:(ncols - sample_cols - 3) # Main columns before sample columns
tail_cols <- (ncols - 2):ncols # The last 3 columns (adduct, isotope, pcgroup)

# Combine the selected columns from matgrp with the group names
variableMetadata <- cbind(
name = names_default,
name_custom = names_custom,
peakList[, c(main_cols, tail_cols)]
stringsAsFactors = FALSE
)

variableMetadata <- cbind(variableMetadata, peakList[, c(main_cols, tail_cols)])

if (!exists("RTinMinute")) RTinMinute <- FALSE

if (args$convertRTMinute && RTinMinute == FALSE) {
Expand Down
6 changes: 4 additions & 2 deletions tools/camera/CAMERA_findIsotopes.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,18 @@ ncols <- length(colnames(peakList))
sample_cols <- length(rownames(xdata@phenoData)) # Number of samples

# Indices for the columns of interest
main_cols <- 1:(ncols - sample_cols) # Main columns before sample columns
main_cols <- 1:(ncols - sample_cols - 3) # Main columns before sample columns
tail_cols <- (ncols - 2):ncols # The last 3 columns (adduct, isotope, pcgroup)

# Combine the selected columns from matgrp with the group names
variableMetadata <- cbind(
name = names_default,
name_custom = names_custom,
peakList[, c(main_cols, tail_cols)]
stringsAsFactors = FALSE
)

variableMetadata <- cbind(variableMetadata, peakList[, c(main_cols, tail_cols)])

if (!exists("RTinMinute")) RTinMinute <- FALSE

if (args$convertRTMinute && RTinMinute == FALSE) {
Expand Down
6 changes: 4 additions & 2 deletions tools/camera/CAMERA_groupCorr.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,18 @@ ncols <- length(colnames(peakList))
sample_cols <- length(rownames(xdata@phenoData)) # Number of samples

# Indices for the columns of interest
main_cols <- 1:(ncols - sample_cols) # Main columns before sample columns
main_cols <- 1:(ncols - sample_cols - 3) # Main columns before sample columns
tail_cols <- (ncols - 2):ncols # The last 3 columns (adduct, isotope, pcgroup)

# Combine the selected columns from matgrp with the group names
variableMetadata <- cbind(
name = names_default,
name_custom = names_custom,
peakList[, c(main_cols, tail_cols)]
stringsAsFactors = FALSE
)

variableMetadata <- cbind(variableMetadata, peakList[, c(main_cols, tail_cols)])

if (!exists("RTinMinute")) RTinMinute <- FALSE

if (args$convertRTMinute == TRUE && RTinMinute == FALSE) {
Expand Down
6 changes: 4 additions & 2 deletions tools/camera/CAMERA_groupFWHM.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,18 @@ ncols <- length(colnames(peakList))
sample_cols <- length(rownames(xdata@phenoData)) # Number of samples

# Indices for the columns of interest
main_cols <- 1:(ncols - sample_cols) # Main columns before sample columns
main_cols <- 1:(ncols - sample_cols - 3) # Main columns before sample columns
tail_cols <- (ncols - 2):ncols # The last 3 columns (adduct, isotope, pcgroup)

# Combine the selected columns from matgrp with the group names
variableMetadata <- cbind(
name = names_default,
name_custom = names_custom,
peakList[, c(main_cols, tail_cols)]
stringsAsFactors = FALSE
)

variableMetadata <- cbind(variableMetadata, peakList[, c(main_cols, tail_cols)])

if (!exists("RTinMinute")) RTinMinute <- FALSE

if (args$convertRTMinute && RTinMinute == FALSE) {
Expand Down

0 comments on commit 04a9bdd

Please sign in to comment.