Skip to content

Commit 94c8977

Browse files
committed
Add gene-symbol-ID conversion in README #87
1 parent 3fb44c2 commit 94c8977

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,29 @@ Currently, there is no plan for R compatibility. Try to convert R objects into A
516516
```
517517
This model can be used as with other CellTypist models.
518518
</details>
519+
520+
+ <details>
521+
<summary><strong>Model conversion from gene symbols to Ensembl IDs</strong></summary>
522+
523+
CellTypist models are usually trained based on gene symbols. When genes of a query dataset are formatted as Ensembl IDs, you can convert gene symbols in the model to Ensembl ID for matching the query dataset. The [convert](https://celltypist.readthedocs.io/en/latest/celltypist.models.Model.html#celltypist.models.Model.convert) method will be utilised as in the above section.
524+
525+
Specifically, you need to provide a gene-symbol-to-Ensembl-ID file, such that gene symbols in the model will be converted to IDs (or vice versa). A built-in [file](https://github.com/Teichlab/celltypist/blob/main/celltypist/data/samples/GENCODEv44_Gene_id2name.csv) is provided in CellTypist (GENCODE v44). Parameters and details during model conversion can be found in the previous section `Cross-species model conversion`.
526+
527+
Load a human immune model.
528+
```python
529+
model = models.Model.load('Immune_All_Low.pkl')
530+
```
531+
Convert gene symbols to Ensembl IDs using the built-in file. You can also provide a path to your own ID mapping file.
532+
```python
533+
#Note `model` is modified in-place.
534+
model.convert('GENCODEv44_Gene_id2name.csv')
535+
```
536+
Lastly, write out the converted model locally.
537+
```python
538+
model.write('/path/to/local/folder/some_model_name.pkl')
539+
```
540+
This model can be used as with other CellTypist models.
541+
</details>
519542
</details>
520543

521544
# Citation

0 commit comments

Comments
 (0)