Beispiel #1
0
void create_header2(std::vector<std::ofstream*>& outfile, cmdvars& input_var,
                    phedata& phd, int interaction_cox)
{
    create_start_of_header(outfile, input_var, phd);
    *outfile[0] << input_var.getSep() << "beta_SNP_add"
                << input_var.getSep() << "sebeta_SNP_add";

    if (input_var.getInteraction() != 0)
    {
        *outfile[0] << input_var.getSep() << "beta_SNP_"
                    << phd.model_terms[interaction_cox]
                    << input_var.getSep() << "sebeta_SNP_"
                    << phd.model_terms[interaction_cox];
    }

    if (input_var.getInverseFilename() == NULL)
    {
        //Han Chen
#if !COXPH
        if (input_var.getInteraction() != 0 && !input_var.getAllcov())
        {
            *outfile[0] << input_var.getSep() << "cov_SNP_int_SNP_"
                        << phd.model_terms[interaction_cox];
        }
#endif
        *outfile[0] << input_var.getSep() << "loglik"; //"chi2_SNP";
    }
    //Oct 26, 2009
    *outfile[0] << "\n";
}
Beispiel #2
0
void create_start_of_header(std::vector<std::ofstream*>& outfile,
        cmdvars& input_var, phedata& phd)
{
    for (unsigned int i = 0; i < outfile.size(); i++)
    {
        (*outfile[i]) << "name" << input_var.getSep()
                      << "A1" << input_var.getSep()
                      << "A2" << input_var.getSep()
                      << "Freq1" << input_var.getSep()
                      << "MAF" << input_var.getSep()
                      << "Quality" << input_var.getSep()
                      << "Rsq" << input_var.getSep()
                      << "n"   << input_var.getSep()
                      << "Mean_predictor_allele";
        if (input_var.getChrom() != "-1")
            (*outfile[i]) << input_var.getSep() << "chrom";
        if (input_var.getMapfilename() != NULL)
            (*outfile[i]) << input_var.getSep() << "position";
    }

    if (input_var.getAllcov()) //All covariates in output
    {
        for (unsigned int file = 0; file < outfile.size(); file++)
            for (int i = 0; i < phd.n_model_terms - 1; i++)
                *outfile[file] << input_var.getSep()
                               << "beta_" << phd.model_terms[i]
                               << input_var.getSep() << "sebeta_"
                               << phd.model_terms[i];
    }
}
Beispiel #3
0
int get_start_position(const cmdvars& input_var, int model,
        int number_of_rows_or_columns)
{
    int start_pos;
    if (!input_var.getAllcov() &&
        model == 0 &&
        input_var.getInteraction() == 0)
    {
        if (input_var.getNgpreds() == 2)
        {
            start_pos = number_of_rows_or_columns - 2;
        } else
        {
            start_pos = number_of_rows_or_columns - 1;
        }
    } else if (!input_var.getAllcov() && model == 0
            && input_var.getInteraction() != 0)
    {
        if (input_var.getNgpreds() == 2)
        {
            start_pos = number_of_rows_or_columns - 4;
        } else
        {
            start_pos = number_of_rows_or_columns - 2;
        }
    } else if (!input_var.getAllcov() && model != 0
            && input_var.getInteraction() == 0)
    {
        start_pos = number_of_rows_or_columns - 1;
    } else if (!input_var.getAllcov() && model != 0
            && input_var.getInteraction() != 0)
    {
        start_pos = number_of_rows_or_columns - 2;
    } else
    {
        start_pos = 0;
    }

    return start_pos;
}
Beispiel #4
0
void create_header(std::vector<std::ofstream*>& outfile, cmdvars& input_var,
                   phedata& phd, int& interaction_cox)
{
    create_start_of_header(outfile, input_var, phd);

    if (input_var.getNgpreds() == 1) // dose data: only additive model
    {
        *outfile[0] << input_var.getSep()
                    << "beta_SNP_add"
                    << input_var.getSep()
                    << "sebeta_SNP_add";

        if (input_var.getInteraction() != 0)
        {
            *outfile[0] << input_var.getSep()
                        << "beta_SNP_"
                        << phd.model_terms[interaction_cox]
                        << input_var.getSep()
                        << "sebeta_SNP_"
                        << phd.model_terms[interaction_cox];
        }

        if (input_var.getInverseFilename() == NULL)
        {
            //Han Chen
#if !COXPH
            if (input_var.getInteraction() != 0 && !input_var.getAllcov())
            {
                *outfile[0] << input_var.getSep()
                            << "cov_SNP_int_SNP_"
                            << phd.model_terms[interaction_cox];
            }
#endif
        }
        *outfile[0] << input_var.getSep() << "chi2_SNP";
        *outfile[0] << "\n";
    } // ngpreds == 1
    else if (input_var.getNgpreds() == 2) // prob data: all models
    {
        *outfile[0] << input_var.getSep()
                    << "beta_SNP_A1A2"
                    << input_var.getSep()
                    << "sebeta_SNP_A1A2"
                    << input_var.getSep()
                    << "beta_SNP_A1A1"
                    << input_var.getSep()
                    << "sebeta_SNP_A1A1";
        *outfile[1] << input_var.getSep()
                    << "beta_SNP_addA1"
                    << input_var.getSep()
                    << "sebeta_SNP_addA1";
        *outfile[2] << input_var.getSep()
                    << "beta_SNP_domA1"
                    << input_var.getSep()
                    << "sebeta_SNP_domA1";
        *outfile[3] << input_var.getSep()
                    << "beta_SNP_recA1"
                    << input_var.getSep()
                    << "sebeta_SNP_recA1";
        *outfile[4] << input_var.getSep()
                    << "beta_SNP_odomA1"
                    << input_var.getSep()
                    << "sebeta_SNP_odomA1";
        if (input_var.getInteraction() != 0)
        {
            //Han Chen
            *outfile[0] << input_var.getSep()
                        << "beta_SNP_A1A2_"
                        << phd.model_terms[interaction_cox]
                        << input_var.getSep()
                        << "sebeta_SNP_A1A2_"
                        << phd.model_terms[interaction_cox]
                        << input_var.getSep()
                        << "beta_SNP_A1A1_"
                        << phd.model_terms[interaction_cox]
                        << input_var.getSep()
                        << "sebeta_SNP_A1A1_"
                        << phd.model_terms[interaction_cox];
#if !COXPH
            if (input_var.getInverseFilename() == NULL && !input_var.getAllcov())
            {
                *outfile[0] << input_var.getSep()
                            << "cov_SNP_A1A2_int_SNP_"
                            << phd.model_terms[interaction_cox]
                            << input_var.getSep()
                            << "cov_SNP_A1A1_int_SNP_"
                            << phd.model_terms[interaction_cox];
            }
#endif
            //Oct 26, 2009
            for (unsigned int file = 1; file < outfile.size(); file++)
            {
                *outfile[file] << input_var.getSep()
                               << "beta_SNP_"
                               << phd.model_terms[interaction_cox]
                               << input_var.getSep()
                               << "sebeta_SNP_"
                               << phd.model_terms[interaction_cox];
                //Han Chen
#if !COXPH
                if (input_var.getInverseFilename() == NULL
                    && !input_var.getAllcov())
                {
                    *outfile[file] << input_var.getSep()
                                   << "cov_SNP_int_SNP_"
                                   << phd.model_terms[interaction_cox];
                }
#endif
                //Oct 26, 2009
            }
        }
        *outfile[0] << input_var.getSep() << "chi2_SNP_2df\n";  // "loglik\n";
        *outfile[1] << input_var.getSep() << "chi2_SNP_A1\n";   // "loglik\n";
        *outfile[2] << input_var.getSep() << "chi2_SNP_domA1\n";// "loglik\n";
        *outfile[3] << input_var.getSep() << "chi2_SNP_recA1\n";// "loglik\n";
        *outfile[4] << input_var.getSep() << "chi2_SNP_odomA1\n"; // "loglik\n";
    } // End: ngpreds == 2
    else
    {
        cerr << "Error: create_header(): ngpreds != 1 or 2.\n";
    }
}
Beispiel #5
0
void create_header_1(std::vector<std::ofstream*>& outfile, cmdvars& input_var,
        phedata& phd, int& interaction_cox)
{
    create_start_of_header(outfile, input_var, phd);

    *outfile[0] << input_var.getSep() << "beta_SNP_A1A2" << input_var.getSep()
                << "beta_SNP_A1A1" << input_var.getSep() << "sebeta_SNP_A1A2"
                << input_var.getSep() << "sebeta_SNP_A1A1";

    *outfile[1] << input_var.getSep() << "beta_SNP_addA1" << input_var.getSep()
                << "sebeta_SNP_addA1";
    *outfile[2] << input_var.getSep() << "beta_SNP_domA1" << input_var.getSep()
                << "sebeta_SNP_domA1";
    *outfile[3] << input_var.getSep() << "beta_SNP_recA1" << input_var.getSep()
                << "sebeta_SNP_recA1";
    *outfile[4] << input_var.getSep() << "beta_SNP_odom" << input_var.getSep()
                << "sebeta_SNP_odom";
    if (input_var.getInteraction() != 0)
    {
        //Han Chen
        *outfile[0] << input_var.getSep() << "beta_SNP_A1A2_"
                    << phd.model_terms[interaction_cox]
                    << input_var.getSep() << "sebeta_SNP_A1A2_"
                    << phd.model_terms[interaction_cox]
                    << input_var.getSep() << "beta_SNP_A1A1_"
                    << phd.model_terms[interaction_cox]
                    << input_var.getSep() << "sebeta_SNP_A1A1_"
                    << phd.model_terms[interaction_cox];
#if !COXPH
        if (input_var.getInverseFilename() == NULL && !input_var.getAllcov())
        {
            *outfile[0] << input_var.getSep() << "cov_SNP_A1A2_int_SNP_"
                        << phd.model_terms[interaction_cox]
                        << input_var.getSep() << "cov_SNP_A1A1_int_SNP_"
                        << phd.model_terms[interaction_cox];
        }
#endif
        //Oct 26, 2009
        for (unsigned int file = 1; file < outfile.size(); file++)
        {
            *outfile[file] << input_var.getSep() << "beta_SNP_"
                           << phd.model_terms[interaction_cox]
                           << input_var.getSep() << "sebeta_SNP_"
                           << phd.model_terms[interaction_cox];
            //Han Chen
#if !COXPH
            if (input_var.getInverseFilename() == NULL
                && !input_var.getAllcov())
            {
                *outfile[file] << input_var.getSep() << "cov_SNP_int_SNP_"
                               << phd.model_terms[interaction_cox];
            }
#endif
            //Oct 26, 2009
        }
    }
    *outfile[0] << input_var.getSep() << "loglik\n"; //"chi2_SNP_2df\n";
    *outfile[1] << input_var.getSep() << "loglik\n"; //"chi2_SNP_A1\n";
    *outfile[2] << input_var.getSep() << "loglik\n"; //"chi2_SNP_domA1\n";
    *outfile[3] << input_var.getSep() << "loglik\n"; //"chi2_SNP_recA1\n";
    *outfile[4] << input_var.getSep() << "loglik\n"; //"chi2_SNP_odom\n";
}