iCLIP.utils.spread

iCLIP.utils.spread(profile, bases, reindex=True, right_bases=None)

Extend cross-link sites in both directions.

By default the cross-links are “spread” by the same amount in both directions. However, providing right_bases will make the spreading happen bases in the left direction and right_bases in the right direction.

Parameters:
  • profile (pandas.Series) – Cross-link profile with positions to be spread
  • bases (int) – Number of bases to spread the cross-link sites by. operates both left and right unless right_bases is provided.
  • reindex (bool, optional) – Should the profile be reindexed before spreading. Only set False if the profile has already been reindexed (see below).
  • right_bases (int, optional) – If set with extend bases in the left direction and right_bases in the right direction.
Returns:

The profile of the spread crosslinked bases. This will not be in sparse form (will contain 0s).

Return type:

pandas.Series

Notes

The reindex parameter is provided as a covenience for when this has already been done. The following would need to be done if reindex=False:

start = int(profile.index.min() - window) end = int(profile.index.max() + window+1) profile = profile.reindex(np.arange(start, end), fill_value=0)