| 83 | } |
| 84 | |
| 85 | void TOPPASOutputFileListVertex::run() |
| 86 | { |
| 87 | __DEBUG_BEGIN_METHOD__ |
| 88 | |
| 89 | // copy tmp files to output dir |
| 90 | |
| 91 | // get incoming edge and preceding vertex |
| 92 | TOPPASEdge* e = *inEdgesBegin(); |
| 93 | RoundPackages pkg = e->getSourceVertex()->getOutputFiles(); |
| 94 | if (pkg.empty()) |
| 95 | { |
| 96 | std::cerr << "A problem occurred while grabbing files from the parent tool. This is a bug, please report it!" << std::endl; |
| 97 | __DEBUG_END_METHOD__ |
| 98 | return; |
| 99 | } |
| 100 | |
| 101 | String full_dir = createOutputDir(); // create output dir |
| 102 | |
| 103 | round_total_ = (int) pkg.size(); // take number of rounds from previous tool(s) - should all be equal |
| 104 | round_counter_ = 0; // once round_counter_ reaches round_total_, we are done |
| 105 | |
| 106 | // clear output file list |
| 107 | output_files_.clear(); |
| 108 | output_files_.resize(pkg.size()); // #rounds |
| 109 | |
| 110 | files_total_ = 0; |
| 111 | files_written_ = 0; |
| 112 | |
| 113 | const TOPPASScene* ts = qobject_cast<TOPPASScene*>(scene()); |
| 114 | bool dry_run = ts->isDryRun(); |
| 115 | |
| 116 | int param_index_src = e->getSourceOutParam(); |
| 117 | int param_index_me = e->getTargetInParam(); |
| 118 | for (Size round = 0; round < pkg.size(); ++round) |
| 119 | { |
| 120 | foreach(const QString &f, pkg[round][param_index_src].filenames.get()) |
| 121 | { |
| 122 | if (!dry_run && !File::exists(f)) |
| 123 | { |
| 124 | OPENMS_LOG_ERROR << "The file '" << String(f) << "' does not exist!" << std::endl; |
| 125 | throw Exception::FileNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, f.toStdString()); |
| 126 | } |
| 127 | QString new_file = full_dir.toQString() |
| 128 | + QDir::separator() |
| 129 | + File::basename(f).toQString(); |
| 130 | |
| 131 | // remove "_tmp<number>" if its a suffix |
| 132 | QRegExp rx("_tmp\\d+$"); |
| 133 | int tmp_index = rx.indexIn(new_file); |
| 134 | if (tmp_index != -1) |
| 135 | { |
| 136 | new_file = new_file.left(tmp_index); |
| 137 | } |
| 138 | |
| 139 | // get file type and rename |
| 140 | FileTypes::Type ft = FileTypes::UNKNOWN; |
| 141 | if (!dry_run) |
| 142 | { |
nothing calls this directly
no test coverage detected