nodes: 0, module; 1, function_definition; 2, function_name:contigs_to_positions; 3, parameters; 4, block; 5, identifier:contigs; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:binning; 13, integer:10000; 14, comment:"""Build positions from contig labels
  
      From a list of contig labels and a binning parameter,
      build a list of positions that's essentially a
      concatenation of linspaces with step equal to the
      binning.
  
      Parameters
      ----------
      contigs : list or array_like
          The list of contig labels, must be sorted.
      binning : int, optional
          The step for the list of positions. Default is 10000.    
      
      Returns
      -------
      positions : numpy.ndarray
          The piece-wise sorted list of positions
      """; 15, assignment; 16, assignment; 17, pattern_list; 18, call; 19, block; 20, identifier:positions; 21, identifier:positions; 22, call; 23, identifier:index; 24, integer:0; 25, identifier:_; 26, identifier:chunk; 27, attribute; 28, argument_list; 29, expression_statement; 30, expression_statement; 31, expression_statement; 32, attribute; 33, argument_list; 34, identifier:itertools; 35, identifier:groubpy; 36, identifier:contigs; 37, assignment; 38, assignment; 39, augmented_assignment; 40, identifier:np; 41, identifier:zeros_like; 42, identifier:contigs; 43, identifier:l; 44, call; 45, subscript; 46, binary_operator:np.arange(list(chunk)) * binning; 47, identifier:index; 48, identifier:l; 49, identifier:len; 50, argument_list; 51, identifier:positions; 52, slice; 53, call; 54, identifier:binning; 55, identifier:chunk; 56, identifier:index; 57, binary_operator:index + l; 58, attribute; 59, argument_list; 60, identifier:index; 61, identifier:l; 62, identifier:np; 63, identifier:arange; 64, call; 65, identifier:list; 66, argument_list; 67, identifier:chunk
code: def contigs_to_positions(contigs, binning=10000):
      """Build positions from contig labels
  
      From a list of contig labels and a binning parameter,
      build a list of positions that's essentially a
      concatenation of linspaces with step equal to the
      binning.
  
      Parameters
      ----------
      contigs : list or array_like
          The list of contig labels, must be sorted.
      binning : int, optional
          The step for the list of positions. Default is 10000.    
      
      Returns
      -------
      positions : numpy.ndarray
          The piece-wise sorted list of positions
      """
  
      positions = np.zeros_like(contigs)
  
      index = 0
      for _, chunk in itertools.groubpy(contigs):
          l = len(chunk)
          positions[index : index + l] = np.arange(list(chunk)) * binning
          index += l
  
      return positions