Module: RGFA::FieldWriter Private

Included in:
Object
Defined in:
lib/rgfa/field_writer.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Methods to convert ruby objects to the GFA string representations The default conversion is implemented in this module, which is included in Object; single classes may overwrite the following methods, if necessary:

  • #default_gfa_datatype, which returns the symbol of the optional field GFA datatype to use, if none is specified (See RGFA::Line::FIELD_DATATYPE); the default is :Z

  • #to_gfa_field should return a GFA string representation, eventually depending on the specified datatype; no validation is done; the default is #to_s

Instance Method Summary collapse

Instance Method Details

#default_gfa_datatypeRGFA::Line::FIELD_DATATYPE

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Optional field GFA datatype to use, if none is provided



43
# File 'lib/rgfa/field_writer.rb', line 43

def default_gfa_datatype; :Z; end

#to_gfa_field(datatype: nil) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Representation of the data for GFA fields; this method does not (in general) validate the string. The method can be overwritten for a given class, and may take the #default_gfa_datatype into consideration.

Returns:



28
# File 'lib/rgfa/field_writer.rb', line 28

def to_gfa_field(datatype: nil); to_s; end

#to_gfa_optfield(fieldname, datatype: default_gfa_datatype) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Representation of the data as an optional field

Parameters:



35
36
37
# File 'lib/rgfa/field_writer.rb', line 35

def to_gfa_optfield(fieldname, datatype: default_gfa_datatype)
  return "#{fieldname}:#{datatype}:#{to_gfa_field(datatype: datatype)}"
end