Sha256: f8c8d5a20066e061a3c47f4ecdbad870b1ad447b3a30df3649d578e910f0c7e5

Contents?: true

Size: 1007 Bytes

Versions: 1

Compression:

Stored size: 1007 Bytes

Contents

module Bio
  class Assembly
    class Read
      
      module Ace 
        attr_accessor :base_sequences
        
        def add_base_sequence(from, to, read_name)
          @base_sequences = Array.new if @base_sequences.nil?
          @base_sequences.push BaseSequence.new(from, to, read_name)
        end
        
        class BaseSequence
          attr_accessor :from, :to, :read_name
          
          def initialize(from, to, read_name)
            @from = from
            @to = to
            @read_name = read_name
          end
          
          def <=>(other)
            unless other.kind_of?(Bio::Assembly::Read::BaseSequence)
              raise "[Error] markers are not comparable"
            end
            if self.from == other.from
              # sort by to if froms are identical
              return self.to.<=>(other.to)
            else
              return self.from.<=>(other.from)
            end
          end
          
        end
        
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bio-assembly-0.0.0 lib/bio-assembly/read/ace.rb