bcftools

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: 8 Imported by: 0

Documentation

Overview

Package bcftools wraps the bcftools cli to be used with Go.

Requires both bcftools and samtools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateVCF

func GenerateVCF(ctx context.Context, startRegion int, endRegion int, templateFasta fasta.Record, samAlignments io.Reader, w io.Writer) error

GenerateVCF generates a VCF file from sam alignments. Specifically, it runs the following commands, with sam alignments in stdin and the templateFasta written to a temporary file:

`samtools view -bS - | samtools sort - | bcftools mpileup -Ou -f tmpFile.fasta -t {template:6-150} - | bcftools call -mv -Ov -`

Here's a breakdown of the process and flags used:

samtools view -bS -:

  • Converts SAM to BAM format.

samtools sort -:

  • Sorts the BAM in preparation for bcftools.

bcftools mpileup:

  • -Ou: Outputs an uncompressed BCF, which is faster for piping.
  • -f: Reads from the temporary template file.
  • -t {template:6-150}: Targets certain sections of the template. Larger regions around the region of interest are often used for better alignment.

bcftools call:

  • -m: Activates the multiallelic caller, better for calling mutations in prone regions.
  • -v: Outputs variants only, omitting non-variant sites.
  • -Ov: Sets the output type to VCF text, which is easier to read and parse.

The sequence starts with converting SAM to BAM, sorting it, then using bcftools mpileup and call to generate a VCF file from the alignments.

Types

This section is empty.

Jump to

Keyboard shortcuts

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