Hello, 

I took a 10x matrix from a collaborator and created a Seurat object. The issue I am having which I only realised when attempting to visualise my favourite genes, is that the original matrix has gene names in the format of "gene name - ensembl"

example :

    Dcn-ENSMUSG00000019929.16, Inmt-ENSMUSG00000003477.5, Mfap4-ENSMUSG00000042436.12

So I can not search for my genes of interest unless I know what the corresponding ENSMUS following it is. 
Is there I way I can remove at this stage everything after (and including) the "-" so that I am left only with the gene name? 

So convert "Dcn-ENSMUSG00000019929.16" to simply "Dcn".

Thank you :)
Huh, you are quite right that my comment on jomo's answer doesn't work. Too used to `SingleCellExperiment` objects, where that does work. Anyway, there are two workarounds. The annoying one is to extract the counts from assay data and remake the Seurat object:

    # Get counts
    count.data <- GetAssayData(object = pbmc_small[["RNA"]], slot = "counts")
    count.data <- as.matrix(count.data)
     
    # Rename rows
    rownames(count.data) <- unlist(map(strsplit(rownames(count.data),"-ENSMUS",fixed=T),1))
    
    # Generate new Seurat object.
    new.obj <- CreateSeuratObject(
         count.data,
         project = "SeuratProject",
         assay = "RNA",
         min.cells = 0,
         min.features = 0,
         names.field = 1,
         names.delim = "_",
         meta.data = NULL
    )

Obviously not ideal. You'll have to redo the normalization. Other option is to convert to a `SingleCellExperiment` object, rename the rownames as above, then convert back to a Seurat object. This at least retains the normalization and any dimensionality reductions, metadata, clustering, etc.