Documentation ¶
Overview ¶
Package gene contains the types and methods to handle the definition of a gene. A gene is a union of genomic sequences encoding a coherent set of potentially overlapping functional products. Since the package is located under the feat namespace, we define gene to correspond to a specific genomic region (has genomic coordinates).
The package also contain types to describe gene transcripts. Transcripts can be coding and non-coding. Coding transcripts have functional regions (5'UTR, CDS and 3'UTR) and consist of exons.
Index ¶
- type CodingTranscript
- func (t *CodingTranscript) CDS() feat.Feature
- func (t *CodingTranscript) Description() string
- func (t *CodingTranscript) End() int
- func (t *CodingTranscript) Exons() Exons
- func (t *CodingTranscript) Introns() Introns
- func (t *CodingTranscript) Len() int
- func (t *CodingTranscript) Location() feat.Feature
- func (t *CodingTranscript) Name() string
- func (t *CodingTranscript) Orientation() feat.Orientation
- func (t *CodingTranscript) SetExons(exons ...Exon) error
- func (t *CodingTranscript) Start() int
- func (t *CodingTranscript) UTR3() feat.Feature
- func (t *CodingTranscript) UTR3end() int
- func (t *CodingTranscript) UTR3start() int
- func (t *CodingTranscript) UTR5() feat.Feature
- func (t *CodingTranscript) UTR5end() int
- func (t *CodingTranscript) UTR5start() int
- type Exon
- type Exons
- type Gene
- func (g *Gene) Description() string
- func (g *Gene) End() int
- func (g *Gene) Features() []feat.Feature
- func (g *Gene) Len() int
- func (g *Gene) Location() feat.Feature
- func (g *Gene) Name() string
- func (g *Gene) Orientation() feat.Orientation
- func (g *Gene) SetFeatures(feats ...feat.Feature) error
- func (g *Gene) Start() int
- type Interface
- type Intron
- type Introns
- type NonCodingTranscript
- func (t *NonCodingTranscript) Description() string
- func (t *NonCodingTranscript) End() int
- func (t *NonCodingTranscript) Exons() Exons
- func (t *NonCodingTranscript) Introns() Introns
- func (t *NonCodingTranscript) Len() int
- func (t *NonCodingTranscript) Location() feat.Feature
- func (t *NonCodingTranscript) Name() string
- func (t *NonCodingTranscript) Orientation() feat.Orientation
- func (t *NonCodingTranscript) SetExons(exons ...Exon) error
- func (t *NonCodingTranscript) Start() int
- type Transcript
- type TranscriptFeature
- func (t *TranscriptFeature) Description() string
- func (t *TranscriptFeature) End() int
- func (t *TranscriptFeature) Len() int
- func (t *TranscriptFeature) Location() feat.Feature
- func (t *TranscriptFeature) Name() string
- func (t *TranscriptFeature) Orientation() feat.Orientation
- func (t *TranscriptFeature) Start() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodingTranscript ¶
type CodingTranscript struct { ID string Loc feat.Feature Offset int Orient feat.Orientation Desc string CDSstart int CDSend int // contains filtered or unexported fields }
A CodingTranscript is a gene transcript that has coding potential. It can be located on any feat.Feature such as a gene or a chromosome. The concept of exons is tightly coupled with the CodingTranscript in the sense that the transcript borders are basically defined by the contained exons. By definition one of the exons must always start at position 0 relative to the transcript and this or another one must end at the transcript end. The former is asserted when exons are set and the latter is guaranteed by setting the transcript end at the end of the last exon.
func (*CodingTranscript) CDS ¶ added in v1.0.1
func (t *CodingTranscript) CDS() feat.Feature
CDS returns a feat.Feature that corresponds to the coding region of the transcript.
func (*CodingTranscript) Description ¶
func (t *CodingTranscript) Description() string
Description returns a description for the transcript.
func (*CodingTranscript) End ¶
func (t *CodingTranscript) End() int
End returns the transcript end relative to Location.
func (*CodingTranscript) Exons ¶
func (t *CodingTranscript) Exons() Exons
Exons returns a typed slice with the transcript exons.
func (*CodingTranscript) Introns ¶
func (t *CodingTranscript) Introns() Introns
Introns returns a typed slice with the transcript introns.
func (*CodingTranscript) Len ¶
func (t *CodingTranscript) Len() int
Len returns the length of the transcript.
func (*CodingTranscript) Location ¶
func (t *CodingTranscript) Location() feat.Feature
Location returns the location of the transcript. Can be any feat.Feature such as a gene or a chromosome.
func (*CodingTranscript) Name ¶
func (t *CodingTranscript) Name() string
Name returns the transcript name. Currently the same as the id.
func (*CodingTranscript) Orientation ¶
func (t *CodingTranscript) Orientation() feat.Orientation
Orientation returns the orientation of the transcript relative to Location.
func (*CodingTranscript) SetExons ¶
func (t *CodingTranscript) SetExons(exons ...Exon) error
SetExons sets the transcript exons. Internally, it sorts exons by Start, verifies that their Location is the transcript, that they are not overlapping and that one has zero Start. If an error occurs it is returned and the exons are not set.
func (*CodingTranscript) Start ¶
func (t *CodingTranscript) Start() int
Start returns the transcript start relative to Location.
func (*CodingTranscript) UTR3 ¶ added in v1.0.1
func (t *CodingTranscript) UTR3() feat.Feature
UTR3 returns a feat.Feature that corresponds to the 3'UTR of the transcript.
func (*CodingTranscript) UTR3end ¶
func (t *CodingTranscript) UTR3end() int
UTR3end returns the end of the 3'UTR relative to the transcript. UTR3end is shorthand for t.UTR3().End().
func (*CodingTranscript) UTR3start ¶
func (t *CodingTranscript) UTR3start() int
UTR3start returns the start of the 3'UTR relative to the transcript. UTR3start is shorthand for t.UTR3().Start().
func (*CodingTranscript) UTR5 ¶ added in v1.0.1
func (t *CodingTranscript) UTR5() feat.Feature
UTR5 returns a feat.Feature that corresponds to the 5'UTR of the transcript.
func (*CodingTranscript) UTR5end ¶
func (t *CodingTranscript) UTR5end() int
UTR5end returns the end of the 5'UTR relative to the transcript. UTR5end is shorthand for t.UTR5().End().
func (*CodingTranscript) UTR5start ¶
func (t *CodingTranscript) UTR5start() int
UTR5start returns the start of the 5'UTR relative to the transcript. UTR5start is shorthand for t.UTR5().Start().
type Exon ¶
type Exon struct { Transcript Transcript Offset int Length int Desc string }
An Exon is the part of a transcript that remains present in the final mature RNA product after splicing.
func (Exon) Description ¶
Description returns a description for the exon.
func (Exon) Orientation ¶
func (e Exon) Orientation() feat.Orientation
Orientation always returns Forward.
type Exons ¶
type Exons []Exon
Exons is a typed slice of Exon. It guarantees that exons are always sorted by Start, are all located on the same feature and are non overlapping.
func (Exons) Add ¶
Add adds exons to the slice and safeguards the types contracts. It returns a new slice with the added exons. It checks for sorting, overlap, and location match. If and error occurs it returns the old slice (without the new exons) and the error.
func (Exons) End ¶
End returns the maximum End of all exons. Since exons are sorted and non overlapping this matches the End of the last exon in the slice.
func (Exons) Less ¶
Less returns whether the exon with index i should sort before the exon with index j.
func (Exons) SplicedLen ¶
SplicedLen returns the total length of the exons.
type Gene ¶
type Gene struct { ID string Chrom feat.Feature Offset int Orient feat.Orientation Desc string // contains filtered or unexported fields }
A Gene occupies a specific region on the genome and may have 0 or more features, including transcripts, associated with it. The gene is tightly coupled with its features in the sense that the gene boundaries are defined by the features. By definition one of the features must always start at position 0 relative to the gene and this or another one has to end at the end of the gene. The former is asserted when features are set and the latter is guaranteed by setting the gene end at the largest end of the features.
func (*Gene) Description ¶
Description returns a description for the gene.
func (*Gene) Orientation ¶
func (g *Gene) Orientation() feat.Orientation
Orientation returns the orientation of the gene relative to the chromosome.
func (*Gene) SetFeatures ¶
SetFeatures sets the gene features. Internally, it verifies that their Location is the gene and that one of them has zero Start. If an error occurs it is returned and the features are not set.
type Intron ¶
type Intron struct { Transcript Transcript Offset int Length int Desc string }
An Intron is the part of a transcript that is removed during splicing and is not part of the final mature RNA product.
func (Intron) Description ¶
Description returns a description for the intron.
func (Intron) Orientation ¶
func (i Intron) Orientation() feat.Orientation
Orientation always returns Forward.
type NonCodingTranscript ¶
type NonCodingTranscript struct { ID string Loc feat.Feature Offset int Orient feat.Orientation Desc string // contains filtered or unexported fields }
A NonCodingTranscript is a gene transcript that has no coding potential. It can be located on any feat.Feature such as a gene or a chromosome. The concept of exons is tightly coupled with the NonCodingTranscript in the sense that the transcript borders are basically defined by the contained exons. By definition one of the exons must always start at position 0 relative to the transcript and this or another one must end at the end of transcript. The former is asserted when exons are set and the latter is guaranteed by setting the transcript end at the end of the last exon.
func (*NonCodingTranscript) Description ¶
func (t *NonCodingTranscript) Description() string
Description returns a description for the transcript.
func (*NonCodingTranscript) End ¶
func (t *NonCodingTranscript) End() int
End returns the transcript end relative to Location.
func (*NonCodingTranscript) Exons ¶
func (t *NonCodingTranscript) Exons() Exons
Exons returns a typed slice with the transcript exons.
func (*NonCodingTranscript) Introns ¶
func (t *NonCodingTranscript) Introns() Introns
Introns returns a typed slice with the transcript introns.
func (*NonCodingTranscript) Len ¶
func (t *NonCodingTranscript) Len() int
Len returns the length of the transcript.
func (*NonCodingTranscript) Location ¶
func (t *NonCodingTranscript) Location() feat.Feature
Location returns the location of the transcript. Can be any feat.Feature such as a gene or a chromosome.
func (*NonCodingTranscript) Name ¶
func (t *NonCodingTranscript) Name() string
Name returns the transcript name. Currently the same as the id.
func (*NonCodingTranscript) Orientation ¶
func (t *NonCodingTranscript) Orientation() feat.Orientation
Orientation returns the orientation of the transcript relative to Location.
func (*NonCodingTranscript) SetExons ¶
func (t *NonCodingTranscript) SetExons(exons ...Exon) error
SetExons sets the transcript exons. Internally, it sorts exons by Start, verifies that their Location is the transcript, that they are not overlapping and that one has zero Start. If an error occurs it is returned and the exons are not set.
func (*NonCodingTranscript) Start ¶
func (t *NonCodingTranscript) Start() int
Start returns the transcript start relative to Location.
type Transcript ¶
type Transcript interface { feat.Feature feat.Orienter Exons() Exons Introns() Introns SetExons(...Exon) error }
Transcript is the interface for a gene transcript.
func TranscriptsOf ¶
func TranscriptsOf(s feat.Set) []Transcript
TranscriptsOf scans a feat.Set and returns any Transcripts that it finds.
type TranscriptFeature ¶ added in v1.0.1
type TranscriptFeature struct { Transcript Transcript // Transcript is the transcript that the feature is located. Offset int // Offset is the position of the feature relative to Transcript. Length int // Length is the feature length. Orient feat.Orientation // Orientation is the feature orientation relative to Transcript. FeatName string // FeatName is the name of the feature. Desc string // Desc is the description of the feature. }
TranscriptFeature defines a feature on a transcript.
func (*TranscriptFeature) Description ¶ added in v1.0.1
func (t *TranscriptFeature) Description() string
Description returns the feature description.
func (*TranscriptFeature) End ¶ added in v1.0.1
func (t *TranscriptFeature) End() int
End returns the feature end relative to TranscriptLocation.
func (*TranscriptFeature) Len ¶ added in v1.0.1
func (t *TranscriptFeature) Len() int
Len returns the length of the feature.
func (*TranscriptFeature) Location ¶ added in v1.0.1
func (t *TranscriptFeature) Location() feat.Feature
Location returns the Transcript.
func (*TranscriptFeature) Name ¶ added in v1.0.1
func (t *TranscriptFeature) Name() string
Name returns an empty string.
func (*TranscriptFeature) Orientation ¶ added in v1.0.1
func (t *TranscriptFeature) Orientation() feat.Orientation
Orientation returns the orientation of the feature relative to Transcript.
func (*TranscriptFeature) Start ¶ added in v1.0.1
func (t *TranscriptFeature) Start() int
Start returns the feature start relative to Transcript.