[Genabel-commits] r675 - pkg/VariABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Mar 7 15:25:58 CET 2011
Author: maksim
Date: 2011-03-07 15:25:58 +0100 (Mon, 07 Mar 2011)
New Revision: 675
Removed:
pkg/VariABEL/src/constants.h
pkg/VariABEL/src/gtps_container.cpp
pkg/VariABEL/src/gtps_container.h
pkg/VariABEL/src/inverse_variance_metaanalysis.cpp
pkg/VariABEL/src/inverse_variance_metaanalysis.h
Log:
clean all for following copying all file into one directory
Deleted: pkg/VariABEL/src/constants.h
===================================================================
--- pkg/VariABEL/src/constants.h 2011-03-07 14:14:29 UTC (rev 674)
+++ pkg/VariABEL/src/constants.h 2011-03-07 14:25:58 UTC (rev 675)
@@ -1,11 +0,0 @@
-
-#ifndef SMV_CONSTANTS_H
-#define SMV_CONSTANTS_H
-const VARIABLE_TYPE NA_value = -999.999; // which numeric value is ised as NA
-const int NA_value_int = -999; // which numeric value is ised as NA
-const unsigned precision_output=4;
-const double median_table_chi2_df2 = 1.386294;
-
-
-
-#endif
Deleted: pkg/VariABEL/src/gtps_container.cpp
===================================================================
--- pkg/VariABEL/src/gtps_container.cpp 2011-03-07 14:14:29 UTC (rev 674)
+++ pkg/VariABEL/src/gtps_container.cpp 2011-03-07 14:25:58 UTC (rev 675)
@@ -1,213 +0,0 @@
-//#=====================================================================================
-//#
-//# Filename: gtps_container.cpp
-//#
-//# Description: Container for storaging genotype data. Use in function for merging of two snp.data class objects.
-//#
-//# Version: 1.0
-//# Created: 18-March-2008
-//# Revision: none
-//#
-//#
-//# Author: Maksim V. Struchalin, Yurii S. Aulchenko
-//# Company: ErasmusMC, Epidemiology & Biostatistics Department, The Netherlands.
-//# Email: m.struchalin@@erasmusmc.nl, i.aoultchenko at erasmusmc.nl
-//#
-//#=====================================================================================
-
-#include "gtps_container.h"
-#include <cstdlib>
-#include <math.h>
-
-
-
-
-gtps_container::gtps_container(char * gtps_array_, char * strand_array_, char * coding_array_, unsigned id_numbers_, unsigned snp_numbers_)
-{
-do_we_have_strand_and_codding_arrays = true; //of course
-rearrangement_array = new unsigned[4];
-rearrangement_array[0] = 6;
-rearrangement_array[1] = 4;
-rearrangement_array[2] = 2;
-rearrangement_array[3] = 0;
-
-
-
-
-
-gtps_array = gtps_array_;
-strand_array = strand_array_;
-coding_array = coding_array_;
-id_numbers = id_numbers_;
-snp_numbers = snp_numbers_;
-nbytes_for_one_snp = unsigned(ceil(double(id_numbers)/4.) + 0.5);
-
-//std::cout<<"gtps_container::gtps_container: nbytes_for_one_snp="<<nbytes_for_one_snp<<"\n";
-
-}
-//------------------------------------------------------------------
-
-
-
-//------------------------------------------------------------------
-gtps_container::gtps_container(char * gtps_array_, unsigned id_numbers_, unsigned snp_numbers_)
-{
-do_we_have_strand_and_codding_arrays = true; //of course
-rearrangement_array = new unsigned[4];
-rearrangement_array[0] = 6;
-rearrangement_array[1] = 4;
-rearrangement_array[2] = 2;
-rearrangement_array[3] = 0;
-
-
-
-
-
-gtps_array = gtps_array_;
-id_numbers = id_numbers_;
-snp_numbers = snp_numbers_;
-nbytes_for_one_snp = unsigned(ceil(double(id_numbers)/4.) + 0.5);
-}
-//------------------------------------------------------------------
-
-
-
-
-
-
-gtps_container::~gtps_container(void)
-{
-delete[] rearrangement_array;
-}
-
-
-
-
-//------------------------------------------------------------------
-void gtps_container::get_our_byte_number_and_local_person_number(unsigned id_position, unsigned snp_position)
-{
-our_byte_number = int(ceil(id_position/4.)+0.5) + (snp_position-1)*nbytes_for_one_snp; //What byte is our id in?
-
-local_person_number = id_position - ((our_byte_number-(snp_position-1)*nbytes_for_one_snp-1)*4); //What position of our id is in byte?
-}
-//------------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-//------------------------------------------------------------------
-char gtps_container::get(unsigned id_position, unsigned snp_position)
-{
-get_our_byte_number_and_local_person_number(id_position, snp_position); //calculate our_byte_number value
-
-//char our_byte_vallue = gtps_array[our_byte_number-1];
-
-
-
-return char((gtps_array[our_byte_number-1] >> rearrangement_array[local_person_number-1]) & 3);
-}
-//------------------------------------------------------------------
-
-
-
-
-//------------------------------------------------------------------
-//Attention! This class does not carry about allocated in this function memory.
-//In order to avoid memory leak "delete" must be performed for every array created in this function.
-char* gtps_container::get_gtps_array_for_snp(unsigned snp_position)
-{
-char* gtps_for_one_snp = new char(nbytes_for_one_snp);
-get_our_byte_number_and_local_person_number(1, snp_position); //calculate our_byte_number value
-
-std::cout<<"gtps_container::get_gtps_array_for_snp: our_byte_number="<<our_byte_number<<"\n";
-std::cout<<"gtps_container::get_gtps_array_for_snp: nbytes_for_one_snp="<<nbytes_for_one_snp<<"\n";
-
-std::cout<<"gtps_array[0]="<<int(gtps_array[0])<<"\n";
-
-for(unsigned int i=0 ; i<nbytes_for_one_snp; i++)
- {
- gtps_for_one_snp[i]=gtps_array[our_byte_number-1+i];
- }
-
-
-return gtps_for_one_snp;
-}
-//------------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-char gtps_container::get_strand(unsigned snp_position)
-{
-if(do_we_have_strand_and_codding_arrays) return strand_array[snp_position-1];
-else std::cout<<"gtps_container::get_strand: You can not get strand since you create object with constructor gtps_container(char * gtps_array_raw, unsigned id_numbers, unsigned snp_numbers)\n";
-return char(0);
-}
-
-
-
-char gtps_container::get_coding(unsigned snp_position)
-{
-if(do_we_have_strand_and_codding_arrays) return coding_array[snp_position-1];
-else std::cout<<"gtps_container::get_strand: You can not get strand since you create object with constructor gtps_container(char * gtps_array_raw, unsigned id_numbers, unsigned snp_numbers)\n";
-return char(0);
-}
-
-
-//------------------------------------------------------------------
-void gtps_container::set(unsigned id_position, unsigned snp_position, char data)
-{
-//for(int i=0 ; i<4 ; i++)
-//std::cout<<"rearrangement_array["<<i<<"]="<<rearrangement_array[i]<<"\n";
-
-
-static const char clear_info_for_person[]={63, 207, 243, 252};
-
-//std::cout<<"set: id_position="<<id_position<<", snp_position="<<snp_position<<", data="<<int(data)<<"\n";
-get_our_byte_number_and_local_person_number(id_position, snp_position);
-
-
-//std::cout<<"set: (gtps_array[our_byte_number]&clear_info_for_person[local_person_number-1])="<<int(gtps_array[our_byte_number]&clear_info_for_person[local_person_number-1])<<"\n";
-
-//char tmp = (gtps_array[our_byte_number]&clear_info_for_person[local_person_number-1]) | data;
-//std::cout<<"set: tmp="<<int(tmp)<<"\n";
-
-
-//std::cout<<"gtps_array["<<our_byte_number-1<<"] = (gtps_array["<<our_byte_number-1<<"]&"<<int(clear_info_for_person[local_person_number-1])<<" |"<< int((data&3)<<rearrangement_array[local_person_number-1])<<"\n";
-
-
-gtps_array[our_byte_number-1] = (gtps_array[our_byte_number-1]&clear_info_for_person[local_person_number-1]) | (data&3)<<rearrangement_array[local_person_number-1];
-//std::cout<<"gtps_array["<<our_byte_number<<"-1]="<<int(gtps_array[our_byte_number-1])<<"\n";
-}
-//------------------------------------------------------------------
-
-
-
-
-/*
-gtps_container::checking(unsigned id_position, unsigned snp_position)
-{
-if (id_position > id_numbers || id_position<0)
- {
- std::cerr<<"Bad ID number. ID_number="<<id_position<<". Maximum ID_number can be "<<id_position<<"\n";
- }
-
-if(snp_position > snp_position || snp_position <0)
- {
- std::cerr<<"Bad ID number. ID_number="<<id_position<<". Maximum ID_number can be "<<id_position<<"\n";
- }
-}
-*/
-
-
-
Deleted: pkg/VariABEL/src/gtps_container.h
===================================================================
--- pkg/VariABEL/src/gtps_container.h 2011-03-07 14:14:29 UTC (rev 674)
+++ pkg/VariABEL/src/gtps_container.h 2011-03-07 14:25:58 UTC (rev 675)
@@ -1,73 +0,0 @@
-//#=====================================================================================
-//#
-//# Filename: gtps_container.h
-//#
-//# Description: Set of functions for merging two snp.data class objects.
-//#
-//# Version: 1.0
-//# Created: 18-March-2008
-//# Revision: none
-//#
-//#
-//# Author: Maksim V. Struchalin, Yurii S. Aulchenko
-//# Company: ErasmusMC, Epidemiology & Biostatistics Department, The Netherlands.
-//# Email: m.struchalin@@erasmusmc.nl, i.aoultchenko at erasmusmc.nl
-//#
-//#=====================================================================================
-
-#ifndef SMV_GTPS_CONTAINER_H
-#define SMV_GTPS_CONTAINER_H
-
-
-
-#include<iostream>
-#include<vector>
-#include<memory>
-
-
-
-
-
-
-
-
-//==================================================================
-// Class gtps_container - container for gtps data. Class facilitates access to gtps array.
-class gtps_container
- {
- public:
- gtps_container(char * gtps_array_raw, char * strand_array, char * coding_array, unsigned id_numbers, unsigned snp_numbers);
- gtps_container(char * gtps_array_raw, unsigned id_numbers, unsigned snp_numbers);
- ~gtps_container(void);
-
- //Get polymorphism for person who have ID=id_position for SNP=snp_position
- //Here the first id_position equal zerro, the second - one etc...
- //id_position=1 - THE FIRST ARGUMENT (id_position!=O NEVER!!!). snp_position - same
- char get(unsigned id_position, unsigned snp_position);
- char* get_gtps_array_for_snp(unsigned snp_position);
- char get_strand(unsigned snp_position);
- char get_coding(unsigned snp_position);
-
-
- //id_position=1 - THE FIRST ARGUMENT (id_position!=O NEVER!!!). snp_position - same
- void set(unsigned id_position, unsigned snp_position, char data);
-
- private:
- void get_our_byte_number_and_local_person_number(unsigned id_position, unsigned snp_position);
- bool do_we_have_strand_and_codding_arrays;
- char *gtps_array; //pointer to array where we stotages our data (passed from R)
- char * strand_array;
- char * coding_array;
- unsigned id_numbers, snp_numbers;
- unsigned nbytes_for_one_snp;
-
- unsigned our_byte_number,
- local_person_number; //can have vallues: 1, 2, 3 or 4. Show what is position in the byte.
-// const unsigned rearrangement_array[];
- unsigned *rearrangement_array;
-
-
- };
-//==================================================================
-
-#endif
Deleted: pkg/VariABEL/src/inverse_variance_metaanalysis.cpp
===================================================================
--- pkg/VariABEL/src/inverse_variance_metaanalysis.cpp 2011-03-07 14:14:29 UTC (rev 674)
+++ pkg/VariABEL/src/inverse_variance_metaanalysis.cpp 2011-03-07 14:25:58 UTC (rev 675)
@@ -1,70 +0,0 @@
-//#=====================================================================================
-//#
-//# Filename: inverse_variance_metaanalysis.cpp
-//#
-//# Description: Function for meta analysis with inverse variance method.
-//#
-//# Version: 1.0
-//# Created: 06-July-2009
-//# Revision: none
-//# Modifed: 26-Apr-2010
-//#
-//# Author: Maksim V. Struchalin
-//# Company: ErasmusMC, Epidemiology, The Netherlands.
-//# Email: m.struchalin at erasmusmc.nl
-//#
-//#=====================================================================================
-
-
-
-
-#include<iostream>
-//#include<math>
-
-#include <Rinternals.h>
-
-#include <R.h> // to include Rconfig.h
-
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(String) dgettext ("pkg", String)
-// replace pkg as appropriate
-#else
-#define _(String) (String)
-#endif
-
-extern "C" {
-#include "inverse_variance_metaanalysis.h"
-
-
-void inverse_variance_metaanalysis(double *beta_set1, double *beta_set2,
- double *sebeta_set1, double *sebeta_set2,
- unsigned *num, //number of betas for current cohort
- double *mbeta,
- double *mse,
- char *testname)
-{
-
-unsigned num_el = *num;
-double se_set1, se_set2, wt2_set1, wt2_set2, invsumwt2;
-
-
-
- for(unsigned i=0 ; i<num_el ; i++)
- {
- se_set1 = sqrt(sebeta_set1[i]*sebeta_set1[i]);
- se_set2 = sqrt(sebeta_set2[i]*sebeta_set2[i]);
-
- wt2_set1 = 1./(sebeta_set1[i]*sebeta_set1[i]);
- wt2_set2 = 1./(sebeta_set2[i]*sebeta_set2[i]);
-
- invsumwt2 = 1./(wt2_set1+wt2_set2);
- mbeta[i] = (beta_set1[i]*wt2_set1 + beta_set2[i]*wt2_set2)*invsumwt2;
- mse[i] = sqrt(invsumwt2);
- }
-
-}// end of function
-
-
-
-}//end of extern "C"
Deleted: pkg/VariABEL/src/inverse_variance_metaanalysis.h
===================================================================
--- pkg/VariABEL/src/inverse_variance_metaanalysis.h 2011-03-07 14:14:29 UTC (rev 674)
+++ pkg/VariABEL/src/inverse_variance_metaanalysis.h 2011-03-07 14:25:58 UTC (rev 675)
@@ -1,33 +0,0 @@
-//#=====================================================================================
-//#
-//# Filename: inverse_variance_metaanalysis.h
-//#
-//# Description: Function for meta analysis with inverse variance method
-//#
-//# Version: 1.0
-//# Created: 06-July-2009
-//# Revision: none
-//# Modifed: 26-Apr-2010
-//#
-//# Author: Maksim V. Struchalin
-//# Company: ErasmusMC, Epidemiology, The Netherlands.
-//# Email: m.struchalin at erasmusmc.nl
-//#
-//#=====================================================================================
-
-#ifndef SMV_DOMETA_C_H
-#define SMV_DOMETA_C_H
-
-
-extern "C" {
-void inverse_variance_metaanalysis(double *beta_set1, double *beta_set2,
- double *sebeta_set1, double *sebeta_set2,
- unsigned *num,
- double *mbeta,
- double *mse,
- char *testname);
-
-
-}
-#endif
-
More information about the Genabel-commits
mailing list