|
@ -6,22 +6,31 @@ library("parallel") |
|
|
|
|
|
|
|
|
# Configurations ############################################################# |
|
|
# Configurations ############################################################# |
|
|
# file : decides which file to read in data from ############################# |
|
|
# file : decides which file to read in data from ############################# |
|
|
file <- "/home/junikim/programming/patternmatch/data/allcluster_mz.csv" |
|
|
|
|
|
#file <- "/home/junikim/programming/patternmatch/data/15_Clusters_for_Tuning_29June21.txt" |
|
|
|
|
|
|
|
|
|
|
|
# check cluster 2846 |
|
|
|
|
|
|
|
|
file <- "/path/to/script" |
|
|
|
|
|
|
|
|
|
|
|
# All isotopes to search for |
|
|
search_isos <- c("37Cl", "81Br") |
|
|
search_isos <- c("37Cl", "81Br") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Minimum size of a cluster |
|
|
# Minimum size of a cluster |
|
|
|
|
|
|
|
|
min_cluster_size <- 2 |
|
|
min_cluster_size <- 2 |
|
|
|
|
|
|
|
|
# Number of cores to be used (will be adjusted if not possible) |
|
|
|
|
|
|
|
|
# Number of cores to be used (will be adjusted if it exceeds the true number of cores) |
|
|
use_cores <- 6 |
|
|
use_cores <- 6 |
|
|
|
|
|
|
|
|
# Do not edit below. |
|
|
|
|
|
|
|
|
# Table name configuration |
|
|
|
|
|
|
|
|
|
|
|
# Column name for m/z |
|
|
|
|
|
columns.mz <- "mz" |
|
|
|
|
|
# Column name for time in gc |
|
|
|
|
|
columns.time <- "time" |
|
|
|
|
|
# Column name for intensities |
|
|
|
|
|
columns.intensity <- "Intensity" |
|
|
|
|
|
# Column name for fragment numbers (only numbers accepted) |
|
|
|
|
|
columns.spectra <- "Spectra_Number" |
|
|
|
|
|
|
|
|
|
|
|
############################################################################## |
|
|
|
|
|
# Script |
|
|
|
|
|
|
|
|
iso_length <- length(search_isos) |
|
|
iso_length <- length(search_isos) |
|
|
if (!("13C" %in% search_isos)) { |
|
|
if (!("13C" %in% search_isos)) { |
|
|
search_isos <- append(search_isos, "13C") |
|
|
search_isos <- append(search_isos, "13C") |
|
@ -29,8 +38,11 @@ if (!("13C" %in% search_isos)) { |
|
|
# Read in the Table ########################################################## |
|
|
# Read in the Table ########################################################## |
|
|
table <- read.table(file, header=TRUE, sep=",") |
|
|
table <- read.table(file, header=TRUE, sep=",") |
|
|
|
|
|
|
|
|
|
|
|
# Sort table by spectra ID |
|
|
|
|
|
table <- table[order(table[,columns.spectra]),] |
|
|
|
|
|
|
|
|
# Organize the tables by number ############################################## |
|
|
# Organize the tables by number ############################################## |
|
|
fragments <- max(table[,"Spectra_Number"]) |
|
|
|
|
|
|
|
|
fragments <- max(table[,columns.spectra]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# The algorithm below guarantees linear complexity of looking up data points.# |
|
|
# The algorithm below guarantees linear complexity of looking up data points.# |
|
@ -48,7 +60,7 @@ usable <- unlist(map(1:fragments, function(x) FALSE)) |
|
|
|
|
|
|
|
|
# Set all of the intervals ################################################### |
|
|
# Set all of the intervals ################################################### |
|
|
for (i in seq(1, nrow(table))) { |
|
|
for (i in seq(1, nrow(table))) { |
|
|
fragment <- table[i, "Spectra_Number"] |
|
|
|
|
|
|
|
|
fragment <- table[i, columns.spectra] |
|
|
if (! usable[fragment]) { |
|
|
if (! usable[fragment]) { |
|
|
minint[fragment] <- i |
|
|
minint[fragment] <- i |
|
|
} |
|
|
} |
|
@ -71,9 +83,10 @@ getdata <- function(fragment, key) { |
|
|
|
|
|
|
|
|
# Add all data frames as necessary for evaluation. ############################ |
|
|
# Add all data frames as necessary for evaluation. ############################ |
|
|
getdataframe <- function (fragment) { |
|
|
getdataframe <- function (fragment) { |
|
|
mz <- getdata(fragment, "mz") |
|
|
|
|
|
time <- getdata(fragment, "time") |
|
|
|
|
|
Intensity <- getdata(fragment, "Intensity") |
|
|
|
|
|
|
|
|
mz <- getdata(fragment, columns.mz) |
|
|
|
|
|
time <- getdata(fragment, columns.time) |
|
|
|
|
|
Intensity <- getdata(fragment, columns.intensity) |
|
|
|
|
|
# Must be indexed in this order. |
|
|
return(data.frame(mz=mz, Intensity=Intensity,time=time)) |
|
|
return(data.frame(mz=mz, Intensity=Intensity,time=time)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|