Reads Filtering and Processing - mchialva/myNGS_tools GitHub Wiki
reorient_PE_reads.R
This R script reorient 16S/18S barcoded amplicon reads from non-directional Illumina PE sequencing according to FW and REV primer sequence. Reads in input must be in .fastq or .fastq.gz formats. Two files will be generated: R1 containing only FW reads, R2 containing only REV reads. The script recognize a barcode sequence of a given length (upstream to primers) and trims variable Ns upstream to barcodes at the beginning of reads (if any) retaining only paisr that contain at least one full barcode on one side or both. Read pairs without a primer match at both R1 and R2 (partial primer sequence on both R1/R2), or pairs without at least one complete barcode will be discarded. The script needs fqgrep (https://github.com/indraniel/fqgrep) to be installed. Reads in input must have the same name in R1 and R2 files (different reads comments are allowed)
Rscript commandline Usage:
Rscript reorient_PE_reads.R path_to_R1 path_to_R2 fw_primer rev_primer primer_mismatch output_dir barcode_length nthreads