-
Notifications
You must be signed in to change notification settings - Fork 1
Setup Support Scripts
Matt Ravenhall edited this page Jan 24, 2019
·
1 revision
This is a collection of code snippets to help prep your files for SVPop.
bcftools='/usr/bin/env bcftools'
samples=($(ls *bcf))
for sample in ${samples[@]}; do
# Remove file extension
ID=$(echo ${sample} | cut -d'.' -f1)
# Convert to vcf file
${bcftools} view ${ID}.bcf > ${ID}.vcf
done
samples=($(ls *vcf))
for sample in ${samples[@]}; do
gzip $sample
done
samples=($(ls *vcf.gz))
models=(DEL DUP INS INV)
# Split by model
for sample in ${samples[@]}; do
# Remove file extension
ID=$(echo ${sample} | cut -d'.' -f1)
echo ${ID}
for model in ${models[@]}; do
(zcat ${ID}.vcf.gz | grep '^##' ; zcat ${ID}.vcf.gz | grep 'SVTYPE='${model}) | gzip > ./${model}/${ID}_${model}.vcf.gz
done
done
Assuming your variant files are formatted as <filePrefix>_<model>.vcf.gz, output a ForSVPop_<model>.txt file for each model.
for x in DEL DUP INS INV; do readlink -f *_${x}.vcf.gz > ForSVPop_${x}.txt; done