1. 进入虚拟环境并安装sequenza
scarHRD需要sequenza的结果文件运行
conda activate sequenza
R
library(devtools)
install_github('sztup/scarHRD',build_vignettes = TRUE)
install_github('aroneklund/copynumber')
2. 构建按样本运行scarHRD的R脚本
EXAMPLE_scarHRD.R
library(copynumber)
library(sequenza)
library(scarHRD)
scar_score("/data02/zhangmengmeng/BPT/LCM-WES/sequenza/EXAMPLE.small.seqz.gz",reference = "grch38", seqz=TRUE)
运行scarHRD :
RunScarHRD.sh
#!/bin/bash
# Directory containing the .seqz.gz files
input_dir="../sequenza"
# Loop through each .seqz.gz file in the directory
for file in $input_dir/*small.seqz.gz; do
# Extract the base name without path and extension
sample_name=$(basename "$file" .small.seqz.gz)
# Create the necessary commands and run them
cp ./EXAMPLE_scarHRD.R $sample_name.R
sed -i "s/EXAMPLE/$sample_name/" $sample_name.R
Rscript $sample_name.R
echo "$sample_name scarHRD ok"
done
合并结果文件
awk 'FNR==1 && NR!=1 {next} {print}' *.small.seqz._HRDresults.txt > All_HRDresults.txt