Skip to content

Instantly share code, notes, and snippets.

@janxkoci
Created June 18, 2025 08:46
Show Gist options
  • Save janxkoci/9c15c431753feaff13a97a480d051767 to your computer and use it in GitHub Desktop.
Save janxkoci/9c15c431753feaff13a97a480d051767 to your computer and use it in GitHub Desktop.
converting vcf data to traw format using GNU parallel
#!/bin/bash
cd $PBS_O_WORKDIR || exit
source /storage/brno2/home/$USER/.bashrc
module add plink/2.0
## example: https://stackoverflow.com/a/17316302/5184574
# dowork() {
# echo "Starting i=$1, j=$2"
# sleep 5
# echo "Done i=$1, j=$2"
# }
# export -f dowork
#
# parallel dowork ::: "${list[@]}" ::: "${other[@]}"
get_traw() {
vcf=sim200mb/$(basename -s .txt $1 | sed 's/gens_/gens\t/' | cut -f1).vcf.gz
out=${1%.txt}_traw
plink2 --keep $1 --vcf $vcf --out $out --recode A-transpose --max-alleles 2 --min-alleles 2
}
export -f get_traw
parallel -j20 get_traw ::: subsampling/*200mb*.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment