alphagenome.data.track_data.interleave#
- alphagenome.data.track_data.interleave(track_datas, name_prefixes)[source]#
Interleaves multiple
TrackDataobjects by alternating rows.This function combines multiple
TrackDataobjects 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 resultingTrackDataobject 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 ofTrackDataobjects 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:
- Returns:
A new
TrackDataobject containing the interleaved data.- Raises:
ValueError – If the input
TrackDataobjects have different shapes, resolutions, or intervals.