|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Judge the SAMPLE info of vcf file |
|
|
# Judge the SAMPLE info of vcf file |
|
|
tumor_id=`awk -F'\t' '{if($1~"^#CHROM"){print $10}}' ${vcf}` |
|
|
|
|
|
normal_id=`awk -F'\t' '{if($1~"^#CHROM"){print $11}}' ${vcf}` |
|
|
|
|
|
|
|
|
|
|
|
if [ $normal_id ]; then |
|
|
|
|
|
SAMPLE_vcf2maf="--tumor-id $tumor_id --normal-id $normal_id" |
|
|
|
|
|
SAMPLE_vcf2vcf="--vcf-tumor-id $tumor_id --vcf-normal-id $normal_id" |
|
|
|
|
|
|
|
|
sample_col_1=`awk -F'\t' '{if($1~"^#CHROM"){print $10}}' ${vcf}` |
|
|
|
|
|
sample_col_2=`awk -F'\t' '{if($1~"^#CHROM"){print $11}}' ${vcf}` |
|
|
|
|
|
|
|
|
|
|
|
if [ $sample_col_2 ]; then # This situation means there are pairs |
|
|
|
|
|
SAMPLE_vcf2maf="--tumor-id $sample_col_2 --normal-id $sample_col_1" |
|
|
|
|
|
SAMPLE_vcf2vcf="--vcf-tumor-id $sample_col_2 --vcf-normal-id $sample_col_1" |
|
|
cp ${vcf} ${sample_id}.tmp1.vcf |
|
|
cp ${vcf} ${sample_id}.tmp1.vcf |
|
|
else |
|
|
|
|
|
SAMPLE_vcf2maf="--tumor-id $tumor_id" |
|
|
|
|
|
|
|
|
else # Tumor-only or normal-only |
|
|
|
|
|
SAMPLE_vcf2maf="--tumor-id $sample_col_1" |
|
|
# Add a column and remove it after vcf2vcf |
|
|
# Add a column and remove it after vcf2vcf |
|
|
SAMPLE_vcf2vcf="--vcf-tumor-id $tumor_id --vcf-normal-id $tumor_id" |
|
|
|
|
|
|
|
|
SAMPLE_vcf2vcf="--vcf-tumor-id $sample_col_1 --vcf-normal-id $sample_col_1" |
|
|
awk -F'\t' 'OFS="\t" {if($1!~"^##" && length($11)==0) $11=$10; print $0}' ${vcf} > ${sample_id}.tmp1.vcf |
|
|
awk -F'\t' 'OFS="\t" {if($1!~"^##" && length($11)==0) $11=$10; print $0}' ${vcf} > ${sample_id}.tmp1.vcf |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$SAMPLE_vcf2vcf \ |
|
|
$SAMPLE_vcf2vcf \ |
|
|
--ref-fasta ${ref_dir}/${fasta} |
|
|
--ref-fasta ${ref_dir}/${fasta} |
|
|
|
|
|
|
|
|
if [ $normal_id ]; then |
|
|
|
|
|
|
|
|
if [ $sample_col_2 ]; then |
|
|
cp ${sample_id}.tmp2.vcf ${basename}.norm.vcf |
|
|
cp ${sample_id}.tmp2.vcf ${basename}.norm.vcf |
|
|
else |
|
|
else |
|
|
cut -f 1,2,3,4,5,6,7,8,9,10 ${sample_id}.tmp2.vcf > ${basename}.norm.vcf |
|
|
cut -f 1,2,3,4,5,6,7,8,9,10 ${sample_id}.tmp2.vcf > ${basename}.norm.vcf |