stats

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Exon       = "exon"
	ExonIntron = "exonic_intronic"
	Intergenic = "intergenic"
	Intron     = "intron"
	Other      = "others"
	Total      = "total"
)

general element constants

Variables

This section is empty.

Functions

This section is empty.

Types

type CoverageStats

type CoverageStats struct {
	Total      ElementStats `json:"total"`
	Continuous ElementStats `json:"continuous"`
	Split      ElementStats `json:"split"`
	Uniq       bool         `json:"-"`
	// contains filtered or unexported fields
}

CoverageStats represents genome coverage statistics for continuos, split and total mapped reads.

func NewCoverageStats

func NewCoverageStats(index *annotation.RtreeMap, uniq bool) *CoverageStats

NewCoverageStats create a new instance of CoverageStats.

func (*CoverageStats) Collect

func (s *CoverageStats) Collect(record *sam.Record)

Collect collects genome coverage statistics from a sam.Record.

func (*CoverageStats) Finalize

func (s *CoverageStats) Finalize()

Finalize updates dependent counts of a CoverageStats instance.

func (*CoverageStats) Merge

func (s *CoverageStats) Merge(others chan Stats)

Merge update counts from a channel of Stats instances.

func (*CoverageStats) Type

func (s *CoverageStats) Type() string

Type returns the type of stats

func (*CoverageStats) Update

func (s *CoverageStats) Update(other Stats)

Update updates all counts from a Stats instance.

type ElementStats

type ElementStats map[string]uint64

ElementStats represents mappings statistics for genomic elements

func (ElementStats) Keys

func (s ElementStats) Keys() []string

Keys returns map keys

func (ElementStats) MarshalJSON

func (s ElementStats) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON Marshaller interface

func (ElementStats) MergeKeys

func (s ElementStats) MergeKeys(other ElementStats) []string

MergeKeys combine keys from two ElementsStats instances

func (ElementStats) Update

func (s ElementStats) Update(other ElementStats)

Update updates all counts from another ElementsStats instance.

type GeneralStats

type GeneralStats struct {
	Protocol string           `json:"protocol"`
	Reads    MappingsStats    `json:"reads,omitempty"`
	Pairs    MappedPairsStats `json:"pairs,omitempty"`
}

GeneralStats represents general mapping statistics

func NewGeneralStats

func NewGeneralStats() *GeneralStats

NewGeneralStats creates a new instance of GeneralStats

func (*GeneralStats) Collect

func (s *GeneralStats) Collect(r *sam.Record)

Collect collects general mapping statistics from a sam.Record.

func (*GeneralStats) Finalize

func (s *GeneralStats) Finalize()

Finalize updates dependent counts of a Stats instance.

func (*GeneralStats) Merge

func (s *GeneralStats) Merge(others chan Stats)

Merge updates counts from a channel of Stats instances.

func (*GeneralStats) Type

func (s *GeneralStats) Type() string

Type returns the type of stats

func (*GeneralStats) Update

func (s *GeneralStats) Update(other Stats)

Update updates all counts from a Stats instance.

type Map

type Map map[string]Stats

Map is a map of Stats instances with string keys.

func NewMap

func NewMap(stats ...Stats) Map

NewMap creates and instance of a stats.Map

func (Map) Add

func (sm Map) Add(s Stats)

Add adds a new Stats object to sm

func (*Map) Merge

func (sm *Map) Merge(stats chan Map)

Merge merges instances of StatsMap

func (Map) OutputJSON

func (sm Map) OutputJSON(writer io.Writer) error

OutputJSON writes sm to the wrtier as JSON

type MappedPairsStats

type MappedPairsStats struct {
	MappedReadsStats
	InsertSizes TagMap `json:"insert_sizes,omitempty"`
}

MappedPairsStats represents statistcs for mapped read-pairs

func NewMappedPairsStats

func NewMappedPairsStats() *MappedPairsStats

NewMappedPairsStats creates a new instance of MappedPairsStats

func (*MappedPairsStats) FilterInsertSizes

func (s *MappedPairsStats) FilterInsertSizes(percent float64)

FilterInsertSizes filters out insert size lengths having support below the given percentage of total read-pairs.

func (*MappedPairsStats) Update

func (s *MappedPairsStats) Update(other MappedPairsStats)

Update updates all counts from another MappedPairsStats instance.

type MappedReadsStats

type MappedReadsStats struct {
	Total      uint64 `json:"total,omitempty"`
	Unmapped   uint64 `json:"unmapped,omitempty"`
	Mapped     TagMap `json:"mapped,omitempty"`
	Duplicates uint64 `json:"duplicates,omitempty"`
}

MappedReadsStats represents statistics for mapped reads

func NewMappedReadsStats

func NewMappedReadsStats() *MappedReadsStats

NewMappedReadsStats creates a new instance of MappedReadsStats

func (*MappedReadsStats) Unique

func (s *MappedReadsStats) Unique() uint64

Unique returns the number of uniquely mapped reads.

func (*MappedReadsStats) Update

func (s *MappedReadsStats) Update(other MappedReadsStats)

Update updates all counts from another MappedReadStats instance.

func (*MappedReadsStats) UpdateUnmapped

func (s *MappedReadsStats) UpdateUnmapped()

UpdateUnmapped updates the count of unmapped pairs

type MappingsStats

type MappingsStats struct {
	MappedReadsStats
	Mappings MultimapStats `json:"mappings"`
}

MappingsStats represents statistics for mappings

func (*MappingsStats) Update

func (s *MappingsStats) Update(other MappingsStats)

Update updates all counts from another MappingsStats instance.

func (*MappingsStats) UpdateMappingsRatio

func (s *MappingsStats) UpdateMappingsRatio()

UpdateMappingsRatio updates ration of mappings vs total mapped reads.

type MultimapStats

type MultimapStats struct {
	Ratio fraction `json:"ratio"`
	Count uint64   `json:"count"`
}

MultimapStats represents statistics for multi-maps

type RNAseqMetrics

type RNAseqMetrics struct {
	Mapped     fraction `json:"fraction_mapped,omitempty"`
	Intergenic fraction `json:"fraction_intergenic,omitempty"`
	RRNA       fraction `json:"fraction_rrna,omitempty"`
	Duplicates fraction `json:"fraction_duplicates,omitempty"`
}

RNAseqMetrics represents statistics for mapped reads

type RNAseqStats

type RNAseqStats struct {
	Intergenic uint64         `json:"intergenic"`
	RRNA       uint64         `json:"rRNA"`
	Metrics    *RNAseqMetrics `json:"metrics,omitempty"`
	// contains filtered or unexported fields
}

RNAseqStats represents statistics for mapped reads

func NewIHECstats

func NewIHECstats(index *annotation.RtreeMap) *RNAseqStats

NewIHECstats creates a new instance of IHECstats

func (*RNAseqStats) Collect

func (s *RNAseqStats) Collect(record *sam.Record)

Collect collects general mapping statistics from a sam.Record.

func (*RNAseqStats) Finalize

func (s *RNAseqStats) Finalize()

Finalize updates dependent counts of a Stats instance.

func (*RNAseqStats) Merge

func (s *RNAseqStats) Merge(others chan Stats)

Merge updates counts from a channel of Stats instances.

func (*RNAseqStats) Type

func (s *RNAseqStats) Type() string

Type returns the type of stats

func (*RNAseqStats) Update

func (s *RNAseqStats) Update(other Stats)

Update updates all counts from a Stats instance.

func (*RNAseqStats) UpdateTotal

func (s *RNAseqStats) UpdateTotal(amount uint64)

UpdateTotal adds amount to total

type Stats

type Stats interface {
	Type() string
	Update(other Stats)
	Merge(others chan Stats)
	Collect(record *sam.Record)
	Finalize()
}

Stats represents mapping statistics.

type TagMap

type TagMap map[int]uint64

TagMap represents a map of sam tags with integer keys

func (TagMap) MarshalJSON

func (tm TagMap) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON representation of a TagMap, numerically sorting the keys.

func (TagMap) Total

func (tm TagMap) Total() (sum uint64)

Total returns the total number of reads in the TagMap

func (*TagMap) UnmarshalJSON

func (tm *TagMap) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON parse a JSON representation of a TagMap.

func (TagMap) Update

func (tm TagMap) Update(other TagMap)

Update updates all counts from another TagMap instance.

Jump to

Keyboard shortcuts

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