小编Ang*_*gel的帖子

将 bash 脚本一起更改为所有文件

我有一个 bash 脚本从 .vcf 文件中提取一些信息。我如何以某种方式更改此脚本以同时处理一堆 .vcf 文件,并为每个文件返回单独的 .txt 输出?

这是我的脚本

#!/usr/bash

#outfilename
outname=$(echo $1".parsed.txt")

#Header for output file
echo -e "Chrom"'\t'"Position"'\t'"Ref"'\t'"Alt"'\t'"TumorReadCount"'\t'"TumorVariantAlleleCount"'\t'"TumorReferenceAlleleCount"'\t'"NormalReadCount"'\t'"NormalVariantAlleleCount"'\t'"NormalReferenceAlleleCount"'\t'"VAF" > $outname

while read -r line ; 
do;

#Basic information
chrom=$(echo $line | sed 's/ /\t/g' | cut -f 1) #&& echo $chrom;
Pos=$(echo $line | sed 's/ /\t/g' |  cut -f 2) #&& echo $Pos;
Ref=$(echo $line | sed 's/ /\t/g' | cut -f 4)
Alt=$(echo $line | sed 's/ /\t/g' | cut -f 5)

#Tumor sample read, …
Run Code Online (Sandbox Code Playgroud)

bash scripts

2
推荐指数
1
解决办法
136
查看次数

标签 统计

bash ×1

scripts ×1