class_docstr: Fast overlap detection of a genomic position against a database of Ranges.
  
  Enables O(log n) computation of whether a point chr:pos falls within one of a
  large number of genomic ranges.
  
  This class does not supports overlapping or adjacent intervals. Any such
  intervals will be automatically merged together in the constructor.
  
  This class is immutable. No methods should be added that directly modify the
  ranges held by the class.
class_docstr_tok: ["Fast","overlap","detection","of","a","genomic","position","against","a","database","of","Ranges",".","Enables","O","(","log","n",")","computation","of","whether","a","point","chr",":","pos","falls","within","one","of","a","large","number","of","genomic","ranges",".","This","class","does","not","supports","overlapping","or","adjacent","intervals",".","Any","such","intervals","will","be","automatically","merged","together","in","the","constructor",".","This","class","is","immutable",".","No","methods","should","be","added","that","directly","modify","the","ranges","held","by","the","class","."]
docstr: Parses a command-line style literal regions flag into a RangeSet.
  
  Args:
    regions: An iterable or None. If not None, regions will be parsed with
      ranges.from_regions.
    contig_map: An optional dictionary mapping from contig names to ContigInfo
      protobufs. If provided, allows literals of the format "contig_name",
      which will be parsed into a Range with reference_name=contig_name,
      start=0, end=n_bases where n_bases comes from the ContigInfo;
      additionally the sort order of the RangeSet will be determined by
      contig.pos_in_fasta.
  
  Returns:
    A RangeSet object.
docstr_tok: ["Parses","a","command-line","style","literal","regions","flag","into","a","RangeSet",".","Args",":","regions",":","An","iterable","or","None",".","If","not","None",",","regions","will","be","parsed","with","ranges.from_regions",".","contig_map",":","An","optional","dictionary","mapping","from","contig","names","to","ContigInfo","protobufs",".","If","provided",",","allows","literals","of","the","format","``","contig_name","''",",","which","will","be","parsed","into","a","Range","with","reference_name=contig_name",",","start=0",",","end=n_bases","where","n_bases","comes","from","the","ContigInfo",";","additionally","the","sort","order","of","the","RangeSet","will","be","determined","by","contig.pos_in_fasta",".","Returns",":","A","RangeSet","object","."]
code: def from_regions(
      cls,
      regions: Sequence[str],
      # TODO: Use X | None instead.
      contig_map: Optional[Dict[str, reference_pb2.ContigInfo]] = None,
  ) -> "RangeSet":
      """Parses a command-line style literal regions flag into a RangeSet.
  
      Args:
        regions: An iterable or None. If not None, regions will be parsed with
          ranges.from_regions.
        contig_map: An optional dictionary mapping from contig names to ContigInfo
          protobufs. If provided, allows literals of the format "contig_name",
          which will be parsed into a Range with reference_name=contig_name,
          start=0, end=n_bases where n_bases comes from the ContigInfo;
          additionally the sort order of the RangeSet will be determined by
          contig.pos_in_fasta.
  
      Returns:
        A RangeSet object.
      """
      if regions is None:
          return cls(ranges=[])
      else:
          return cls(
              ranges=from_regions(regions, contig_map=contig_map)
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import re
  from typing import Dict, Iterable, Optional, Sequence
  from absl import logging
  from etils import epath
  import intervaltree
  import six
  from third_party.nucleus.io import bed
  from third_party.nucleus.protos import position_pb2
  from third_party.nucleus.protos import range_pb2
  from third_party.nucleus.protos import reference_pb2
  from third_party.nucleus.protos import variants_pb2
label_desc: Use image node_id 3 for calling the RangeSet obj's underlying member method code with example usage: obj.from_regions(cls, regions, contig_map) and returns: cls, cls