File: mimarksattributescommand.h

package info (click to toggle)
mothur 1.48.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,684 kB
  • sloc: cpp: 161,854; makefile: 122; sh: 31
file content (101 lines) | stat: -rwxr-xr-x 2,863 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//
//  mimarksattributescommand.h
//  Mothur
//
//  Created by Sarah Westcott on 3/17/15.
//  Copyright (c) 2015 Schloss Lab. All rights reserved.
//

#ifndef __Mothur__mimarksattributescommand__
#define __Mothur__mimarksattributescommand__

#include "command.hpp"

struct Package {
    bool required;
    string groupName;
    string name;
    Package() { required=false; groupName=""; name=""; }
    Package(bool r, string g, string n) : required(r), groupName(g), name(n) {}
    ~Package() = default;
    
    string getPackageString() {
        string r = "mandatory";
        if (!required) { r = "optional";  }
        string packageString = name + '\t' + groupName + '\t' + r;
        return packageString;
    }
};

struct Value {
    bool required;
    string format, description;
    
    Value() { format=""; description=""; required=false; }
    Value(bool r, string d, string f) : format(f), description(d), required(r) {}
    ~Value() = default;

};

struct Group {
    string packageName;
    map<string, Value> values;
    
    Group() { packageName = ""; }
    Group(string p) :  packageName(p) {}
    ~Group() = default;
};

struct Attribute {
    string name, harmonizedName, description, format;
    vector<Package> packages;
    
    string getPackagesString() {
        string packagesString = "";
        for (int i = 0; i < packages.size(); i++) {
            packagesString += packages[i].getPackageString() + "\n";
        }
        return packagesString;
    }
    
    Attribute() { format=""; description=""; harmonizedName=""; name=""; }
    Attribute(string hn, string d, string n, string f) : format(f), harmonizedName(hn), name(n), description(d) {}
    ~Attribute() = default;
};

/**************************************************************************************************/

class MimarksAttributesCommand : public Command {
public:
    MimarksAttributesCommand(string);
   ~MimarksAttributesCommand(){}
    
    vector<string> setParameters();
    string getCommandName()			{ return "mimarks.attributes";			}
    string getCommandCategory()		{ return "Hidden";		}
    
    string getOutputPattern(string);
    
    string getHelpString();
    string getCitation() { return "http://www.mothur.org/wiki/Mimarks.attributes"; }
    string getDescription()		{ return "Reads bioSample Attributes xml and generates source for get.mimarkspackage command."; }
    
    int execute();
    void help() { m->mothurOut(getHelpString()); }
    
private:

    Attribute readAttribute(ifstream& in);
    Package parsePackage(string package);
    string trimTags(string& value);
    
    bool abort;
    string  xmlFile, selectedPackage;
    vector<string> outputNames;
};

/**************************************************************************************************/



#endif /* defined(__Mothur__mimarksattributescommand__) */