qdiv.sequences.align

qdiv.sequences.align(objlist, *, different_lengths=False, name_type='OTU')[source]

Align feature names across multiple objects containing sequences (‘seq’).

Works with either dicts or MicrobiomeData objects. Returns the same types as inputs.

Parameters:
  • objlist (list of dict or MicrobiomeData) – List of input objects to align. Each object must contain at least: - ‘seq’: sequence table (features x sequence) Optionally: - ‘tab’: abundance table (features x samples) - ‘tax’: taxonomy table - ‘meta’: sample metadata - ‘tree’: sample tree data

  • different_lengths (bool, optional) – If True, allows alignment of features with different sequence lengths (substring matching, O(n^2) over unique sequences). Default is False.

  • name_type (str, optional) – Prefix for renaming aligned features (e.g., ‘OTU’, ‘ASV’). Default is ‘OTU’.

Returns:

aligned_objects – List of aligned objects, of the same types as the input.

Return type:

list of dict or MicrobiomeData

Notes

  • Duplicate sequences within each object are collapsed (abundance tables summed, taxonomy taken from the first occurrence).

  • Feature names are harmonized across all objects.

  • If different_lengths=True, substring matching is used for alignment.