-
Notifications
You must be signed in to change notification settings - Fork 2
/
subset_cortical_labels.R
43 lines (36 loc) · 1.42 KB
/
subset_cortical_labels.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#Packages
suppressPackageStartupMessages(library(tidyverse))
#Output directory
outdir='data/isocortex/'
#Create outdir if needed
if (!dir.exists(outdir)) {
dir.create(outdir, recursive = TRUE, showWarnings = FALSE)
}
#Input and output mouse files
infile <- 'data/MouseExpressionMatrix_voxel_coronal_maskcoronal_log2_grouped_imputed_labelled.csv'
outfile <- file.path(outdir, basename(infile))
#Filter mouse input matrix for isocortical labels and write out
data.table::fread(infile, header = TRUE) %>%
as_tibble() %>%
filter(Region11 == 'Isocortex') %>%
data.table::fwrite(outfile)
#Input and output human files
infile <- 'data/HumanExpressionMatrix_samples_pipeline_abagen_labelled.csv'
outfile <- file.path(outdir, basename(infile))
#Filter human input matrix for cortical labels and write out
data.table::fread(infile, header = TRUE) %>%
as_tibble() %>%
filter(Region16 %in% c("limbic lobe",
"frontal lobe",
"insula",
"occipital lobe",
"parietal lobe",
"temporal lobe")) %>%
filter(!(Region88 %in% c("claustrum",
"dentate gyrus",
"CA1 field",
"CA2 field",
"CA3 field",
"CA4 field",
"subiculum"))) %>%
data.table::fwrite(outfile)