Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash script for pairwise comparisons

Tags:

bash

vcftools

I would like to write a bash script to do a pairwise calculation with my files.

I have a fixed file in a directory and a series of files that I want to use them for pairwise comparisons.

For example:

The name of the fixed file is: Genome.vcf The name of the files for the pairwise calculations that are all in one directory: ind_GER, ind_ENG, ind_MRO

I have come up with the following script:

#!/bin/bash

for pop1 in $(find ind_*)
do
for pop2 in $(find ind_*)
do

 vcftools --gzvcf PATH/Genome.vcf --weir-fst-pop $pop1 --weir-fst-pop $pop2 --out $pop1_$pop2_fst

done
done

The error that I get is:

Error: Requested Missing Argument

Obviously, I am getting something wrong, I'd be very grateful if you could help with this, thanks.

like image 519
Homap Avatar asked Jun 18 '14 14:06

Homap


1 Answers

Change this:

--out $pop1_$pop2_fst

for:

--out ${pop1}_${pop2}_fst

_ is a valid character in a variable name.

like image 56
Juan Diego Godoy Robles Avatar answered Sep 21 '22 17:09

Juan Diego Godoy Robles