Skip to content

Commit

Permalink
update header and small edits html output
Browse files Browse the repository at this point in the history
  • Loading branch information
vanbuggenum committed Jul 8, 2021
1 parent 50cfced commit e1a42d1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
18 changes: 15 additions & 3 deletions analysis/MOFAaIg.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ editor_options:
---

```{r setup, warning=FALSE, message=FALSE}

knitr::opts_chunk$set(
message = F, warning = F, echo = T, eval = T
)

source("code/load_packages.R")
seu_combined_selectsamples <- readRDS("output/seu_aIG_samples.rds")
library(ggrepel)
Expand Down Expand Up @@ -48,6 +53,8 @@ meta.allcells <- seu_combined_selectsamples@meta.data %>%

#### MOFA model

Note, if mofa object was generated before, it will read the generated rds file. (this will speed-up the process of generating this html document if edits are required)

```{r Mofa object}
## Note, if mofa object was generated before, it will read the generated rds file. (this will speed-up the process of generating this html document if edits are required)

Expand Down Expand Up @@ -84,9 +91,9 @@ mofa
```

```{r}
## Rename protein names
featurenamesmofa <- features_names(mofa)

## Hack to rename protein names for visualization
featurenamesmofa <- features_names(mofa)

## todo cleanup/more efficient
featurenamesmofa <- rapply(featurenamesmofa,function(x) ifelse(x=="p-Src" ,"p-SRC",x), how = "replace")
Expand All @@ -102,6 +109,12 @@ featurenamesmofa <- rapply(featurenamesmofa,function(x) ifelse(x=="p-Myc" ,"p-MY
featurenamesmofa <- rapply(featurenamesmofa,function(x) ifelse(x=="p-Btk" ,"p-BTK",x), how = "replace")
featurenamesmofa <- rapply(featurenamesmofa,function(x) ifelse(x=="Bcl-6" ,"BCL6",x), how = "replace")

featurenamesmofa <- rapply(featurenamesmofa,function(x) ifelse(x=="CD53-PROT" ,"CD53",x), how = "replace")
featurenamesmofa <- rapply(featurenamesmofa,function(x) ifelse(x=="CD70-PROT" ,"CD70",x), how = "replace")
featurenamesmofa <- rapply(featurenamesmofa,function(x) ifelse(x=="KLF6-PROT" ,"KLF6",x), how = "replace")
featurenamesmofa <- rapply(featurenamesmofa,function(x) ifelse(x=="XBP1-PROT" ,"XBP1",x), how = "replace")


features_names(mofa) <- featurenamesmofa


Expand Down Expand Up @@ -281,7 +294,6 @@ WNN.Dimplot <- DimPlot(seu_combined_selectsamples, reduction = 'wnn.umap', label
```{r}
Factorvalues <- data.frame(get_factors(mofa)[1])[,1:4]
colnames(Factorvalues) <- c(paste0("Factor", 1:4))
Factorvalues
seu_combined_selectsamples <- AddMetaData(seu_combined_selectsamples, Factorvalues)

plot.wnn.Factor1 <- FeaturePlot(seu_combined_selectsamples, reduction = "wnn.umap", features = "Factor1") +
Expand Down
12 changes: 12 additions & 0 deletions analysis/QC.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ seu_combined_filtered <- subset(seu_combined, subset = nFeature_RNA > 150 & nCou

```

```{r}
## Small hack to prevent mofa error with duplicate gene or protein names
double <- c("CD53", "CD70", "KLF6", "XBP1")
PROT.counts <-as.data.frame(seu_combined_filtered[["PROT"]]@counts)
prot.rownames <- rownames(PROT.counts)
row.names(PROT.counts) <- ifelse(prot.rownames %in% double, paste0(prot.rownames, "-PROT"), paste0(prot.rownames))

seu_combined_filtered[["PROT"]] <- CreateAssayObject(counts = PROT.counts)

```


## Normalize and scale


Expand Down

0 comments on commit e1a42d1

Please sign in to comment.