Skip to content

Commit

Permalink
merged upstream changes to this fork
Browse files Browse the repository at this point in the history
  • Loading branch information
azmfaridee committed May 20, 2012
2 parents fcc4da7 + e7ae6e6 commit 9afd400
Show file tree
Hide file tree
Showing 191 changed files with 9,469 additions and 4,934 deletions.
237 changes: 58 additions & 179 deletions Mothur.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DD76FA90486AB0100D96B5E"
BuildableName = "Mothur"
BuildableName = "mothur"
BlueprintName = "Mothur"
ReferencedContainer = "container:Mothur.xcodeproj">
</BuildableReference>
Expand All @@ -32,7 +32,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DD76FA90486AB0100D96B5E"
BuildableName = "Mothur"
BuildableName = "mothur"
BlueprintName = "Mothur"
ReferencedContainer = "container:Mothur.xcodeproj">
</BuildableReference>
Expand All @@ -50,7 +50,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DD76FA90486AB0100D96B5E"
BuildableName = "Mothur"
BuildableName = "mothur"
BlueprintName = "Mothur"
ReferencedContainer = "container:Mothur.xcodeproj">
</BuildableReference>
Expand All @@ -68,7 +68,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DD76FA90486AB0100D96B5E"
BuildableName = "Mothur"
BuildableName = "mothur"
BlueprintName = "Mothur"
ReferencedContainer = "container:Mothur.xcodeproj">
</BuildableReference>
Expand Down
2 changes: 0 additions & 2 deletions aligncommand.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#ifndef ALIGNCOMMAND_H
#define ALIGNCOMMAND_H

/*
* aligncommand.h
* Mothur
Expand All @@ -10,7 +9,6 @@
*
*/

#include "mothur.h"
#include "command.hpp"
#include "database.hpp"
#include "alignment.hpp"
Expand Down
40 changes: 35 additions & 5 deletions alignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/**************************************************************************************************/

Alignment::Alignment() { /* do nothing */ }
Alignment::Alignment() { m = MothurOut::getInstance(); /* do nothing */ }

/**************************************************************************************************/

Expand Down Expand Up @@ -53,7 +53,8 @@ void Alignment::resize(int A) {

void Alignment::traceBack(){ // This traceback routine is used by the dynamic programming algorithms
try {
// to fill the values of seqAaln and seqBaln
BBaseMap.clear();
ABaseMap.clear(); // to fill the values of seqAaln and seqBaln
seqAaln = "";
seqBaln = "";
int row = lB-1;
Expand All @@ -65,31 +66,51 @@ void Alignment::traceBack(){ // This traceback routine is used by the dynamic
// matrix

if(currentCell.prevCell == 'x'){ seqAaln = seqBaln = "NOALIGNMENT"; }//If there's an 'x' in the bottom-
else{ // right corner bail out because it means nothing got aligned
else{ // right corner bail out because it means nothing got aligned
int count = 0;
while(currentCell.prevCell != 'x'){ // while the previous cell isn't an 'x', keep going...

if(currentCell.prevCell == 'u'){ // if the pointer to the previous cell is 'u', go up in the
seqAaln = '-' + seqAaln; // matrix. this indicates that we need to insert a gap in
seqBaln = seqB[row] + seqBaln; // seqA and a base in seqB
BBaseMap[row] = count;
currentCell = alignment[--row][column];
}
else if(currentCell.prevCell == 'l'){ // if the pointer to the previous cell is 'l', go to the left
seqBaln = '-' + seqBaln; // in the matrix. this indicates that we need to insert a gap
seqAaln = seqA[column] + seqAaln; // in seqB and a base in seqA
ABaseMap[column] = count;
currentCell = alignment[row][--column];
}
else{
seqAaln = seqA[column] + seqAaln; // otherwise we need to go diagonally up and to the left,
seqBaln = seqB[row] + seqBaln; // here we add a base to both alignments
BBaseMap[row] = count;
ABaseMap[column] = count;
currentCell = alignment[--row][--column];
}
count++;
}
}

pairwiseLength = seqAaln.length();

pairwiseLength = seqAaln.length();
seqAstart = 1; seqAend = 0;
seqBstart = 1; seqBend = 0;

//flip maps since we now know the total length
map<int, int> newAMap;
for (map<int, int>::iterator it = ABaseMap.begin(); it != ABaseMap.end(); it++) {
int spot = it->second;
newAMap[pairwiseLength-spot-1] = it->first-1;
}
ABaseMap = newAMap;
map<int, int> newBMap;
for (map<int, int>::iterator it = BBaseMap.begin(); it != BBaseMap.end(); it++) {
int spot = it->second;
newBMap[pairwiseLength-spot-1] = it->first-1;
}
BBaseMap = newBMap;

for(int i=0;i<seqAaln.length();i++){
if(seqAaln[i] != '-' && seqBaln[i] == '-') { seqAstart++; }
else if(seqAaln[i] == '-' && seqBaln[i] != '-') { seqBstart++; }
Expand Down Expand Up @@ -156,7 +177,16 @@ int Alignment::getCandidateEndPos(){
int Alignment::getTemplateStartPos(){
return seqBstart; // this is called to report the quality of the alignment
}
/**************************************************************************************************/

map<int, int> Alignment::getSeqAAlnBaseMap(){
return ABaseMap;
}
/**************************************************************************************************/

map<int, int> Alignment::getSeqBAlnBaseMap(){
return BBaseMap;
}
/**************************************************************************************************/

int Alignment::getTemplateEndPos(){
Expand Down
4 changes: 4 additions & 0 deletions alignment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class Alignment {
// float getAlignmentScore();
string getSeqAAln();
string getSeqBAln();
map<int, int> getSeqAAlnBaseMap();
map<int, int> getSeqBAlnBaseMap();
int getCandidateStartPos();
int getCandidateEndPos();
int getTemplateStartPos();
Expand All @@ -49,6 +51,8 @@ class Alignment {
int pairwiseLength;
int nRows, nCols, lA, lB;
vector<vector<AlignmentCell> > alignment;
map<int, int> ABaseMap;
map<int, int> BBaseMap;
MothurOut* m;
};

Expand Down
4 changes: 2 additions & 2 deletions bayesian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Classify(), kmerSize(ksize), confidenceThreshold(cutoff), iters(i) {
if (baseTName == "saved") { baseTName = rdb->getSavedTaxonomy(); }

/************calculate the probablity that each word will be in a specific taxonomy*************/
string tfileroot = baseTName.substr(0,baseTName.find_last_of(".")+1);
string tfileroot = m->getFullPathName(baseTName.substr(0,baseTName.find_last_of(".")+1));
string tempfileroot = m->getRootName(m->getSimpleName(baseName));
string phyloTreeName = tfileroot + "tree.train";
string phyloTreeSumName = tfileroot + "tree.sum";
Expand Down Expand Up @@ -230,7 +230,7 @@ Classify(), kmerSize(ksize), confidenceThreshold(cutoff), iters(i) {
delete phyloTree;

phyloTree = new PhyloTree(phyloTreeTest, phyloTreeName);
//save probabilities
if (rdb->save) { rdb->wordGenusProb = wordGenusProb; rdb->WordPairDiffArr = WordPairDiffArr; }
}
Expand Down
Loading

0 comments on commit 9afd400

Please sign in to comment.