github.com/biogo/biogo@v1.0.4/feat/genome/genome.go (about) 1 // Copyright ©2013 The bíogo Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package genome defines types useful for representing cytogenetic features. 6 package genome 7 8 import ( 9 "github.com/biogo/biogo/feat" 10 "github.com/biogo/biogo/seq" 11 ) 12 13 // Chromosome represent a chromosome and associated features. Elements in the 14 // Features field should return the Chromosome when their Location() method is 15 // called. 16 type Chromosome struct { 17 Chr string 18 Desc string 19 Length int 20 Features []feat.Feature 21 } 22 23 func (c *Chromosome) Start() int { return 0 } 24 func (c *Chromosome) End() int { return c.Length } 25 func (c *Chromosome) Len() int { return c.Length } 26 func (c *Chromosome) Name() string { return c.Chr } 27 func (c *Chromosome) Description() string { return c.Desc } 28 func (c *Chromosome) Location() feat.Feature { return nil } 29 30 // Band represents a chromosome band. 31 type Band struct { 32 Band string 33 Desc string 34 Chr feat.Feature 35 StartPos int 36 EndPos int 37 Giemsa string 38 } 39 40 func (b *Band) Start() int { return b.StartPos } 41 func (b *Band) End() int { return b.EndPos } 42 func (b *Band) Len() int { return b.End() - b.Start() } 43 func (b *Band) Name() string { return b.Band } 44 func (b *Band) Description() string { return b.Desc } 45 func (b *Band) Location() feat.Feature { return b.Chr } 46 47 // Fragment represents an assembly fragment. 48 type Fragment struct { 49 Frag string 50 Desc string 51 Chr feat.Feature 52 ChrStart int 53 ChrEnd int 54 FragStart int 55 FragEnd int 56 Type byte 57 Strand seq.Strand 58 } 59 60 func (f *Fragment) Start() int { return f.ChrStart } 61 func (f *Fragment) End() int { return f.ChrEnd } 62 func (f *Fragment) Len() int { return f.End() - f.Start() } 63 func (f *Fragment) Name() string { return f.Frag } 64 func (f *Fragment) Description() string { return f.Desc } 65 func (f *Fragment) Location() feat.Feature { return f.Chr }