-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAF_File_Processing_Strelka2.R
35 lines (23 loc) · 1.1 KB
/
MAF_File_Processing_Strelka2.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
# Set-up environment
rm(list = ls())
# Set working directiry
# Load required Packages
required.packages = c("stringr", "ggplot2")
ipak(required.packages)
# Load data
merged_txt = read.csv("./insert file path/strelka2_all_samples.maf", sep = "\t") # read maf file called "strelka2_all_samples.maf"
head.txt = read.table("./insert file path/header_strelka2_all_samples.txt", sep = "\t", stringsAsFactors = FALSE) # read header file called "header_strelka2_all_samples.txt"
# Set colnames
colnames(merged_txt) = head.txt[1,]
MAF_df = merged_txt
# Add sample_ID and Patient ID columns
MAF_df$Sample_ID = gsub("WES_COAD_LUMC_SIDRA_", "", MAF_df$Tumor_Sample_Barcode) # Example
MAF_df$Sample_ID = gsub("_sorted", "", MAF_df$Sample_ID)
MAF_df$Patient_ID = gsub("T", "", MAF_df$Sample_ID)
MAF_df$Sample_ID = paste(MAF_df$Patient_ID, MAF_df$Tissue, sep = "")
# Add tissue column
MAF_df$Tissue = str_sub(MAF_df$Sample_ID,-1,-1)
strelka2_MAF_df = MAF_df
# Save as R data file
dir.create("./Processed_Data/WES/MAF", showWarnings = FALSE)
save(strelka2_MAF_df, file = "./Processed_Data/WES/MAF/MAF_strelka2_all_version.Rdata")