Class: BioDSL::Usearch
- Inherits:
-
Object
- Object
- BioDSL::Usearch
- Includes:
- Enumerable
- Defined in:
- lib/BioDSL/usearch.rb
Overview
Class with methods to execute Usearch and parse the results.
Defined Under Namespace
Classes: IO
Class Method Summary collapse
-
.cluster_otus(options) ⇒ Object
Execute cluster_otus.
-
.cluster_smallmem(options) ⇒ Object
Execute cluster_smallmem.
-
.open(*args) {|IO| ... } ⇒ IO
Open a Usearch file.
-
.uchime_ref(options) ⇒ Object
Execute uchime_ref.
-
.usearch_global(options) ⇒ Object
Execute usearch_local.
-
.usearch_local(options) ⇒ Object
Execute usearch_local.
Instance Method Summary collapse
-
#cluster_otus ⇒ self
Combose a command list and execute cluster_otus with this.
-
#cluster_smallmem ⇒ self
Combose a command list and execute cluster_smallmem with this.
-
#initialize(options) ⇒ Usearch
constructor
Constructor for Usearch class.
-
#uchime_ref ⇒ self
Combose a command list and execute uchime_ref with this.
-
#usearch_global ⇒ self
Combose a command list and execute usearch_global with this.
-
#usearch_local ⇒ self
Combose a command list and execute usearch_local with this.
Constructor Details
#initialize(options) ⇒ Usearch
Constructor for Usearch class.
136 137 138 139 140 141 142 143 |
# File 'lib/BioDSL/usearch.rb', line 136 def initialize() @options = @stderr = nil return self unless File.size(@options[:input]) == 0 fail UsearchError, %(Empty input file -> "#{@options[:input]}") end |
Class Method Details
.cluster_otus(options) ⇒ Object
Execute cluster_otus.
62 63 64 65 |
# File 'lib/BioDSL/usearch.rb', line 62 def self.cluster_otus() usearch = new() usearch.cluster_otus end |
.cluster_smallmem(options) ⇒ Object
Execute cluster_smallmem.
48 49 50 51 |
# File 'lib/BioDSL/usearch.rb', line 48 def self.cluster_smallmem() usearch = new() usearch.cluster_smallmem end |
.open(*args) {|IO| ... } ⇒ IO
Open a Usearch file.
115 116 117 118 119 120 121 122 123 |
# File 'lib/BioDSL/usearch.rb', line 115 def self.open(*args) ios = IO.open(*args) if block_given? yield ios else return ios end end |
.uchime_ref(options) ⇒ Object
Execute uchime_ref.
76 77 78 79 |
# File 'lib/BioDSL/usearch.rb', line 76 def self.uchime_ref() usearch = new() usearch.uchime_ref end |
.usearch_global(options) ⇒ Object
Execute usearch_local.
90 91 92 93 |
# File 'lib/BioDSL/usearch.rb', line 90 def self.usearch_global() usearch = new() usearch.usearch_global end |
.usearch_local(options) ⇒ Object
Execute usearch_local.
104 105 106 107 |
# File 'lib/BioDSL/usearch.rb', line 104 def self.usearch_local() usearch = new() usearch.usearch_local end |
Instance Method Details
#cluster_otus ⇒ self
Combose a command list and execute cluster_otus with this.
170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/BioDSL/usearch.rb', line 170 def cluster_otus command = [] command << 'usearch' command << "-cluster_otus #{@options[:input]}" command << "-otus #{@options[:output]}" command << "-id #{@options[:identity]}" command << "-threads #{@options[:cpus]}" if @options[:cpus] execute(command) self end |
#cluster_smallmem ⇒ self
Combose a command list and execute cluster_smallmem with this.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/BioDSL/usearch.rb', line 148 def cluster_smallmem command = [] command << 'usearch' command << "-cluster_smallmem #{@options[:input]}" command << "-id #{@options[:identity]}" command << "-threads #{@options[:cpus]}" if @options[:cpus] command << "-strand #{@options[:strand]}" if @options[:align] command << "-msaout #{@options[:output]}" else command << "-uc #{@options[:output]}" end execute(command) self end |
#uchime_ref ⇒ self
Combose a command list and execute uchime_ref with this.
186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/BioDSL/usearch.rb', line 186 def uchime_ref command = [] command << 'usearch' command << "-uchime_ref #{@options[:input]}" command << "-db #{@options[:database]}" command << "-strand #{@options[:strand]}" command << "-threads #{@options[:cpus]}" if @options[:cpus] command << "-nonchimeras #{@options[:output]}" execute(command) self end |
#usearch_global ⇒ self
Combose a command list and execute usearch_global with this.
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/BioDSL/usearch.rb', line 203 def usearch_global command = [] command << 'usearch' command << '-notrunclabels' command << "-usearch_global #{@options[:input]}" command << "-db #{@options[:database]}" command << "-strand #{@options[:strand]}" if @options[:strand] command << "-threads #{@options[:cpus]}" if @options[:cpus] command << "-id #{@options[:identity]}" command << "-uc #{@options[:output]}" execute(command) self end |
#usearch_local ⇒ self
Combose a command list and execute usearch_local with this.
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/BioDSL/usearch.rb', line 222 def usearch_local command = [] command << 'usearch' command << '-notrunclabels' command << "-usearch_local #{@options[:input]}" command << "-db #{@options[:database]}" command << "-strand #{@options[:strand]}" if @options[:strand] command << "-threads #{@options[:cpus]}" if @options[:cpus] command << "-id #{@options[:identity]}" command << "-uc #{@options[:output]}" execute(command) self end |