首页 > 解决方案 > 如何将我的基本文件列表与其对应的匹配“表型”文件匹配

问题描述

我正在尝试运行一个脚本,该脚本将包含遗传数据的 99 个基本文件列表与其相应的 99 个表型文件相匹配。每个基本文件都有 1 个匹配项,我只想将 1 个基本文件运行到其对应的完全匹配项。我对编程很陌生,这个任务可能看起来很简单,但我很难做到。截至目前,我采取了“穴居人”的方法。我已将包含所有表型文件的表解构为 99 个以表型命名的单独文件。然后我创建了一个包含 2 列的列表,第 1 列包含与具有表型文件名称的列匹配的所有基本文件的名称。这可行,但我想改进脚本并使其更高效,我们将不胜感激。

这是一个 Bash 脚本

#SBATCH -N 1
#SBATCH -t 01:59:00

在这里我加载适当的模块

module load 2020
module load R/3.3.1-intel-2016b

在这里我设置我的变量并确保我的程序可以访问它需要的文件

cd /nfs/home3/vanderes/Donders/Desikan_Killian/ 

file_name=$1 
pheno_name=$2

PRSICEPATH=/home/vanderes/R/PRSice.R 
 
GENTYPE=/home/vanderes/Donders/Emma2Yingjie/adh_amd1_eur_es-postpc2.hg19.ch.fl.bgn

COVS=/home/vanderes/Donders/Emma2Yingjie/Mcovall_4prsice.txt  

PRSICE_linux=/home/vanderes/R/PRSice_linux 

在这里,我进行了一个 while 循环,以将我的文件名列表提供给程序

while read file_name pheno_name 
do 
#pheno-col does not work, maybe i have to make seperate phenotype files after all fuck. 
Rscript $PRSICEPATH  --dir . --prsice $PRSICE_linux  --no-default \
 --base ${file_name}  --stat 5 --beta  --A1 3 --A2 4 --chr 0 --snp 1 --bp 2 --pvalue 8 --index \
 --target $GENTYPE  --pheno-file ${pheno_name} --ignore-fid  --cov-file $COVS --cov-factor Batch Site Sex \
  --missing SET_ZERO --bar-levels 0.0000005,0.0000005,0.000005,0.00005,0.0005,0.001,0.01,0.05,0.1,0.2,0.5,1 \
  --missing SET_ZERO  --thread 1 --quantile 100 --quant-break 1,5,10,20,40,60,80,90,95,99,100 --quant-ref 60 --out ${pheno_name}   

done < file_list.txt 

标签: rlinuxbashwhile-loop

解决方案


推荐阅读