alphagenome.data.track_data.interleave

Contents

alphagenome.data.track_data.interleave#

alphagenome.data.track_data.interleave(track_datas, name_prefixes)[source]#

Interleaves multiple TrackData objects by alternating rows.

This function combines multiple TrackData objects into a single object by interleaving their rows and metadata. This interleaves operation alternates between the trackdatas, like shuffling cards, i.e., ‘abcd’ interleaved with ‘efgh’ would be “aebfcgdh”. The resulting TrackData object will have the same resolution and interval as the input objects, but the number of tracks will be the sum of the tracks in the input objects.

Parameters:
  • track_datas (Sequence[TrackData]) – A sequence of TrackData objects to interleave. All objects must have the same shape, resolution, and interval. The order in this list will determine the interleaving order.

  • name_prefixes (Sequence[str]) – A sequence of name prefixes to add to the track names in the metadata to ensure uniqueness of (name, strand) pairs.

Return type:

TrackData

Returns:

A new TrackData object containing the interleaved data.

Raises:

ValueError – If the input TrackData objects have different shapes, resolutions, or intervals.