This repository has been archived by the owner on Sep 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path1_prep_tissue_expr.R
57 lines (42 loc) · 1.7 KB
/
1_prep_tissue_expr.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# This script is to prepare four expressio tables for four tissues
# including: sam, leaf, root and seed.
# File in: 1. Gene expression matrix (raw count) for 1266 libraries.
# 2. A table indicating libraris from which tissue.
# File out: 1. Four matrix for each tissues gene expression.
# (expr_leaf, expr_root, expr_sam, expr_seed)
###############################################################################
# load libraries
setwd("~/projects/NTWK/tissue_ntwk/data/")
library(tidyverse)
# read the originial expression table
expr_all <- read_tsv(file = "ALL_FC_noDuplicateLib_biggerThan5Million_70allignmentRate_1266.txt",
col_names = T)
tissue_lib <- read_tsv(file = "Four_tissue_specific_libraries_correct_seed.txt",col_names = T)
head(expr_all)
head(tissue_lib)
# get gene names. remove unecessary columns.
gene_name_all <- unname(expr_all$Geneid)
expr_all <- expr_all[,-c(2:6)]
# get the library name for each tissue
tissue_sam <- tissue_lib$sam %>%
na.omit %>%
as.vector()
tissue_leaf <- tissue_lib$leaf %>%
na.omit %>%
as.vector()
tissue_root <- tissue_lib$root %>%
na.omit %>%
as.vector()
tissue_seed <- tissue_lib$seed %>%
na.omit %>%
as.vector()
# generate tissue specific expression table. These will be used by next script.
expr_sam <- select(expr_all, one_of(tissue_sam))
expr_leaf <- select(expr_all, one_of(tissue_leaf))
expr_root <- select(expr_all, one_of(tissue_root))
expr_seed <- select(expr_all, one_of(tissue_seed))
# remove all files except tissue expression matrix and gene name.
# expr_leaf, expr_root, expr_sam, expr_seed and
# gene_name_all were kept.
rm(expr_all,tissue_lib,tissue_leaf, tissue_root,
tissue_sam, tissue_seed)