nodes: 0, module; 1, function_definition; 2, function_name:reference_contexts_for_variants; 3, parameters; 4, block; 5, identifier:variants; 6, identifier:context_size; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:transcript_id_whitelist; 13, None; 14, comment:"""
      Extract a set of reference contexts for each variant in the collection.
  
      Parameters
      ----------
      variants : varcode.VariantCollection
  
      context_size : int
          Max of nucleotides to include to the left and right of the variant
          in the context sequence.
  
      transcript_id_whitelist : set, optional
          If given, then only consider transcripts whose IDs are in this set.
  
      Returns a dictionary from variants to lists of ReferenceContext objects,
      sorted by max coding sequence length of any transcript.
      """; 15, assignment; 16, identifier:variant; 17, identifier:variants; 18, block; 19, identifier:result; 20, identifier:result; 21, call; 22, expression_statement; 23, identifier:OrderedDict; 24, argument_list; 25, assignment; 26, subscript; 27, call; 28, identifier:result; 29, identifier:variant; 30, identifier:reference_contexts_for_variant; 31, argument_list; 32, keyword_argument; 33, keyword_argument; 34, keyword_argument; 35, identifier:variant; 36, identifier:variant; 37, identifier:context_size; 38, identifier:context_size; 39, identifier:transcript_id_whitelist; 40, identifier:transcript_id_whitelist
code: def reference_contexts_for_variants(
          variants,
          context_size,
          transcript_id_whitelist=None):
      """
      Extract a set of reference contexts for each variant in the collection.
  
      Parameters
      ----------
      variants : varcode.VariantCollection
  
      context_size : int
          Max of nucleotides to include to the left and right of the variant
          in the context sequence.
  
      transcript_id_whitelist : set, optional
          If given, then only consider transcripts whose IDs are in this set.
  
      Returns a dictionary from variants to lists of ReferenceContext objects,
      sorted by max coding sequence length of any transcript.
      """
      result = OrderedDict()
      for variant in variants:
          result[variant] = reference_contexts_for_variant(
              variant=variant,
              context_size=context_size,
              transcript_id_whitelist=transcript_id_whitelist)
      return result