<jupyter_start><jupyter_text>scRFE Tutorial<jupyter_code># visit: https://github.com/czbiohub/scRFE/blob/master/scripts/scRFE.ipynb
# for how the scRFE function is built<jupyter_output><empty_output><jupyter_text>Transcription Factor Analysis<jupyter_code>from scRFE.scRFE import scRFE #import the scRFE function from the scRFE .py file from the scRFE directory
from anndata import read_h5ad #to read in Anndata object
import pandas as pd #to read in csv list of TFs
# read in AnnData/.h5ad file 
adata = read_h5ad('/data/madeline/src3/01_figure_1/tabula-muris-senis-droplet-processed-official-annotations.h5ad')
# read in GO mouse transcription factor list 
mouse_tfs = pd.read_csv("/home/angela/maca/GO_term_summary_20171110_222852.csv")
# to see what possibilities exist for classOfInterest, the value to split
# observations by, run 
set(adata.obs)
# subset the anndata object to only consider features that exist in the GO mouse TF list
adataTF = adata[:,adata.var_names[adata.var_names.isin(mouse_tfs['Symbol'])]]
# call scRFE with adataTF as your AnnData object, splitting observations
# by cell_ontology_class, or cell type
TFtopFeaturesDF, TFscore = scRFE(adata = adataTF, classOfInterest = 'cell_ontology_class')<jupyter_output><empty_output><jupyter_text>Aging Analysis<jupyter_code>from scRFE.scRFE import scRFE #import the scRFE function from the scRFE .py file from the scRFE directory
from anndata import read_h5ad #to read in Anndata object
import pandas as pd #to read in csv list of TFs
# read in AnnData/.h5ad file 
adata = read_h5ad('/data/madeline/src3/01_figure_1/tabula-muris-senis-droplet-processed-official-annotations.h5ad')
# call scRFE with adata and splitting obs by age
topFeaturesDF, score = scRFE(adata = adata, classOfInterest = 'age')<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup