| 70 | } |
| 71 | |
| 72 | void writeTermTree_(const String& accession, const ControlledVocabulary& cv, TextFile& file, UInt indent) |
| 73 | { |
| 74 | const ControlledVocabulary::CVTerm& term = cv.getTerm(accession); |
| 75 | for (set<String>::const_iterator it = term.children.begin(); it != term.children.end(); ++it) |
| 76 | { |
| 77 | const ControlledVocabulary::CVTerm& child_term = cv.getTerm(*it); |
| 78 | String subterm_line; |
| 79 | for (Size i = 0; i < 4 * indent; ++i) subterm_line += " "; |
| 80 | String description = child_term.description; |
| 81 | if (!child_term.synonyms.empty()) |
| 82 | { |
| 83 | description += String(" -- Synonyms: '") + ListUtils::concatenate(child_term.synonyms, ", ") + "'"; |
| 84 | } |
| 85 | subterm_line += "- <span title=\"" + description + "\">" + child_term.id + " ! " + child_term.name + "</span>"; |
| 86 | StringList tags; |
| 87 | if (child_term.obsolete) |
| 88 | { |
| 89 | tags.push_back("<font color=darkred>obsolete</font>"); |
| 90 | } |
| 91 | if (child_term.xref_type != ControlledVocabulary::CVTerm::NONE) |
| 92 | { |
| 93 | tags.push_back("value-type=" + ControlledVocabulary::CVTerm::getXRefTypeName(child_term.xref_type)); |
| 94 | } |
| 95 | if (!child_term.units.empty()) |
| 96 | { |
| 97 | StringList units; |
| 98 | for (set<String>::const_iterator u_it = child_term.units.begin(); u_it != child_term.units.end(); ++u_it) |
| 99 | { |
| 100 | units.push_back(*u_it + "!" + cv.getTerm(*u_it).name); |
| 101 | } |
| 102 | tags.push_back(String("units=") + ListUtils::concatenate(units, ",")); |
| 103 | } |
| 104 | if (!child_term.xref_binary.empty()) |
| 105 | { |
| 106 | StringList types; |
| 107 | for (StringList::const_iterator u_it = child_term.xref_binary.begin(); u_it != child_term.xref_binary.end(); ++u_it) |
| 108 | { |
| 109 | types.push_back(*u_it + "!" + cv.getTerm(*u_it).name); |
| 110 | } |
| 111 | tags.push_back(String("binary-array-types=") + ListUtils::concatenate(types, ",")); |
| 112 | } |
| 113 | if (!tags.empty()) |
| 114 | { |
| 115 | subterm_line += String("<FONT color=\"grey\"> (") + ListUtils::concatenate(tags, ", ") + ")</FONT>"; |
| 116 | } |
| 117 | file.addLine(subterm_line + "<BR>"); |
| 118 | writeTermTree_(child_term.id, cv, file, indent + 1); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | ExitCodes main_(int, const char**) override |
| 123 | { |