1

Does anyone what the ^ symbol means in R?

Here is the context:

mito.genes <- grep("^MT-", rownames(pbmc@data), value = T)

This command is used to extract only the mitochondrial genes from a large list of genes. This came from the Seurat tutorial which can be found here: https://raw.githubusercontent.com/satijalab/satijalab.github.io/master/seurat/pbmc-tutorial.Rmd

These mitochondrial genes all share the prefix "MT-" Example genes are MT-ND1, MT-ND2

I am trying to improve my understanding so i can adapt this command to extract other sets of genes by the characters in their names.

Thanks for your help

zx8754
  • 46,390
  • 10
  • 104
  • 180
Paul
  • 624
  • 1
  • 4
  • 19

1 Answers1

0

It is a regex meaning it start with MT. so basically whenever you have "^MT-" it means looking for anything which start with MT-

Daniel
  • 1,172
  • 2
  • 15
  • 24