This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to pass a variable to vcftools --weir-fst-pop

Is it possible to pass a population list as a variable to the vcftools --weir-fst-pop function instead of a file?

My original code is correct and works: vcftools --bcf <bcf_file.txt> --weir-fst-pop <pop_1_file.txt> --weir-fst-pop <pop_2_file.txt> --out <output_file.txt>

However I need to run this code many times in a loop and it would be preferable not to create lots of files of population lists.

I have tried:

vcftools --bcf <bcf_file.txt> --weir-fst-pop ${<pop_1_list_as_variable>} --weir-fst-pop ${<pop_2_list_as_variable>} --out <output_file.txt>

and

vcftools --bcf <bcf_file.txt> --weir-fst-popecho ${<pop_1_list_as_variable>}--weir-fst-popecho ${<pop_2_list_as_variable>}--out <output_file.txt>

but I get the error Error: Unknown option: <first_sample_name_in_pop_1_variable>

Is this possible?

Thanks

vcftools fst bash

1 answer

This seems to work:

vcftools --bcf <bcf_file.bcf> --weir-fst-pop <(echo ${<pop_1_list_as_variable>}) --weir-fst-pop <(echo ${<pop_2_list_as_variable>})

Log in to answer this question.