Skip to content

Commit

Permalink
fixed jest calc to return only value between 0 and 1. Modified reads …
Browse files Browse the repository at this point in the history
…in get.seqs, remove.seqs, remove.lineage, get.lineage, screen.seqs, pcr.seqs changed read of count file causing file mismatches with count files that didn't include group data. Fixed bug with make.contigs and reverse index files. Added another file types to fastq.info parse to work towards completion of sra command. Added "NONE" to reverseOligos function.
  • Loading branch information
mothur-westcott committed Sep 29, 2014
1 parent f806efc commit f7eb3d6
Show file tree
Hide file tree
Showing 12 changed files with 427 additions and 87 deletions.
5 changes: 3 additions & 2 deletions getlineagecommand.cpp
Expand Up @@ -492,15 +492,16 @@ int GetLineageCommand::readCount(){

string headers = m->getline(in); m->gobble(in);
out << headers << endl;
string test = headers; vector<string> pieces = m->splitWhiteSpace(test);

string name, rest; int thisTotal;
string name, rest; int thisTotal; rest = "";
while (!in.eof()) {

if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }

in >> name; m->gobble(in);
in >> thisTotal; m->gobble(in);
rest = m->getline(in); m->gobble(in);
if (pieces.size() > 2) { rest = m->getline(in); m->gobble(in); }
if (m->debug) { m->mothurOut("[DEBUG]: " + name + '\t' + rest + "\n"); }

if (names.count(name) != 0) {
Expand Down
14 changes: 13 additions & 1 deletion linearalgebra.cpp
Expand Up @@ -1889,29 +1889,35 @@ void LinearAlgebra::ludcmp(vector<vector<double> >& A, vector<int>& index, doubl

void LinearAlgebra::lubksb(vector<vector<double> >& A, vector<int>& index, vector<double>& b){
try {
//if(m->debug){ m->mothurOut("lubksb\n"); }
double total;
int n = (int)A.size();
int ii = 0;

for(int i=0;i<n;i++){
//if(m->debug){ m->mothurOut("i loop " + toString(i) + "\n"); }
if (m->control_pressed) { break; }
int ip = index[i];
total = b[ip];
b[ip] = b[i];

if (ii != 0) {
for(int j=ii-1;j<i;j++){
//if(m->debug){ m->mothurOut("j loop " + toString(j) + "\n"); }
total -= A[i][j] * b[j];
}
}
else if(total != 0){ ii = i+1; }
b[i] = total;
}
for(int i=n-1;i>=0;i--){
//if(m->debug){ m->mothurOut("i loop " + toString(i) + "\n"); }
total = b[i];
for(int j=i+1;j<n;j++){ total -= A[i][j] * b[j]; }
for(int j=i+1;j<n;j++){ total -= A[i][j] * b[j]; }
b[i] = total / A[i][i];
//if (A[i][i] == 0) { cout << "ohno!!" << endl; }
}
//if(m->debug){ m->mothurOut("end lubksb\n"); }
}
catch(exception& e) {
m->errorOut(e, "LinearAlgebra", "lubksb");
Expand All @@ -1922,6 +1928,7 @@ void LinearAlgebra::lubksb(vector<vector<double> >& A, vector<int>& index, vecto

void LinearAlgebra::ludcmp(vector<vector<float> >& A, vector<int>& index, float& d){
try {
//if(m->debug){ m->mothurOut("ludcmp\n"); }
double tiny = 1e-20;

int n = (int)A.size();
Expand All @@ -1932,6 +1939,7 @@ void LinearAlgebra::ludcmp(vector<vector<float> >& A, vector<int>& index, float&
d = 1.0;

for(int i=0;i<n;i++){
//if(m->debug){ m->mothurOut("i loop " + toString(i) + "\n"); }
float big = 0.0;
for(int j=0;j<n;j++){ if((temp=fabs(A[i][j])) > big ) big=temp; }
if(big==0.0){ m->mothurOut("Singular matrix in routine ludcmp\n"); }
Expand All @@ -1940,14 +1948,17 @@ void LinearAlgebra::ludcmp(vector<vector<float> >& A, vector<int>& index, float&

for(int j=0;j<n;j++){
if (m->control_pressed) { break; }
//if(m->debug){ m->mothurOut("j loop " + toString(j) + "\n"); }
for(int i=0;i<j;i++){
//if(m->debug){ m->mothurOut("i loop " + toString(i) + "\n"); }
float sum = A[i][j];
for(int k=0;k<i;k++){ sum -= A[i][k] * A[k][j]; }
A[i][j] = sum;
}

float big = 0.0;
for(int i=j;i<n;i++){
//if(m->debug){ m->mothurOut("j loop " + toString(j) + "\n"); }
float sum = A[i][j];
for(int k=0;k<j;k++){ sum -= A[i][k] * A[k][j]; }
A[i][j] = sum;
Expand Down Expand Up @@ -1975,6 +1986,7 @@ void LinearAlgebra::ludcmp(vector<vector<float> >& A, vector<int>& index, float&
for(int i=j+1;i<n;i++){ A[i][j] *= dum; }
}
}
//if(m->debug){ m->mothurOut("end ludcmp\n"); }
}
catch(exception& e) {
m->errorOut(e, "LinearAlgebra", "ludcmp");
Expand Down
2 changes: 1 addition & 1 deletion makecontigscommand.cpp
Expand Up @@ -977,7 +977,7 @@ int MakeContigsCommand::driver(vector<string> files, string outputFasta, string

if (thisrindexfile != "") {
Sequence temp(inRIndex); m->gobble(inRIndex);
rindexBarcode.setAligned(temp.getAligned());
rindexBarcode.setAligned(trimOligos.reverseOligo(temp.getAligned()));
}

int barcodeIndex = 0;
Expand Down
3 changes: 3 additions & 0 deletions oligos.cpp
Expand Up @@ -461,6 +461,9 @@ map<int, oligosPair> Oligos::getReorientedPairedBarcodes(){
//********************************************************************/
string Oligos::reverseOligo(string oligo){
try {

if (oligo == "NONE") { return "NONE"; }

string reverse = "";

for(int i=oligo.length()-1;i>=0;i--){
Expand Down

0 comments on commit f7eb3d6

Please sign in to comment.