vector<string> setParameters();
string getCommandName() { return "summary.seqs"; }
string getCommandCategory() { return "Sequence Processing"; }
+
string getHelpString();
+ string getOutputPattern(string);
string getCitation() { return "http://www.mothur.org/wiki/Summary.seqs"; }
string getDescription() { return "summarize the quality of sequences in an unaligned or aligned fasta file"; }
void help() { m->mothurOut(getHelpString()); }
private:
bool abort;
- string fastafile, outputDir, namefile;
+ string fastafile, outputDir, namefile, countfile;
int processors;
vector<string> outputNames;
map<string, int> nameMap;
//custom data structure for threads to use.
// This is passed by void pointer so it can be any data type
// that can be passed using a single void pointer (LPVOID).
-typedef struct seqSumData {
- vector<int>* startPosition;
- vector<int>* endPosition;
- vector<int>* seqLength;
- vector<int>* ambigBases;
- vector<int>* longHomoPolymer;
+struct seqSumData {
+ vector<int> startPosition;
+ vector<int> endPosition;
+ vector<int> seqLength;
+ vector<int> ambigBases;
+ vector<int> longHomoPolymer;
string filename;
string sumFile;
unsigned long long start;
unsigned long long end;
int count;
MothurOut* m;
- string namefile;
+ bool hasNameMap;
map<string, int> nameMap;
seqSumData(){}
- seqSumData(vector<int>* s, vector<int>* e, vector<int>* l, vector<int>* a, vector<int>* h, string f, string sf, MothurOut* mout, unsigned long long st, unsigned long long en, string na, map<string, int> nam) {
- startPosition = s;
- endPosition = e;
- seqLength = l;
- ambigBases = a;
- longHomoPolymer = h;
+ seqSumData(string f, string sf, MothurOut* mout, unsigned long long st, unsigned long long en, bool na, map<string, int> nam) {
filename = f;
sumFile = sf;
m = mout;
start = st;
end = en;
- namefile = na;
+ hasNameMap = na;
nameMap = nam;
count = 0;
}
};
/**************************************************************************************************/
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
#else
static DWORD WINAPI MySeqSumThreadFunction(LPVOID lpParam){
seqSumData* pDataArray;
in.seekg(pDataArray->start-1); pDataArray->m->gobble(in);
}
- pDataArray->count = pDataArray->end;
for(int i = 0; i < pDataArray->end; i++){ //end is the number of sequences to process
+ pDataArray->count++;
+
if (pDataArray->m->control_pressed) { in.close(); outSummary.close(); pDataArray->count = 1; return 1; }
Sequence current(in); pDataArray->m->gobble(in);
if (current.getName() != "") {
int num = 1;
- if (pDataArray->namefile != "") {
+ if (pDataArray->hasNameMap){
//make sure this sequence is in the namefile, else error
map<string, int>::iterator it = pDataArray->nameMap.find(current.getName());
- if (it == pDataArray->nameMap.end()) { pDataArray->m->mothurOut("[ERROR]: " + current.getName() + " is not in your namefile, please correct."); pDataArray->m->mothurOutEndLine(); pDataArray->m->control_pressed = true; }
+ if (it == pDataArray->nameMap.end()) { pDataArray->m->mothurOut("[ERROR]: " + current.getName() + " is not in your name or count file, please correct."); pDataArray->m->mothurOutEndLine(); pDataArray->m->control_pressed = true; }
else { num = it->second; }
}
//for each sequence this sequence represents
for (int i = 0; i < num; i++) {
- pDataArray->startPosition->push_back(current.getStartPos());
- pDataArray->endPosition->push_back(current.getEndPos());
- pDataArray->seqLength->push_back(current.getNumBases());
- pDataArray->ambigBases->push_back(current.getAmbigBases());
- pDataArray->longHomoPolymer->push_back(current.getLongHomoPolymer());
+ pDataArray->startPosition.push_back(current.getStartPos());
+ pDataArray->endPosition.push_back(current.getEndPos());
+ pDataArray->seqLength.push_back(current.getNumBases());
+ pDataArray->ambigBases.push_back(current.getAmbigBases());
+ pDataArray->longHomoPolymer.push_back(current.getLongHomoPolymer());
}
outSummary << current.getName() << '\t';