zktuong/dandelion

change rarefaction output

Opened this issue · 0 comments

Description of the issue

to just be something like

for grp in ['untreated', 'day1', 'week1']:
    vdj_data = tdata[tdata.obs["TimePoint"] == grp].copy()
    groupby = 'Group_TimePoint'
    clone_key = None
    palette = None
    figsize = (5, 3)
    chain_status_include = ["Single pair", "Orphan VDJ", "Orphan VDJ-exception", "Extra pair", "Extra pair-exception",]
    save = None
    TRUES = ["T", "True", "true", "TRUE", True]
    metadata = vdj_data.obs.copy()
    metadata = metadata[metadata["contig_QC_pass"].isin(TRUES)]
    groups = list(set(metadata[groupby]))
    if type(metadata[clonekey]) == "category":
        metadata[clonekey] = metadata[clonekey].cat.remove_unused_categories()
    res = {}
    for g in groups:
        _metadata = metadata[metadata[groupby] == g].copy()
        res[g] = _metadata[clonekey].value_counts()
        res[g] = res[g].loc[~(res[g]==0)]
        res[g].to_csv('rarefaction/rarefaction_' + g + '.csv')