Documentation ¶
Overview ¶
Package alignment handles aligned sequences stored as columns.
Index ¶
- type QSeq
- func (self *QSeq) Add(n ...protein.Sequence) (err error)
- func (self *QSeq) Alphabet() alphabet.Alphabet
- func (self *QSeq) AppendColumns(a ...[]alphabet.QLetter) (err error)
- func (self *QSeq) AppendEach(a [][]alphabet.QLetter) (err error)
- func (self *QSeq) At(pos seq.Position) alphabet.QLetter
- func (self *QSeq) Circular(c bool)
- func (self *QSeq) Column(pos int, _ bool) (c []alphabet.Letter)
- func (self *QSeq) ColumnQL(pos int, _ bool) []alphabet.QLetter
- func (self *QSeq) Compose(f feat.FeatureSet) (err error)
- func (self *QSeq) Consensus(_ bool) (qs *protein.QSeq)
- func (self *QSeq) Copy() seq.Sequence
- func (self *QSeq) Count() int
- func (self *QSeq) Description() *string
- func (self *QSeq) EAt(pos seq.Position) float64
- func (self *QSeq) Encoding() alphabet.Encoding
- func (self *QSeq) End() int
- func (self *QSeq) Extract(i int) protein.Sequence
- func (self *QSeq) IsCircular() bool
- func (self *QSeq) Join(p *QSeq, where int) (err error)
- func (self *QSeq) Len() int
- func (self *QSeq) Location() *string
- func (self *QSeq) Name() *string
- func (self *QSeq) Offset(o int)
- func (self *QSeq) Protein()
- func (self *QSeq) QDecode(l byte) alphabet.Qphred
- func (self *QSeq) QEncode(pos seq.Position) byte
- func (self *QSeq) Raw() interface{}
- func (self *QSeq) Reverse()
- func (self *QSeq) Set(pos seq.Position, l alphabet.QLetter)
- func (self *QSeq) SetE(pos seq.Position, l float64)
- func (self *QSeq) SetEncoding(e alphabet.Encoding)
- func (self *QSeq) Start() int
- func (self *QSeq) Stitch(f feat.FeatureSet) (err error)
- func (self *QSeq) String() string
- func (self *QSeq) Subseq(start int, end int) (sub seq.Sequence, err error)
- func (self *QSeq) Truncate(start int, end int) (err error)
- type Seq
- func (self *Seq) Add(n ...protein.Sequence) (err error)
- func (self *Seq) Alphabet() alphabet.Alphabet
- func (self *Seq) AppendColumns(a ...[]alphabet.QLetter) (err error)
- func (self *Seq) AppendEach(a [][]alphabet.QLetter) (err error)
- func (self *Seq) At(pos seq.Position) alphabet.QLetter
- func (self *Seq) Circular(c bool)
- func (self *Seq) Column(pos int, _ bool) (c []alphabet.Letter)
- func (self *Seq) ColumnQL(pos int, _ bool) (c []alphabet.QLetter)
- func (self *Seq) Compose(f feat.FeatureSet) (err error)
- func (self *Seq) Consensus(_ bool) (qs *protein.QSeq)
- func (self *Seq) Copy() seq.Sequence
- func (self *Seq) Count() int
- func (self *Seq) Description() *string
- func (self *Seq) End() int
- func (self *Seq) Extract(i int) protein.Sequence
- func (self *Seq) IsCircular() bool
- func (self *Seq) Join(p *Seq, where int) (err error)
- func (self *Seq) Len() int
- func (self *Seq) Location() *string
- func (self *Seq) Name() *string
- func (self *Seq) Offset(o int)
- func (self *Seq) Protein()
- func (self *Seq) Raw() interface{}
- func (self *Seq) Reverse()
- func (self *Seq) Set(pos seq.Position, l alphabet.QLetter)
- func (self *Seq) Start() int
- func (self *Seq) Stitch(f feat.FeatureSet) (err error)
- func (self *Seq) String() string
- func (self *Seq) Subseq(start int, end int) (sub seq.Sequence, err error)
- func (self *Seq) Truncate(start int, end int) (err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QSeq ¶
type QSeq struct { ID string Desc string Loc string SubIDs []string S [][]alphabet.QLetter Consensify protein.Consensifyer Threshold alphabet.Qphred // Threshold for returning valid letter. LowQFilter seq.Filter // How to represent below threshold letter. Stringify seq.Stringify Meta interface{} // No operation implicitly copies or changes the contents of Meta. // contains filtered or unexported fields }
Aligned protein with quality scores.
func NewQSeq ¶
func NewQSeq(id string, subids []string, ql [][]alphabet.QLetter, alpha alphabet.Peptide, encode alphabet.Encoding, cons protein.Consensifyer) (*QSeq, error)
Example ¶
qm, err := NewQSeq("example alignment", []string{"seq 1", "seq 2", "seq 3"}, [][]alphabet.QLetter{ {{'A', 40}, {'A', 40}, {'A', 40}}, {{'C', 40}, {'C', 40}, {'C', 40}}, {{'G', 40}, {'G', 40}, {'G', 40}}, {{'C', 40}, {'G', 40}, {'A', 40}}, {{'T', 40}, {'T', 40}, {'T', 40}}, {{'G', 40}, {'G', 40}, {'G', 40}}, {{'A', 40}, {'A', 40}, {'A', 40}}, {{'C', 40}, {'C', 40}, {'C', 40}}, {{'T', 40}, {'C', 40}, {'G', 40}}, {{'T', 40}, {'T', 40}, {'T', 40}}, {{'G', 40}, {'G', 40}, {'G', 40}}, {{'G', 40}, {'G', 40}, {'G', 40}}, {{'T', 40}, {'C', 40}, {'C', 40}}, {{'G', 40}, {'G', 40}, {'G', 40}}, {{'C', 40}, {'C', 40}, {'C', 40}}, {{'A', 40}, {'G', 40}, {'T', 40}}, {{'C', 40}, {'C', 40}, {'C', 40}}, {{'G', 40}, {'A', 40}, {'A', 40}}, {{'T', 40}, {'T', 40}, {'T', 40}}, }, alphabet.Protein, alphabet.Sanger, protein.QConsensify) if err != nil { panic(err) } qaligned(qm)
Output: ACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCAT ACGATGACGTGGCGCTCAT acgxtgacxtggcgcxcat
func (*QSeq) Add ¶
Add sequences n to Alignment. Sequences in n must align start and end with the receiving alignment. Additional sequence will be clipped.
Example ¶
fmt.Printf("%v %v\n", qm.Count(), qm) qm.Add(protein.NewQSeq("example DNA", []alphabet.QLetter{{'a', 40}, {'c', 39}, {'g', 40}, {'C', 38}, {'t', 35}, {'g', 20}}, alphabet.Protein, alphabet.Sanger)) fmt.Printf("%v %v\n", qm.Count(), qm)
Output: 3 acgxtgacxtggcgcxcat 4 acgctgacxtggcgcxcat
func (*QSeq) AppendColumns ¶
Append each byte of each a to the appropriate sequence in the reciever.
func (*QSeq) AppendEach ¶
Append each []byte in a to the appropriate sequence in the reciever.
func (*QSeq) Copy ¶
Example ¶
qn = qm.Copy().(*QSeq) qn.Set(seq.Position{Pos: 3, Ind: 2}, alphabet.QLetter{L: 't', Q: 40}) qaligned(qm) fmt.Println() qaligned(qn)
Output: ACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCAT ACGATGACGTGGCGCTCAT acgCtg------------- acgctgacxtggcgcxcat ACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCAT ACGtTGACGTGGCGCTCAT acgCtg------------- acgctgacxtggcgcxcat
func (*QSeq) Description ¶
Description returns a pointer to the Desc string of the sequence.
func (*QSeq) IsCircular ¶
func (*QSeq) Join ¶
Example ¶
qaligned(qn) qn.Join(qm, seq.End) fmt.Println() qaligned(qn)
Output: ACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCAT ACGtTGACGTGGCGCTCAT acgCtg------------- acgctgacxtggcgcxcat ACGCTGACTTGGTGCACGTACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCATACGGTGACCTGGCGCGCAT ACGtTGACGTGGCGCTCATACGATGACGTGGCGCTCAT acgCtg-------------acgCtg------------- acgctgacxtggcgcxcatacgctgacxtggcgcxcat
func (*QSeq) Raw ¶
func (self *QSeq) Raw() interface{}
Raw returns a pointer to the underlying [][]alphabet.QLetter slice.
func (*QSeq) Reverse ¶
func (self *QSeq) Reverse()
Example ¶
qaligned(qm) fmt.Println() qm.Reverse() qaligned(qm)
Output: ACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCAT ACGATGACGTGGCGCTCAT acgCtg------------- acgctgacxtggcgcxcat TGCACGTGGTTCAGTCGCA TACGCGCGGTCCAGTGGCA TACTCGCGGTGCAGTAGCA -------------gtCgca tacxcgcggtxcagtcgca
func (*QSeq) SetEncoding ¶
Set the quality encoding type to e.
func (*QSeq) Stitch ¶
func (self *QSeq) Stitch(f feat.FeatureSet) (err error)
Example ¶
f := feat.FeatureSet{ &feat.Feature{Start: -1, End: 4}, &feat.Feature{Start: 30, End: 38}, } qaligned(qn) fmt.Println() err := qn.Stitch(f) if err != nil { fmt.Println(err) } else { qaligned(qn) }
Output: ACGCTGACTTGGTGCACGTACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCATACGGTGACCTGGCGCGCAT ACGtTGACGTGGCGCTCATACGATGACGTGGCGCTCAT acgCtg-------------acgCtg------------- acgctgacxtggcgcxcatacgctgacxtggcgcxcat ACGCGTGCACGT ACGGGCGCGCAT ACGtGCGCTCAT acgC-------- acgcgcgcxcat
type Seq ¶
type Seq struct { ID string Desc string Loc string SubIDs []string S [][]alphabet.Letter Consensify protein.Consensifyer Stringify seq.Stringify Meta interface{} // No operation implicitly copies or changes the contents of Meta. // contains filtered or unexported fields }
Alignment protein sequence.
func NewSeq ¶
func NewSeq(id string, subids []string, b [][]alphabet.Letter, alpha alphabet.Peptide, cons protein.Consensifyer) (*Seq, error)
Example ¶
m, err := NewSeq("example alignment", []string{"seq 1", "seq 2", "seq 3"}, [][]alphabet.Letter{ []alphabet.Letter("AAA"), []alphabet.Letter("CCC"), []alphabet.Letter("GGG"), []alphabet.Letter("CGA"), []alphabet.Letter("TTT"), []alphabet.Letter("GGG"), []alphabet.Letter("AAA"), []alphabet.Letter("CCC"), []alphabet.Letter("TCG"), []alphabet.Letter("TTT"), []alphabet.Letter("GGG"), []alphabet.Letter("GGG"), []alphabet.Letter("TCC"), []alphabet.Letter("GGG"), []alphabet.Letter("CCC"), []alphabet.Letter("AGT"), []alphabet.Letter("CCC"), []alphabet.Letter("GAA"), []alphabet.Letter("TTT"), }, alphabet.Protein, protein.Consensify) if err != nil { panic(err) } aligned(m)
Output: ACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCAT ACGATGACGTGGCGCTCAT acgxtgacxtggcgcxcat
func (*Seq) Add ¶
Add sequences n to Seq. Sequences in n must align start and end with the receiving alignment. Additional sequence will be clipped.
Example ¶
fmt.Printf("%v %v\n", m.Count(), m) m.Add(protein.NewQSeq("example Protein", []alphabet.QLetter{{'a', 40}, {'c', 39}, {'g', 40}, {'C', 38}, {'t', 35}, {'g', 20}}, alphabet.Protein, alphabet.Sanger)) fmt.Printf("%v %v\n", m.Count(), m)
Output: 3 acgxtgacxtggcgcxcat 4 acgctgacxtggcgcxcat
func (*Seq) AppendColumns ¶
Append each byte of each a to the appropriate sequence in the reciever.
func (*Seq) AppendEach ¶
Append each []byte in a to the appropriate sequence in the reciever.
func (*Seq) Copy ¶
Example ¶
n = m.Copy().(*Seq) n.Set(seq.Position{Pos: 3, Ind: 2}, alphabet.QLetter{L: 't'}) aligned(m) fmt.Println() aligned(n)
Output: ACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCAT ACGATGACGTGGCGCTCAT acgCtg------------- acgctgacxtggcgcxcat ACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCAT ACGtTGACGTGGCGCTCAT acgCtg------------- acgctgacxtggcgcxcat
func (*Seq) Description ¶
Description returns a pointer to the Desc string of the sequence.
func (*Seq) IsCircular ¶
func (*Seq) Join ¶
Example ¶
aligned(n) n.Join(m, seq.End) fmt.Println() aligned(n)
Output: ACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCAT ACGtTGACGTGGCGCTCAT acgCtg------------- acgctgacxtggcgcxcat ACGCTGACTTGGTGCACGTACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCATACGGTGACCTGGCGCGCAT ACGtTGACGTGGCGCTCATACGATGACGTGGCGCTCAT acgCtg-------------acgCtg------------- acgctgacxtggcgcxcatacgctgacxtggcgcxcat
func (*Seq) Raw ¶
func (self *Seq) Raw() interface{}
Raw returns a pointer to the underlying [][]byte slice.
func (*Seq) Reverse ¶
func (self *Seq) Reverse()
Example ¶
aligned(m) fmt.Println() m.Reverse() aligned(m)
Output: ACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCAT ACGATGACGTGGCGCTCAT acgCtg------------- acgctgacxtggcgcxcat TGCACGTGGTTCAGTCGCA TACGCGCGGTCCAGTGGCA TACTCGCGGTGCAGTAGCA -------------gtCgca tacxcgcggtxcagtcgca
func (*Seq) Stitch ¶
func (self *Seq) Stitch(f feat.FeatureSet) (err error)
Example ¶
f := feat.FeatureSet{ &feat.Feature{Start: -1, End: 4}, &feat.Feature{Start: 30, End: 38}, } aligned(n) fmt.Println() err := n.Stitch(f) if err != nil { fmt.Println(err) } else { aligned(n) }
Output: ACGCTGACTTGGTGCACGTACGCTGACTTGGTGCACGT ACGGTGACCTGGCGCGCATACGGTGACCTGGCGCGCAT ACGtTGACGTGGCGCTCATACGATGACGTGGCGCTCAT acgCtg-------------acgCtg------------- acgctgacxtggcgcxcatacgctgacxtggcgcxcat ACGCGTGCACGT ACGGGCGCGCAT ACGtGCGCTCAT acgC-------- acgcgcgcxcat