From 9fe0c828e4a8e1f61a1acba1e7b8439dd5edc598 Mon Sep 17 00:00:00 2001 From: cmzmasek Date: Fri, 9 Jun 2017 13:39:20 -0700 Subject: [PATCH] in progress... --- forester/ruby/evoruby/lib/evo/msa/msa.rb | 16 +++++++++------- forester/ruby/evoruby/lib/evo/tool/msa_processor.rb | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/forester/ruby/evoruby/lib/evo/msa/msa.rb b/forester/ruby/evoruby/lib/evo/msa/msa.rb index dede7c7..a61e62a 100644 --- a/forester/ruby/evoruby/lib/evo/msa/msa.rb +++ b/forester/ruby/evoruby/lib/evo/msa/msa.rb @@ -423,7 +423,7 @@ module Evoruby end end - def extract( first, last, suffix ) + def extract( first, last, min_non_gap_length, suffix ) if !is_aligned() error_msg = "attempt to extract from unaligned msa" raise StandardError, error_msg, caller @@ -443,17 +443,19 @@ module Evoruby msa = Msa.new() for i in 0 ... get_number_of_seqs subseq = get_sequence( i ).get_subsequence( first, last ) - if suffix != nil - msa.add( subseq.get_name + suffix, subseq.get_sequence_as_string ) - else - msa.add( subseq.get_name, subseq.get_sequence_as_string ) + unless ( ( subseq.get_length - subseq.get_gap_length ) < min_non_gap_length ) + if suffix != nil + msa.add( subseq.get_name + suffix, subseq.get_sequence_as_string ) + else + msa.add( subseq.get_name, subseq.get_sequence_as_string ) + end end end msa end - def sliding_extraction( step, size, suffix = nil ) + def sliding_extraction( step, size, min_non_gap_length, suffix = nil ) counter = 0 done = false msas = Array.new() @@ -466,7 +468,7 @@ module Evoruby end unless first >= last counter +=1 - res = extract(first, last, suffix) + res = extract(first, last, min_non_gap_length, suffix) res.set_name(first.to_s + "-" + last.to_s) msas << res end diff --git a/forester/ruby/evoruby/lib/evo/tool/msa_processor.rb b/forester/ruby/evoruby/lib/evo/tool/msa_processor.rb index 1d92b60..eebf8f6 100644 --- a/forester/ruby/evoruby/lib/evo/tool/msa_processor.rb +++ b/forester/ruby/evoruby/lib/evo/tool/msa_processor.rb @@ -377,7 +377,7 @@ module Evoruby end if @window - msas = msa.sliding_extraction( @step, @size, '_Q' ) + msas = msa.sliding_extraction( @step, @size, @size / 2, '_Q' ) begin io = MsaIO.new() w = MsaWriter -- 1.7.10.2