Module: RGFATools::LinearPaths

Included in:
Defined in:


Methods for the RGFA class, which involve a traversal of the graph following links

Instance Method Summary collapse

Instance Method Details

#merge_linear_path(segpath, **options) ⇒ RGFA

Merge a linear path, i.e. a path of segments without extra-branches. Extends the RGFA method, with additional functionality:

  • name: the name of the merged segment is set to the name of the single segments joined by underscore (_). If a name already contained an underscore, it is splitted before merging. Whenever a segment is reversed complemented, its name (or the name of all its components) is suffixed with a ^; if the last letter was already ^, it is removed; if it contained _ the name is splitted, the elements reversed and joined back using _; round parentheses are removed from the name before processing and added back after it.

  • :or: keeps track of the origin of the merged segment; the origin tag is set to an array of :or or name (if no :or available) tags of the segment which have been merged; the character ^ is assigned the same meaning as in name

  • :rn: tag used to store possible inversion positions and it is updated by this method; i.e. it is passed from the single segments to the merged segment, and the coordinates updated

  • :mp: tag used to store the position of the single segments in the merged segment; it is created or updated by this method

Note that the extensions to the original method will only be run if either #enable_extensions has been called on RGFA object or the enable_tracking parameter is set.. After calling #enable_extensions, you may still obtain the original behaviour by setting the disable_tracking parameter.

Limitations: all containments und paths involving merged segments are deleted.


  • segpath (Array<RGFA::SegmentEnd>)

    a linear path, such as that retrieved by #linear_path (see RGFA API documentation)

  • options (Hash)

    optional keyword arguments

Options Hash (**options):

  • :merged_name (String, :short, nil) — default: nil

    if nil, the merged_name is automatically computed; if :short, a name is computed starting with “merged1” and calling next until an available name is founf; if String, the name to use

  • :cut_counts (Boolean) — default: false

    if true, total count in merged segment m, composed of segments s of set S is multiplied by the factor Sum(|s in S|)/|m|

  • :enable_tracking (Boolean) — default: false

    if true, the extended method with RGFATools is called, no matter if RGFA#enable_extensions was called.

  • :disable_tracking (Boolean) — default: false

    if true, the original method of RGFA without RGFATools is called, no matter if RGFA#enable_extensions was called.


See Also:

  • #merge_linear_paths

# File 'lib/rgfatools/linear_paths.rb', line 7