| 3641 | } |
| 3642 | |
| 3643 | void MzMLHandler::writeSourceFile_(std::ostream& os, const String& id, const SourceFile& source_file, const Internal::MzMLValidator& validator) |
| 3644 | { |
| 3645 | os << "\t\t\t<sourceFile id=\"" << id << "\" name=\"" << writeXMLEscape(source_file.getNameOfFile()) << "\" location=\"" << writeXMLEscape(source_file.getPathToFile()) << "\">\n"; |
| 3646 | //checksum |
| 3647 | if (source_file.getChecksumType() == SourceFile::SHA1) |
| 3648 | { |
| 3649 | os << "\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000569\" name=\"SHA-1\" value=\"" << source_file.getChecksum() << "\" />\n"; |
| 3650 | } |
| 3651 | else if (source_file.getChecksumType() == SourceFile::MD5) |
| 3652 | { |
| 3653 | os << "\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000568\" name=\"MD5\" value=\"" << source_file.getChecksum() << "\" />\n"; |
| 3654 | } |
| 3655 | else //FORCED |
| 3656 | { |
| 3657 | os << "\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000569\" name=\"SHA-1\" value=\"\" />\n"; |
| 3658 | } |
| 3659 | //file type |
| 3660 | ControlledVocabulary::CVTerm ft_term = getChildWithName_("MS:1000560", source_file.getFileType()); |
| 3661 | if (ft_term.id.empty() && source_file.getFileType().hasSuffix("file")) |
| 3662 | { |
| 3663 | ft_term = getChildWithName_("MS:1000560", source_file.getFileType().chop(4) + "format"); // this is born out of desperation that sourcefile has a string interface for its filetype and not the enum, which could have been easily manipulated to the updated cv |
| 3664 | } |
| 3665 | if (!ft_term.id.empty()) |
| 3666 | { |
| 3667 | os << "\t\t\t\t<cvParam cvRef=\"MS\" accession=\"" << ft_term.id << "\" name=\"" << ft_term.name << "\" />\n"; |
| 3668 | } |
| 3669 | else //FORCED |
| 3670 | { |
| 3671 | os << "\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000564\" name=\"PSI mzData format\" />\n"; |
| 3672 | } |
| 3673 | //native ID format |
| 3674 | ControlledVocabulary::CVTerm id_term = getChildWithName_("MS:1000767", source_file.getNativeIDType()); |
| 3675 | if (!id_term.id.empty()) |
| 3676 | { |
| 3677 | os << "\t\t\t\t<cvParam cvRef=\"MS\" accession=\"" << id_term.id << "\" name=\"" << id_term.name << "\" />\n"; |
| 3678 | } |
| 3679 | else //FORCED |
| 3680 | { |
| 3681 | os << "\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000777\" name=\"spectrum identifier nativeID format\" />\n"; |
| 3682 | } |
| 3683 | writeUserParam_(os, source_file, 4, "/mzML/fileDescription/sourceFileList/sourceFile/cvParam/@accession", validator); |
| 3684 | os << "\t\t\t</sourceFile>\n"; |
| 3685 | } |
| 3686 | |
| 3687 | void MzMLHandler::writeDataProcessing_(std::ostream& os, const String& id, const std::vector< ConstDataProcessingPtr >& dps, const Internal::MzMLValidator& validator) |
| 3688 | { |
nothing calls this directly
no test coverage detected