Hi!
I have a csv file with a list of genes that are DE.
I want to pass list of DE genes to celltypist for it to take only those genes in consideration when annotating:
celltypist.annotate(self.query, gene_file=xxxx, model = 'Developing_Human_Brain.pkl', majority_voting = True)
According to the documentation annotate method works in the following way:
def annotate(filename: Union[AnnData,str] = "",
model: Optional[Union[str, Model]] = None,
transpose_input: bool = False,
gene_file: Optional[str] = None,
cell_file: Optional[str] = None,
mode: str = 'best match',
p_thres: float = 0.5,
majority_voting: bool = False,
over_clustering: Optional[Union[str, list, tuple, np.ndarray, pd.Series, pd.Index]] = None,
use_GPU: bool = False,
min_prop: float = 0) -> classifier.AnnotationResult:
gene_file argument is described in the following way:
gene_file
Path to the file which stores each gene per line corresponding to the genes used in the provided mtx file.
Ignored if `filename` is not provided in the mtx format.
I have a csv with a column that represents this gene file, how can I generate this mtx file that should be passed as argument to annotate?
I have tried converting the list of genes to an .mtx with one gene per line comma separated, as inside the classifier methos method within the annotator this is read in the following way:
if self.filename.endswith(('.mtx', '.mtx.gz')):
if (gene_file is None) or (cell_file is None):
raise FileNotFoundError(
"Missing `gene_file` and/or `cell_file`. Please provide both arguments together with the input mtx file")
genes_mtx = pd.read_csv(gene_file, header=None)[0].values
But the UMAP before and after remains the same meaning that the fileis being ignored or not read...
Best Regards,
Manuel