Class: Bio::FinishM::ReadInput
- Inherits:
-
Object
- Object
- Bio::FinishM::ReadInput
- Defined in:
- lib/assembly/read_input.rb
Overview
A class representing reads or sets of reads to be assembled
Constant Summary collapse
- READ_INPUT_SYMBOLS =
[ :fasta_singles, :fastq_singles, :fasta_singles_gz, :fastq_singles_gz, :interleaved_fasta, :interleaved_fastq, :interleaved_fasta_gz, :interleaved_fastq_gz, :separate_fasta, :separate_fastq, :separate_fasta_gz, :separate_fastq_gz, ]
Instance Method Summary collapse
-
#add_options(option_parser, options) ⇒ Object
Given an OptionParser, add options to it, which parse out read-related options.
-
#parse_options(options) ⇒ Object
Parse options from options hash into instance variables for this object.
-
#validate_options(options, argv) ⇒ Object
Require at least 1 set of reads to be given, of any type.
-
#velvet_read_arguments ⇒ Object
Output a string to be used on the command line with velvet.
Instance Method Details
#add_options(option_parser, options) ⇒ Object
Given an OptionParser, add options to it, which parse out read-related options
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/assembly/read_input.rb', line 13 def (option_parser, ) { '--fasta' => :fasta_singles, '--fastq' => :fastq_singles, '--fasta-gz' => :fasta_singles_gz, '--fastq-gz' => :fastq_singles_gz, '--interleaved-fasta' => :interleaved_fasta, '--interleaved-fastq' => :interleaved_fastq, '--interleaved-fasta-gz' => :interleaved_fasta_gz, '--interleaved-fastq-gz' => :interleaved_fastq_gz, '--separate-fasta' => :separate_fasta, '--separate-fastq' => :separate_fastq, '--separate-fasta-gz' => :separate_fasta_gz, '--separate-fastq-gz' => :separate_fastq_gz, }.each do |flag, sym| option_parser.on("#{flag} PATH", Array, "One or more paths to reads, comma separated") do |arg| [sym] = arg end end end |
#parse_options(options) ⇒ Object
Parse options from options hash into instance variables for this object
44 45 46 47 48 |
# File 'lib/assembly/read_input.rb', line 44 def () READ_INPUT_SYMBOLS.each do |sym| send("#{sym}=",[sym]) if [sym] end end |
#validate_options(options, argv) ⇒ Object
Require at least 1 set of reads to be given, of any type
35 36 37 38 39 40 41 |
# File 'lib/assembly/read_input.rb', line 35 def (, argv) return nil if [:previous_assembly] #bit of a hack, but hey READ_INPUT_SYMBOLS.each do |sym| return nil if [sym] end return "No definition of reads for assembly was found" end |
#velvet_read_arguments ⇒ Object
Output a string to be used on the command line with velvet
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 |
# File 'lib/assembly/read_input.rb', line 51 def velvet_read_arguments readset_index = 1 args = '' # Have to put probe sequences (which are single-ended) first in this (ordered) hash { :fasta_singles => '-fasta -short', :fastq_singles => '-fastq -short', :fasta_singles_gz => '-fasta.gz -short', :fastq_singles_gz => '-fastq.gz -short', :interleaved_fasta => '-fasta -shortPaired', :interleaved_fastq => '-fastq -shortPaired', :interleaved_fasta_gz => '-fasta.gz -shortPaired', :interleaved_fastq_gz => '-fastq.gz -shortPaired', :separate_fasta => '-fasta -shortPaired -separate', :separate_fastq => '-fastq -shortPaired -separate', :separate_fasta_gz => '-fasta.gz -shortPaired -separate', :separate_fastq_gz => '-fastq.gz -shortPaired -separate', }.each do |sym, velvet_flag| paths = send(sym) unless paths.nil? or paths.empty? args += " #{velvet_flag}" paths.each do |path| args += " #{path}" end end end return args end |