Skip to content

Commit

Permalink
Update dosage template
Browse files Browse the repository at this point in the history
  • Loading branch information
choishingwan committed May 26, 2017
1 parent 236b70b commit 4e77c96
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/binarygen.cpp
Expand Up @@ -50,7 +50,6 @@ BinaryGen::BinaryGen(std::string prefix, std::string pheno_file,

BinaryGen::~BinaryGen()
{
if(m_tmp_genotype != nullptr) delete [] m_tmp_genotype;
}

std::vector<SNP> BinaryGen::load_snps()
Expand Down
1 change: 0 additions & 1 deletion src/binaryplink.cpp
Expand Up @@ -47,7 +47,6 @@ BinaryPlink::BinaryPlink(std::string prefix, std::string remove_sample, std::str

BinaryPlink::~BinaryPlink()
{
if(m_tmp_genotype != nullptr) delete [] m_tmp_genotype;
}
std::vector<Sample> BinaryPlink::load_samples(bool ignore_fid)
{
Expand Down
1 change: 1 addition & 0 deletions src/genotype.cpp
Expand Up @@ -182,6 +182,7 @@ Genotype::~Genotype() {
if(m_marker_exclude != nullptr) delete [] m_marker_exclude;
if(m_haploid_mask != nullptr) delete [] m_haploid_mask;
if(m_chrom_mask != nullptr) delete [] m_chrom_mask;
if(m_tmp_genotype != nullptr) delete [] m_tmp_genotype;
}

void Genotype::read_base(const Commander &c_commander, Region &region)
Expand Down
8 changes: 6 additions & 2 deletions template/dosagetemplate.cpp
Expand Up @@ -59,7 +59,6 @@ Dosage_template::Dosage_template(std::string prefix, std::string pheno_file, boo
// num_line is the SNP id from the file, e.g. 0 for the first SNP
// this will be use for jumping to the specific SNP
m_existed_snps = load_snps();

if(verbose)
{
fprintf(stderr, "%zu people (%zu males, %zu females) included\n", m_unfiltered_sample_ct, m_num_male, m_num_female);
Expand All @@ -68,10 +67,15 @@ Dosage_template::Dosage_template(std::string prefix, std::string pheno_file, boo
}
// You should always include this to initialize the variables correctly
initialize();
// You should also initialize this here
// this is a temporary object required for Plink processing. By pre-initializing
// it here, this should help to speed things up
m_tmp_genotype = new uintptr_t[m_unfiltered_sample_ctl*2];

}

Dosage_template::~Dosage_template()
{
// TODO Auto-generated destructor stub
// Don't need to delete m_tmp_genotype here as the base class should do it
}

0 comments on commit 4e77c96

Please sign in to comment.