#!/usr/bin/perl

use strict;
my $dir = "/Net/sparse/data/scratch/HSMICE/POE/GCTA.OUT/";
system("mkdir $dir");
my $glob = "/Net/sparse//data/scratch/HSMICE/POE/GCTA/PHENOTYPES/*.txt";


my @phen = glob( $glob );
foreach my $phen ( @phen ) {
  my ($p) = $phen =~ /\/([^\/]+).txt$/;
  my $out = "$dir/$p";
  my $gcta = "/Net/mus/data/www/HS/GCTA/SPARSE/gcta64 --mgrm /Net/sparse/data/scratch/HSMICE/POE/mats.txt --keep /Net/sparse/data/scratch/HSMICE/POE/with.parents.txt --pheno $phen --reml --out $out --reml-alg 2 --reml-maxit 10000 &";  
  system($gcta);
  sleep(4);
}

