Esempio n. 1
0
int main(int argc, char *argv[] )
{
	//=========  WORK WITH R INTERFACE   ===========

	int Total_Num_SNPSets;
	int Total_Num_SNP;
	int Total_Num_IND;
	int my_error;



	/*
	Generate_MWA_SetID_File((char*)"../data/Example1.bed",(char*)"../data/Example1.bim",(char*)"../data/Example1.fam",
		(char*)"../data/Example1.SetID", (char*)"../data/Example1_0124_SetID.mwa", (char*)"../data/Example1_0124_INFO.txt",&my_error);

	*/
	/*
	Generate_MWA_SetID_File((char*)"../data/reiner.bed",(char*)"../data/reiner.bim",(char*)"../data/reiner.fam",
		(char*)"../data/reiner.SetID", (char*)"../data/reiner_0124_SetID.mwa", (char*)"../data/reiner_0124_INFO.txt",&my_error);

	if(my_error != 0)
		return 0;
	Kill_MWA_SetID_File();
    */


	/* Open_MWA((char*)"../data/reiner_0124_SetID.mwa", (char*)"../data/reiner_0124_INFO.txt",&my_error); */
	Open_MWA((char*)"/home/seunggeun/Project/Kernel_Machine/Test_From_Others/Yasin/test.SSD"
	, (char*)"/home/seunggeun/Project/Kernel_Machine/Test_From_Others/Yasin/test.SSD.info",&my_error);

	if(my_error != 0)
		return 0;
	Get_TotalNumberofSets(&Total_Num_SNPSets);
	Get_TotalNumberofSNPs(&Total_Num_SNP);
	Get_TotalNumberofInd( &Total_Num_IND);

	int Num_SNP7;
	int* TheGenotypesArray7;
	int size;
	int i;
	for (i = 1; i < Total_Num_SNPSets+1; ++ i)
	{
		Get_NumberofSnps(i,&Num_SNP7, &my_error);
		if(my_error != 0) continue;
		TheGenotypesArray7 = new int [Total_Num_IND*Num_SNP7];
		size = Total_Num_IND*Num_SNP7;
		Get_Genotypes(i, TheGenotypesArray7,size, 1,&my_error); // int Is_MakeFile = 1 -> print set to file, 0 -> don't
		Get_Genotypes(i, TheGenotypesArray7,size, 1,&my_error);
		//delete [] TheGenotypesArray7;
		if(my_error != 0) continue;
	}
/*
		Get_NumberofSnps(1,&Num_SNP7, &my_error);
		//if(my_error != 0) continue;
		TheGenotypesArray7 = new int [Total_Num_IND*Num_SNP7];
		size = Total_Num_IND*Num_SNP7;
		Get_Genotypes(1, TheGenotypesArray7,size, 1,&my_error); // int Is_MakeFile = 1 -> print set to file, 0 -> don't
		delete [] TheGenotypesArray7;
		//if(my_error != 0) continue;



	for (i = 1; i < 11; ++ i)
	{
		Get_NumberofSnps(i,&Num_SNP7, &my_error);
		if(my_error != 0) continue;
		TheGenotypesArray7 = new int [Total_Num_IND*Num_SNP7];
		size = Total_Num_IND*Num_SNP7;
		Get_Genotypes(i, TheGenotypesArray7,size, 1,&my_error); // int Is_MakeFile = 1 -> print set to file, 0 -> don't
		delete [] TheGenotypesArray7;
		if(my_error != 0) continue;


	}
*/
	Close_MWA();
	return 1;
	//============================================================
	Generate_MWA_MovingWindow( (char*)"../data/CEU.bed",(char*)"../data/CEU.bim",(char*)"../data/CEU.fam",
							(char*)"../data/CEU_MW.mwa", 20, 5, (char*)"../data/MW_INFO.txt",&my_error );
	Kill_MWA_MovingWindow();
	Open_MWA((char*)"../data/CEU_MW.mwa",(char*)"../data/MW_INFO.txt",&my_error);
	Get_TotalNumberofSets(&Total_Num_SNPSets);
	Get_TotalNumberofSNPs(&Total_Num_SNP);
	Get_TotalNumberofInd( &Total_Num_IND);

	int Num_SNP25;
	Get_NumberofSnps(25,&Num_SNP25,&my_error);
	int* TheGenotypesArray25 = new int [Total_Num_IND*Num_SNP25];

	Get_Genotypes(25, TheGenotypesArray25,Total_Num_IND*Num_SNP25, 1,&my_error);
	Close_MWA();


	//============================================================
	//Generate_MWA_SetID_File((char*)"../data/CEU.bed",(char*)"../data/CEU.bim",(char*)"../data/CEU.fam"
	//	, (char*)"../data/SetID.TXT", (char*)"../data/CEU_SetID.mwa", (char*)"../data/SetID_INFO.txt",&my_error);
	//if(my_error != 0) return 0;
	//Kill_MWA_SetID_File();
	/*
	Open_MWA((char*)"../data/CEU_SetID.mwa", (char*)"../data/SetID_INFO.txt",&my_error);
	if(my_error != 0) return 0;
	Get_TotalNumberofSets(&Total_Num_SNPSets);
	Get_TotalNumberofSNPs(&Total_Num_SNP);
	Get_TotalNumberofInd( &Total_Num_IND);
	int Num_SNP8;
	int* TheGenotypesArray8;
	for (int i = 1; i < 9; ++i)
	{
		Get_NumberofSnps(i,&Num_SNP8, &my_error);
		if(my_error != 0) continue;

		TheGenotypesArray8 = new int[Total_Num_IND*Num_SNP8];
		int size = 5; //Total_Num_IND*Num_SNP8;
		Get_Genotypes(i, TheGenotypesArray8,size, 1,&my_error); // int Is_MakeFile = 1 -> print set to file, 0 -> don't
		delete [] TheGenotypesArray8;
		if(my_error != 0) continue;

	}
	Close_MWA();
	*/

   //============================================

	//Generate_MWA_MovingWindow( (char*)"../data/CEU.bed",(char*)"../data/CEU.bim",(char*)"../data/CEU.fam",
	//						(char*)"../data/CEU_MW.mwa", 20, 5, (char*)"../data/MW_INFO.txt",&my_error );
	Open_MWA((char*)"../data/CEU_MW.mwa",(char*)"../data/MW_INFO.txt",&my_error);
	Get_TotalNumberofSets(&Total_Num_SNPSets);
	Get_TotalNumberofSNPs(&Total_Num_SNP);
	Get_TotalNumberofInd( &Total_Num_IND);
	int Num_SNP9;
	Get_NumberofSnps(4,&Num_SNP9,&my_error);
	int* TheGenotypesArray9 = new int [Total_Num_IND*Num_SNP9];

	Get_Genotypes(4, TheGenotypesArray9,Total_Num_IND*Num_SNP9, 1,&my_error);
	Close_MWA();
	//Kill_MWA_MovingWindow();

	/*
		//int* TheGenotypesArray = NULL;
	//Get_Genotypes(-33, TheGenotypesArray);
	//Get_Genotypes(33, TheGenotypesArray);
	//Get_Genotypes(51, TheGenotypesArray);
	//Get_Genotypes(30, TheGenotypesArray);

	int Num_SNP1, Num_SNP2, Num_SNP3,Num_SNP4,Num_SNP5;
	Get_NumberofSnps(33,&Num_SNP1);
	Get_NumberofSnps(-14,&Num_SNP2);
	Get_NumberofSnps(5000,&Num_SNP3);
	Get_NumberofSnps(2,&Num_SNP4);
	Get_NumberofSnps(1,&Num_SNP5);
*/
	//=========  END OF WORK WITH R INTERFACE   ===========

	//======================================================================================================

	//SBM = SETID BEDFILE MERGE
/*	Hasht hash_table("../data/SetID.TXT", "../data/CEU.bim");
	BedFileReader bed_pedigree( "../data/CEU.bed","../data/CEU.bim","../data/CEU.fam","../data/CEU.mwa",&hash_table);
	MwoFileReader mwa("../data/CEU.mwa", NULL, &bed_pedigree); //it will take also "CEU.bed.INFO.txt"
	mwa.get_set(1); //some integer - enter the value base on CEU.bed.INFO.txt
	mwa.get_set(2); //some integer - enter the value base on CEU.bed.INFO.txt
	mwa.get_set(3); //some integer - enter the value base on CEU.bed.INFO.txt
*/
//	int a;
//	mwa.get_TotalNumberofSets(&a);


//

}
Esempio n. 2
0
void R_Close_MWA() 
{
	Close_MWA();
}