Skip to content

Instantly share code, notes, and snippets.

@AmyOlex
Last active September 16, 2024 20:03
Show Gist options
  • Save AmyOlex/996230ad0b853a1ec631f008b6b1e520 to your computer and use it in GitHub Desktop.
Save AmyOlex/996230ad0b853a1ec631f008b6b1e520 to your computer and use it in GitHub Desktop.

Revisions

  1. AmyOlex revised this gist Feb 2, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions PAM50 Classification Using genefu() R Package
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,7 @@ tpm <- tpm[,as.character(annot$preferred.sample.name)]
    stopifnot(all(as.character(annot$preferred.sample.name) == names(tpm)))

    ## transpose the gene expression matrix
    ## Rows are now samples, and columns are genes with the Official Gene Symbol as the column name
    tpm_t <- t(tpm)
    colnames(tpm_t) <- gene_annot$Gene.Symbol

  2. AmyOlex renamed this gist Jan 25, 2018. 1 changed file with 0 additions and 0 deletions.
  3. AmyOlex renamed this gist Jan 25, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. AmyOlex created this gist Jan 25, 2018.
    32 changes: 32 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    ## Amy Olex
    ## PAM50 Classification of PDX samples.

    library(genefu)

    setwd("~/my/working/folder")

    ## import expression data
    tpm <- read.delim("Gene_Expression_Data_TPMvalues.txt")

    ## import sample annotations
    annot <- read.delim("Sample_Annotations.txt")

    gene_annot <- tpm[,c("gene_id","symbol")]
    names(gene_annot) <- c("Ensemble.ID","Gene.Symbol")

    ## Reorder so gene matrix and annotations are in same order
    tpm_filtered <- tpm[,as.character(annot_filtered$preferred.sample.name)]
    stopifnot(all(as.character(annot_filtered$preferred.sample.name) == names(tpm_filtered)))

    tpm <- tpm[,as.character(annot$preferred.sample.name)]
    stopifnot(all(as.character(annot$preferred.sample.name) == names(tpm)))

    ## transpose the gene expression matrix
    tpm_t <- t(tpm)
    colnames(tpm_t) <- gene_annot$Gene.Symbol

    ## run PAM50 classification
    pam50_predictions_all <- molecular.subtyping(sbt.model = "pam50", data = tpm_t, annot = gene_annot, do.mapping = FALSE)

    pam50_predictions_all$subtype.crisp
    pam50_predictions_all$subtype.proba