#include <stdio.h>
#include <math.h>
#include <stdlib.h>
//#include "nrutil.h"
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#include <malloc.h>

void usage();


void usage()
{
	printf("usage: batCalculation alignment name\n");
	exit(1);
}

int main(int argc, char **argv)
{
	int i,j,k,m;
	char alnName[20];
	if(argc<2) usage();
	else strcpy(alnName,argv[1]);
	for(i=1;i<=7;i++){
		for(j=1;j<=4;j++){
			for(k=1;k<=2;k++){
				for(m=1;m<=4;m++){
					char chooseSeq[200];
					strcpy(chooseSeq,"/home1/UTSW/wcai/likelihood/likely2 -RO -Z -S ");
					sprintf(chooseSeq+strlen(chooseSeq),"%d",k);
					strcat(chooseSeq," -d ");
					sprintf(chooseSeq+strlen(chooseSeq),"%d",m);
					strcat(chooseSeq," -i ");
					strcat(chooseSeq,alnName);
					sprintf(chooseSeq+strlen(chooseSeq),"%d",i);
					sprintf(chooseSeq+strlen(chooseSeq),"%d",j);
					strcat(chooseSeq,"/");
					strcat(chooseSeq,alnName);
					sprintf(chooseSeq+strlen(chooseSeq),"%d",i);
					sprintf(chooseSeq+strlen(chooseSeq),"%d",j);
					strcat(chooseSeq,".aln -o ");
					strcat(chooseSeq,alnName);
					sprintf(chooseSeq+strlen(chooseSeq),"%d",i);
					sprintf(chooseSeq+strlen(chooseSeq),"%d",j);
					strcat(chooseSeq,"/");
					strcat(chooseSeq,alnName);
					sprintf(chooseSeq+strlen(chooseSeq),"%d",i);
					sprintf(chooseSeq+strlen(chooseSeq),"%d",j);
					sprintf(chooseSeq+strlen(chooseSeq),"%d",k);
					sprintf(chooseSeq+strlen(chooseSeq),"%d",m);
					strcat(chooseSeq,".out -T ");
					strcat(chooseSeq,alnName);
					strcat(chooseSeq,"_cutoff");
					printf("%s\n",chooseSeq);
					system(chooseSeq);
				}
			}
		}
	}

}
