diff --git a/alignment.cpp b/alignment.cpp index a0a27a6c..0b04a128 100644 --- a/alignment.cpp +++ b/alignment.cpp @@ -763,8 +763,22 @@ SeqType Alignment::detectSequenceType(StrVector &sequences) { } if (((double)num_nuc) / num_ungap > 0.9) return SEQ_DNA; - if (((double)num_bin) / num_ungap > 0.9) - return SEQ_BINARY; + if (((double)num_bin) / num_ungap > 0.9) { + cout << "[BINARY-SEQUENCE-WARNING]" << endl; + cout << "Since the PLL library we are using only supports sequence of type DNA, the following process will treat the input as DNA (mapping 0 to A and 1 to G) and not break the property of resulting trees." << endl; + cout << "[BINARY-SEQUENCE-WARNING]" << endl; + cout << endl; + + for (StrVector::iterator it = sequences.begin(); it != sequences.end(); it++) { + for (string::iterator i = it->begin(); i != it->end(); i++) { + if ((*i) == '0') *i = 'A'; + if ((*i) == '1') *i = 'G'; + if ((*i) == '-') *i = 'R'; + } + } + + return SEQ_DNA; + } if (((double)num_alpha) / num_ungap > 0.9) return SEQ_PROTEIN; if (((double)(num_alpha+num_digit)) / num_ungap > 0.9) diff --git a/phyloanalysis.cpp b/phyloanalysis.cpp index 3b825adc..b63a20c0 100644 --- a/phyloanalysis.cpp +++ b/phyloanalysis.cpp @@ -2130,6 +2130,10 @@ void runPhyloAnalysis(Params ¶ms) { IQTree *tree; /****************** read in alignment **********************/ + if (strcmp(params.sequence_type, "BIN") == 0) { + params.sequence_type = "DNA"; + } + if (params.partition_file) { // Partition model analysis if(params.partition_type){ @@ -2159,8 +2163,6 @@ void runPhyloAnalysis(Params ¶ms) { alignment = aln; } tree = new IQTree(alignment); - - } // if(params.maximum_parsimony && (params.gbo_replicates || params.sankoff_cost_file)){