5 * Created by Thomas Ryabin on 1/30/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "getlabelcommand.h"
12 //**********************************************************************************************************************
14 GetlabelCommand::GetlabelCommand(string option){
16 globaldata = GlobalData::getInstance();
19 //allow user to run help
20 if(option == "help") { help(); abort = true; }
23 if (option != "") { mothurOut("There are no valid parameters for the get.label command."); mothurOutEndLine(); abort = true; }
25 if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { mothurOut("You must read a list, sabund or rabund before you can use the get.label command."); mothurOutEndLine(); abort = true; }
30 errorOut(e, "GetlabelCommand", "GetlabelCommand");
34 //**********************************************************************************************************************
36 void GetlabelCommand::help(){
38 mothurOut("The get.label command can only be executed after a successful read.otu command.\n");
39 mothurOut("You may not use any parameters with the get.label command.\n");
40 mothurOut("The get.label command should be in the following format: \n");
41 mothurOut("get.label()\n");
42 mothurOut("Example get.label().\n");
45 errorOut(e, "GetlabelCommand", "help");
50 //**********************************************************************************************************************
52 GetlabelCommand::~GetlabelCommand(){
55 //**********************************************************************************************************************
57 int GetlabelCommand::execute(){
60 if (abort == true) { return 0; }
62 filename = globaldata->inputFileName;
64 openInputFile(filename, in);
72 mothurOut(label); mothurOutEndLine();
84 errorOut(e, "GetlabelCommand", "execute");