-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add script and process to extract unmerged seqs from the rds file
- mimics logic from old NGS16S pipeline script as described in #17
- Loading branch information
Hoogestraat
committed
May 18, 2022
1 parent
018dae0
commit cc27b5b
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env Rscript | ||
|
||
suppressPackageStartupMessages(library(argparse, quietly = TRUE)) | ||
suppressPackageStartupMessages(library(tidyr, quietly = TRUE)) | ||
suppressPackageStartupMessages(library(readr, quietly = TRUE)) | ||
suppressPackageStartupMessages(library(dplyr, quietly = TRUE)) | ||
n | ||
main <- function(arguments){ | ||
parser <- ArgumentParser( | ||
description="Write forward and reverse unmerged denoised, dereplicated reads") | ||
parser$add_argument('rdata', help='RDS files containing dada2 output') | ||
parser$add_argument( | ||
'-o', '--outfile', default='chim_dropped.csv', | ||
help='output csv file with weight and sequence of svs identified as chimeras') | ||
|
||
args <- parser$parse_args(arguments) | ||
|
||
obj <- readRDS(args$rdata) | ||
seqtab <- as.data.frame(as.table(obj$seqtab)) | ||
seqtab.nochim <- as.data.frame(as.table(obj$seqtab.nochim)) | ||
|
||
seqtab %>% anti_join(seqtab.nochim, by=c('Var2')) %>% | ||
arrange(-Freq) %>% rename(sequence=Var2) %>% | ||
rename(weight=Freq) %>% select(weight, sequence) %>% | ||
write_csv(args$outfile) | ||
} | ||
|
||
main(commandArgs(trailingOnly=TRUE)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters