Commit 146fe3ea authored by Afif Elghraoui's avatar Afif Elghraoui
Browse files

New upstream version 0.9.0

parent 436609ff
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -52,7 +52,9 @@ ifeq ($(HTS), install)
    HTS_INCLUDE=-I./htslib
else
    # Use system-wide htslib
    HTS_LIB=-lhts
    HTS_LIB=
    HTS_INCLUDE=
    LIBS += -lhts
endif

# Include the header-only fast5 library
+5 −29
Original line number Diff line number Diff line
@@ -59,22 +59,15 @@ nanopolish eventalign: align signal-level events to k-mers of a reference genome
Nanopolish needs access to the signal-level data measured by the nanopore sequencer. The first step of any nanopolish workflow is to prepare the input data by telling nanopolish where to find the signal files. If you ran Albacore 2.0 on your data you should run `nanopolish index` on your input reads (-d can be specified more than once if using multiple runs):

```
# Only run this if you used Albacore 2.0 or later
nanopolish index -d /path/to/raw_fast5s/ albacore_output.fastq
# Index the output of the albacore basecaller
nanopolish index -d /path/to/raw_fast5s/ -s sequencing_summary.txt albacore_output.fastq
```

If you basecalled your reads with Albacore 1.2 or earlier, you should run `nanopolish extract` on your input reads instead:

```
# Only run this if you used Albacore 1.2 or later
nanopolish extract --type template directory/pass/ > reads.fa
```

Note these two commands are mutually exclusive - you only need to run one of them. You need to decide what command to run depending on the version of Albacore that you used. In the following sections we assume you have preprocessed the data by following the instructions above and that your reads are in a file named `reads.fa`.
The `-s` option tells nanopolish to read the `sequencing_summary.txt` file from Albacore to speed up indexing. Without this option `nanopolish index` is extremely slow as it needs to read every fast5 file individually. If you basecalled your run in parallel, so you have multiple `sequencing_summary.txt` files, you can use the `-f` option to pass in a file containing the paths to the sequencing summary files (one per line).

### Computing a new consensus sequence for a draft assembly

The original purpose of nanopolish was to compute an improved consensus sequence for a draft genome assembly produced by a long-read assembly like [canu](https://github.com/marbl/canu). This section describes how to do this, starting with your draft assembly which should have megabase-sized contigs.
The original purpose of nanopolish was to compute an improved consensus sequence for a draft genome assembly produced by a long-read assembly like [canu](https://github.com/marbl/canu). This section describes how to do this, starting with your draft assembly which should have megabase-sized contigs. We've also posted a tutorial including example data [here](http://nanopolish.readthedocs.io/en/latest/quickstart_consensus.html).

```
# Index the draft genome
@@ -102,24 +95,7 @@ python nanopolish_merge.py polished.*.fa > polished_genome.fa

## Calling Methylation

nanopolish can use the signal-level information measured by the sequencer to detect 5-mC as described [here](http://www.nature.com/nmeth/journal/vaop/ncurrent/full/nmeth.4184.html). Here's how you run it:

```
# Align the basecalled reads to a reference genome
bwa mem -x ont2d -t 8 reference.fa reads.fa | samtools sort -o reads.sorted.bam -T reads.tmp -
samtools index reads.sorted.bam

# Run the methylation caller
nanopolish call-methylation -t 8 -r reads.fa -g reference.fa -b reads.sorted.bam > methylation.tsv
```

The output of call-methylation is a tab-separated file containing per-read log-likelihood ratios (positive values indicate more evidence for 5-mC, negative values indicate more evidence for C). Each line contains the name of the read that covered the CpG site, which allows methylation calls to be phased. We have provided a script to calculate per-site methylation frequencies using call-methylation's output:

```
python /path/to/nanopolish/scripts/calculate_methylation_frequency -c 2.5 -i methylation.tsv > frequencies.tsv
```

The output of this script is a tab-seperated file containing the genomic position of the CpG site, the number of reads that covered the site, and the percentage of those reads that were predicted to be methylated. The `-c 2.5` option requires the absolute value of the log-likelihood ratio to be at least 2.5 to make a call, otherwise the read will be ignored. This helps reduce calling errors as only sites with sufficient evidence will be included in the calculation.
nanopolish can use the signal-level information measured by the sequencer to detect 5-mC as described [here](http://www.nature.com/nmeth/journal/vaop/ncurrent/full/nmeth.4184.html). We've posted a tutorial on how to call methylation [here](http://nanopolish.readthedocs.io/en/latest/quickstart_call_methylation.html).

## To run using docker

+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ Oxford Nanopore sequencers are sensitive to base modifications. Here we provide
**Requirements**:

* `nanopolish v0.8.4 <installation.html>`_
* `samtools v1.2 <http://samtools.sourceforge.net/>`_
* `samtools v1.2 <https://htslib.org>`_
* `minimap2 <https://github.com/lh3/minimap2>`_

Download example dataset
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ The original purpose for nanopolish was to improve the consensus assembly accura
**Requirements**:

* `nanopolish v0.8.4 <installation.html>`_
* `samtools v1.2 <http://samtools.sourceforge.net/>`_
* `samtools v1.2 <https://htslib.org>`_
* `bwa v0.7.12 <https://github.com/lh3/bwa>`_
* `MUMmer <https://github.com/mummer4/mummer>`_

+2 −2
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ for contig_name in sorted(segments_by_name.keys()):

        # Ensure the segments overlap
        if not( prev_segment is None or prev_segment + SEGMENT_LENGTH + OVERLAP_LENGTH > segment_start ):
            sys.stderr.write("error: segment starting at %s:%d is missing\n" % (contig, prev_segment + SEGMENT_LENGTH + 40))
            sys.stderr.write("error: segment starting at %s:%d is missing\n" % (contig_name, prev_segment + SEGMENT_LENGTH + 40))
            all_segments_found = False

        sequence = segments_by_name[contig_name][segment_start]
@@ -98,5 +98,5 @@ for contig_name in sorted(segments_by_name.keys()):
    if all_segments_found:
        print(">%s\n%s" % (contig_name, assembly))
    else:
        sys.stderr.write("error: some segments are missing, could not merge contig %s\n" % (contig))
        sys.stderr.write("error: some segments are missing, could not merge contig %s\n" % (contig_name))
        sys.exit(1)
Loading