convert

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package convert contains functions for converting data between standard file formats. This is a high level package that avoids circular dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BedGraphToWig

func BedGraphToWig(inFile string, reference map[string]chromInfo.ChromInfo, missing float64) map[string]wig.Wig

BedGraphToWig uses bedGraph entries to construct a slice of Wig data structures where the Wig value is equal to the DataValue for the range of the bedGraph entry. Regions with no bedGraph entries will be set to the value set by Missing (default 0 in cmd).

func BedReadUpdateWig added in v1.0.1

func BedReadUpdateWig(w map[string]wig.Wig, b bed.Bed)

func BedReadsToWig

func BedReadsToWig(b []bed.Bed, reference map[string]chromInfo.ChromInfo) map[string]wig.Wig

BedReadsToWig returns a slice of Wig structs where the wig scores correspond to the number of input bed entries that overlap the position.

func BedToFasta

func BedToFasta(b []bed.Bed, ref []fasta.Fasta) []fasta.Fasta

BedToFasta extracts sub-Fastas out of a reference Fasta slice comprised of the sequences of input bed regions.

func BedValuesToWig

func BedValuesToWig(inFile string, reference map[string]chromInfo.ChromInfo, Missing float64, method string, useRange bool, annotationField int) map[string]wig.Wig

BedValuesToWig uses bed entries from an input file to construct a Wig data structure where the Wig value is equal to the float64-casted name of an overlapping bed entry. Regions with no bed entries will be set to the value set by Missing (default 0 in the cmd). useRange sets the wig value to the bed value across the range of the bed region, not just at the midpoint, as is default.

func EnsemblToUCSC

func EnsemblToUCSC(in string) string

EnsemblToUCSC converts ensembl-style human chromosome names to the standard UCSC format chromosome names.

func PairwiseFaToVcf

func PairwiseFaToVcf(f []fasta.Fasta, chr string, out *fileio.EasyWriter, substitutionsOnly bool, retainN bool)

PairwiseFaToVcf takes in a pairwise multiFa alignment and writes Vcf entries for segregating sites with the first entry as the reference and the second fasta entry as the alt allele. This will have to be done by chromosome, as a pairwise multiFa will only have two entries, thus containing one chromosome per file.

func SamToBed

func SamToBed(s sam.Sam) bed.Bed

SamToBed extracts the position information from a Sam entry and returns it as a bed entry.

func SamToBedFrag

func SamToBedFrag(s sam.Sam, fragLength int, reference map[string]chromInfo.ChromInfo) bed.Bed

SamToBedFrag converts a Sam entry into a bed based on the fragment length from which the aligned read was derived. Uses a chromInfo map to ensure fragments are called within the ends of the chromosomes.

func SamToBedWithDeletions added in v1.0.1

func SamToBedWithDeletions(s sam.Sam) []bed.Bed

SamToBedWithDeletions extracts the position from a Sam entry and returns it in a slice of bed. If there are deletions in the cigar, it will return multiple bed entries corresponding to each separate alignment segment.

func SingleBedToFasta

func SingleBedToFasta(b bed.Bed, ref []fasta.Fasta) fasta.Fasta

SingleBedToFasta extracts a sub-Fasta from a reference Fasta sequence at positions specified by an input bed.

func ThreeWayFaToVcf added in v1.0.1

func ThreeWayFaToVcf(f []fasta.Fasta, chr string, out *fileio.EasyWriter)

ThreeWayFaToVcf takes in a three-way multiFa alignment and writes Vcf entries for segregating sites with the first entry as the reference and the last two fasta entries as the alt alleles. This is done by chromosome since a multiFa contains only one chromosome per file. This function only checks for substitutions, not indels.

func UCSCToEnsembl

func UCSCToEnsembl(in string) string

UCSCToEnsembl converts UCSC-style chromosome names to ensembl-format names.

Types

This section is empty.

Jump to

Keyboard shortcuts

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