Made snippet input- and output files more harmonised.

This commit is contained in:
Hylke C. Donker
2021-02-22 13:18:18 +01:00
parent 981a983dd5
commit 8a09d00a51
5 changed files with 60 additions and 34 deletions

View File

@ -18,7 +18,7 @@ do.scale = FALSE
# The analysis
# We ise prcomp to calculate the PCAs. Afterwards you should plot the results.
# We use prcomp to calculate the PCAs. Afterwards you should plot the results.
norm.expr.data <- expression.data %>%
tibble::column_to_rownames("Gene")
norm.expr.data <- norm.expr.data[rowSums(norm.expr.data) >= 10,] %>%
@ -37,8 +37,8 @@ norm.expr.data.pcs <- norm.expr.data %>%
)
# Write summary of PCAs to files
pcs.summery <- summary(norm.expr.data.pcs)
pcs.summery$importance %>%
pcs.summary <- summary(norm.expr.data.pcs)
pcs.summary$importance %>%
t() %>%
as.data.frame() %>%
tibble::rownames_to_column("PC.name") %>%
@ -46,7 +46,7 @@ pcs.summery$importance %>%
file.path(results.dir.pca, "importance.csv")
)
pcs.summery$x %>%
pcs.summary$x %>%
t() %>%
as.data.frame() %>%
tibble::rownames_to_column("ensembl.id") %>%
@ -54,7 +54,7 @@ pcs.summery$x %>%
file.path(results.dir.pca, "values.csv")
)
pcs.summery$rotation %>%
pcs.summary$rotation %>%
t() %>%
as.data.frame() %>%
tibble::rownames_to_column("sample.id") %>%
@ -63,15 +63,15 @@ pcs.summery$rotation %>%
)
data.frame(
rownames = names(pcs.summery$center),
center = pcs.summery$center,
scale = pcs.summery$scale
rownames = names(pcs.summary$center),
center = pcs.summary$center,
scale = pcs.summary$scale
) %>%
readr::write_csv(
file.path(results.dir.pca, "rest.csv")
)
# Not saved: pcs.summery$sdev,
# Not saved: pcs.summary$sdev,
# Next thing to do: