| 1 | // Copyright ©2011-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 featscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/ |
| 6 | |
| 7 | import ( |
| 8 | "stringsscip-go gomod github.com/golang/go/src go1.14 strings/" |
| 9 | ) |
| 10 | |
| 11 | const ( |
| 12 | Undefinedscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Undefined. Moltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Moltype# = iota - 1 |
| 13 | DNAscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/DNA. |
| 14 | RNAscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/RNA. |
| 15 | Proteinscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Protein. |
| 16 | ) |
| 17 | |
| 18 | var ( |
| 19 | moltypeToStringscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/moltypeToString. = [...]string{ |
| 20 | "DNA", "RNA", "Protein", |
| 21 | } |
| 22 | stringToMoltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/stringToMoltype. map[string]Moltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Moltype# = map[string]Moltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Moltype#{} |
| 23 | ) |
| 24 | |
| 25 | func initscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/init().() { |
| 26 | for m, s := range moltypeToStringscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/moltypeToString. { |
| 27 | stringToMoltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/stringToMoltype.[stringsscip-go gomod github.com/golang/go/src go1.14 strings/.ToLowerscip-go gomod github.com/golang/go/src go1.14 strings/ToLower().(s)] = Moltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Moltype#(m) |
| 28 | stringToMoltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/stringToMoltype.[s] = Moltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Moltype#(m) |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | // Moltype represents the molecule type of a source of sequence data. |
| 33 | type Moltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Moltype# int8 |
| 34 | |
| 35 | // Return a string representation of a Moltype. |
| 36 | func (m Moltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Moltype#) Stringscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Moltype#String().() string { |
| 37 | if m == Undefinedscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Undefined. { |
| 38 | return "Undefined" |
| 39 | } |
| 40 | return moltypeToStringscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/moltypeToString.[m] |
| 41 | } |
| 42 | |
| 43 | // ParseMoltype allows conversion from a string to a Moltype. |
| 44 | func ParseMoltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/ParseMoltype().(s string) Moltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Moltype# { |
| 45 | if m, ok := stringToMoltypescip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/stringToMoltype.[s]; ok { |
| 46 | return m |
| 47 | } |
| 48 | |
| 49 | return Undefinedscip-go gomod github.com/biogo/biogo . `github.com/biogo/biogo/feat`/Undefined. |
| 50 | } |