#include<stdio.h>
#include<stdlib.h>

#include "functionsAT.h"
//prog <genome> <tagFile>
FILE *f1,*f2;
int max,tagCount,lcount,k,n=0,scaf_repeats=0,q=0;
char tag[150],line[150];
float per;
unsigned long int microCount=0,seqSize=0,count=0,num_repeats=0,fin_at=0;

int main(int argc ,char **argv)
{
	f1 = fopen(argv[2],"r");
	i=0; 
	while(!feof(f1))
	{
		fscanf(f1,"%s%*[^\n]",tag);
       		i++; 
	}
	tagCount = i-1; rewind(f1);
	SS = (struct SEQUENCE *)malloc(sizeof(struct SEQUENCE)*tagCount);
	i=0;
	while(!feof(f1)) fscanf(f1,"%s%*[^\n]",SS[i++].tag);
	fclose(f1);
	for(i=0;i<tagCount;i++)
	{
		f1 = fopen(argv[1],"r");
		Extractseq(f1);//Function to Extract the Sequence
		fin_at=fin_at+SS[i].at_cnt;
		SS[i].size=SS[i].size-1;
		seqSize=seqSize+SS[i].size;//Gives the to length of the genome
		fclose(f1);
		printf("Completed %s\n",SS[i].tag);		
		f2=fopen("Results","w");
		fprintf(f2,"AT count:- %d\nGenome size:- %d\n",fin_at,seqSize);
		fclose(f2);
	}
}


