Skip to content

Commit

Permalink
Merge branch 'ufboot2corr' into latest
Browse files Browse the repository at this point in the history
  • Loading branch information
bqminh committed May 5, 2017
2 parents 1edf317 + aa85dfd commit adbb56d
Show file tree
Hide file tree
Showing 11 changed files with 496 additions and 28 deletions.
37 changes: 37 additions & 0 deletions alignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3093,6 +3093,43 @@ void Alignment::createBootstrapAlignment(int *pattern_freq, const char *spec, in
}
}


void Alignment::buildFromPatternFreq(Alignment & aln, IntVector new_pattern_freqs){
int nsite = aln.getNSite();
seq_names.insert(seq_names.begin(), aln.seq_names.begin(), aln.seq_names.end());
num_states = aln.num_states;
seq_type = aln.seq_type;

genetic_code = aln.genetic_code;
STATE_UNKNOWN = aln.STATE_UNKNOWN;
site_pattern.resize(nsite, -1);

clear();
pattern_index.clear();

int site = 0;
std::vector<Pattern>::iterator it;
int p;

for(it = aln.begin(), p = 0; it != aln.end(); ++it, ++p) {
if(new_pattern_freqs[p] > 0){
Pattern pat = *it;
addPattern(pat, site, new_pattern_freqs[p]);
for (int j = 0; j < new_pattern_freqs[p]; j++)
site_pattern[site++] = size()-1;
}
}
if (!aln.site_state_freq.empty()) {
site_model = site_pattern;
assert(site_state_freq.size() == getNPattern());
}

countConstSite();
buildSeqStates();
// checkSeqName();
}


void Alignment::createGapMaskedAlignment(Alignment *masked_aln, Alignment *aln) {
if (masked_aln->getNSeq() != aln->getNSeq()) outError("Different number of sequences in masked alignment");
if (masked_aln->getNSite() != aln->getNSite()) outError("Different number of sites in masked alignment");
Expand Down
8 changes: 8 additions & 0 deletions alignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,14 @@ class Alignment : public vector<Pattern> {
*/
virtual void createBootstrapAlignment(int *pattern_freq, const char *spec = NULL, int *rstream = NULL);

/**
Diep: This is for UFBoot2-Corr
Initialize "this" alignment as a bootstrap alignment
@param aln: the reference to the original alignment
@new_pattern_freqs: the frequencies of patterns to be present in bootstrap aln
*/
void buildFromPatternFreq(Alignment & aln, IntVector new_pattern_freqs);

/**
create a gap masked alignment from an input alignment. Gap patterns of masked_aln
will be superimposed into aln to create the current alignment object.
Expand Down
Loading

0 comments on commit adbb56d

Please sign in to comment.