gneiss.util.match¶
-
gneiss.util.
match
(table, metadata)[source]¶ Matches samples between a contingency table and a metadata table.
Sorts samples in metadata and contingency table in the same order. If there are sames contained in the contigency table, but not in metadata or vice versa, the intersection of samples in the contingency table and the metadata table will returned.
Parameters: - table (pd.DataFrame) – Contingency table where samples correspond to rows and features correspond to columns.
- metadata (pd.DataFrame) – Metadata table where samples correspond to rows and explanatory metadata variables correspond to columns.
Returns: - pd.DataFrame – Filtered contingency table.
- pd.DataFrame – Filtered metadata table
Raises: - ValueError: – Raised if duplicate sample ids are present in table.
- ValueError: – Raised if duplicate sample ids are present in metadata.
- ValueError: – Raised if table and metadata have incompatible sizes.