TRIM_GALORE(1)

okay bestie, pull up a chair πŸ’– this is the manual page for trim_galore β€” it lives in section 1, User Commands, and it's literally about to become your new fave. no cap.


✨ NAME ✨

trim_galore β€” automate quality and adapter trimming for DNA sequencing πŸ§¬πŸ¦‹


🌸 DESCRIPTION 🌸

okay so here's how you actually run it:

trim_galore [options] <filename(s)>

that's it, that's the whole vibe. now let's go through the options one by one, because there are A LOT and every single one matters πŸ‘‘

  • -h/--help β€” prints this help message and then dips (exits). πŸ’…
  • -v/--version β€” prints the version info and then dips (exits). πŸ’…
  • -q/--quality <INT> β€” trims the low-quality ends off your reads in addition to adapter removal. here's the tea: for RRBS samples, quality trimming happens first, and adapter trimming happens in a second round. other files get quality + adapter trimmed in a single pass. the algorithm is the exact same one BWA uses (Subtract INT from all qualities; compute partial sums from all indices to the end of the sequence; cut sequence at the index at which the sum is minimal). default Phred score: 20.
  • --phred33 β€” tells Cutadapt to use ASCII+33 quality scores as Phred scores (Sanger/Illumina 1.9+ encoding) for quality trimming. default: ON. βœ…
  • --phred64 β€” tells Cutadapt to use ASCII+64 quality scores as Phred scores (Illumina 1.5 encoding) for quality trimming.
  • --fastqc β€” runs FastQC in the default mode on the FastQ file once trimming is done. πŸŽ€
  • --fastqc_args "<ARGS>" β€” passes extra arguments to FastQC. if you're passing more than one argument, they gotta be in the form "arg1 arg2 etc.". example incoming:
--fastqc_args "--nogroup --outdir /home/"

heads up: passing extra arguments automatically invokes FastQC, so you don't have to specify --fastqc separately. slay ✨

  • -a/--adapter <STRING> β€” the adapter sequence to be trimmed. if you don't specify it explicitly, Trim Galore will try to auto-detect whether the Illumina universal, Nextera transposase or Illumina small RNA adapter sequence was used. also peep --illumina, --nextera and --small_rna. if no adapter can be detected within the first 1 million sequences of the first file specified, or if there's a tie between several adapter sequences, Trim Galore defaults to --illumina (as long as the Illumina adapter was one of the options, else --nextera is the default). you can also give a single base like -a A{10}, which gets expanded to -a AAAAAAAAAA. πŸ’…
  • -a2/--adapter2 <STRING> β€” optional adapter sequence to trim off read 2 of paired-end files. this option requires --paired to be specified too. if the libraries being trimmed are smallRNA, then a2 gets set to the Illumina small RNA 5' adapter automatically (GATCGTCGGACT). a single base works here too, e.g. -a2 A{10} expands to -a2 AAAAAAAAAA.
  • --illumina β€” the adapter sequence being trimmed is the first 13bp of the Illumina universal adapter AGATCGGAAGAGC, instead of the default auto-detection of adapter sequence.
  • --nextera β€” the adapter sequence being trimmed is the first 12bp of the Nextera adapter CTGTCTCTTATA, instead of the default auto-detection of adapter sequence.
  • --small_rna β€” the adapter sequence being trimmed is the first 12bp of the Illumina Small RNA 3' Adapter TGGAATTCTCGG, instead of the default auto-detection of adapter sequence. choosing to trim smallRNA adapters will also lower the --length value to 18bp. if the smallRNA libraries are paired-end then a2 gets set to the Illumina small RNA 5' adapter automatically (GATCGTCGGACT) unless -a 2 had been defined explicitly.
  • --consider_already_trimmed <INT> β€” during adapter auto-detection, the limit set by <INT> lets you set a threshold up to which the file is considered already adapter-trimmed. if no adapter sequence exceeds this threshold, no additional adapter trimming will be performed (technically, the adapter is set to -a X). quality trimming is still performed as usual. default: NOT SELECTED (i.e. normal auto-detection precedence rules apply).
  • --max_length <INT> β€” discards reads that are longer than <INT> bp after trimming. this is only advised for smallRNA sequencing, to remove non-small RNA sequences.
  • --stringency <INT> β€” how much overlap with the adapter sequence is required to trim a sequence. defaults to a very stringent setting of 1, i.e. even a single bp of overlapping sequence will be trimmed off from the 3' end of any read. 😀
  • -e <ERROR RATE> β€” maximum allowed error rate (no. of errors divided by the length of the matching region) (default: 0.1).
  • --gzip β€” compresses the output file with GZIP. if the input files are GZIP-compressed, the output files will automatically be GZIP compressed as well. as of v0.2.8 the compression happens on the fly. 🧚
  • --dont_gzip β€” output files won't be compressed with GZIP. this option overrides --gzip.
  • --length <INT> β€” discards reads that became shorter than length INT because of either quality or adapter trimming. a value of '0' effectively disables this behaviour. default: 20 bp. for paired-end files, both reads of a read-pair need to be longer than <INT> bp to be printed out to validated paired-end files (see option --paired). if only one read became too short, there's the possibility of keeping such unpaired single-end reads (see --retain_unpaired). default pair-cutoff: 20 bp.
  • --max_n COUNT β€” the total number of Ns (as integer) a read may contain before it will be removed altogether. in a paired-end setting, either read exceeding this limit will result in the entire pair being removed from the trimmed output files. πŸ’€
  • --trim-n β€” removes Ns from either side of the read. > this option does currently not work in RRBS mode. ⚠️
  • -o/--output_dir <DIR> β€” if specified, all output will be written to this directory instead of the current directory. if the directory doesn't exist, it'll be created for you. 🫢
  • --no_report_file β€” if specified, no report file will be generated.
  • --suppress_warn β€” if specified, any output to STDOUT or STDERR will be suppressed. 🀫
  • --clip_R1 <int> β€” tells Trim Galore to remove <int> bp from the 5' end of read 1 (or single-end reads). this may be useful if the qualities were very poor, or if there's some sort of unwanted bias at the 5' end. default: OFF.
  • --clip_R2 <int> β€” tells Trim Galore to remove <int> bp from the 5' end of read 2 (paired-end reads only). this may be useful if the qualities were very poor, or if there's some sort of unwanted bias at the 5' end. for paired-end BS-Seq, it's recommended to remove the first few bp because the end-repair reaction may introduce a bias towards low methylation. please refer to the M-bias plot section in the Bismark User Guide for some examples. default: OFF.
  • --three_prime_clip_R1 <int> β€” tells Trim Galore to remove <int> bp from the 3' end of read 1 (or single-end reads) AFTER adapter/quality trimming has been performed. this may remove some unwanted bias from the 3' end that is not directly related to adapter sequence or basecall quality. default: OFF.
  • --three_prime_clip_R2 <int> β€” tells Trim Galore to remove <int> bp from the 3' end of read 2 AFTER adapter/quality trimming has been performed. this may remove some unwanted bias from the 3' end that is not directly related to adapter sequence or basecall quality. default: OFF.
  • --2colour/--nextseq INT β€” this enables the option --nextseq-trim=3'CUTOFF within Cutadapt, which will set a quality cutoff (that is normally given with -q instead), but qualities of G bases are ignored. this trimming is in common for the NextSeq- and NovaSeq-platforms, where basecalls without any signal are called as high-quality G bases. > this is mutually exlusive with -q INT. ⚠️
  • --path_to_cutadapt </path/to/cutadapt> β€” you may use this option to specify a path to the Cutadapt executable, e.g. /my/home/cutadapt-1.7.1/bin/cutadapt. else it's assumed that Cutadapt is in the PATH.
  • --basename <PREFERRED_NAME> β€” use PREFERRED_NAME as the basename for output files, instead of deriving the filenames from the input files. single-end data would be called PREFERRED_NAME_trimmed.fq(.gz), or PREFERRED_NAME_val_1.fq(.gz) and PREFERRED_NAME_val_2.fq(.gz) for paired-end data. --basename only works when 1 file (single-end) or 2 files (paired-end) are specified, but not for longer lists.
  • -j/--cores INT β€” number of cores to be used for trimming [default: 1]. for Cutadapt to work with multiple cores, it requires Python 3 as well as parallel gzip (pigz) installed on the system. the version of Python used is detected from the shebang line of the Cutadapt executable (either 'cutadapt', or a specified path). if Python 2 is detected, --cores is set to 1. if pigz cannot be detected on your system, Trim Galore reverts to using gzip compression. > please note that gzip compression will slow down multi-core processes so much that it's hardly worthwhile, please see: https://github.com/FelixKrueger/TrimGalore/issues/16#issuecomment-458557103 for more info. 😭 actual core usage: it should be mentioned that the actual number of cores used is a little convoluted. assuming that Python 3 is used and pigz is installed, --cores 2 would use 2 cores to read the input (probably not at a high usage though), 2 cores to write to the output (at moderately high usage), and 2 cores for Cutadapt itself + 2 additional cores for Cutadapt (not sure what they are used for) + 1 core for Trim Galore itself. so this can be up to 9 cores, even though most of them won't be used at 100% for most of the time. paired-end processing uses twice as many cores for the validation (= writing out) step. --cores 4 would then be: 4 (read) + 4 (write) + 4 (Cutadapt) + 2 (extra Cutadapt) + 1 (Trim Galore) = 15. it seems that --cores 4 could be a sweet spot, anything above has diminishing returns. πŸ“

πŸ‘‘ SPECIFIC TRIMMING β€” without adapter/quality trimming πŸ‘‘

  • --hardtrim5 <int> β€” instead of performing adapter-/quality trimming, this option will simply hard-trim sequences to <int> bp at the 5'-end. once hard-trimming of files is complete, Trim Galore will exit. hard-trimmed output files will end in .<int>_5prime.fq(.gz). here is an example:
before:
CCTAAGGAAACAAGTACACTCCACACATGCATAAAGGAAATCAAATGTTATTTTTAAGAAAATGGAAAAT

--hardtrim5 20: CCTAAGGAAACAAGTACACT

  • --hardtrim3 <int> β€” bestie this one is SO straightforward πŸ’… instead of doing the whole adapter-/quality-trimming song and dance, this option just hard-trims your sequences to <int> bp at the 3'-end. And once the hard-trimming of your files is done? Trim Galore exits, periodt. πŸšͺ✨

Hard-trimmed output files end in .<int>_3prime.fq(.gz). Here's the vibe:

before:
CCTAAGGAAACAAGTACACTCCACACATGCATAAAGGAAATCAAATGTTATTTTTAAGAAAATGGAAAAT

--hardtrim3 20:
TTTTTAAGAAAATGGAAAAT
  • --clock β€” clock mode, literally iconic πŸ•°οΈβœ¨ in this mode reads get trimmed in a very specific way that's currently used for the Mouse Epigenetic Clock (see here: Multi-tissue DNA methylation age predictor in mouse, Stubbs et al., Genome Biology, 2017 18:68, https://doi.org/10.1186/s13059-017-1203-5). After that, Trim Galore exits. πŸšͺ

In it's current implementation, the dual-UMI RRBS reads come in this format:

Read 1 5' UUUUUUUU CAGTA FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF TACTG UUUUUUUU 3'

Read 2 3' UUUUUUUU GTCAT FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ATGAC UUUUUUUU 5'

Where UUUUUUUU is a random 8-mer unique molecular identifier (UMI), CAGTA is a constant region, and FFFFFFFFF... is the actual RRBS-Fragment to be sequenced. The UMIs for Read 1 (R1) and Read 2 (R2), plus the fixed sequences (F1 or F2), get written into the read ID and removed from the actual sequence. Example time, bestie:

R1: @HWI-D00436:407:CCAETANXX:1:1101:4105:1905 1:N:0: CGATGTTT
ATCTAGTTCAGTACGGTGTTTTCGAATTAGAAAAATATGTATAGAGGAAATAGATATAAAGGCGTATTCGTTATTG

R2: @HWI-D00436:407:CCAETANXX:1:1101:4105:1905 3:N:0: CGATGTTT
CAATTTTGCAGTACAAAAATAATACCTCCTCTATTTATCCAAAATCACAAAAAACCACCCACTTAACTTTCCCTAA

R1: @HWI-D00436:407:CCAETANXX:1:1101:4105:1905 1:N:0: CGATGTTT:R1:ATCTAGTT:R2:CAATTTTG:F1:CAGT:F2:CAGT
CGGTGTTTTCGAATTAGAAAAATATGTATAGAGGAAATAGATATAAAGGCGTATTCGTTATTG

R2: @HWI-D00436:407:CCAETANXX:1:1101:4105:1905 3:N:0: CGATGTTT:R1:ATCTAGTT:R2:CAATTTTG:F1:CAGT:F2:CAGT
CAAAAATAATACCTCCTCTATTTATCCAAAATCACAAAAAACCACCCACTTAACTTTCCCTAA

After clock trimming, the resulting files (.clock_UMI.R1.fq(.gz) and .clock_UMI.R2.fq(.gz)) should be adapter- and quality-trimmed with Trim Galore as usual. On top of that, reads need to be trimmed by 15bp from their 3' end to get rid of potential UMI and fixed sequences. The command is:

trim_galore --paired --three_prime_clip_R1 15 --three_prime_clip_R2 15 *.clock_UMI.R1.fq.gz *.clock_UMI.R2.fq.gz

After this, reads should be aligned with Bismark and deduplicated with UmiBam in --dual_index mode (see here: https://github.com/FelixKrueger/Umi-Grinder). UmiBam recognises the UMIs within this pattern: R1:(ATCTAGTT):R2:(CAATTTTG): as (UMI R1) and (UMI R2).

  • --polyA β€” okay so this one is new and still experimental πŸ§ͺ✨ β€” it's a trimming mode that identifies and removes poly-A tails from sequences.

When --polyA is selected, Trim Galore attempts to identify from the first supplied sample whether sequences contain more often a stretch of either 'AAAAAAAAAA' or 'TTTTTTTTTT'. This determines if Read 1 of a paired-end file, or single-end files, are trimmed for PolyA or PolyT. In the case of paired-end sequencing, Read2 is trimmed for the complementary base from the start of the reads. The auto-detection uses a default of A{20} for Read1 (3'-end trimming) and T{150} for Read2 (5'-end trimming). These values may be changed manually using the options -a and -a2.

In addition to trimming the sequences, white spaces are replaced with _ and it records in the read ID how many bases were trimmed so it can later be used to identify PolyA trimmed sequences. This is currently done by writing tags to both the start ("32:A:") and end ("_PolyA:32") of the reads, like in this example:

@READ-ID:1:1102:22039:36996 1:N:0:CCTAATCC
GCCTAAGGAAACAAGTACACTCCACACATGCATAAAGGAAATCAAATGTTATTTTTAAGAAAATGGAAAATAAAAACTTTATAAACACCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

@32:A:READ-ID:1:1102:22039:36996_1:N:0:CCTAATCC_PolyA:32
GCCTAAGGAAACAAGTACACTCCACACATGCATAAAGGAAATCAAATGTTATTTTTAAGAAAATGGAAAATAAAAACTTTATAAACACC
PLEASE NOTE: The poly-A trimming mode expects that sequences were both adapter and quality trimmed before looking for Poly-A tails, and it is the user's responsibility to carry out an initial round of trimming. Like this:
1) trim_galore file.fastq.gz
2) trim_galore --polyA file_trimmed.fq.gz
3) zcat file_trimmed_trimmed.fq.gz | grep -A 3 PolyA | grep -v ^-- > PolyA_trimmed.fastq

Which will 1) trim qualities and Illumina adapter contamination, 2) find and remove PolyA contamination. Finally, if desired, 3) will specifically find PolyA trimmed sequences to a specific FastQ file of your choice. 🫢

  • --implicon β€” a special little mode, bestie 🧚 this is for paired-end data, such as required for the IMPLICON method, where a UMI sequence is getting transferred from the start of Read 2 to the readID of both reads. Following this, Trim Galore will exit. πŸšͺ

In it's current implementation, the UMI carrying reads come in this format:

Read 1 5' FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 3'

Read 2 3' UUUUUUUUFFFFFFFFFFFFFFFFFFFFFFFFFFFF 5'

Where UUUUUUUU is a random 8-mer unique molecular identifier (UMI) and FFFFFFFFF... is the actual fragment to be sequenced. The UMI of Read 2 (R2) is written into the read ID of both reads and removed from the actual sequence. Example incoming:

R1: @HWI-D00436:407:CCAETANXX:1:1101:4105:1905 1:N:0: CGATGTTT
ATCTAGTTCAGTACGGTGTTTTCGAATTAGAAAAATATGTATAGAGGAAATAGATATAAAGGCGTATTCGTTATTG

R2: @HWI-D00436:407:CCAETANXX:1:1101:4105:1905 3:N:0: CGATGTTT
CAATTTTGCAGTACAAAAATAATACCTCCTCTATTTATCCAAAATCACAAAAAACCACCCACTTAACTTTCCCTAA

After --implicon trimming:

R1: @HWI-D00436:407:CCAETANXX:1:1101:4105:1905 1:N:0: CGATGTTT:CAATTTTG
ATCTAGTTCAGTACGGTGTTTTCGAATTAGAAAAATATGTATAGAGGAAATAGATATAAAGGCGTATTCGTTATTG

R2: @HWI-D00436:407:CCAETANXX:1:1101:4105:1905 3:N:0: CGATGTTT:CAATTTTG
CAGTACAAAAATAATACCTCCTCTATTTATCCAAAATCACAAAAAACCACCCACTTAACTTTCCCTAA

🌸 RRBS-specific options (MspI digested material) 🌸

  • --rrbs β€” tells Trim Galore that your input file was an MspI digested RRBS sample (recognition site: CCGG). Single-end or Read 1 sequences (paired-end) which were adapter-trimmed will have a further 2 bp removed from their 3' end. Sequences that were merely trimmed because of poor quality will not be shortened further. Read 2 of paired-end libraries will in addition have the first 2 bp removed from the 5' end (by setting '--clip_r2 2'). This is to avoid using artificial methylation calls from the filled-in cytosine positions close to the 3' MspI site in sequenced fragments. This option is not recommended for users of the NuGEN ovation RRBS System 1-16 kit (see below).
  • --non_directional β€” selecting this for non-directional RRBS libraries will screen quality-trimmed sequences for 'CAA' or 'CGA' at the start of the read and, if found, removes the first two basepairs. Like with the option '--rrbs' this avoids using cytosine positions that were filled-in during the end-repair step. '--non_directional' requires '--rrbs' to be specified as well. Heads up though: this option does not set '--clip_r2 2' in paired-end mode.
  • --keep β€” keep the quality trimmed intermediate file. Default: off, which means the temporary file is being deleted after adapter trimming. Only has an effect for RRBS samples since other FastQ files are not trimmed for poor qualities separately.

πŸ’œ Note for RRBS using the NuGEN Ovation RRBS System 1-16 kit

Owing to the fact that the NuGEN Ovation kit attaches a varying number of nucleotides (0-3) after each MspI site, Trim Galore should be run WITHOUT the option --rrbs. This trimming is accomplished in a subsequent diversity trimming step afterwards (see their manual).

πŸ’œ Note for RRBS using MseI

If your DNA material was digested with MseI (recognition motif: TTAA) instead of MspI, it is NOT necessary to specify --rrbs or --non_directional since virtually all reads should start with the sequence 'TAA', and this holds true for both directional and non-directional libraries. As the end-repair of 'TAA' restricted sites does not involve any cytosines, it does not need to be treated especially. Instead, simply run Trim Galore! in the standard (i.e. non-RRBS) mode. πŸŽ€


πŸ’œ Paired-end specific options πŸ’œ

  • --paired β€” this option performs length trimming of quality/adapter/RRBS trimmed reads for paired-end files. To pass the validation test, both sequences of a sequence pair are required to have a certain minimum length which is governed by the option --length (see above). If only one read passes this length threshold, the other read can be rescued (see option --retain_unpaired). Using this option lets you discard too short read pairs without disturbing the sequence-by-sequence order of FastQ files which is required by many aligners.

Trim Galore! expects paired-end files to be supplied in a pairwise fashion, e.g. file1_1.fq file1_2.fq SRR2_1.fq.gz SRR2_2.fq.gz ... .

  • -t/--trim1 β€” trims 1 bp off every read from its 3' end. This may be needed for FastQ files that are to be aligned as paired-end data with Bowtie. That's because Bowtie (1) regards alignments like this:
R1 --------------------------->
or this:    ----------------------->  R1

R2 <---------------------------
<-----------------  R2

as invalid (whenever a start/end coordinate is contained within the other read). NOTE: if you are planning to use Bowtie2, BWA etc. you don't need to specify this option.

  • --retain_unpaired β€” if only one of the two paired-end reads became too short, the longer read will be written to either '.unpaired_1.fq' or '.unpaired_2.fq' output files. The length cutoff for unpaired single-end reads is governed by the parameters -r1/--length_1 and -r2/--length_2. Default: OFF.
  • -r1/--length_1 <INT> β€” unpaired single-end read length cutoff needed for read 1 to be written to

.unpaired_1.fq output file β€” and yeah bestie, these reads may be mapped in single-end mode. Default: 35 bp. πŸ¦‹

  • -r2, --length_2 <INT> β€” the unpaired single-end read length cutoff that read 2 has to clear before it gets written to the .unpaired_2.fq output file. Same vibe as before: these reads may be mapped in single-end mode. Default: 35 bp.

Last modified on 07 October 2020. πŸ•°οΈ

πŸ‘‘ AUTHOR πŸ‘‘

This manpage was written by Nilesh Patra for the Debian distribution, and can be used for any other usage of the program. 🫢


and that's a wrap, bestie!! πŸŽ€ this whole glowing page is trim_galore 0.6.7 from July 2021 β€” go forth and trim, you absolute icon πŸ’…βœ¨