Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Doc: Dimension Reduction

kmorrisongr edited this page Feb 17, 2020 · 1 revision

Calculate A Breadth Score

fcdr_breadth_score(fc, to_condense, name=NULL)

  • Replace a subset of features with a single score representing the geometric mean for each subject across those features. Do NOT pass standardized data.
  • @param fc The Fc Array data frame.
  • @param to_condense A vector of strings of features that you want to collapse into a single score.
  • @param name An optional name parameter to specify for the new score feature. Otherwise, the members of to_condense will be presumed to be of a similar class, and the first substring of the first feature (when split by [.]) will be prepended to "_score".
  • @return The Fc Array data frame, with the features provided replaced with a single score.
  • @examples
# pass only the colnames that contain IgG3
fc_new = fcdr_breath_score(fc, colnames(fc)[grepl("IgG3", colnames(fc), fixed=TRUE)])
# contains the new score feature
fc_new[,"IgG3_score"]

Calculate Many Breadth Scores

fcdr_fc_breadth(fc, to_condense)

  • Replace each subset of features with a single score representing the geometric mean for each subject across those features. Do NOT pass standardized data. Does not work with ordering subclasses (IgG1 before IgG2, etc. - see how fcgo_get_prop works).
  • @param fc The Fc Array data frame.
  • @param to_condense A vector of strings of features that you want to collapse into individual scores.
  • @return The Fc Array data frame, with each class of features provided replaced with individual scores. None of the other feature data remains.
  • @examples
# pass only the colnames that contain IgG3
gopts$feat_ant = c("gp120","gp140","V1.V2.","gag","p17,p24,p51,p55,p66")
# contains gp120_score, gp140_score, V1.V2._score, etc.
fc_new = fcdr_breath_score(fc, gopts$feat_ant)

Perform Dimension Reduction

Function for doing multiple kinds of dimension reduction.

fcdr_dimred(fc, method, dims=NULL, perplexity=30, init_pca=TRUE, max_iters=500, theta=0.5, seed=1337, verbose=FALSE)

  • @param fc The Fc Array data frame
  • @param method A string "pca", "tsne", or "umap" the denotes what dimension reduction method will be used.
  • @param dims The number of dimensions to reduce the dataset down to. Pass NULL if you want all components back (PCA), or if you feel like letting tSNE and UMAP yell at you that they picked 2 for you.
  • @param perplexity A parameter for tSNE. It will be adjusted for you if you don't provide it/change it and it needs providing/to be changed.
  • @param init_pca A boolean that determines whether or not tSNE performs an initial pca to perform a first-pass on reducing dimensions.
  • @param max_iters The maximum number of iterations you want tSNE or UMAP to perform before terminating.
  • @param theta Speed/accuracy tradeoff for tSNE. 0.0 is exact tSNE, 1.0 is "just get it done ASAP idfc if it's wildly inaccurate".
  • @param seed The random seed you wish to use to facilitate reproducibility.
  • @param verbose A boolean that determines how much you get yelled at by tSNE and UMAP about how they're doing.
  • @return The Fc Array data frame with all the features replaced by all the components generated by the method you used.
  • @examples
colnames(fc)
# [1] "subject" "group" "IgG3.gp41" "IgG.gp70.V1.V2" # etc.
fc_tsne = fcdr_dimred(fc, "tsne", dims=2)
colnames(fc_tsne)
# [1] "subject" "group" "tsne.1" "tsne.2"

Clone this wiki locally