| 862 | } |
| 863 | |
| 864 | MzTabPeptideSectionRow MzTab::peptideSectionRowFromConsensusFeature_( |
| 865 | const ConsensusFeature& c, |
| 866 | const ConsensusMap& consensus_map, |
| 867 | const StringList& ms_runs, |
| 868 | const Size n_study_variables, |
| 869 | const set<String>& consensus_feature_user_value_keys, |
| 870 | const set<String>& peptide_identifications_user_value_keys, |
| 871 | const set<String>& peptide_hit_user_value_keys, |
| 872 | const map<String, size_t>& idrun_2_run_index, |
| 873 | const map<pair<size_t,size_t>,size_t>& map_run_fileidx_2_msfileidx, |
| 874 | const std::map< std::pair< String, unsigned >, unsigned>& path_label_to_assay, |
| 875 | const vector<String>& fixed_mods, |
| 876 | bool export_subfeatures) |
| 877 | { |
| 878 | MzTabPeptideSectionRow row; |
| 879 | |
| 880 | const ConsensusMap::ColumnHeaders& cm_column_headers = consensus_map.getColumnHeaders(); |
| 881 | const String & experiment_type = consensus_map.getExperimentType(); |
| 882 | const vector<ProteinIdentification>& prot_id = consensus_map.getProteinIdentifications(); |
| 883 | |
| 884 | // create opt_ column for peptide sequence containing modification |
| 885 | MzTabOptionalColumnEntry opt_global_modified_sequence; |
| 886 | opt_global_modified_sequence.first = "opt_global_cv_MS:1000889_peptidoform_sequence"; |
| 887 | row.opt_.push_back(opt_global_modified_sequence); |
| 888 | |
| 889 | // Defines how to consume user value keys for the upcoming keys |
| 890 | const auto addUserValueToRowBy = [&row](const function<void(const String &s, MzTabOptionalColumnEntry &entry)>& f) -> function<void(const String &key)> |
| 891 | { |
| 892 | return [f,&row](const String &user_value_key) |
| 893 | { |
| 894 | MzTabOptionalColumnEntry opt_entry; |
| 895 | opt_entry.first = "opt_global_" + user_value_key; |
| 896 | f(user_value_key, opt_entry); |
| 897 | |
| 898 | // Use default column_header for target decoy |
| 899 | row.opt_.push_back(opt_entry); |
| 900 | }; |
| 901 | }; |
| 902 | |
| 903 | // create opt_ columns for consensus map user values |
| 904 | for_each(consensus_feature_user_value_keys.begin(), consensus_feature_user_value_keys.end(), |
| 905 | addUserValueToRowBy([&c](const String &key, MzTabOptionalColumnEntry &opt_entry) |
| 906 | { |
| 907 | if (c.metaValueExists(key)) |
| 908 | { |
| 909 | opt_entry.second = MzTabString(c.getMetaValue(key).toString()); |
| 910 | } |
| 911 | }) |
| 912 | ); |
| 913 | |
| 914 | // add optional columns for first peptide identification in consensus feature |
| 915 | for_each(peptide_identifications_user_value_keys.begin(), peptide_identifications_user_value_keys.end(), |
| 916 | addUserValueToRowBy([&c](const String &key, MzTabOptionalColumnEntry &opt_entry) |
| 917 | { |
| 918 | opt_entry.second = MzTabString(c.getMetaValue(key).toString()); |
| 919 | }) |
| 920 | ); |
| 921 |
nothing calls this directly
no test coverage detected