diff --git a/src/MSDIAL5/MsdialCore/Export/SpectraExport.cs b/src/MSDIAL5/MsdialCore/Export/SpectraExport.cs index 932e4ff49..c4d2f5587 100644 --- a/src/MSDIAL5/MsdialCore/Export/SpectraExport.cs +++ b/src/MSDIAL5/MsdialCore/Export/SpectraExport.cs @@ -415,22 +415,26 @@ private static void WriteChromPeakFeatureInfoAsSdf( { WriteSdfDataItem(sb, "NAME", string.IsNullOrWhiteSpace(spotProperty.Name)? "Unknown": spotProperty.Name); WriteSdfDataItem(sb, "SCANS", spotProperty.MasterAlignmentID.ToString()); - WriteSdfDataItem(sb, "PRECURSOR MZ", Math.Round(spotProperty.MassCenter,5).ToString()); + WriteSdfDataItem(sb, "PRECURSOR M/Z", Math.Round(spotProperty.MassCenter, 5).ToString()); WriteSdfDataItem(sb, "ION MODE", spotProperty.IonMode.ToString()); if (spotProperty.IsMsmsAssigned) { if (spotProperty.AdductType != null) WriteSdfDataItem(sb, "PRECURSOR TYPE", spotProperty.AdductType.AdductIonName); if (!string.IsNullOrWhiteSpace(spotProperty.Formula.FormulaString)) WriteSdfDataItem(sb, "FORMULA", spotProperty.Formula.FormulaString); - if (!string.IsNullOrWhiteSpace(spotProperty.InChIKey)) WriteSdfDataItem(sb, "FORMULA", spotProperty.InChIKey); - if (!string.IsNullOrWhiteSpace(spotProperty.SMILES)) WriteSdfDataItem(sb, "FORMULA", spotProperty.SMILES); + if (spotProperty.Formula.Mass > 0d) WriteSdfDataItem(sb, "EXACT MASS", Math.Round(spotProperty.Formula.Mass, 5).ToString()); + if (!string.IsNullOrWhiteSpace(spotProperty.InChIKey)) WriteSdfDataItem(sb, "INCHIKEY", spotProperty.InChIKey); + if (!string.IsNullOrWhiteSpace(spotProperty.SMILES)) WriteSdfDataItem(sb, "SMILES", spotProperty.SMILES); + if (spotProperty.TimesCenter != null && spotProperty.TimesCenter.RT != null && spotProperty.TimesCenter.RT.Value >= 0) + WriteSdfDataItem(sb, "RETENTION TIME", Math.Round(spotProperty.TimesCenter.RT.Value, 3).ToString()); + if (!string.IsNullOrWhiteSpace(spotProperty.Ontology)) WriteSdfDataItem(sb, "ONTOLOGY", spotProperty.Ontology); WriteSdfDataItem(sb, "MS LEVEL", "MS2"); var peaks = spectrum.Where(spec => spec.Intensity > 0).ToList(); WriteSdfDataItem(sb, "NUM PEAKS", peaks.Count.ToString()); var peaksText = string.Join( "\n", spectrum.Select(p => - $"{Math.Round(p.Mass, 5)} {Math.Round(p.Intensity,0)}" + $"{Math.Round(p.Mass, 4)} {Math.Round(p.Intensity,0)}" ) ); WriteSdfDataItem(sb, "MASS SPECTRAL PEAKS", peaksText); @@ -443,15 +447,18 @@ private static void WriteChromPeakFeatureInfoAsSdf( { WriteSdfDataItem(sb, "NAME", string.IsNullOrWhiteSpace(spotProperty.Name) ? "Unknown" : spotProperty.Name); WriteSdfDataItem(sb, "SCANS", spotProperty.PeakID.ToString()); - WriteSdfDataItem(sb, "PRECURSOR MZ", Math.Round(spotProperty.PrecursorMz, 5).ToString()); + WriteSdfDataItem(sb, "PRECURSOR M/Z", Math.Round(spotProperty.PrecursorMz, 5).ToString()); WriteSdfDataItem(sb, "ION MODE", spotProperty.IonMode.ToString()); if (spotProperty.IsMsmsContained) { if (spotProperty.AdductType != null) WriteSdfDataItem(sb, "PRECURSOR TYPE", spotProperty.AdductType.AdductIonName); if (!string.IsNullOrWhiteSpace(spotProperty.Formula.FormulaString)) WriteSdfDataItem(sb, "FORMULA", spotProperty.Formula.FormulaString); - if (!string.IsNullOrWhiteSpace(spotProperty.InChIKey)) WriteSdfDataItem(sb, "FORMULA", spotProperty.InChIKey); - if (!string.IsNullOrWhiteSpace(spotProperty.SMILES)) WriteSdfDataItem(sb, "FORMULA", spotProperty.SMILES); + if (!string.IsNullOrWhiteSpace(spotProperty.Formula.Mass.ToString())) WriteSdfDataItem(sb, "EXACT MASS", Math.Round(spotProperty.Formula.Mass, 5).ToString()); + if (!string.IsNullOrWhiteSpace(spotProperty.InChIKey)) WriteSdfDataItem(sb, "INCHIKEY", spotProperty.InChIKey); + if (!string.IsNullOrWhiteSpace(spotProperty.SMILES)) WriteSdfDataItem(sb, "SMILES", spotProperty.SMILES); + if (!string.IsNullOrWhiteSpace(spotProperty.ChromXs.RT.Value.ToString())) WriteSdfDataItem(sb, "RETENTION TIME", spotProperty.ChromXs.RT.Value.ToString()); + if (!string.IsNullOrWhiteSpace(spotProperty.Ontology)) WriteSdfDataItem(sb, "ONTOLOGY", spotProperty.Ontology); WriteSdfDataItem(sb, "MS LEVEL", "MS2"); var peaks = spectrum.Where(spec => spec.Intensity > 0).ToList(); WriteSdfDataItem(sb, "NUM PEAKS", peaks.Count.ToString());