Closed jdhenaos closed 3 years ago
Hi Juan,
on this first glance, this looks like it should work (provided that adata
contains all samples and the obs_names
match). Do you get any logging output (try setting sc.settings.verbosity = 4
)?
Otherwise you could also try to merge them on a per-sample basis, and concatenate the merged adatas, as described in the data loading tutorial.
Best, Gregor
Hi.
Thanks a lot for the quick response! When I merge sample by sample with the expression anndata I received the next message:
.... storing 'IR_VJ_1_cdr3' as categorical
... storing 'IR_VJ_2_cdr3' as categorical
... storing 'IR_VDJ_1_cdr3' as categorical
... storing 'IR_VDJ_2_cdr3' as categorical
... storing 'IR_VJ_1_cdr3_nt' as categorical
... storing 'IR_VJ_2_cdr3_nt' as categorical
... storing 'IR_VDJ_1_cdr3_nt' as categorical
... storing 'IR_VDJ_2_cdr3_nt' as categorical
... storing 'sample_y' as categorical
... storing 'type_y' as categorical
... storing 'ID_y' as categorical
... storing 'multi_chain' as categorical
... storing 'IR_VJ_1_cdr3' as categorical
... storing 'IR_VJ_2_cdr3' as categorical
... storing 'IR_VDJ_1_cdr3' as categorical
... storing 'IR_VDJ_2_cdr3' as categorical
... storing 'IR_VJ_1_cdr3_nt' as categorical
... storing 'IR_VJ_2_cdr3_nt' as categorical
... storing 'IR_VDJ_1_cdr3_nt' as categorical
... storing 'IR_VDJ_2_cdr3_nt' as categorical
WARNING: It seems you already have immune receptor (IR) data in `adata`. Merging IR objects by chain.
I cannot follow the tutorial because the expression anndata I am working on is an already preprocessed one. That is the reason I am adding TCR data directly to the same anndata object.
Kind regards,
Juan
When I merge sample by sample with the expression anndata I received the next message:
I'd actually expect this message in every loop iteration :thinking:
I cannot follow the tutorial because the expression anndata I am working on is an already preprocessed one.
I see! Before I start further investigation, could you please double-check that the obs_names
match between transcriptomics and IR adata? As the transcriptomics adata is already merged, it might have batch ids appended to the barcodes, while the IR adatas don't.
The obs_names are the same. However, when I merge both, the column "samples" become into "sample_x" and a couple of new columns with the same name arise. But only one of them have the entire sample information
Providing columns that are both in adata.obs
and adata_ir.obs
to on
should do the trick, i.e.
ir.pp.merge_with_ir(adata, adata_ir, on=["sample", "type", "ID"])
In principle, the merge_with_ir
function seems to work as I expected, when I use this toy example here (splitting up an existing adata_ir
by sample, and merging it into the corresponding transcriptomics adata
on a sample-by-sample basis):
ir_adatas = {
sample: adata_ir[adata.obs["sample"] == sample, :].copy() for sample in adata_ir.obs["sample"]
}
for tmp_adata in ir_adatas.values():
ir.pp.merge_with_ir(adata, tmp_adata, on=["patient", "sample"])
Problem solved!
Now all info merged in the previously created .obs without problems.
Thanks a lot!
Hi.
I have the .json from 10X per sample. How could I integrate all those samples with the expression anndata.
I used the following code. However, in the further steps I saw the information is present just for the first sample.
Thanks in advance,
Juan