class DustMasker
DustMasker
launcher class
Public Class Methods
new(extra_params = '')
click to toggle source
initializator
# File lib/scbi_blast/dust_masker.rb, line 50 def initialize(extra_params = '') @format = 'interval' @extra_params=extra_params end
Public Instance Methods
close()
click to toggle source
# File lib/scbi_blast/dust_masker.rb, line 114 def close end
do_dust(seq_fasta)
click to toggle source
do the processing with dustmasker to a set of sequences in fasta stored in a string
# File lib/scbi_blast/dust_masker.rb, line 66 def do_dust(seq_fasta) intervals=[] if !seq_fasta.nil? && !seq_fasta.empty? if seq_fasta.is_a?(Array) seq_fasta=seq_fasta.join("\n") end cmd = get_cmd(@extra_params) if !seq_fasta.index('>') raise "Data passed to dust must be in fasta format" end # puts seq_fasta res='' # Ojo, que una vez nos ibamos a volver locos buscando porque esto no devolvia todos los hits que se encontraban al ejecutar el blast a mano, y era porque en el blast a mano le estabamos pasando la secuencia completa mientras que en el MID le estabamos pasando solo los 20 primeros nt. IO.popen(cmd,'w+') {|blast| blast.sync = true # blast.write(">seq\n") blast.write(seq_fasta) blast.close_write res = blast.readlines blast.close_read } if !$?.exitstatus.nil? && $?.exitstatus>0 raise "Error while doing #{cmd} to seq: #{seq_fasta}" end res.each do |line| # puts "LINEA:" + line if line =~ /^>(.*)$/ intervals.push DustQuery.new($1) elsif line =~ /^(\d+)\s\-\s(\d+)/ # puts "Algo #{$1}, #{$2}" intervals.last.push [$1.to_i,$2.to_i] end end end return intervals end
get_cmd(extra_params = '')
click to toggle source
returns command to be executed
# File lib/scbi_blast/dust_masker.rb, line 58 def get_cmd(extra_params = '') cmd = 'dustmasker '+@extra_params + '-outfmt '+ @format + ' 2>/dev/null' return cmd end