else if (alignfile != "") { inputFileName = alignfile; readAlign(); }
else if (listfile != "") { inputFileName = listfile; readList(); }
+ if (m->control_pressed) { return 0; }
+
//sort in alphabetical order
sort(names.begin(), names.end());
//output to .accnos file
for (int i = 0; i < names.size(); i++) {
+
+ if (m->control_pressed) { out.close(); remove(outputFileName.c_str()); return 0; }
+
out << names[i] << endl;
}
out.close();
+ if (m->control_pressed) { remove(outputFileName.c_str()); return 0; }
+
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
m->mothurOut(outputFileName); m->mothurOutEndLine();
}
//**********************************************************************************************************************
-void ListSeqsCommand::readFasta(){
+int ListSeqsCommand::readFasta(){
try {
ifstream in;
string name;
while(!in.eof()){
+
+ if (m->control_pressed) { in.close(); return 0; }
+
Sequence currSeq(in);
name = currSeq.getName();
gobble(in);
}
- in.close();
+ in.close();
+
+ return 0;
}
catch(exception& e) {
}
}
//**********************************************************************************************************************
-void ListSeqsCommand::readList(){
+int ListSeqsCommand::readList(){
try {
ifstream in;
openInputFile(listfile, in);
for (int i = 0; i < list.getNumBins(); i++) {
string binnames = list.get(i);
+ if (m->control_pressed) { in.close(); return 0; }
+
while (binnames.find_first_of(',') != -1) {
string name = binnames.substr(0,binnames.find_first_of(','));
binnames = binnames.substr(binnames.find_first_of(',')+1, binnames.length());
}
in.close();
+ return 0;
+
}
catch(exception& e) {
m->errorOut(e, "ListSeqsCommand", "readList");
}
//**********************************************************************************************************************
-void ListSeqsCommand::readName(){
+int ListSeqsCommand::readName(){
try {
ifstream in;
string name, firstCol, secondCol;
while(!in.eof()){
+
+ if (m->control_pressed) { in.close(); return 0; }
in >> firstCol;
in >> secondCol;
gobble(in);
}
in.close();
+ return 0;
}
catch(exception& e) {
}
//**********************************************************************************************************************
-void ListSeqsCommand::readGroup(){
+int ListSeqsCommand::readGroup(){
try {
ifstream in;
string name, group;
while(!in.eof()){
-
+
+ if (m->control_pressed) { in.close(); return 0; }
+
in >> name; //read from first column
in >> group; //read from second column
gobble(in);
}
in.close();
+ return 0;
}
catch(exception& e) {
//**********************************************************************************************************************
//alignreport file has a column header line then all other lines contain 16 columns. we just want the first column since that contains the name
-void ListSeqsCommand::readAlign(){
+int ListSeqsCommand::readAlign(){
try {
ifstream in;
while(!in.eof()){
+
+ if (m->control_pressed) { in.close(); return 0; }
in >> name; //read from first column
gobble(in);
}
in.close();
+
+ return 0;
}