class Line::Path

A path line of a RGFA file

Constants

DATATYPE
PREDEFINED_OPTFIELDS
RECORD_TYPE
REQFIELDS

Public Instance Methods

circular?() click to toggle source

Is the path circular? In this case the number of CIGARs must be equal to the number of segments. @return [Boolean]

# File lib/rgfa/line/path.rb, line 32
def circular?
  self.overlaps.size == self.segment_names.size
end
linear?() click to toggle source

Is the path linear? This is the case when the number of CIGARs is equal to the number of segments minus 1, or the CIGARs are represented by a single “*”.

# File lib/rgfa/line/path.rb, line 39
def linear?
  !circular?
end
to_sym() click to toggle source

@return [Symbol] name of the path as symbol

# File lib/rgfa/line/path.rb, line 25
def to_sym
  name.to_sym
end
undef_overlaps?() click to toggle source

Are the overlaps a single “*”? This is a compact representation of a linear path where all CIGARs are “*” @return [Boolean]

# File lib/rgfa/line/path.rb, line 46
def undef_overlaps?
  self.overlaps.size == 1 and self.overlaps[0].empty?
end

Private Instance Methods

validate_lists_size!() click to toggle source
# File lib/rgfa/line/path.rb, line 80
def validate_lists_size!
  n_overlaps = self.overlaps.size
  n_segments = self.segment_names.size
  if n_overlaps == n_segments - 1
    # case 1: linear path
    return true
  elsif n_overlaps == 1 and self.overlaps[0].empty?
    # case 2: linear path, single "*" to represent overlaps which are all "*"
    return true
  elsif n_overlaps == n_segments
    # case 3: circular path
  else
    raise RGFA::Line::Path::ListLengthsError,
      "Path has #{n_segments} oriented segments, "+
      "but #{n_overlaps} overlaps"
  end
end
validate_record_type_specific_info!() click to toggle source
# File lib/rgfa/line/path.rb, line 98
def validate_record_type_specific_info!
  validate_lists_size!
end