추출한 TCGA data를 기반으로 분석하기

library(limma)


# 샘플 이름에서 '01A'는 암 (Cancer), '01B'는 정상 (Normal)으로 구분

sample_ids <- colnames(expr_data_filtered)  # 발현 데이터의 샘플 이름

# '01A'와 '01B'를 사용하여 정상/암 샘플 구분
normal_samples <- sample_ids[grepl("11A", sample_ids)]  # '11A'가 포함된 샘플
cancer_samples <- sample_ids[grepl("01A", sample_ids)]  # '01A'가 포함된 샘플

# 정상 샘플과 암 샘플을 사용하여 발현 데이터 분리
expr_data_normal <- expr_data_filtered[, normal_samples]
expr_data_cancer <- expr_data_filtered[, cancer_samples]
 
# 결과 확인
print(dim(expr_data_normal))  # 정상 샘플의 차원
[1] 115  15
print(dim(expr_data_cancer))  # 암 샘플의 차원
[1] 115 465

# 조건 설정: 정상 vs 암 (두 그룹 비교)
group <- factor(c(rep("Normal", length(normal_samples)), rep("Cancer", length(cancer_samples))))

# 데이터 결합
expr_data_combined <- cbind(expr_data_normal, expr_data_cancer)

# 설계 행렬 생성 (두 그룹을 비교)
design <- model.matrix(~ group)

# limma 분석
fit <- lmFit(expr_data_combined, design)
fit <- eBayes(fit)


Ensembl ID gene symbol로 교체하기




댓글

이 블로그의 인기 게시물

#single cell sequencing 기초 분석 - #1 R 설치 및 package 설치

리눅스 기초 #10 GATK calling을 사용하기 위하여, reference file indexing하는 방법

Single cell 분석을 위한 package 소개