nxtrim: Software to remove Nextera Mate Pair junction adapters and categorise reads according to the orientation implied by the adapter location. This software is not commercially supported.
Copyright (c) 2018, Illumina, Inc. All rights reserved.
This software is provided under the terms and conditions of the BSD 2-Clause License
You should have received a copy of the BSD 2-Clause License along with this program. If not, see https://github.com/sequencing/licenses/.
Some detailed assembly results for Nextera Mate-Pair data are available here
git clone https://github.com/sequencing/NxTrim.git cd NxTrim make ./nxtrim
Trimming and assembly with Velvet:
nxtrim -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -O sample velveth output_dir 55 -short -fastq.gz sample.se.fastq.gz -shortPaired2 -fastq.gz sample.pe.fastq.gz -shortPaired3 -fastq.gz sample.mp.fastq.gz -shortPaired4 -fastq.gz sample.unknown.fastq.gz velvetg output_dir -exp_cov auto -cov_cutoff auto -shortMatePaired4 yes
the above approach corresponds to the results in the NxTrim publication.
Trimming and assembly with SPAdes:
nxtrim -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz --stdout | gzip -1 -c > sample.allmp.fastq.gz spades.py -t 4 --hqmp1-12 sample.allmp.fastq.gz -o output_dir
We concatenate the unknown/mp libraries in this example for SPAdes. SPAdes versions>3.1.0 seems to perform better without our virtual single/pe libraries.
Note: We achieved good results using the above commands on the bacterial samples analysed in the NxTrim paper. These had modest coverage (<50X). If you have very high coverage samples, it might be preferable to not use the "unknown" library at all or just treat it as a single-ended library, this will remove the risk of PE contaminants causing problems.
Piping trimmed reads directly to an aligner:
nxtrim --stdout -1 EcMG1_ATGTCA_L001_R1_001.fastq.gz -2 EcMG1_ATGTCA_L001_R2_001.fastq.gz | bwa mem EcMG.fna -p - > out.sam or nxtrim --stdout-mp -1 EcMG1_ATGTCA_L001_R1_001.fastq.gz -2 EcMG1_ATGTCA_L001_R2_001.fastq.gz | bwa mem EcMG.fna -p - > out.sam
The first command pipes both unknown/MP reads to stdout, this is useful if you have a high quality reference to align to. The second only prints known MP reads, which is useful for scaffolding purposes.
The default behaviour expects fastq files from a Nextera Mate-Pair library kit in reverse-forward orientation.
Based on the location of the Nextera junction adapter (if detected), nxtrim produces four different "virtual libraries":
- mp: read pairs that are large insert-size mate-pairs, both mates will be reverse-complemented by nxtrim (from RF to FR) unless
--rfcommandline option is used
- pe: read pairs that are short insert-size paired-end reads due to the junction adapter occurring early in a read
- se: single reads (reads having no R1 or R2 counterpart)
- unknown: a library of read-pairs that are mostly large-insert mate-pair, but possibly contain a small proportion of paired end contaminants
Output is reverse-complemented such that the resulting reads will be in forward-reverse orientation.
If you wish to keep your reads as reverse-forward then use
If you wish to generate pure mate-pair libraries (say for scaffolding), you can use the
--justmp flag. This will only generate the unknown and mp libraries. Reads with a junction adapter occurring < minlength bp before the start will be completely N masked.
If you wish to preserve mate-pair libraries whenever possible, the
--preservemp flag may be useful. This will always keep the mate-pair library unless a read generated would be < minlength, in which case it will generate a PE.
You can trade specificity/sensitivity of junction adapter detection with the
--similarity flag (1 - proportion of bp differences allowed for match) and the
--minoverlap flag (minimum #bp considered on the ends of reads to match with the Nextera junction adapter). The defaults were well suited to bacteria in our testing.
You can turn on a more aggressive search for junction adapters with
--aggressive. Some notes on how we detect adapters are here.
Free registration required.