Calculate log fold change and percentage of cells expressing each feature for different identity classes.

FoldChange(object, ...)

# S3 method for default
FoldChange(object, cells.1, cells.2, mean.fxn, fc.name, features = NULL, ...)

# S3 method for Assay
FoldChange(
  object,
  cells.1,
  cells.2,
  features = NULL,
  slot = "data",
  pseudocount.use = 1,
  fc.name = NULL,
  mean.fxn = NULL,
  base = 2,
  ...
)

# S3 method for DimReduc
FoldChange(
  object,
  cells.1,
  cells.2,
  features = NULL,
  slot = NULL,
  pseudocount.use = NULL,
  fc.name = NULL,
  mean.fxn = NULL,
  ...
)

# S3 method for Seurat
FoldChange(
  object,
  ident.1 = NULL,
  ident.2 = NULL,
  group.by = NULL,
  subset.ident = NULL,
  assay = NULL,
  slot = "data",
  reduction = NULL,
  features = NULL,
  pseudocount.use = 1,
  mean.fxn = NULL,
  base = 2,
  fc.name = NULL,
  ...
)

Arguments

object

A Seurat object

...

Arguments passed to other methods

cells.1

Vector of cell names belonging to group 1

cells.2

Vector of cell names belonging to group 2

mean.fxn

Function to use for fold change or average difference calculation

fc.name

Name of the fold change, average difference, or custom function column in the output data.frame

features

Features to calculate fold change for. If NULL, use all features

slot

Slot to pull data from

pseudocount.use

Pseudocount to add to averaged expression values when calculating logFC. 1 by default.

base

The base with respect to which logarithms are computed.

ident.1

Identity class to calculate fold change for; pass an object of class phylo or 'clustertree' to calculate fold change for a node in a cluster tree; passing 'clustertree' requires BuildClusterTree to have been run

ident.2

A second identity class for comparison; if NULL, use all other cells for comparison; if an object of class phylo or 'clustertree' is passed to ident.1, must pass a node to calculate fold change for

group.by

Regroup cells into a different identity class prior to calculating fold change (see example in FindMarkers)

subset.ident

Subset a particular identity class prior to regrouping. Only relevant if group.by is set (see example in FindMarkers)

assay

Assay to use in fold change calculation

reduction

Reduction to use - will calculate average difference on cell embeddings

Value

Returns a data.frame

Details

If the slot is scale.data or a reduction is specified, average difference is returned instead of log fold change and the column is named "avg_diff". Otherwise, log2 fold change is returned with column named "avg_log2_FC".

See also

FindMarkers

Examples

data("pbmc_small") FoldChange(pbmc_small, ident.1 = 1)
#> avg_log2FC pct.1 pct.2 #> MS4A1 -4.28919107 0.08 0.182 #> CD79B -1.70880277 0.28 0.291 #> CD79A -2.57718101 0.16 0.164 #> HLA-DRA -0.06416269 0.92 0.582 #> TCL1A -3.48809407 0.04 0.127 #> HLA-DQB1 -0.42133510 0.56 0.291 #> HVCN1 -2.03467354 0.16 0.127 #> HLA-DMB -0.38069057 0.48 0.236 #> LTB -3.59542410 0.56 0.582 #> LINC00926 -3.54710578 0.00 0.091 #> FCER2 -3.24498901 0.00 0.091 #> SP100 -2.12617019 0.16 0.291 #> NCF1 -1.00830804 0.20 0.091 #> PPP3CC -4.18178053 0.00 0.145 #> EAF2 -2.08790713 0.12 0.109 #> PPAPDC1B -2.69758838 0.04 0.073 #> CD19 -3.63990351 0.00 0.073 #> KIAA0125 -3.34190698 0.00 0.073 #> CYB561A3 -3.39568220 0.00 0.073 #> CD180 -3.18194660 0.00 0.073 #> RP11-693J15.5 -2.63616954 0.04 0.073 #> FAM96A -1.90046616 0.20 0.145 #> CXCR4 -2.75033862 0.36 0.491 #> STX10 -1.90159882 0.16 0.182 #> SNHG7 -2.45576665 0.12 0.236 #> NT5C -2.51061237 0.12 0.236 #> BANK1 -2.51048406 0.04 0.109 #> IGLL5 -5.95213976 0.00 0.055 #> CD200 -3.14476673 0.00 0.055 #> FCRLA -1.78238605 0.04 0.073 #> CD3D -6.28552921 0.04 0.400 #> NOSIP -2.35379099 0.32 0.345 #> SAFB2 -3.56403302 0.00 0.091 #> CD2 -4.36314214 0.04 0.200 #> IL7R -3.37504451 0.20 0.400 #> PIK3IP1 -3.74363704 0.08 0.182 #> MPHOSPH6 -2.51947696 0.08 0.145 #> KHDRBS1 -3.35125949 0.16 0.182 #> MAL -2.50097557 0.04 0.091 #> CCR7 -4.50140931 0.00 0.109 #> THYN1 -3.07838881 0.08 0.182 #> TAF7 -1.89394803 0.28 0.255 #> LDHB -2.17766061 0.48 0.491 #> TMEM123 -2.05943608 0.36 0.400 #> CCDC104 -3.38712683 0.00 0.091 #> EPC1 -2.98272363 0.04 0.218 #> EIF4A2 -2.48226003 0.44 0.545 #> CD3E -4.99698444 0.04 0.436 #> TMUB1 -1.26142556 0.16 0.091 #> BLOC1S4 -1.75732736 0.16 0.109 #> ACSM3 -3.15808647 0.00 0.055 #> TMEM204 -2.98929107 0.00 0.055 #> SRSF7 -1.86722520 0.48 0.491 #> ACAP1 -5.00927488 0.00 0.236 #> TNFAIP8 -2.29293103 0.24 0.291 #> CD7 -6.05289686 0.00 0.418 #> TAGAP -1.92935984 0.20 0.145 #> DNAJB1 -1.63959481 0.32 0.218 #> ASNSD1 -2.17916833 0.04 0.091 #> S1PR4 -3.17737479 0.20 0.255 #> CTSW -5.22040295 0.04 0.418 #> GZMK -4.60753759 0.00 0.145 #> NKG7 -4.20694002 0.40 0.455 #> IL32 -4.85607900 0.12 0.382 #> DNAJC2 -1.83236679 0.16 0.164 #> LYAR -3.87939257 0.16 0.309 #> CST7 -4.84188441 0.08 0.418 #> LCK -4.84733531 0.04 0.400 #> CCL5 -4.79782729 0.28 0.527 #> HNRNPH1 -3.77326957 0.00 0.182 #> SSR2 -1.52399049 0.52 0.527 #> DLGAP1-AS1 -2.61792002 0.00 0.073 #> GIMAP1 -1.88807517 0.36 0.327 #> MMADHC -1.88583869 0.16 0.255 #> ZNF76 -1.66272094 0.04 0.073 #> CD8A -4.33712385 0.00 0.127 #> PTPN22 -2.22991122 0.04 0.091 #> GYPC -4.76041482 0.04 0.364 #> HNRNPF -2.44485999 0.32 0.436 #> RPL7L1 -1.73137345 0.16 0.145 #> KLRG1 -4.63263689 0.00 0.164 #> CRBN -2.37128107 0.08 0.327 #> SATB1 -4.99043038 0.00 0.109 #> SIT1 -3.88679168 0.00 0.091 #> PMPCB -2.01094637 0.08 0.145 #> NRBP1 -2.81269137 0.04 0.164 #> TCF7 -3.71991390 0.04 0.200 #> HNRNPA3 -1.56241035 0.28 0.400 #> S100A8 6.24424946 0.96 0.091 #> S100A9 5.43107170 0.88 0.164 #> LYZ 3.03509465 1.00 0.473 #> CD14 4.26286201 0.52 0.018 #> FCN1 2.15323842 0.88 0.182 #> TYROBP 2.10808004 1.00 0.382 #> ASGR1 3.34948706 0.32 0.018 #> NFKBIA 1.14395404 0.88 0.382 #> TYMP 3.18984368 1.00 0.164 #> CTSS 1.77230271 0.96 0.436 #> TSPO 2.09672237 0.88 0.364 #> RBP7 2.45227523 0.28 0.018 #> CTSB 2.88012565 0.68 0.109 #> LGALS1 1.73555808 1.00 0.455 #> FPR1 3.87429237 0.48 0.018 #> VSTM1 2.77886267 0.24 0.018 #> BLVRA 1.46653682 0.56 0.145 #> MPEG1 1.97037751 0.40 0.073 #> BID 2.64099830 0.72 0.127 #> SMCO4 3.06632072 0.52 0.018 #> CFD 2.96449029 0.64 0.091 #> LINC00936 1.67113693 0.60 0.145 #> LGALS2 2.90506643 0.60 0.109 #> MS4A6A 2.94090176 0.52 0.055 #> FCGRT 2.99879333 0.84 0.109 #> LGALS3 2.67588930 0.72 0.109 #> NUP214 2.68345820 0.48 0.036 #> SCO2 2.39906489 0.32 0.055 #> IL17RA 3.33704348 0.20 0.000 #> IFI6 1.94968148 0.72 0.164 #> HLA-DPA1 0.85136966 0.84 0.382 #> FCER1A 1.46567639 0.24 0.073 #> CLEC10A 2.86183813 0.28 0.055 #> HLA-DMA 0.88529349 0.56 0.200 #> RGS1 0.63239779 0.20 0.073 #> HLA-DPB1 0.20655435 0.88 0.382 #> HLA-DQA1 0.16656202 0.52 0.236 #> RNF130 2.99564372 0.56 0.091 #> HLA-DRB5 0.55316386 0.76 0.309 #> HLA-DRB1 0.31113282 0.88 0.345 #> CST3 2.36781206 1.00 0.327 #> IL1B 4.17165139 0.48 0.055 #> POP7 2.70898964 0.28 0.091 #> HLA-DQA2 0.11517137 0.28 0.164 #> CD1C 1.35589999 0.08 0.055 #> GSTP1 1.38335588 0.88 0.364 #> EIF3G -0.38719262 0.68 0.436 #> VPS28 0.99524929 0.60 0.273 #> LY86 -0.96509892 0.28 0.200 #> ZFP36L1 0.23478287 0.20 0.145 #> ZNF330 3.06106708 0.08 0.055 #> ANXA2 0.67494288 0.84 0.400 #> GRN 2.24739490 0.76 0.127 #> CFP 2.20733104 0.68 0.145 #> HSP90AA1 -2.12146559 0.48 0.473 #> FUOM 0.40038903 0.08 0.055 #> LST1 2.62062672 0.96 0.200 #> AIF1 2.44437601 1.00 0.273 #> PSAP 1.31149957 1.00 0.436 #> YWHAB 0.81609082 0.64 0.473 #> MYO1G 1.13664553 0.52 0.309 #> SAT1 1.65146815 1.00 0.582 #> RGS2 0.35672093 0.68 0.200 #> SERPINA1 3.06207426 0.72 0.109 #> IFITM3 2.72918017 0.80 0.109 #> FCGR3A 0.92216062 0.48 0.291 #> LILRA3 0.46153127 0.24 0.036 #> S100A11 1.95776781 1.00 0.364 #> FCER1G 1.84742419 1.00 0.364 #> TNFRSF1B 1.37628505 0.36 0.109 #> IFITM2 0.03541657 0.84 0.745 #> WARS 0.89232783 0.44 0.091 #> IFI30 2.35703293 0.64 0.091 #> MS4A7 1.30919797 0.28 0.109 #> C5AR1 2.63314348 0.44 0.018 #> HCK 2.72495368 0.56 0.055 #> COTL1 1.54418101 0.96 0.545 #> LGALS9 1.67911557 0.40 0.109 #> CD68 2.08288103 0.52 0.145 #> RP11-290F20.3 1.78533079 0.28 0.055 #> RHOC 0.62948696 0.40 0.309 #> CARD16 1.50218605 0.72 0.182 #> LRRC25 1.38573660 0.44 0.091 #> COPS6 1.23573624 0.36 0.182 #> ADAR 1.25569155 0.36 0.127 #> PPBP -4.93016961 0.08 0.200 #> GPX1 -0.23355576 0.92 0.545 #> TPM4 -1.75816225 0.28 0.382 #> PF4 -6.99236888 0.00 0.182 #> SDPR -3.91627465 0.04 0.182 #> NRGN -1.33759142 0.16 0.182 #> SPARC -2.49813129 0.08 0.164 #> GNG11 -4.77592968 0.04 0.164 #> CLU -3.84344732 0.04 0.164 #> HIST1H2AC -3.91617333 0.04 0.182 #> NCOA4 -2.60591013 0.16 0.255 #> GP9 -4.95521690 0.00 0.164 #> FERMT3 -1.64963946 0.32 0.255 #> ODC1 -2.40661977 0.16 0.218 #> CD9 -3.13309249 0.04 0.164 #> RUFY1 -3.41752829 0.04 0.200 #> TUBB1 -5.66064604 0.00 0.164 #> TALDO1 -0.34792859 0.84 0.345 #> TREML1 -2.51960858 0.04 0.127 #> NGFRAP1 -4.38847635 0.00 0.164 #> PGRMC1 -4.12690545 0.00 0.145 #> CA2 -3.87018980 0.04 0.145 #> ITGA2B -3.27851372 0.04 0.145 #> MYL9 -2.85570180 0.04 0.109 #> TMEM40 -3.74981561 0.00 0.127 #> PARVB -1.91458235 0.12 0.109 #> PTCRA -4.26849783 0.00 0.109 #> ACRBP -2.79452458 0.04 0.109 #> TSC22D1 -2.74633184 0.04 0.073 #> VDAC3 -3.93120825 0.16 0.273 #> GZMB -4.44525698 0.12 0.236 #> GZMA -5.48075935 0.04 0.327 #> GNLY -6.80388397 0.04 0.327 #> FGFBP2 -3.63582002 0.08 0.309 #> AKR1C3 -4.33377513 0.00 0.145 #> CCL4 -3.34203201 0.04 0.182 #> PRF1 -5.55481022 0.04 0.327 #> GZMH -5.72224717 0.00 0.182 #> XBP1 -3.10514361 0.12 0.364 #> GZMM -5.51584466 0.00 0.345 #> PTGDR -5.23708321 0.00 0.145 #> IGFBP7 -0.80806483 0.32 0.164 #> TTC38 -2.39371634 0.04 0.145 #> KLRD1 -2.73340441 0.04 0.182 #> ARHGDIA -0.82480839 0.44 0.309 #> IL2RB -3.61031123 0.00 0.145 #> CLIC3 -2.99027133 0.04 0.127 #> PPP1R18 -2.37828341 0.16 0.364 #> CD247 -3.78769595 0.04 0.291 #> ALOX5AP -2.82699414 0.16 0.345 #> XCL2 -3.60936133 0.00 0.127 #> C12orf75 -3.69536396 0.04 0.200 #> RARRES3 -3.50476187 0.20 0.455 #> PCMT1 -1.89293611 0.36 0.182 #> LAMP1 -3.75123871 0.08 0.309 #> SPON2 -3.19346179 0.12 0.236 #> S100B -3.85144719 0.00 0.055