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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684
|
// --------------------------------------------------------------------------
// OpenMS -- Open-Source Mass Spectrometry
// --------------------------------------------------------------------------
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
// ETH Zurich, and Freie Universitaet Berlin 2002-2013.
//
// This software is released under a three-clause BSD license:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of any author or any participating institution
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
// For a full list of authors, refer to the file AUTHORS.
// --------------------------------------------------------------------------
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// --------------------------------------------------------------------------
// $Maintainer: Stephan Aiche $
// $Authors: Andreas Bertsch $
// --------------------------------------------------------------------------
#include <OpenMS/FORMAT/XTandemInfile.h>
#include <OpenMS/SYSTEM/File.h>
#include <OpenMS/CHEMISTRY/ModificationsDB.h>
#include <set>
#include <fstream>
using namespace xercesc;
using namespace std;
namespace OpenMS
{
XTandemInfile::XTandemInfile() :
Internal::XMLFile(),
fragment_mass_tolerance_(0.3),
precursor_mass_tolerance_plus_(2.0),
precursor_mass_tolerance_minus_(2.0),
precursor_mass_type_(XTandemInfile::MONOISOTOPIC),
precursor_mass_error_unit_(XTandemInfile::DALTONS),
fragment_mass_error_unit_(XTandemInfile::DALTONS),
fragment_mass_type_(XTandemInfile::MONOISOTOPIC),
max_precursor_charge_(3),
precursor_lower_mz_(500.0),
fragment_lower_mz_(150.0),
number_of_threads_(1),
modifications_(""),
input_filename_(""),
output_filename_(""),
cleavage_site_("[RK]|{P}"),
refine_(true),
semi_cleavage_(true),
refine_max_valid_evalue_(1000),
number_of_missed_cleavages_(1),
default_parameters_file_(""),
max_valid_evalue_(1000)
{
}
XTandemInfile::~XTandemInfile()
{
}
void XTandemInfile::load(const String& filename)
{
Internal::XTandemInfileXMLHandler handler(filename, notes_, this);
parse_(filename, &handler);
}
void XTandemInfile::write(const String& filename)
{
if (!File::writable(filename))
{
throw (Exception::UnableToCreateFile(__FILE__, __LINE__, __PRETTY_FUNCTION__, filename));
}
ofstream os(filename.c_str());
writeTo_(os);
return;
}
String XTandemInfile::convertModificationSet_(const set<ModificationDefinition>& mods) const
{
StringList xtandem_mods;
for (set<ModificationDefinition>::const_iterator it = mods.begin(); it != mods.end(); ++it)
{
double mod_mass(ModificationsDB::getInstance()->getModification(it->getModification()).getDiffMonoMass());
String mod_string;
if (mod_mass >= 0)
{
mod_string = "+" + String(mod_mass);
}
else
{
mod_string = "-" + String(mod_mass);
}
ResidueModification::Term_Specificity ts = ModificationsDB::getInstance()->getModification(it->getModification()).getTermSpecificity();
if (ts == ResidueModification::ANYWHERE)
{
mod_string += "@" + ModificationsDB::getInstance()->getModification(it->getModification()).getOrigin();
}
else
{
if (ts == ResidueModification::C_TERM)
{
mod_string += "@]";
}
else
{
mod_string += "@[";
}
}
xtandem_mods.push_back(mod_string);
}
return xtandem_mods.concatenate(",");
}
void XTandemInfile::writeTo_(ostream& os)
{
set<String> used_labels; // labels which are set by OpenMS not by the default parameters file
os << "<?xml version=\"1.0\"?>" << "\n"
<< "<?xml-stylesheet type=\"text/xsl\" href=\"tandem-input-style.xsl\"?>" << "\n"
<< "<bioml>" << "\n";
//////////////// list path parameters
writeNote_(os, "input", "list path, default parameters", default_parameters_file_);
used_labels.insert("list path, default parameters");
writeNote_(os, "input", "list path, taxonomy information", taxonomy_file_);
used_labels.insert("list path, taxonomy information");
//<note type="input" label="spectrum, path">test_spectra.mgf</note>
writeNote_(os, "input", "spectrum, path", input_filename_);
used_labels.insert("spectrum, path");
////////////////////////////////////////////////////////////////////////////////
//////////////// spectrum parameters
//<note type="input" label="spectrum, fragment monoisotopic mass error">0.4</note>
writeNote_(os, "input", "spectrum, fragment monoisotopic mass error", String(fragment_mass_tolerance_));
used_labels.insert("spectrum, fragment monoisotopic mass error");
//<note type="input" label="spectrum, parent monoisotopic mass error plus">100</note>
writeNote_(os, "input", "spectrum, parent monoisotopic mass error plus", String(precursor_mass_tolerance_plus_));
used_labels.insert("spectrum, parent monoisotopic mass error plus");
//<note type="input" label="spectrum, parent monoisotopic mass error minus">100</note>
writeNote_(os, "input", "spectrum, parent monoisotopic mass error minus", String(precursor_mass_tolerance_minus_));
used_labels.insert("spectrum, parent monoisotopic mass error minus");
//<note type="input" label="spectrum, parent monoisotopic mass isotope error">yes</note>
if (precursor_mass_type_ == XTandemInfile::MONOISOTOPIC)
{
writeNote_(os, "input", "spectrum, parent monoisotopic mass isotope error", "yes");
}
else
{
writeNote_(os, "input", "spectrum, parent monoisotopic mass isotope error", "no");
}
used_labels.insert("spectrum, parent monoisotopic mass isotope error");
//<note type="input" label="spectrum, fragment monoisotopic mass error units">Daltons</note>
//<note>The value for this parameter may be 'Daltons' or 'ppm': all other values are ignored</note>
if (fragment_mass_error_unit_ == XTandemInfile::DALTONS)
{
writeNote_(os, "input", "spectrum, fragment monoisotopic mass error units", "Daltons");
}
else
{
writeNote_(os, "input", "spectrum, fragment monoisotopic mass error units", "ppm");
}
used_labels.insert("spectrum, fragment monoisotopic mass error units");
//<note type="input" label="spectrum, parent monoisotopic mass error units">ppm</note>
//<note>The value for this parameter may be 'Daltons' or 'ppm': all other values are ignored</note>
if (precursor_mass_error_unit_ == XTandemInfile::PPM)
{
writeNote_(os, "input", "spectrum, parent monoisotopic mass error units", "ppm");
}
else
{
writeNote_(os, "input", "spectrum, parent monoisotopic mass error units", "Daltons");
}
used_labels.insert("spectrum, parent monoisotopic mass error units");
//<note type="input" label="spectrum, fragment mass type">monoisotopic</note>
//<note>values are monoisotopic|average </note>
if (fragment_mass_type_ == XTandemInfile::MONOISOTOPIC)
{
writeNote_(os, "input", "spectrum, fragment mass type", "monoisotopic");
}
else
{
writeNote_(os, "input", "spectrum, fragment mass type", "average");
}
used_labels.insert("spectrum, fragment mass type");
////////////////////////////////////////////////////////////////////////////////
//////////////// spectrum conditioning parameters
//<note type="input" label="spectrum, dynamic range">100.0</note>
//<note>The peaks read in are normalized so that the most intense peak
//is set to the dynamic range value. All peaks with values of less that
//1, using this normalization, are not used. This normalization has the
//overall effect of setting a threshold value for peak intensities.</note>
//writeNote_(os, "input", "spectrum, dynamic range", String(dynamic_range_));
//<note type="input" label="spectrum, total peaks">50</note>
//<note>If this value is 0, it is ignored. If it is greater than zero (lets say 50),
//then the number of peaks in the spectrum with be limited to the 50 most intense
//peaks in the spectrum. X! tandem does not do any peak finding: it only
//limits the peaks used by this parameter, and the dynamic range parameter.</note>
//writeNote_(os, "input", "spectrum, total peaks", String(total_number_peaks_));
//<note type="input" label="spectrum, maximum parent charge">4</note>
writeNote_(os, "input", "spectrum, maximum parent charge", String(max_precursor_charge_));
used_labels.insert("spectrum, maximum parent charge");
// <note type="input" label="spectrum, use noise suppression">yes</note>
//writeNote_(os, "input", "spectrum, use noise suppression", noise_supression_);
//<note type="input" label="spectrum, minimum parent m+h">500.0</note>
//writeNote_(os, "input", "spectrum, minimum parent m+h", String(precursor_lower_mz_));
//<note type="input" label="spectrum, minimum fragment mz">150.0</note>
//writeNote_(os, "input", "spectrum, minimum fragment mz", String(fragment_lower_mz_));
//used_labels.insert("spectrum, minimum fragment mz");
//<note type="input" label="spectrum, minimum peaks">15</note>
//writeNote_(os, "input", "spectrum, minimum peaks", String(min_number_peaks_));
//<note type="input" label="spectrum, threads">1</note>
writeNote_(os, "input", "spectrum, threads", String(number_of_threads_));
used_labels.insert("spectrum, threads");
//<note type="input" label="spectrum, sequence batch size">1000</note>
//writeNote_(os, "input", "spectrum, sequence batch size", String(batch_size_));
////////////////////////////////////////////////////////////////////////////////
//////////////// residue modification parameters
//<note type="input" label="residue, modification mass">57.022@C</note>
//<note>The format of this parameter is m@X, where m is the modfication
//mass in Daltons and X is the appropriate residue to modify. Lists of
//modifications are separated by commas. For example, to modify M and C
//with the addition of 16.0 Daltons, the parameter line would be
//+16.0@M,+16.0@C
//Positive and negative values are allowed.
//</note>
writeNote_(os, "input", "residue, modification mass", convertModificationSet_(modifications_.getFixedModifications()));
used_labels.insert("residue, modification mass");
//<note type="input" label="residue, potential modification mass"></note>
//<note>The format of this parameter is the same as the format
//for residue, modification mass (see above).</note>
writeNote_(os, "input", "residue, potential modification mass", convertModificationSet_(modifications_.getVariableModifications()));
used_labels.insert("residue, potential modification mass");
writeNote_(os, "input", "protein, taxon", taxon_);
used_labels.insert("protein, taxon");
writeNote_(os, "input", "output, path", output_filename_);
used_labels.insert("output, path");
/*
//<note type="input" label="residue, potential modification motif"></note>
//<note>The format of this parameter is similar to residue, modification mass,
//with the addition of a modified PROSITE notation sequence motif specification.
//For example, a value of 80@[ST!]PX[KR] indicates a modification
//of either S or T when followed by P, and residue and the a K or an R.
//A value of 204@N!{P}[ST]{P} indicates a modification of N by 204, if it
//is NOT followed by a P, then either an S or a T, NOT followed by a P.
//Positive and negative values are allowed.
//</note>
writeNote_(os, "input", "residue, potential modification motif", variable_modification_motif_);
////////////////////////////////////////////////////////////////////////////////
//////////////// protein parameters
//<note type="input" label="protein, taxon">other mammals</note>
//<note>This value is interpreted using the information in taxonomy.xml.</note>
writeNote_(os, "input", "protein, taxon", taxon_);
used_labels.insert("protein, taxon");
//<note type="input" label="protein, cleavage site">[RK]|{P}</note>
//<note>this setting corresponds to the enzyme trypsin. The first characters
//in brackets represent residues N-terminal to the bond - the '|' pipe -
//and the second set of characters represent residues C-terminal to the
//bond. The characters must be in square brackets (denoting that only
//these residues are allowed for a cleavage) or french brackets (denoting
//that these residues cannot be in that position). Use UPPERCASE characters.
//To denote cleavage at any residue, use [X]|[X] and reset the
//scoring, maximum missed cleavage site parameter (see below) to something like 50.
//</note>
writeNote_(os, "input", "protein, cleavage site", cleavage_site_);
*/
//////////////// semi cleavage parameter
//<note type="input" label="protein, cleavage semi">yes</note>
writeNote_(os, "input", "protein, cleavage semi", semi_cleavage_);
used_labels.insert("protein, cleavage semi");
//<note type="input" label="protein, modified residue mass file"></note>
//writeNote_(os, "input", "protein, modified residue mass file", modified_residue_mass_file_);
//<note type="input" label="protein, cleavage C-terminal mass change">+17.002735</note>
//writeNote_(os, "input", "protein, cleavage C-terminal mass change", String(cleavage_c_term_mass_change_));
//<note type="input" label="protein, cleavage N-terminal mass change">+1.007825</note>
//writeNote_(os, "input", "protein, cleavage N-terminal mass change", String(cleavage_n_term_mass_change_));
//<note type="input" label="protein, N-terminal residue modification mass">0.0</note>
//writeNote_(os, "input", "protein, N-terminal residue modification mass", String(protein_n_term_mod_mass_));
//<note type="input" label="protein, C-terminal residue modification mass">0.0</note>
//writeNote_(os, "input", "protein, C-terminal residue modification mass", String(protein_c_term_mod_mass_));
//<note type="input" label="protein, homolog management">no</note>
//<note>if yes, an upper limit is set on the number of homologues kept for a particular spectrum</note>
//writeNote_(os, "input", "protein, homolog management", protein_homolog_management_);
////////////////////////////////////////////////////////////////////////////////
//////////////// model refinement parameters
//<note type="input" label="refine">yes</note>
writeNote_(os, "input", "refine", refine_);
used_labels.insert("refine");
/*
//<note type="input" label="refine, modification mass"></note>
writeNote_(os, "input", "refine, modification mass", String(refine_mod_mass_));
//<note type="input" label="refine, sequence path"></note>
writeNote_(os, "input", "refine, sequence path", refine_sequence_path_);
//<note type="input" label="refine, tic percent">20</note>
writeNote_(os, "input", "refine, tic percent", String(refine_tic_percent_));
//<note type="input" label="refine, spectrum synthesis">yes</note>
writeNote_(os, "input", "refine, spectrum synthesis", refine_spectrum_sythesis_);
//<note type="input" label="refine, maximum valid expectation value">0.1</note>
writeNote_(os, "input", "refine, maximum valid expectation value", String(refine_max_valid_evalue_));
//<note type="input" label="refine, potential N-terminus modifications">+42.010565@[</note>
writeNote_(os, "input", "refine, potential N-terminus modifications", refine_variable_n_term_mods_);
//<note type="input" label="refine, potential C-terminus modifications"></note>
writeNote_(os, "input", "refine, potential C-terminus modifications", refine_variable_c_term_mods_);
//<note type="input" label="refine, unanticipated cleavage">yes</note>
writeNote_(os, "input", "refine, unanticipated cleavage", refine_unanticipated_cleavage_);
//<note type="input" label="refine, potential modification mass"></note>
writeNote_(os, "input", "refine, potential modification mass", String(variable_mod_mass_));
//<note type="input" label="refine, point mutations">no</note>
writeNote_(os, "input", "refine, point mutations", refine_point_mutations_);
//<note type="input" label="refine, use potential modifications for full refinement">no</note>
writeNote_(os, "input", "refine, use potential modifications for full refinement", use_var_mod_for_full_refinement_);*/
//<note type="input" label="refine, potential modification motif"></note>
//<note>The format of this parameter is similar to residue, modification mass,
//with the addition of a modified PROSITE notation sequence motif specification.
//For example, a value of 80@[ST!]PX[KR] indicates a modification
//of either S or T when followed by P, and residue and the a K or an R.
//A value of 204@N!{P}[ST]{P} indicates a modification of N by 204, if it
//is NOT followed by a P, then either an S or a T, NOT followed by a P.
//Positive and negative values are allowed.
//</note>
//writeNote_(os, "input", "refine, potential modification motif", refine_var_mod_motif_);
////////////////////////////////////////////////////////////////////////////////
//////////////// scoring parameters
//<note type="input" label="scoring, minimum ion count">4</note>
//writeNote_(os, "input", "scoring, minimum ion count", String(scoring_min_ion_count_));
//<note type="input" label="scoring, maximum missed cleavage sites">1</note>
writeNote_(os, "input", "scoring, maximum missed cleavage sites", String(number_of_missed_cleavages_));
used_labels.insert("scoring, maximum missed cleavage sites");
//<note type="input" label="scoring, x ions">no</note>
//writeNote_(os, "input", "scoring, x ions", score_x_ions_);
//<note type="input" label="scoring, y ions">yes</note>
//writeNote_(os, "input", "scoring, y ions", score_y_ions_);
//<note type="input" label="scoring, z ions">no</note>
//writeNote_(os, "input", "scoring, z ions", score_z_ions_);
//<note type="input" label="scoring, a ions">no</note>
//writeNote_(os, "input", "scoring, a ions", score_a_ions_);
//<note type="input" label="scoring, b ions">yes</note>
//writeNote_(os, "input", "scoring, b ions", score_b_ions_);
//<note type="input" label="scoring, c ions">no</note>
//writeNote_(os, "input", "scoring, c ions", score_c_ions_);
//<note type="input" label="scoring, cyclic permutation">no</note>
//<note>if yes, cyclic peptide sequence permutation is used to pad the scoring histograms</note>
//writeNote_(os, "input", "scoring, cyclic permutation", scoring_cyclic_permutation_);
//<note type="input" label="scoring, include reverse">no</note>
//<note>if yes, then reversed sequences are searched at the same time as forward sequences</note>
//writeNote_(os, "input", "scoring, include reverse", scoring_include_reverse_);
////////////////////////////////////////////////////////////////////////////////
//////////////// output parameters
//<note type="input" label="output, log path"></note>
//<note type="input" label="output, message">...</note>
//writeNote_(os, "input", "output, message", String("..."));
//<note type="input" label="output, one sequence copy">no</note>
//<note type="input" label="output, sequence path"></note>
//<note type="input" label="output, path">output.xml</note>
//writeNote_(os, "input", "output, path", output_filename_);
//<note type="input" label="output, sort results by">protein</note>
writeNote_(os, "input", "output, sort results by", "spectrum");
used_labels.insert("output, sort results by");
//<note>values = protein|spectrum (spectrum is the default)</note>
//<note type="input" label="output, path hashing">yes</note>
//<note>values = yes|no</note>
//<note type="input" label="output, xsl path">tandem-style.xsl</note>
//<note type="input" label="output, parameters">yes</note>
//<note>values = yes|no</note>
//<note type="input" label="output, performance">yes</note>
//<note>values = yes|no</note>
//<note type="input" label="output, spectra">yes</note>
//<note>values = yes|no</note>
//<note type="input" label="output, histograms">yes</note>
//<note>values = yes|no</note>
//<note type="input" label="output, proteins">yes</note>
//<note>values = yes|no</note>
//<note type="input" label="output, sequences">yes</note>
//<note>values = yes|no</note>
//<note type="input" label="output, one sequence copy">no</note>
//<note>values = yes|no, set to yes to produce only one copy of each protein sequence in the output xml</note>
//<note type="input" label="output, results">valid</note>
writeNote_(os, "input", "output, results", "all");
used_labels.insert("output, results");
//<note>values = all|valid|stochastic</note>
//<note type="input" label="output, maximum valid expectation value">0.1</note>
writeNote_(os, "input", "output, maximum valid expectation value", String(max_valid_evalue_));
used_labels.insert("output, maximum valid expectation value");
//<note>value is used in the valid|stochastic setting of output, results</note>
//<note type="input" label="output, histogram column width">30</note>
//<note>values any integer greater than 0. Setting this to '1' makes cutting and pasting histograms
//into spread sheet programs easier.</note>
//<note type="description">ADDITIONAL EXPLANATIONS</note>
//<note type="description">Each one of the parameters for X! tandem is entered as a labeled note
// node. In the current version of X!, keep those note nodes
// on a single line.
//</note>
//<note type="description">The presence of the type 'input' is necessary if a note is to be considered
// an input parameter.
//</note>
//<note type="description">Any of the parameters that are paths to files may require alteration for a
// particular installation. Full path names usually cause the least trouble,
// but there is no reason not to use relative path names, if that is the
// most convenient.
//</note>
//<note type="description">Any parameter values set in the 'list path, default parameters' file are
// reset by entries in the normal input file, if they are present. Otherwise,
// the default set is used.
//</note>
//<note type="description">The 'list path, taxonomy information' file must exist.
//</note>
//<note type="description">The directory containing the 'output, path' file must exist: it will not be created.
//</note>
//<note type="description">The 'output, xsl path' is optional: it is only of use if a good XSLT style sheet exists.
//</note>
////////////////////////////////////////////////////////////////////////////////
// those of the parameters that are not set by this file adapter
// are just written from the default XTandem infile
for (vector<Internal::XTandemInfileNote>::const_iterator it = notes_.begin(); it != notes_.end(); ++it)
{
if (it->note_type != "" && it->note_label != "" && used_labels.find(it->note_label) == used_labels.end())
{
writeNote_(os, it->note_type, it->note_label, it->note_value);
}
}
os << "</bioml>" << "\n";
}
void XTandemInfile::writeNote_(ostream& os, const String& type, const String& label, const String& value)
{
os << "\t<note type=\"" << type << "\" label=\"" << label << "\">" << value << "</note>" << "\n";
}
void XTandemInfile::writeNote_(ostream& os, const String& type, const String& label, const char* value)
{
String val(value);
os << "\t<note type=\"" << type << "\" label=\"" << label << "\">" << val << "</note>" << "\n";
}
void XTandemInfile::writeNote_(ostream& os, const String& type, const String& label, bool value)
{
if (value)
{
os << "\t<note type=\"" << type << "\" label=\"" << label << "\">yes</note>" << "\n";
}
else
{
os << "\t<note type=\"" << type << "\" label=\"" << label << "\">no</note>" << "\n";
}
}
void XTandemInfile::setOutputFilename(const String& filename)
{
output_filename_ = filename;
}
const String& XTandemInfile::getOutputFilename() const
{
return output_filename_;
}
void XTandemInfile::setInputFilename(const String& filename)
{
input_filename_ = filename;
}
const String& XTandemInfile::getInputFilename() const
{
return input_filename_;
}
void XTandemInfile::setTaxonomyFilename(const String& filename)
{
taxonomy_file_ = filename;
}
const String& XTandemInfile::getTaxonomyFilename() const
{
return taxonomy_file_;
}
void XTandemInfile::setDefaultParametersFilename(const String& filename)
{
default_parameters_file_ = filename;
}
const String& XTandemInfile::getDefaultParametersFilename() const
{
return default_parameters_file_;
}
void XTandemInfile::setModifications(const ModificationDefinitionsSet& mods)
{
modifications_ = mods;
}
const ModificationDefinitionsSet& XTandemInfile::getModifications() const
{
return modifications_;
}
void XTandemInfile::setTaxon(const String& taxon)
{
taxon_ = taxon;
}
const String& XTandemInfile::getTaxon() const
{
return taxon_;
}
void XTandemInfile::setPrecursorMassTolerancePlus(double tolerance)
{
precursor_mass_tolerance_plus_ = tolerance;
}
double XTandemInfile::getPrecursorMassTolerancePlus() const
{
return precursor_mass_tolerance_plus_;
}
void XTandemInfile::setPrecursorMassToleranceMinus(double tolerance)
{
precursor_mass_tolerance_minus_ = tolerance;
}
double XTandemInfile::getPrecursorMassToleranceMinus() const
{
return precursor_mass_tolerance_minus_;
}
void XTandemInfile::setPrecursorMassErrorUnit(ErrorUnit unit)
{
precursor_mass_error_unit_ = unit;
}
XTandemInfile::ErrorUnit XTandemInfile::getPrecursorMassErrorUnit() const
{
return precursor_mass_error_unit_;
}
void XTandemInfile::setFragmentMassErrorUnit(ErrorUnit unit)
{
fragment_mass_error_unit_ = unit;
}
XTandemInfile::ErrorUnit XTandemInfile::getFragmentMassErrorUnit() const
{
return fragment_mass_error_unit_;
}
void XTandemInfile::setMaxPrecursorCharge(Int max_charge)
{
max_precursor_charge_ = max_charge;
}
Int XTandemInfile::getMaxPrecursorCharge() const
{
return max_precursor_charge_;
}
void XTandemInfile::setFragmentMassTolerance(double tolerance)
{
fragment_mass_tolerance_ = tolerance;
}
double XTandemInfile::getFragmentMassTolerance() const
{
return fragment_mass_tolerance_;
}
void XTandemInfile::setNumberOfThreads(UInt num_threads)
{
number_of_threads_ = num_threads;
}
UInt XTandemInfile::getNumberOfThreads() const
{
return number_of_threads_;
}
XTandemInfile::MassType XTandemInfile::getPrecursorErrorType() const
{
return precursor_mass_type_;
}
void XTandemInfile::setPrecursorErrorType(const MassType mass_type)
{
precursor_mass_type_ = mass_type;
}
void XTandemInfile::setMaxValidEValue(double value)
{
max_valid_evalue_ = value;
}
double XTandemInfile::getMaxValidEValue() const
{
return max_valid_evalue_;
}
void XTandemInfile::setNumberOfMissedCleavages(UInt missed_cleavages)
{
number_of_missed_cleavages_ = missed_cleavages;
}
UInt XTandemInfile::getNumberOfMissedCleavages() const
{
return number_of_missed_cleavages_;
}
bool XTandemInfile::isRefining() const
{
return refine_;
}
void XTandemInfile::setRefine(const bool refine)
{
refine_ = refine;
}
void XTandemInfile::setSemiCleavage(const bool semi_cleavage)
{
semi_cleavage_ = semi_cleavage;
}
} // namespace OpenMS
|