Skip to content

Commit

Permalink
Normalize line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
alchemistmatt committed Sep 11, 2017
1 parent b4251b8 commit 94ff92d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
50 changes: 24 additions & 26 deletions LcmsSpectator/Writers/Exporters/SpectrumPeakExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
namespace LcmsSpectator.Writers.Exporters
{
using System.IO;
using System.Windows.Input;
using System.Windows.Shapes;

using InformedProteomics.Backend.Data.Sequence;
using InformedProteomics.Backend.Data.Spectrometry;
Expand Down Expand Up @@ -42,27 +40,27 @@ public SpectrumPeakExporter(string outputFile, IEnumerable<BaseIonType> baseIonT
this.tolerance = tolerance ?? new Tolerance(10, ToleranceUnit.Ppm);
}

public void Export(IList<PeakDataPoint> peakDataPoints, IProgress<ProgressData> progress = null)
{
using (var writer = new StreamWriter(this.outputFile))
{
// Write headers
writer.WriteLine("Monoisotopic Mass\tM/Z\tIntensity\tIonType\tCharge\tResidue");
foreach (var peakDataPoint in peakDataPoints)
{
writer.WriteLine(
"{0}\t{1}\t{2}\t{3}\t{4}\t{5}{6}",
peakDataPoint.MonoisotopicMass,
peakDataPoint.X,
peakDataPoint.Y,
peakDataPoint.IonType.BaseIonType.Symbol,
peakDataPoint.IonType.Charge,
peakDataPoint.Residue,
peakDataPoint.Index);
}
}
}

public void Export(IList<PeakDataPoint> peakDataPoints, IProgress<ProgressData> progress = null)
{
using (var writer = new StreamWriter(this.outputFile))
{
// Write headers
writer.WriteLine("Monoisotopic Mass\tM/Z\tIntensity\tIonType\tCharge\tResidue");
foreach (var peakDataPoint in peakDataPoints)
{
writer.WriteLine(
"{0}\t{1}\t{2}\t{3}\t{4}\t{5}{6}",
peakDataPoint.MonoisotopicMass,
peakDataPoint.X,
peakDataPoint.Y,
peakDataPoint.IonType.BaseIonType.Symbol,
peakDataPoint.IonType.Charge,
peakDataPoint.Residue,
peakDataPoint.Index);
}
}
}

public void Export(IList<PrSm> ids, IProgress<ProgressData> progress = null)
{
progress = progress ?? new Progress<ProgressData>();
Expand Down Expand Up @@ -142,7 +140,7 @@ public void Export(PrSm id, string outputFilePath)
writer.WriteLine(this.GetHeaders());
foreach (var match in matches)
{
writer.WriteLine(this.GetLine(match));
writer.WriteLine(this.GetLine(match));
}
}
}
Expand All @@ -169,7 +167,7 @@ private IEnumerable<Tuple<Peak, PeakDataPoint>> GetMappedPeaks(PrSm id)
{
var lcms = id.LcMs;
var fragSequence = id.GetFragmentationSequence();
var fragments = lcms.GetMsLevel(id.Scan) == 2 ?
var fragments = lcms.GetMsLevel(id.Scan) == 2 ?
fragSequence.GetFragmentLabels(this.ionTypes.Where(ionType => ionType.Charge <= id.Charge).ToList()) :
fragSequence.GetChargePrecursorLabels();
var spectrum = lcms.GetSpectrum(id.Scan, true);
Expand Down Expand Up @@ -207,7 +205,7 @@ private string GetLine(Tuple<Peak, PeakDataPoint> match)
var peak = match.Item1;
var peakDataPoint = match.Item2;

if (peakDataPoint != null && peakDataPoint.IonType != null)
if (peakDataPoint != null && peakDataPoint.IonType != null)
{
line = string.Format(
"{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}",
Expand Down
2 changes: 1 addition & 1 deletion LcmsSpectatorTests/XicPlotTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down

0 comments on commit 94ff92d

Please sign in to comment.