5

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.

zx8754
  • 52,746
  • 12
  • 114
  • 209
Homap
  • 2,142
  • 5
  • 24
  • 34

1 Answers1

7

Change this:

--out $pop1_$pop2_fst

for:

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

_ is a valid character in a variable name.

choroba
  • 231,213
  • 25
  • 204
  • 289
Juan Diego Godoy Robles
  • 14,447
  • 2
  • 38
  • 52