phbradley / conga

Clonotype Neighbor Graph Analysis
MIT License
79 stars 18 forks source link

Where iMHC scores are stored in the data model? #44

Open markgene opened 2 years ago

markgene commented 2 years ago

Hi there, thanks for developing CONGA!

I wonder where the iMHC scores are stored in the data model or individual output file(s).

Thanks!

-Mark

phbradley commented 2 years ago

Hi Mark,

Thanks for your interest in CONGA! Right now, the iMHC scores are not written out or explicitly saved in the AnnData (adata) object. They are computed on the fly along with all the other TCR-based scores during the graph-vs-feature analyses and in some of the plotting routines, but it doesn't look like they are saved.

To recompute them, you could do something like this in a notebook

scores = conga.tcr_scoring.make_tcr_score_table(adata, ['imhc'])

at which point scores would be a numpy array of shape (num_clonotypes,1) with the imhc scores for each clonotype.

or you could hack the run_conga.py script by inserting a line like this somewhere before line 1072 where the final adata is written out and the final adata.obs spreadsheet is saved to tsv file:

adata.obs['imhc_scores'] = conga.tcr_scoring.make_tcr_score_table(adata, ['imhc'])[:,0]

then the scores would be written out with the adata object and present in the output file <prefix>_final_obs.tsv

Let me know if you run into any trouble with that (I didn't test it!).

Take care, Phil

markgene commented 2 years ago

Thank you SO much, @phbradley ! -Mark