Example #1
0
int main(int argc, char* argv[])
{
	char histoneFileName[1000],chromFileName[1000],projectName[1000];
        int binsize;
	int count=0;
	if (argc!=5)
	{
		printf("Usage: <Histone File Name> <Chromosome Description File Name> <bin size> <cell-type name>\n");
		return 0;
	}

	strcpy(histoneFileName,argv[1]);
	strcpy(chromFileName,argv[2]);
        binsize=atoi(argv[3]);
        strcpy(projectName,argv[4]);


	//Read chromosome description file
	if (!GetChromInfo(chromFileName))
	{
		printf("chromosome description file is not valid\n");
		return 0;
	}

	//Read tag files of L1 and L2, and define the histone modification regions
float **binrpkm;	
int i,j;
ReadHistoneFile(histoneFileName,projectName,binsize);
	


	return 0;
}
Example #2
0
int main(int argc, char* argv[])
{
	char lib1FileName[1000], lib2FileName[1000], chromFileName[1000],configFileName[2000], projectName[1000];
	CONFIG_STRUCT config;
	CHROM_INFO chroms[MAX_CHROM_NUM];
	int chromNum;
	double noiseRate, l1Ratio, l2Ratio;
	int maxL1Count, maxL2Count;
	int i;

	if (argc!=6)
	{
		printf("Usage: <library 1 tag file name> <library 2 tag file name> <chromosome length file name> <config file name> <project name>\n");
		return 0;
	}

	strcpy(lib1FileName, argv[1]);
	strcpy(lib2FileName, argv[2]);
	strcpy(chromFileName, argv[3]);
	strcpy(configFileName, argv[4]);
	strcpy(projectName, argv[5]);

	chromNum = GetChromInfo(chromFileName, chroms);

	if (chromNum<=0)
	{
		return 0;
	}                                                                                                                                                                                                                             

	printf("chromosome length information read. chromNum = %d!\n", chromNum);

	for (i=0;i<chromNum;i++)
	{
		chroms[i].l1PosTagNum = 0;
		chroms[i].l2PosTagNum = 0;
		chroms[i].l1NegTagNum = 0;
		chroms[i].l2NegTagNum = 0;
		chroms[i].l1PeakNum = 0;
		chroms[i].l2PeakNum = 0;
	}

	if (ReadConfigFile(configFileName, &config)<0)
	{
		printf("config file not complet. Default setting used.\n");
	}

	printf("config file read.\n");

	printf("fragmentSize = %d\n", config.fragmentSize);
	printf("isStrandSensitiveMode = %d\n", config.isStrandSensitiveMode);
	printf("slidingWinSize = %d\n", config.slidingWinSize);
	printf("movingStep = %d\n", config.movingStep);
	printf("outputNum = %d\n", config.outputNum);
	printf("minCount = %d\n", config.minCount);
	printf("minScore = %f\n", config.minScore);
	printf("bootstrapPass = %d\n", config.bootstrapPass);
	printf("randSeed = %d\n", config.randomSeed);

	printf("reading tag files......\n");
	
	if (!GetTags(lib1FileName, lib2FileName, chroms, chromNum))
	{
		printf("tag file error!\n");
		return 0;
	}

	printf("tag file read.\n");

	printf("pre-processing......\n");

	if (PreProcessing(chroms, chromNum)<0)
	{
		printf("Preprocessing failed!\n CCAT aborted!\n");
		return -1;
	}

	printf("pre-processing finished.\n");

	printf("estimating noise rate......\n");

	srand(config.randomSeed);

	noiseRate = ComputeNoiseRate(chroms,chromNum, &l1Ratio,&l2Ratio, config);

	printf("noise rate = %f\n", noiseRate);

	printf("peak-finding......\n");

	if (PeakFinding(chroms,chromNum,l1Ratio,l2Ratio, &maxL1Count, &maxL2Count, config)<=0)
	{
		return -1;
	}

	printf("peak-finding finished.\n");

	printf("Significance Analysis......\n");

	if (SignificanceAnalysis(chroms, chromNum, l1Ratio, l2Ratio, maxL1Count, maxL2Count, config)<0)
	{
		printf("DPS paramter esitmation failed!\n");
		return -1;
	}

	printf("Significance analysis finished.\n");

	printf("saving results.......\n");

	OutputFiles(chroms, chromNum, projectName, config);

	printf("results saved.\n");

	FreeChromMem(chroms,chromNum);

	printf("CCAT process completed!\n");
	return 0;
}