forked from jjti/repp
/
list.go
94 lines (80 loc) · 3.81 KB
/
list.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package cmd
import (
"github.com/Lattice-Automation/repp/internal/repp"
"github.com/spf13/cobra"
)
// listCmd is for finding features or enzymes by their name.
var listCmd = &cobra.Command{
Use: "list",
Short: "List features or enzymes",
SuggestionsMinimumDistance: 2,
Long: `List features or enzymes by name.
If there is no exact match, similar entries are returned`,
Aliases: []string{"ls"},
}
// databaseListCmd is for reading features (close to the one requested) from the db.
var databaseListCmd = &cobra.Command{
Use: "database [name]",
Short: "List sequence databases",
Run: repp.ListCmd,
SuggestionsMinimumDistance: 2,
Example: " repp list database",
Long: "List all sequence databases and their costs",
Aliases: []string{"db", "dbs", "databases"},
}
// featureListCmd is for reading features (close to the one requested) from the db.
var featureListCmd = &cobra.Command{
Use: "feature [name]",
Short: "List features in the features database",
Run: repp.FeaturesReadCmd,
SuggestionsMinimumDistance: 2,
Example: " repp list feature terminator",
Long: `List features in the features database that are similar to [name].
Writes each feature to the stdout with their name and sequence.
If multiple features contain the feature name sent, each are logged.
Otherwise, all features with names similar to the feature name are writen to stdout`,
}
// enzymeListCmd is for listing out all the available enzymes usable for digesting
// a backbone. Useful for if the user doesn't know which enzymes are available.
var enzymeListCmd = &cobra.Command{
Use: "enzyme [name]",
Short: "List enzymes available for linearizing backbones",
Run: repp.EnzymesReadCmd,
Example: " repp list enzyme EcoRI",
SuggestionsMinimumDistance: 2,
Long: `List out all the enzymes with the same or a similar name as the argument.
'repp list enzyme' without any arguments logs all enzymes available.`,
Aliases: []string{"enzymes"},
}
// fragmentListCmd is for finding a fragment by its name
var fragmentListCmd = &cobra.Command{
Use: "fragment [name]",
Short: "List a fragment in the databases",
Example: " repp list fragment pSB1C3 --dbs igem",
Run: repp.FragmentListCmd,
SuggestionsMinimumDistance: 2,
Long: `List fragments with a passed name in the specified databases`,
}
// sequenceListCmd is for finding a sequence in the dbs
var sequenceListCmd = &cobra.Command{
Use: "sequence [seq]",
Short: "List a sequence in the databases",
Run: repp.SequenceListCmd,
Example: " repp list sequence GTTGACAATTAATCATCGGCATAGTATATCGGCATAGTATAATACGAC --dbs igem",
SuggestionsMinimumDistance: 2,
Long: `List a sequence's BLAST matches among databases.`,
Aliases: []string{"seq"},
}
// set flags
func init() {
fragmentListCmd.Flags().StringP("dbs", "d", "", "comma separated list of sequence databases")
sequenceListCmd.Flags().StringP("dbs", "d", "", "comma separated list of sequence databases")
sequenceListCmd.Flags().StringP("exclude", "x", "", "keywords for excluding fragments")
sequenceListCmd.Flags().IntP("identity", "t", 100, "match %-identity threshold (see 'blastn -help')")
listCmd.AddCommand(databaseListCmd)
listCmd.AddCommand(featureListCmd)
listCmd.AddCommand(enzymeListCmd)
listCmd.AddCommand(fragmentListCmd)
listCmd.AddCommand(sequenceListCmd)
RootCmd.AddCommand(listCmd)
}