module Bio::GFF::GFF3::Escape

Private methods for escaping characters. Internal only. Users should not use this module directly.

Constants

UNSAFE

unsafe characters to be escaped for normal columns

UNSAFE_ATTRIBUTE

unsafe characters to be escaped for attribute columns

UNSAFE_SEQID

unsafe characters to be escaped for seqid columns and target_id of the “Target” attribute

URI_PARSER

(private) URI::Parser object for escape/unescape GFF3 columns

Private Instance Methods

_escape(str, unsafe) click to toggle source

(private) the same as URI::Parser#escape(str, unsafe)

# File lib/bio/db/gff.rb, line 1005
def _escape(str, unsafe)
  URI_PARSER.escape(str, unsafe)
end
_unescape(str) click to toggle source

(private) the same as URI::Parser#unescape(str)

# File lib/bio/db/gff.rb, line 1010
def _unescape(str)
  URI_PARSER.unescape(str)
end
column_to_s(str) click to toggle source

If str is empty, returns '.'. Otherwise, returns str.

# File lib/bio/db/gff.rb, line 995
def column_to_s(str)
  str = str.to_s
  str.empty? ? '.' : str
end
escape(string) click to toggle source

Escape a column according to the specification at song.sourceforge.net/gff3.shtml.

# File lib/bio/db/gff.rb, line 1032
def escape(string)
  _escape(string, UNSAFE)
end
escape_attribute(string) click to toggle source

Escape attribute according to the specification at song.sourceforge.net/gff3.shtml. In addition to the normal escape rule, the following characters are escaped: “,=;”. Returns the string corresponding to these characters escaped.

# File lib/bio/db/gff.rb, line 1047
def escape_attribute(string)
  _escape(string, UNSAFE_ATTRIBUTE)
end
escape_seqid(string) click to toggle source

Escape seqid column according to the specification at song.sourceforge.net/gff3.shtml.

# File lib/bio/db/gff.rb, line 1038
def escape_seqid(string)
  _escape(string, UNSAFE_SEQID)
end
unescape(string) click to toggle source

Return the string corresponding to these characters unescaped

# File lib/bio/db/gff.rb, line 1026
def unescape(string)
  _unescape(string)
end