Ejemplo n.º 1
0
//**********************************************************************************************************************
int SharedCommand::createSharedFromListGroup() {
	try {

        GroupMap* groupMap = NULL;
        CountTable* countTable = NULL;
        pickedGroups = false;
        if (groupfile != "") {
            groupMap = new GroupMap(groupfile);

            int groupError = groupMap->readMap();
            if (groupError == 1) { delete groupMap; return 0; }
            vector<string> allGroups = groupMap->getNamesOfGroups();
            if (Groups.size() == 0) { Groups = allGroups; }
            else { pickedGroups = true; }
        }else{
            countTable = new CountTable();
            countTable->readTable(countfile, true, false);
            vector<string> allGroups = countTable->getNamesOfGroups();
            if (Groups.size() == 0) { Groups = allGroups; }
            else { pickedGroups = true; }
        }
        int numGroups = Groups.size();
        if (m->getControl_pressed()) { return 0; }

        ofstream out;
        string filename = "";
        if (!pickedGroups) {
            string filename = listfile;
            if (outputDir == "") { outputDir += util.hasPath(filename); }

            map<string, string> variables;
            variables["[filename]"] = outputDir + util.getRootName(util.getSimpleName(filename));
            filename = getOutputFileName("shared",variables);
            outputNames.push_back(filename); outputTypes["shared"].push_back(filename);
            util.openOutputFile(filename, out);
        }

        //set fileroot
        fileroot = outputDir + util.getRootName(util.getSimpleName(listfile));
        map<string, string> variables;
		variables["[filename]"] = fileroot;
        string errorOff = "no error";

        InputData input(listfile, "shared", Groups);
        SharedListVector* SharedList = input.getSharedListVector();
        string lastLabel = SharedList->getLabel();
        SharedRAbundVectors* lookup;

        if (m->getControl_pressed()) {
            delete SharedList; if (groupMap != NULL) { delete groupMap; } if (countTable != NULL) { delete countTable; }
            out.close(); if (!pickedGroups) { util.mothurRemove(filename); }
            return 0;
        }

        //sanity check
        vector<string> namesSeqs;
        int numGroupNames = 0;
        if (current->getGroupMode() == "group") { namesSeqs = groupMap->getNamesSeqs(); numGroupNames = groupMap->getNumSeqs(); }
        else { namesSeqs = countTable->getNamesOfSeqs(); numGroupNames = countTable->getNumUniqueSeqs(); }
        int error = ListGroupSameSeqs(namesSeqs, SharedList);

        if ((!pickedGroups) && (SharedList->getNumSeqs() != numGroupNames)) {  //if the user has not specified any groups and their files don't match exit with error
            m->mothurOut("Your group file contains " + toString(numGroupNames) + " sequences and list file contains " + toString(SharedList->getNumSeqs()) + " sequences. Please correct.\n");  m->setControl_pressed(true);

            out.close(); if (!pickedGroups) { util.mothurRemove(filename); } //remove blank shared file you made

            //delete memory
            delete SharedList; if (groupMap != NULL) { delete groupMap; } if (countTable != NULL) { delete countTable; }
            return 0;
        }

        if (error == 1) { m->setControl_pressed(true); }

        //if user has specified groups make new groupfile for them
        if ((pickedGroups) && (current->getGroupMode() == "group")) { //make new group file
            string groups = "";
            if (numGroups < 4) {
                for (int i = 0; i < numGroups-1; i++) {
                    groups += Groups[i] + ".";
                }
                groups+=Groups[numGroups-1];
            }else { groups = "merge"; }
            map<string, string> variables;
            variables["[filename]"] = outputDir + util.getRootName(util.getSimpleName(listfile));
            variables["[group]"] = groups;
            string newGroupFile = getOutputFileName("group",variables);
            outputTypes["group"].push_back(newGroupFile);
            outputNames.push_back(newGroupFile);
            ofstream outGroups;
            util.openOutputFile(newGroupFile, outGroups);

            vector<string> names = groupMap->getNamesSeqs();
            string groupName;
            for (int i = 0; i < names.size(); i++) {
                groupName = groupMap->getGroup(names[i]);
                if (isValidGroup(groupName, Groups)) {
                    outGroups << names[i] << '\t' << groupName << endl;
                }
            }
            outGroups.close();
        }

        //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
        set<string> processedLabels;
        set<string> userLabels = labels;
        bool printHeaders = true;
    
        while((SharedList != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
            if (m->getControl_pressed()) {
                delete SharedList; if (groupMap != NULL) { delete groupMap; } if (countTable != NULL) { delete countTable; }
                if (!pickedGroups) { out.close(); util.mothurRemove(filename); }
                return 0;
            }

            if(allLines == 1 || labels.count(SharedList->getLabel()) == 1){

                lookup = SharedList->getSharedRAbundVector();

                m->mothurOut(lookup->getLabel()+"\n"); 

                if (m->getControl_pressed()) {
                    delete SharedList; if (groupMap != NULL) { delete groupMap; } if (countTable != NULL) { delete countTable; }
                    delete lookup;
                    if (!pickedGroups) { out.close(); util.mothurRemove(filename); }
                    return 0;
                }

                //if picked groups must split the shared file by label
                if (pickedGroups) {
                    string filename = listfile;
                    if (outputDir == "") { outputDir += util.hasPath(filename); }

                    map<string, string> variables;
                    variables["[filename]"] = outputDir + util.getRootName(util.getSimpleName(filename));
                    variables["[distance]"] = lookup->getLabel();
                    filename = getOutputFileName("shared",variables);
                    outputNames.push_back(filename); outputTypes["shared"].push_back(filename);
                    ofstream out2;
                    util.openOutputFile(filename, out2);

                    lookup->eliminateZeroOTUS();
                    printSharedData(lookup, out2, printHeaders);
                    out2.close();
                }else {
                    printSharedData(lookup, out, printHeaders); //prints info to the .shared file
                }
                delete lookup;

                processedLabels.insert(SharedList->getLabel());
                userLabels.erase(SharedList->getLabel());
            }

            if ((util.anyLabelsToProcess(SharedList->getLabel(), userLabels, errorOff) ) && (processedLabels.count(lastLabel) != 1)) {
                string saveLabel = SharedList->getLabel();

                delete SharedList;
                SharedList = input.getSharedListVector(lastLabel); //get new list vector to process

                lookup = SharedList->getSharedRAbundVector();
                m->mothurOut(lookup->getLabel()+"\n"); 

                if (m->getControl_pressed()) {
                    delete SharedList; if (groupMap != NULL) { delete groupMap; } if (countTable != NULL) { delete countTable; }
                    delete lookup;
                    if (!pickedGroups) { out.close(); util.mothurRemove(filename); }
                    return 0;
                }

                //if picked groups must split the shared file by label
                if (pickedGroups) {
                    string filename = listfile;
                    if (outputDir == "") { outputDir += util.hasPath(filename); }

                    map<string, string> variables;
                    variables["[filename]"] = outputDir + util.getRootName(util.getSimpleName(filename));
                    variables["[distance]"] = lookup->getLabel();
                    filename = getOutputFileName("shared",variables);
                    outputNames.push_back(filename); outputTypes["shared"].push_back(filename);
                    ofstream out2;
                    util.openOutputFile(filename, out2);

                    lookup->eliminateZeroOTUS();
                    printSharedData(lookup, out2, printHeaders);
                    out2.close();
                }else {
                    printSharedData(lookup, out, printHeaders); //prints info to the .shared file
                }
                delete lookup;

                processedLabels.insert(SharedList->getLabel());
                userLabels.erase(SharedList->getLabel());

                //restore real lastlabel to save below
                SharedList->setLabel(saveLabel);
            }


            lastLabel = SharedList->getLabel();

            delete SharedList;
            SharedList = input.getSharedListVector(); //get new list vector to process
        }
        
        //output error messages about any remaining user labels
        set<string>::iterator it;
        bool needToRun = false;
        for (it = userLabels.begin(); it != userLabels.end(); it++) {
            if (processedLabels.count(lastLabel) != 1) {
                needToRun = true;
            }
        }
        
        //run last label if you need to
        if (needToRun )  {
            if (SharedList != NULL) {	delete SharedList;	}
            SharedList = input.getSharedListVector(lastLabel); //get new list vector to process

            lookup = SharedList->getSharedRAbundVector();
            m->mothurOut(lookup->getLabel()+"\n"); 

            if (m->getControl_pressed()) {
                if (groupMap != NULL) { delete groupMap; } if (countTable != NULL) { delete countTable; }
                if (!pickedGroups) { out.close(); util.mothurRemove(filename); }
                return 0;
            }

            //if picked groups must split the shared file by label
            if (pickedGroups) {
                string filename = listfile;
                if (outputDir == "") { outputDir += util.hasPath(filename); }

                map<string, string> variables;
                variables["[filename]"] = outputDir + util.getRootName(util.getSimpleName(filename));
                variables["[distance]"] = lookup->getLabel();
                filename = getOutputFileName("shared",variables);
                outputNames.push_back(filename); outputTypes["shared"].push_back(filename);
                ofstream out2;
                util.openOutputFile(filename, out2);

                lookup->eliminateZeroOTUS();
                printSharedData(lookup, out2, printHeaders);
                out2.close();
            }else {
                printSharedData(lookup, out, printHeaders); //prints info to the .shared file
            }
            delete lookup;
            delete SharedList;
        }
        
        if (!pickedGroups) { out.close(); }

        if (groupMap != NULL) { delete groupMap; } if (countTable != NULL) { delete countTable; }

        if (m->getControl_pressed()) {
            if (!pickedGroups) { util.mothurRemove(filename); }
            return 0;
        }
        
        return 0;
    }
	catch(exception& e) {
		m->errorOut(e, "SharedCommand", "createSharedFromListGroup");
		exit(1);
	}
}
Ejemplo n.º 2
0
bool FILE_DATASET_CLASS::deduceTransferSyntax(FILE_TF_CLASS *fileTf_ptr, string &transferSyntax)

//  DESCRIPTION     : Try to deduce the transfer syntax by interpretating the first
//					  data element found.
//  PRECONDITIONS   :
//  POSTCONDITIONS  :
//  EXCEPTIONS      : 
//  NOTES           : 
//<<===========================================================================
{
	BYTE buffer[8];
	TS_CODE tsCode;

	if (loggerM_ptr)
	{
		loggerM_ptr->text(LOG_DEBUG, 1, "Trying to deduce Transfer Syntax directly from first few bytes of stored Dataset...");
	}

	// check file is open
	if (!fileTf_ptr->isOpen())
	{ 
		// can't determine anything
		return false;
	}
			
	// rewind the file buffer
	fileTf_ptr->rewind(0);

	// read the first few bytes of data from the beginning of the file
	if (fileTf_ptr->readBinary(buffer, 8) != 8)
	{
		// rewind the file buffer
		fileTf_ptr->rewind(0);

		// can't find the preamble
		return false;
	}

	// rewind the file buffer
	fileTf_ptr->rewind(0);

	// check if we can make any sense of the first few bytes - they should represent the tag [VR] and length
	// - get big endian values
	UINT16 bigGroup = (buffer[0] * 256) + buffer[1];
	UINT16 bigElement = (buffer[2] * 256) + buffer[3];

	// - get little endian values
	UINT16 littleGroup = (buffer[1] * 256) + buffer[0];
	UINT16 littleElement = (buffer[3] * 256) + buffer[2];

	// debug log the values read
	if (loggerM_ptr)
	{
		loggerM_ptr->text(LOG_DEBUG, 1, "Big endian tag read (%04X,%04X)", bigGroup, bigElement);
		loggerM_ptr->text(LOG_DEBUG, 1, "Little endian tag read (%04X,%04X)", littleGroup, littleElement);
	}

	// try to get a known VR using the endian representations
	ATTR_VR_ENUM vrBig = DEFINITION->GetAttributeVr(bigGroup, bigElement);
	ATTR_VR_ENUM vrLittle = DEFINITION->GetAttributeVr(littleGroup, littleElement);

	// check if we have big endian
	if ((vrBig != ATTR_VR_UN) &&
		(vrLittle == ATTR_VR_UN))
	{
		// byte ordering is big endian
		tsCode = TS_BIG_ENDIAN;
	}
	else if ((vrBig == ATTR_VR_UN) &&
		(vrLittle != ATTR_VR_UN))
	{
		// byte ordering is little endian
		tsCode = TS_LITTLE_ENDIAN;
	}
	else if (isValidGroup(littleGroup) && 
		(littleElement == LENGTH_ELEMENT))
	{
		// special check for a Group Length - not available in definition files
		// byte ordering is little endian
		tsCode = TS_LITTLE_ENDIAN;
		vrLittle = ATTR_VR_UL;
	}
	else if (isValidGroup(bigGroup) && 
		(bigElement == LENGTH_ELEMENT))
	{
		// special check for a Group Length - not available in definition files
		// byte ordering is big endian
		tsCode = TS_BIG_ENDIAN;
		vrBig = ATTR_VR_UL;
	}	
	else if (((bigGroup & 0x0001) != 0) &&
			(bigElement >= 0x0010) &&
			(bigElement <= 0x00FF))
	{
		// special check for a Private Recognition Code - not available in definition files
		// byte ordering is big endian
		tsCode = TS_BIG_ENDIAN;
		vrBig = ATTR_VR_LO;
	}
	else if (((littleGroup & 0x0001) != 0) &&
			(littleElement >= 0x0010) &&
			(littleElement <= 0x00FF))
	{
		// special check for a Private Recognition Code - not available in definition files
		// byte ordering is little endian
		tsCode = TS_LITTLE_ENDIAN;
		vrLittle = ATTR_VR_LO;
	}
	else
	{
		// cannot determine endianess from VR - must stop
		return false;
	}

	// get VR from definition
	ATTR_VR_ENUM vr = vrLittle;
	if (tsCode == TS_BIG_ENDIAN)
	{
		vr = vrBig;
	}

	// now try to determine if we have an implicit or explicit VR
	// - get the VR of the attribute in 16 bit format
	UINT16 vr16 = (buffer[4] * 256) + buffer[5];

	// check if VR's match
	if (fileTf_ptr->vrToVr16(vr) == vr16)
	{
		// VR is explicit
		tsCode |= TS_EXPLICIT_VR;
	}
	else
	{
		// VR is implicit
		tsCode |= TS_IMPLICIT_VR;
	}

	switch(tsCode)
	{
	case TS_IMPLICIT_VR | TS_LITTLE_ENDIAN:
		transferSyntax = IMPLICIT_VR_LITTLE_ENDIAN;
			
		if (loggerM_ptr)
		{
			loggerM_ptr->text(LOG_INFO, 1, "Detected Implicit VR Little Endian Transfer Syntax for File Dataset");
		}
		break;
	case TS_EXPLICIT_VR | TS_LITTLE_ENDIAN:
		transferSyntax = EXPLICIT_VR_LITTLE_ENDIAN;

		if (loggerM_ptr)
		{
			loggerM_ptr->text(LOG_INFO, 1, "Detected Explicit VR Little Endian Transfer Syntax for File Dataset");
		}
		break;
	case TS_EXPLICIT_VR | TS_BIG_ENDIAN:
		transferSyntax = EXPLICIT_VR_BIG_ENDIAN;

		if (loggerM_ptr)
		{
			loggerM_ptr->text(LOG_INFO, 1, "Detected Explicit VR Big Endian Transfer Syntax for File Dataset");
		}
		break;
	default:
		break;
	}

	// return result
	return true;
}
Ejemplo n.º 3
0
int SharedCommand::execute(){
	try {
		
		if (abort == true) { if (calledHelp) { return 0; }  return 2;	}
		
		//getting output filename
		filename = listfile;
		
		if (outputDir == "") { outputDir += m->hasPath(filename); }
		
		filename = outputDir + m->getRootName(m->getSimpleName(filename));
		filename = filename + "shared";
		outputTypes["shared"].push_back(filename);
		
		m->openOutputFile(filename, out);
		pickedGroups = false;
		
		//if hte user has not specified any groups then use them all
		if (Groups.size() == 0) {
			Groups = groupMap->getNamesOfGroups(); m->setGroups(Groups);
		}else { pickedGroups = true; }
		
		//fill filehandles with neccessary ofstreams
		int i;
		ofstream* temp;
		for (i=0; i<Groups.size(); i++) {
			temp = new ofstream;
			filehandles[Groups[i]] = temp;
		}
		
		//set fileroot
		fileroot = outputDir + m->getRootName(m->getSimpleName(listfile));
		
		//clears file before we start to write to it below
		for (int i=0; i<Groups.size(); i++) {
			m->mothurRemove((fileroot + Groups[i] + ".rabund"));
			outputNames.push_back((fileroot + Groups[i] + ".rabund"));
			outputTypes["rabund"].push_back((fileroot + Groups[i] + ".rabund"));
		}
		
		//lookup.clear();
		string errorOff = "no error";
		//errorOff = "";
		
		//if user provided an order file containing the order the shared file should be in read it
		if (ordergroupfile != "") { readOrderFile(); }
		
		input = new InputData(listfile, "shared");
		SharedList = input->getSharedListVector();
		string lastLabel = SharedList->getLabel();
		vector<SharedRAbundVector*> lookup; 
		
		if (m->control_pressed) { 
			delete input; delete SharedList; delete groupMap; 
			for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) {  delete it3->second;  }
			out.close(); m->mothurRemove(filename); 
			for (int i=0; i<Groups.size(); i++) {  m->mothurRemove((fileroot + Groups[i] + ".rabund"));		}
			return 0; 
		}
		
		//sanity check
		int error = ListGroupSameSeqs();
		
		if ((!pickedGroups) && (SharedList->getNumSeqs() != groupMap->getNumSeqs())) {  //if the user has not specified any groups and their files don't match exit with error
			m->mothurOut("Your group file contains " + toString(groupMap->getNumSeqs()) + " sequences and list file contains " + toString(SharedList->getNumSeqs()) + " sequences. Please correct."); m->mothurOutEndLine(); 
			
			out.close();
			m->mothurRemove(filename); //remove blank shared file you made
			
			createMisMatchFile();
			
			//delete memory
			for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) {
				delete it3->second;
			}
		
			delete input; delete SharedList; delete groupMap; 
			
			return 0; 
		}
		
		if (error == 1) { m->control_pressed = true; }
		
		//if user has specified groups make new groupfile for them
		if (pickedGroups) { //make new group file
			string groups = "";
			if (m->getNumGroups() < 4) {
				for (int i = 0; i < m->getNumGroups(); i++) {
					groups += (m->getGroups())[i] + ".";
				}
			}else { groups = "merge"; }
		
			string newGroupFile = outputDir + m->getRootName(m->getSimpleName(listfile)) + groups + "groups";
			outputTypes["group"].push_back(newGroupFile); 
			outputNames.push_back(newGroupFile);
			ofstream outGroups;
			m->openOutputFile(newGroupFile, outGroups);
		
			vector<string> names = groupMap->getNamesSeqs();
			string groupName;
			for (int i = 0; i < names.size(); i++) {
				groupName = groupMap->getGroup(names[i]);
				if (isValidGroup(groupName, m->getGroups())) {
					outGroups << names[i] << '\t' << groupName << endl;
				}
			}
			outGroups.close();
		}
		
		//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
		set<string> processedLabels;
		set<string> userLabels = labels;	
	
		while((SharedList != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
			if (m->control_pressed) { 
				delete input; delete SharedList; delete groupMap;
				for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) {  delete it3->second;  }
				out.close(); m->mothurRemove(filename); 
				for (int i=0; i<Groups.size(); i++) {  m->mothurRemove((fileroot + Groups[i] + ".rabund"));		}
				return 0; 
			}
		
			if(allLines == 1 || labels.count(SharedList->getLabel()) == 1){
					
					lookup = SharedList->getSharedRAbundVector();
					
					m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
					if (pickedGroups) { //check for otus with no seqs in them
						eliminateZeroOTUS(lookup);
					}
					
					if (m->control_pressed) { 
						delete input; delete SharedList; delete groupMap; 
						for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
						for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) {  delete it3->second;  }
						out.close(); m->mothurRemove(filename); 
						for (int i=0; i<Groups.size(); i++) {  m->mothurRemove((fileroot + Groups[i] + ".rabund"));		}
						return 0; 
					}
					
					if (!m->printedHeaders) { lookup[0]->printHeaders(out); }
					printSharedData(lookup); //prints info to the .shared file
					for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
				
					processedLabels.insert(SharedList->getLabel());
					userLabels.erase(SharedList->getLabel());
			}
			
			if ((m->anyLabelsToProcess(SharedList->getLabel(), userLabels, errorOff) == true) && (processedLabels.count(lastLabel) != 1)) {
					string saveLabel = SharedList->getLabel();
					
					delete SharedList;
					SharedList = input->getSharedListVector(lastLabel); //get new list vector to process
					
					lookup = SharedList->getSharedRAbundVector();
					m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
					if (pickedGroups) { //check for otus with no seqs in them
						eliminateZeroOTUS(lookup);
					}
					
					
					if (m->control_pressed) { 
						delete input; delete SharedList; delete groupMap; 
						for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
						for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) {  delete it3->second;  }
						out.close(); m->mothurRemove(filename); 
						for (int i=0; i<Groups.size(); i++) {  m->mothurRemove((fileroot + Groups[i] + ".rabund"));		}
						return 0; 
					}
					
					if (!m->printedHeaders) { lookup[0]->printHeaders(out); }
					printSharedData(lookup); //prints info to the .shared file
					for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
					
					processedLabels.insert(SharedList->getLabel());
					userLabels.erase(SharedList->getLabel());
					
					//restore real lastlabel to save below
					SharedList->setLabel(saveLabel);
			}
			
		
			lastLabel = SharedList->getLabel();
				
			delete SharedList;
			SharedList = input->getSharedListVector(); //get new list vector to process
		}
		
		//output error messages about any remaining user labels
		set<string>::iterator it;
		bool needToRun = false;
		for (it = userLabels.begin(); it != userLabels.end(); it++) {  
			if (processedLabels.count(lastLabel) != 1) {
				needToRun = true;
			}
		}
		
		//run last label if you need to
		if (needToRun == true)  {
			if (SharedList != NULL) {	delete SharedList;	}
			SharedList = input->getSharedListVector(lastLabel); //get new list vector to process
					
			lookup = SharedList->getSharedRAbundVector();
			m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
			if (pickedGroups) { //check for otus with no seqs in them
				eliminateZeroOTUS(lookup);
			}
			
			if (m->control_pressed) { 
				delete input;  delete groupMap;
					for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) {  delete it3->second;   }
					out.close(); m->mothurRemove(filename); 
					for (int i=0; i<Groups.size(); i++) {  m->mothurRemove((fileroot + Groups[i] + ".rabund"));		}
					return 0; 
			}
			
			if (!m->printedHeaders) { lookup[0]->printHeaders(out); }
			printSharedData(lookup); //prints info to the .shared file
			for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
			delete SharedList;
		}
		
		out.close();
		
		for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) {
			delete it3->second;
		}

		delete input; delete groupMap;
		
		if (m->control_pressed) { 
				m->mothurRemove(filename); 
				for (int i=0; i<Groups.size(); i++) {  m->mothurRemove((fileroot + Groups[i] + ".rabund"));		}
				return 0; 
		}
		
		//set rabund file as new current rabundfile
		string current = "";
		itTypes = outputTypes.find("rabund");
		if (itTypes != outputTypes.end()) {
			if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
		}
		
		itTypes = outputTypes.find("shared");
		if (itTypes != outputTypes.end()) {
			if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSharedFile(current); }
		}	
		
		itTypes = outputTypes.find("group");
		if (itTypes != outputTypes.end()) {
			if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
		}
		
		m->mothurOutEndLine();
		m->mothurOut("Output File Names: "); m->mothurOutEndLine();
		for (int i = 0; i < outputNames.size(); i++) {	m->mothurOut(outputNames[i]); m->mothurOutEndLine();	}
		m->mothurOut(filename); m->mothurOutEndLine();
		m->mothurOutEndLine();
		
		return 0;
	}
	catch(exception& e) {
		m->errorOut(e, "SharedCommand", "execute");
		exit(1);
	}
}