|
3 | 3 | Data preparation from raw reads |
4 | 4 | =================================== |
5 | 5 |
|
6 | | -1. After obtaining fast5 files, the first step is to basecall them. Below is an example script to run Guppy basecaller. You can find more detail about basecalling at `Oxford nanopore Technologies <https://nanoporetech.com>`_:: |
7 | | - |
8 | | - guppy_basecaller -i </PATH/TO/FAST5> -s </PATH/TO/FASTQ> --flowcell <FLOWCELL_ID> --kit <KIT_ID> --device auto -q 0 -r |
9 | | - |
10 | | -2. Align to transcriptome:: |
11 | | - |
12 | | - minimap2 -ax map-ont -uf -t 3 --secondary=no <MMI> <PATH/TO/FASTQ.GZ> > <PATH/TO/SAM> 2>> <PATH/TO/SAM_LOG> |
13 | | - samtools view -Sb <PATH/TO/SAM> | samtools sort -o <PATH/TO/BAM> - &>> <PATH/TO/BAM_LOG> |
14 | | - samtools index <PATH/TO/BAM> &>> <PATH/TO/BAM_INDEX_LOG> |
15 | | - |
16 | | -3. Resquiggle using `nanopolish eventalign <https://nanopolish.readthedocs.io/en/latest/quickstart_eventalign.html>`_:: |
17 | | - |
18 | | - nanopolish index -d <PATH/TO/FAST5_DIR> <PATH/TO/FASTQ_FILE> |
19 | | - nanopolish eventalign --reads <PATH/TO/FASTQ_FILE> \ |
20 | | - --bam <PATH/TO/BAM_FILE> \ |
21 | | - --genome <PATH/TO/FASTA_FILE \ |
22 | | - --signal-index \ |
23 | | - --scale-events \ |
24 | | - --summary <PATH/TO/summary.txt> \ |
25 | | - --threads 32 > <PATH/TO/eventalign.txt> |
| 6 | +1. After obtaining the raw signal files (POD5, or FAST5 for older runs), the first step is to basecall them. Below is an example using `Dorado <https://github.com/nanoporetech/dorado>`_, Oxford Nanopore's current basecaller (it replaces the older Guppy/Albacore basecallers and supports both RNA002 and RNA004 chemistries — select the model that matches your chemistry). You can find more detail about basecalling at `Oxford Nanopore Technologies <https://nanoporetech.com>`_:: |
26 | 7 |
|
| 8 | + dorado basecaller <MODEL> </PATH/TO/POD5_DIR> --emit-fastq > <PATH/TO/FASTQ> |
| 9 | + |
| 10 | + For RNA004 data use an ``rna004`` model (e.g. ``rna004_130bps_sup@v5.1.0``); for RNA002 data use an ``rna002`` model. See the `Dorado documentation <https://github.com/nanoporetech/dorado>`_ for the available models and options. |
| 11 | + |
| 12 | +2. Align the basecalled reads with `minimap2 <https://github.com/lh3/minimap2>`_. xPore supports both **transcriptome** and **genome** alignments — choose one depending on which coordinate system you want in the output. |
| 13 | + |
| 14 | + **Transcriptome alignment** (align to a transcriptome reference). xPore reports transcriptomic coordinates, or genomic coordinates if you also pass ``--genome`` together with ``--gtf_or_gff`` and ``--transcript_fasta`` to ``xpore dataprep``:: |
| 15 | + |
| 16 | + minimap2 -ax map-ont -uf -t 3 --secondary=no <TRANSCRIPTOME.MMI> <PATH/TO/FASTQ.GZ> > <PATH/TO/SAM> 2>> <PATH/TO/SAM_LOG> |
| 17 | + samtools view -Sb <PATH/TO/SAM> | samtools sort -o <PATH/TO/BAM> - &>> <PATH/TO/BAM_LOG> |
| 18 | + samtools index <PATH/TO/BAM> &>> <PATH/TO/BAM_INDEX_LOG> |
| 19 | + |
| 20 | + **Genome alignment** (align directly to a genome reference; use spliced alignment so that reads spanning introns map correctly). Genome alignments contain reverse-strand reads, so run ``xpore dataprep`` with ``--kmer_source model_kmer`` for these (see :ref:`Command line arguments <cmd>`):: |
| 21 | + |
| 22 | + minimap2 -ax splice -uf -k14 -t 3 --secondary=no <GENOME.MMI> <PATH/TO/FASTQ.GZ> > <PATH/TO/SAM> 2>> <PATH/TO/SAM_LOG> |
| 23 | + samtools view -Sb <PATH/TO/SAM> | samtools sort -o <PATH/TO/BAM> - &>> <PATH/TO/BAM_LOG> |
| 24 | + samtools index <PATH/TO/BAM> &>> <PATH/TO/BAM_INDEX_LOG> |
| 25 | + |
| 26 | +3. Resquiggle (align the raw signal to the reference) to produce the eventalign file. We recommend `f5c <https://github.com/hasindu2008/f5c>`_, an optimised, CPU/GPU-accelerated re-implementation of ``nanopolish eventalign`` that produces equivalent output much faster on large datasets:: |
| 27 | + |
| 28 | + # index the raw signal: use -d <FAST5_DIR> for FAST5, or --slow5 <FILE.blow5> for SLOW5/BLOW5 |
| 29 | + f5c index -d <PATH/TO/FAST5_DIR> <PATH/TO/FASTQ_FILE> |
| 30 | + f5c eventalign --reads <PATH/TO/FASTQ_FILE> \ |
| 31 | + --bam <PATH/TO/BAM_FILE> \ |
| 32 | + --genome <PATH/TO/REFERENCE_FASTA> \ |
| 33 | + --rna \ |
| 34 | + --signal-index \ |
| 35 | + --scale-events \ |
| 36 | + --threads 32 > <PATH/TO/eventalign.txt> |
| 37 | + |
| 38 | + For **RNA004** data, add ``--kmer-model <PATH/TO/5-mer-model>``: recent versions of f5c auto-select the 9-mer model for RNA004, which xPore cannot use — xPore requires the 5-mer model (see `xPore issue #215 <https://github.com/GoekeLab/xpore/issues/215>`_). |
| 39 | + |
| 40 | + ``nanopolish eventalign`` can be used instead with the same arguments. Note that the ``--genome`` argument here refers to the **alignment reference** (the transcriptome or genome FASTA used in step 2), not xPore's ``--genome`` flag. |
0 commit comments