Skip to content

Commit

Permalink
added mdscore
Browse files Browse the repository at this point in the history
  • Loading branch information
zlskidmore committed Sep 6, 2019
1 parent 0648e29 commit 20409ee
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ RUN make install
# install R packages
RUN R --vanilla -e 'install.packages(c("devtools", "BiocManager"), repos="http://cran.us.r-project.org")'
RUN R --vanilla -e 'BiocManager::install(c("biomaRt", "copynumber", "GenVisR", "fgsea", "deseq2", "EBSeq", "BSgenome.Hsapiens.UCSC.hg19", "BSgenome.Hsapiens.UCSC.hg38", "TxDb.Hsapiens.UCSC.hg19.knownGene", "TxDb.Hsapiens.UCSC.hg38.knownGene", "org.Hs.eg.db", "NanoStringDiff"))'
RUN R --vanilla -e 'install.packages(c("ggplot2", "data.table", "sequenza", "dplyr", "reshape2", "tidyr", "viridis", "cowplot", "ggalluvial", "msigdbr", "ggdendro", "gridExtra", "deconstructSigs", "tidyverse", "splitstackshape"), repos = "http://cran.us.r-project.org")'
RUN R --vanilla -e 'install.packages(c("mdscore", "ggplot2", "data.table", "sequenza", "dplyr", "reshape2", "tidyr", "viridis", "cowplot", "ggalluvial", "msigdbr", "ggdendro", "gridExtra", "deconstructSigs", "tidyverse", "splitstackshape"), repos = "http://cran.us.r-project.org")'

# copy any one-off R scripts over
RUN mkdir -p /opt/scripts/R
COPY scripts/optitype2imgt.R /opt/scripts/R
45 changes: 45 additions & 0 deletions scripts/optitype2imgt.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
################################################################################
########### load in libraries and data #########################################

# pass command line args
args <- commandArgs(trailingOnly=TRUE)

# hla predictions from optitype
optitypeHLA <- read.delim(args[1])

# imgt mapping between hla annotations and imgt ids
alleleList <- read.csv(args[2], comment.char = "#")

################################################################################
############ convert HLA predictions to standard format ########################

# grab just the HLA predictions
keep <- c("A1", "A2", "B1", "B2", "C1", "C2")
optitypeHLA <- as.character(t(optitypeHLA[,keep]))

# make them consistent with IMGT allele list
#optitypeHLA <- paste0("HLA-", optitypeHLA)

################################################################################
############ Grab the imgt HLA identifier for these ############################

optitype2imgt <- function(x, y){
# find the imgt entries which corresond to the input
y <- y[grepl(x, y$Allele, fixed=TRUE),"AlleleID"]
y <- as.character(y[1])
return(y)
}

result <- unlist(lapply(optitypeHLA, optitype2imgt, alleleList))

# make sure its unique
result <- unique(result)

################################################################################
########### format and return the results ######################################

# collapse and return
result <- paste0(result, collapse=",")
write(result, "")


0 comments on commit 20409ee

Please sign in to comment.