minimap2

package
v0.0.0-...-85e8820 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package minimap2 contains functions for working with minimap2.

minimap2 is a DNA alignment package written by Heng Li for aligning nanopore reads as the spirtual successor to bwa-mem, which is a widely used alignment algorithm for illumina sequencing reads.

minimap2 takes in fasta reference genomes and aligns them with fastq reads, outputting a sam alignment file. In this package, all io is handled with standard library io.Reader and io.Writer, both of which can be used with dnadesign `bio` parsers. Data should be piped in using data `WriteTo` functions, and can be read using a sam parser.

We use `os.Exec` instead of cgo in order to make the package simpler, and also because the overhead of launching is minimal in comparison to how much data is expected to run through minimap2.

For more information on minimap2, please visit Heng Li's git: https://github.com/lh3/minimap2

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Minimap2

func Minimap2(templateFastas []fasta.Record, fastqInput io.Reader, w io.Writer) error

Minimap2 aligns sequences using minimap2 over the command line. Right now, only nanopore (map-ont) is supported. If you need others enabled, please put in an issue.

Example
package main

import (
	"bytes"
	"fmt"
	"os"
	"strings"

	"github.com/koeng101/dnadesign/external/minimap2"
	"github.com/koeng101/dnadesign/lib/bio"
)

func main() {
	// Get template io.Reader
	templateFile, _ := os.Open("./data/templates.fasta")
	templateFastas, _ := bio.NewFastaParser(templateFile).Parse()
	defer templateFile.Close()

	// Get fastq reads io.Reader
	fastqFile, _ := os.Open("./data/reads.fastq")
	defer fastqFile.Close()

	// Create output buffer
	var buf bytes.Buffer

	// Execute the Minimap2Raw function
	_ = minimap2.Minimap2(templateFastas, fastqFile, &buf)
	output := buf.String()
	line2 := strings.Split(output, "\n")[2]

	fmt.Println(line2)
}
Output:

@SQ	SN:oligo2	LN:158

func Minimap2Channeled

func Minimap2Channeled(ctx context.Context, fastaTemplates []fasta.Record, fastqChan <-chan fastq.Read, samChan chan<- sam.Alignment) error

Minimap2Channeled uses channels rather than io.Reader and io.Writers.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL