Extracting Metadata¶
After data are loaded and optionally filtered, a metadata table can be created
with the hicutils.core.metadata.make_metadata_table function.
Examples¶
In [1]:
import hicutils as hu
df = hu.io.read_directory('example_data_immunedb')
Generate a metadata table by replicate¶
In [2]:
hu.metadata.make_metadata_table(df, 'replicate_name')
Out[2]:
| uniques | copies | cdr3_num_nts | avg_v_identity | in_frame | clones | |
|---|---|---|---|---|---|---|
| replicate_name | ||||||
| IgH_HPAP015_rep1_200p0ng | 19195 | 21250 | 53.4805 | 0.960210 | 0.8759 | 10000 |
| IgH_HPAP015_rep2_200p0ng | 19803 | 21765 | 53.3733 | 0.957881 | 0.8635 | 10000 |
| IgH_HPAP017_rep1_200p0ng | 19731 | 22617 | 55.1513 | 0.973640 | 0.8507 | 10000 |
| IgH_HPAP017_rep2_200p0ng | 23410 | 27914 | 54.7887 | 0.971429 | 0.8530 | 10000 |
Generate a metadata table by subject/disease¶
In [3]:
pdf = (
df
.pipe(hu.pooling.pool_by, 'disease') # Pool on disease
.pipe(hu.filters.filter_by_overall_copies, 2) # Filter on 2+ copy
)
hu.metadata.make_metadata_table(pdf, ['subject', 'disease'])
Out[3]:
| uniques | copies | cdr3_num_nts | avg_v_identity | in_frame | clones | ||
|---|---|---|---|---|---|---|---|
| subject | disease | ||||||
| HPAP015 | T1D | 27487 | 31504 | 52.444321 | 0.962745 | 0.888642 | 8109 |
| HPAP017 | Control | 31356 | 38746 | 54.364948 | 0.974526 | 0.870252 | 8108 |