Hi I'm very new to this script thing, so please be gentle.
I am trying to get a command - the mach2qtl command in the code below - to loop through a set of files.
Each command should take the same two .dat and .ped files, but the .mlinfo and .mlprob files with filenames including 'chrom1' should be run together and output to a file PC_full_1.txt
I have run the command fine by retyping it using the appropriate file names, but would like to run this as a script that runs through files 1 - 22.
When I run the script below I get a segmentational error.
What am I doing wrong?
Thanks,
Polly
#! /bin/bash
# program to run through each chromosome carrying out association using mach2qtl
# increment through chromosome numbers
i=0
while [ $i -lt 23 ]
do
i=$(( $i +1 ))
#list info and prob files 1 - 22
infofile=chrom$i_step2.mlinfo
probfile=chrom$i_step2.mlprob
# run mach2qtl using the above specified files
mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile > PC_full_$i.txt
done
exit 0