Hello! I am having a bit of trouble and my story is long and irritating...essentially i have 498 samples im trying to run. Im using my pathetic little laptop so running the errors and dereplicating took days and my laptop crashed a few times. So i stupidly went on chatgpt for help. The code i gave me joined the dereplication and dada inference steps. And after each sample, itsaved all my files in a folder (the folder containing the filtered files). I finally managed to get all the data. However, when trying to merge is get an error.
I have all the data saved - the errFs, errRs, dadaFs, dadaRs, filtered files,
(My dadaR and dadaF files are in separate folders)
My code for derep and dada:
for (i in remaining_idx) {
cat("Processing sample:", sample.names[i], "\n")
Dereplicate
derepF <- derepFastq(filtFs[i])
derepR <- derepFastq(filtRs[i])
names(derepF) <- sample.names[i]
names(derepR) <- sample.names[i]
Run dada
dadaF <- dada(derepF, err=errF, multithread=TRUE)
dadaR <- dada(derepR, err=errR, multithread=TRUE)
SAVE immediately (critical)
saveRDS(dadaF, paste0("E:/FastqFiles/dadaFs_", sample.names[i], ".rds"))
saveRDS(dadaR, paste0("E:/FastqFiles/dadaRs_", sample.names[i], ".rds"))
Clean memory
rm(derepF, derepR, dadaF, dadaR)
gc()
cat("Finished:", sample.names[i], "\n\n")
}
Code for merging:
filt_path <- "E:/FastqFiles/filtered"
filtFs <- sort(list.files(filt_path, pattern="_F_filt.fastq.gz", full.names = TRUE))
filtRs <- sort(list.files(filt_path, pattern="_R_filt.fastq.gz", full.names = TRUE))
sample.names <- sapply(strsplit(basename(filtFs), "_F_filt.fastq.gz"), [, 1)
for (i in seq_along(sample.names)) {
-
cat("Merging sample:", sample.names[i], "\n")
-
-
dadaF <- readRDS(filesF[i])
-
dadaR <- readRDS(filesR[i])
-
-
-
-
-
-
-
-
-
-
saveRDS(merger, paste0("E:/FastqFiles/merger_", sample.names[i], ".rds"))
-
-
-
-
cat("Finished:", sample.names[i], "\n\n")
- }
Error in mergePairs(dadaFs, dadaRs, filtFs, filtRs, verbose = TRUE) :
dadaF and dadaR must be provided as dada-class objects or lists of dada-class objects.
Please help!
Hello! I am having a bit of trouble and my story is long and irritating...essentially i have 498 samples im trying to run. Im using my pathetic little laptop so running the errors and dereplicating took days and my laptop crashed a few times. So i stupidly went on chatgpt for help. The code i gave me joined the dereplication and dada inference steps. And after each sample, itsaved all my files in a folder (the folder containing the filtered files). I finally managed to get all the data. However, when trying to merge is get an error.
I have all the data saved - the errFs, errRs, dadaFs, dadaRs, filtered files,
(My dadaR and dadaF files are in separate folders)
My code for derep and dada:
for (i in remaining_idx) {
cat("Processing sample:", sample.names[i], "\n")
Dereplicate
derepF <- derepFastq(filtFs[i])
derepR <- derepFastq(filtRs[i])
names(derepF) <- sample.names[i]
names(derepR) <- sample.names[i]
Run dada
dadaF <- dada(derepF, err=errF, multithread=TRUE)
dadaR <- dada(derepR, err=errR, multithread=TRUE)
SAVE immediately (critical)
saveRDS(dadaF, paste0("E:/FastqFiles/dadaFs_", sample.names[i], ".rds"))
saveRDS(dadaR, paste0("E:/FastqFiles/dadaRs_", sample.names[i], ".rds"))
Clean memory
rm(derepF, derepR, dadaF, dadaR)
gc()
cat("Finished:", sample.names[i], "\n\n")
}
Code for merging:
filt_path <- "E:/FastqFiles/filtered"
Error in mergePairs(dadaFs, dadaRs, filtFs, filtRs, verbose = TRUE) :
dadaF and dadaR must be provided as dada-class objects or lists of dada-class objects.
Please help!