| 484 | } |
| 485 | |
| 486 | void MzQuantMLHandler::handleCVParam_(const String& parent_parent_tag, const String& parent_tag, const String& accession, const String& name, const String& value, const xercesc::Attributes& /* attributes */, const String& /* cv_ref */, const String& /* unit_accession */) |
| 487 | { |
| 488 | //Abort on unknown terms |
| 489 | if (!cv_.exists(accession)) |
| 490 | { |
| 491 | //in 'sample' several external CVs are used (Brenda, GO, ...). Do not warn then. |
| 492 | if (parent_tag != "sample") |
| 493 | { |
| 494 | warning(LOAD, String("Unknown cvParam '") + accession + "' in tag '" + parent_tag + "'."); |
| 495 | return; |
| 496 | } |
| 497 | } |
| 498 | else |
| 499 | { |
| 500 | const ControlledVocabulary::CVTerm& term = cv_.getTerm(accession); |
| 501 | //obsolete CV terms |
| 502 | if (term.obsolete) |
| 503 | { |
| 504 | warning(LOAD, String("Obsolete CV term '") + accession + " - " + cv_.getTerm(accession).name + "' used in tag '" + parent_tag + "'."); |
| 505 | } |
| 506 | //check if term name and parsed name match |
| 507 | String parsed_name = name; |
| 508 | parsed_name.trim(); |
| 509 | String correct_name = term.name; |
| 510 | correct_name.trim(); |
| 511 | if (parsed_name != correct_name) |
| 512 | { |
| 513 | warning(LOAD, String("Name of CV term not correct: '") + term.id + " - " + parsed_name + "' should be '" + correct_name + "'"); |
| 514 | } |
| 515 | if (term.obsolete) |
| 516 | { |
| 517 | warning(LOAD, String("Obsolete CV term '") + accession + " - " + cv_.getTerm(accession).name + "' used in tag '" + parent_tag + "'."); |
| 518 | } |
| 519 | //values used in wrong places and wrong value types |
| 520 | if (!value.empty()) |
| 521 | { |
| 522 | if (term.xref_type == ControlledVocabulary::CVTerm::NONE) |
| 523 | { |
| 524 | //Quality CV does not state value type :( |
| 525 | if (!accession.hasPrefix("PATO:")) |
| 526 | { |
| 527 | warning(LOAD, String("The CV term '") + accession + " - " + cv_.getTerm(accession).name + "' used in tag '" + parent_tag + "' must not have a value. The value is '" + value + "'."); |
| 528 | } |
| 529 | } |
| 530 | else |
| 531 | { |
| 532 | switch (term.xref_type) |
| 533 | { |
| 534 | //string value can be anything |
| 535 | case ControlledVocabulary::CVTerm::XSD_STRING: |
| 536 | break; |
| 537 | |
| 538 | //int value => try casting |
| 539 | case ControlledVocabulary::CVTerm::XSD_INTEGER: |
| 540 | case ControlledVocabulary::CVTerm::XSD_NEGATIVE_INTEGER: |
| 541 | case ControlledVocabulary::CVTerm::XSD_POSITIVE_INTEGER: |
| 542 | case ControlledVocabulary::CVTerm::XSD_NON_NEGATIVE_INTEGER: |
| 543 | case ControlledVocabulary::CVTerm::XSD_NON_POSITIVE_INTEGER: |