Skip to content

Instantly share code, notes, and snippets.

@davidaknowles
Created June 17, 2022 17:28
Show Gist options
  • Save davidaknowles/2542292782b77dda9b2f6920a9c9a9a3 to your computer and use it in GitHub Desktop.
Save davidaknowles/2542292782b77dda9b2f6920a9c9a9a3 to your computer and use it in GitHub Desktop.
Make a dummy vcf with all SNPs being heterozygous for one individual. SOME_SAMPLE needs to be set to one of the sample names in the input.vcf.
#!/bin/bash
bcftools view -H input.vcf.gz | \
awk '{print $1 "\t" $2 "\t" $3 "\t" $4 "\t" $5 "\t" $6 "\t" $7 "\t" $8 "\t" $9 "\t" "0/1"}' | \
cat <(bcftools view -h -s SOME_SAMPLE input.vcf.gz) - | \
bgzip > \
output.vcf.gz
bcftools view -H output.vcf.gz | awk '{ print $1 "\t" $2 - 1 "\t" $2 }' | bgzip > output.bed.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment