MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / writeFeatures

Method writeFeatures

src/openms/source/FORMAT/FLASHDeconvFeatureFile.cpp:50–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 }
49
50 void FLASHDeconvFeatureFile::writeFeatures(const std::vector<FLASHDeconvHelperStructs::MassFeature>& mass_features, const String& file_name, std::fstream& fs)
51 {
52 int feature_index = 0;
53 for (auto& mass_feature : mass_features)
54 {
55 auto mt = mass_feature.mt;
56 double mass = mt.getCentroidMZ() + mass_feature.iso_offset * Constants::ISOTOPE_MASSDIFF_55K_U;
57 double avg_mass = mass_feature.avg_mass;
58 double sum_intensity = .0;
59
60 for (auto& p : mt)
61 {
62 sum_intensity += p.getIntensity();
63 }
64
65 fs << feature_index++ << "\t" << file_name << "\t" << std::to_string(mass) << "\t" << std::to_string(avg_mass) << "\t" // massdiff
66 << mt.getSize() << "\t" << mt.begin()->getRT() << "\t" << mt.rbegin()->getRT() << "\t" << mt.getTraceLength() << "\t" << mt[mt.findMaxByIntPeak()].getRT() << "\t" << sum_intensity << "\t"
67 << mt.getMaxIntensity(false) << "\t" << mt.computePeakArea() << "\t" << mass_feature.min_charge << "\t" << mass_feature.max_charge << "\t" << mass_feature.charge_count << "\t"
68 << mass_feature.isotope_score << "\t" << mass_feature.qscore << "\t";
69
70 for (int i = mass_feature.min_charge; i <= mass_feature.max_charge; i++)
71 {
72 fs << mass_feature.per_charge_intensity[abs(i)];
73 if (i < mass_feature.max_charge)
74 {
75 fs << ";";
76 }
77 }
78
79 fs << "\t";
80 int iso_end_index = 0;
81
82 for (Size i = 0; i < mass_feature.per_isotope_intensity.size(); i++)
83 {
84 if (mass_feature.per_isotope_intensity[i] == 0)
85 {
86 continue;
87 }
88 iso_end_index = (int)i;
89 }
90 for (int i = 0; i <= iso_end_index; i++)
91 {
92 fs << mass_feature.per_isotope_intensity[i];
93
94 if (i < iso_end_index)
95 {
96 fs << ";";
97 }
98 }
99 fs << "\n";
100 }
101 }
102
103 void FLASHDeconvFeatureFile::writeTopFDFeatures(const std::vector<FLASHDeconvHelperStructs::MassFeature>& mass_features, const std::map<int, PeakGroup>& precursor_peak_groups,
104 const std::map<int, double>& scan_rt_map, const String& file_name, std::vector<std::fstream>& fs)

Callers

nothing calls this directly

Calls 10

getCentroidMZMethod · 0.80
findMaxByIntPeakMethod · 0.80
computePeakAreaMethod · 0.80
getIntensityMethod · 0.45
getSizeMethod · 0.45
getRTMethod · 0.45
beginMethod · 0.45
rbeginMethod · 0.45
getMaxIntensityMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected