@@ -81,7 +81,7 @@ public override void Write(IRawDataPlus rawFile, int firstScanNumber, int lastSc
8181 ConfigureWriter ( ".mzML" ) ;
8282
8383 XmlSerializer serializer ;
84- var settings = new XmlWriterSettings { Indent = true , Encoding = new UTF8Encoding ( ) } ;
84+ var settings = new XmlWriterSettings { Indent = true , Encoding = new UTF8Encoding ( ) } ;
8585 var sha1 = SHA1 . Create ( ) ;
8686 CryptoStream cryptoStream = null ;
8787 if ( _doIndexing )
@@ -410,7 +410,7 @@ public override void Write(IRawDataPlus rawFile, int firstScanNumber, int lastSc
410410 }
411411 }
412412 }
413-
413+
414414
415415 if ( ParseInput . LogFormat == LogFormat . DEFAULT )
416416 {
@@ -435,7 +435,7 @@ public override void Write(IRawDataPlus rawFile, int firstScanNumber, int lastSc
435435 if ( ParseInput . LogFormat == LogFormat . DEFAULT )
436436 {
437437 var scanProgress =
438- ( int ) ( ( double ) scanNumber / ( lastScanNumber - firstScanNumber + 1 ) * 100 ) ;
438+ ( int ) ( ( double ) scanNumber / ( lastScanNumber - firstScanNumber + 1 ) * 100 ) ;
439439 if ( scanProgress % ProgressPercentageStep == 0 )
440440 {
441441 if ( scanProgress != lastScanProgress )
@@ -662,7 +662,7 @@ private string GetTotalScanNumber()
662662 var lastSelectedInstrument = _rawFile . SelectedInstrument ;
663663 var numScans = 0 ;
664664
665- if ( _rawFile . GetInstrumentCountOfType ( Device . MS ) != 0 )
665+ if ( _rawFile . GetInstrumentCountOfType ( Device . MS ) != 0 )
666666 {
667667 _rawFile . SelectInstrument ( Device . MS , 1 ) ;
668668 var levelFilter = _rawFile . GetFilterFromString ( "" ) ;
@@ -931,7 +931,7 @@ private List<ChromatogramType> ConstructChromatograms()
931931
932932 var settings = new ChromatogramTraceSettings ( TraceType . TotalAbsorbance ) ;
933933
934- var data = _rawFile . GetChromatogramData ( new IChromatogramSettings [ ] { settings } , - 1 , - 1 ) ;
934+ var data = _rawFile . GetChromatogramData ( new IChromatogramSettings [ ] { settings } , - 1 , - 1 ) ;
935935
936936 var trace = ChromatogramSignal . FromChromatogramData ( data ) ;
937937
@@ -977,7 +977,7 @@ private List<ChromatogramType> ConstructChromatograms()
977977
978978 var settings = new ChromatogramTraceSettings ( TraceType . StartUVChromatogramTraces + channel + 1 ) ;
979979
980- var data = _rawFile . GetChromatogramData ( new IChromatogramSettings [ ] { settings } , - 1 , - 1 ) ;
980+ var data = _rawFile . GetChromatogramData ( new IChromatogramSettings [ ] { settings } , - 1 , - 1 ) ;
981981
982982 var trace = ChromatogramSignal . FromChromatogramData ( data ) ;
983983
@@ -1027,7 +1027,7 @@ private List<ChromatogramType> ConstructChromatograms()
10271027 var settings = new ChromatogramTraceSettings ( TraceType . StartPCA2DChromatogramTraces + channel +
10281028 1 ) ;
10291029
1030- var data = _rawFile . GetChromatogramData ( new IChromatogramSettings [ ] { settings } , - 1 , - 1 ) ;
1030+ var data = _rawFile . GetChromatogramData ( new IChromatogramSettings [ ] { settings } , - 1 , - 1 ) ;
10311031
10321032 var trace = ChromatogramSignal . FromChromatogramData ( data ) ;
10331033
@@ -1063,6 +1063,7 @@ private List<ChromatogramType> ConstructChromatograms()
10631063 }
10641064 }
10651065
1066+ var channelNameIndex = 1
10661067 for ( int nrI = 1 ; nrI < _rawFile . GetInstrumentCountOfType ( Device . MSAnalog ) + 1 ; nrI ++ )
10671068 {
10681069 _rawFile . SelectInstrument ( Device . MSAnalog , nrI ) ;
@@ -1075,7 +1076,7 @@ private List<ChromatogramType> ConstructChromatograms()
10751076
10761077 if ( channelName . IsNullOrEmpty ( ) )
10771078 {
1078- channelName = "Channel " + channel ;
1079+ channelName = "Channel " + channelNameIndex ++ ;
10791080 }
10801081
10811082 var settings = new ChromatogramTraceSettings ( TraceType . StartAnalogChromatogramTraces + channel +
@@ -1161,7 +1162,7 @@ private ChromatogramType TraceToChromatogram(ChromatogramSignal trace, string ch
11611162 : GetZLib64BitArray ( trace . Times )
11621163 } ;
11631164 timesBinaryData . encodedLength =
1164- ( 4 * Math . Ceiling ( ( double ) timesBinaryData
1165+ ( 4 * Math . Ceiling ( ( double ) timesBinaryData
11651166 . binary . Length / 3 ) ) . ToString ( CultureInfo . InvariantCulture ) ;
11661167 var timesBinaryDataCvParams = new List < CVParamType >
11671168 {
@@ -1226,7 +1227,7 @@ private ChromatogramType TraceToChromatogram(ChromatogramSignal trace, string ch
12261227 : GetZLib64BitArray ( trace . Intensities )
12271228 } ;
12281229 intensitiesBinaryData . encodedLength =
1229- ( 4 * Math . Ceiling ( ( double ) intensitiesBinaryData
1230+ ( 4 * Math . Ceiling ( ( double ) intensitiesBinaryData
12301231 . binary . Length / 3 ) ) . ToString ( CultureInfo . InvariantCulture ) ;
12311232 var intensitiesBinaryDataCvParams = new List < CVParamType >
12321233 {
@@ -1299,7 +1300,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
12991300 var scanEvent = _rawFile . GetScanEventForScanNumber ( scanNumber ) ;
13001301 var spectrum = new SpectrumType
13011302 {
1302- id = ConstructSpectrumTitle ( ( int ) Device . MS , 1 , scanNumber ) ,
1303+ id = ConstructSpectrumTitle ( ( int ) Device . MS , 1 , scanNumber ) ,
13031304 defaultArrayLength = 0
13041305 } ;
13051306
@@ -1332,7 +1333,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
13321333 int ? charge = trailerData . AsPositiveInt ( "Charge State:" ) ;
13331334 double ? monoisotopicMz = trailerData . AsDouble ( "Monoisotopic M/Z:" ) ;
13341335 double ? ionInjectionTime = trailerData . AsDouble ( "Ion Injection Time (ms):" ) ;
1335- double ? isolationWidth = trailerData . AsDouble ( "MS" + ( int ) scanFilter . MSOrder + " Isolation Width:" ) ;
1336+ double ? isolationWidth = trailerData . AsDouble ( "MS" + ( int ) scanFilter . MSOrder + " Isolation Width:" ) ;
13361337 double ? FAIMSCV = null ;
13371338 if ( trailerData . AsBool ( "FAIMS Voltage On:" ) . GetValueOrDefault ( false ) )
13381339 FAIMSCV = trailerData . AsDouble ( "FAIMS CV:" ) ;
@@ -1344,7 +1345,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
13441345 foreach ( var label in trailerData . MatchKeys ( _spSentry ) )
13451346 {
13461347 var mass = trailerData . AsDouble ( label ) . GetValueOrDefault ( 0 ) ;
1347- if ( mass > 0 ) SPSMasses . Add ( ( double ) mass ) ; //zero means mass does not exist
1348+ if ( mass > 0 ) SPSMasses . Add ( ( double ) mass ) ; //zero means mass does not exist
13481349 }
13491350 }
13501351
@@ -1354,7 +1355,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
13541355 foreach ( var labelvalue in trailerData . MatchValues ( _spSentry3 ) )
13551356 {
13561357 foreach ( var mass in labelvalue . Trim ( )
1357- . Split ( new char [ ] { ',' } , StringSplitOptions . RemoveEmptyEntries ) )
1358+ . Split ( new char [ ] { ',' } , StringSplitOptions . RemoveEmptyEntries ) )
13581359 {
13591360 SPSMasses . Add ( double . Parse ( mass ) ) ;
13601361 }
@@ -1383,14 +1384,14 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
13831384
13841385 }
13851386 else if ( msLevel > 1 )
1386- {
1387+ {
13871388 spectrumCvParams . Add ( new CVParamType
1388- {
1389- accession = "MS:1000580" ,
1390- cvRef = "MS" ,
1391- name = "MSn spectrum" ,
1392- value = ""
1393- } ) ;
1389+ {
1390+ accession = "MS:1000580" ,
1391+ cvRef = "MS" ,
1392+ name = "MSn spectrum" ,
1393+ value = ""
1394+ } ) ;
13941395
13951396 // Keep track of scan number and isolation m/z for precursor reference
13961397 var result = _filterStringIsolationMzPattern . Match ( scanEvent . ToString ( ) ) ;
@@ -1458,7 +1459,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
14581459 _precursorTree [ scanNumber ] = new PrecursorInfo ( _precursorScanNumber , 1 , 0 , new PrecursorType [ 0 ] ) ;
14591460
14601461 }
1461-
1462+
14621463 }
14631464 else
14641465 {
@@ -1533,7 +1534,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
15331534 double [ ] masses ;
15341535 double [ ] intensities ;
15351536
1536- if ( ! ParseInput . NoPeakPicking . Contains ( ( int ) scanFilter . MSOrder ) )
1537+ if ( ! ParseInput . NoPeakPicking . Contains ( ( int ) scanFilter . MSOrder ) )
15371538 {
15381539 //Spectrum will be centroided
15391540 spectrumCvParams . Add ( new CVParamType
@@ -1696,7 +1697,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
16961697 binary = ParseInput . NoZlibCompression ? Get64BitArray ( masses ) : GetZLib64BitArray ( masses )
16971698 } ;
16981699 massesBinaryData . encodedLength =
1699- ( 4 * Math . Ceiling ( ( double ) massesBinaryData
1700+ ( 4 * Math . Ceiling ( ( double ) massesBinaryData
17001701 . binary . Length / 3 ) ) . ToString ( CultureInfo . InvariantCulture ) ;
17011702 var massesBinaryDataCvParams = new List < CVParamType >
17021703 {
@@ -1758,7 +1759,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
17581759 : GetZLib64BitArray ( intensities )
17591760 } ;
17601761 intensitiesBinaryData . encodedLength =
1761- ( 4 * Math . Ceiling ( ( double ) intensitiesBinaryData
1762+ ( 4 * Math . Ceiling ( ( double ) intensitiesBinaryData
17621763 . binary . Length / 3 ) ) . ToString ( CultureInfo . InvariantCulture ) ;
17631764 var intensitiesBinaryDataCvParams = new List < CVParamType >
17641765 {
@@ -2001,7 +2002,7 @@ private SpectrumType ConstructPDASpectrum(int scanNumber, int instrumentNumber)
20012002
20022003 var spectrum = new SpectrumType
20032004 {
2004- id = ConstructSpectrumTitle ( ( int ) Device . Pda , instrumentNumber , scanNumber ) ,
2005+ id = ConstructSpectrumTitle ( ( int ) Device . Pda , instrumentNumber , scanNumber ) ,
20052006 defaultArrayLength = 0
20062007 } ;
20072008
@@ -2120,7 +2121,7 @@ private SpectrumType ConstructPDASpectrum(int scanNumber, int instrumentNumber)
21202121 binary = ParseInput . NoZlibCompression ? Get64BitArray ( positions ) : GetZLib64BitArray ( positions )
21212122 } ;
21222123 positionsBinaryData . encodedLength =
2123- ( 4 * Math . Ceiling ( ( double ) positionsBinaryData
2124+ ( 4 * Math . Ceiling ( ( double ) positionsBinaryData
21242125 . binary . Length / 3 ) ) . ToString ( CultureInfo . InvariantCulture ) ;
21252126 var positionsBinaryDataCvParams = new List < CVParamType >
21262127 {
@@ -2181,7 +2182,7 @@ private SpectrumType ConstructPDASpectrum(int scanNumber, int instrumentNumber)
21812182 : GetZLib64BitArray ( intensities )
21822183 } ;
21832184 intensitiesBinaryData . encodedLength =
2184- ( 4 * Math . Ceiling ( ( double ) intensitiesBinaryData
2185+ ( 4 * Math . Ceiling ( ( double ) intensitiesBinaryData
21852186 . binary . Length / 3 ) ) . ToString ( CultureInfo . InvariantCulture ) ;
21862187 var intensitiesBinaryDataCvParams = new List < CVParamType >
21872188 {
@@ -2264,16 +2265,16 @@ private PrecursorListType ConstructPrecursorList(int precursorScanNumber, IScanE
22642265
22652266 spectrumRef = ConstructSpectrumTitle ( ( int ) Device . MS , 1 , precursorScanNumber ) ;
22662267 reaction = scanEvent . GetReaction ( reactionCount ) ;
2267-
2268+
22682269 precursorMz = reaction . PrecursorMass ;
22692270
22702271 //if isolation width was not found in the trailer, try to get one from the reaction
22712272 if ( isolationWidth == null ) isolationWidth = reaction . IsolationWidth ;
2272-
2273+
22732274 var precursor = new PrecursorType
22742275 {
22752276 selectedIonList =
2276- new SelectedIonListType { count = "1" , selectedIon = new ParamGroupType [ 1 ] } ,
2277+ new SelectedIonListType { count = "1" , selectedIon = new ParamGroupType [ 1 ] } ,
22772278 spectrumRef = spectrumRef
22782279 } ;
22792280
@@ -2483,7 +2484,7 @@ private PrecursorListType ConstructPrecursorList(int precursorScanNumber, IScanE
24832484 var SPSPrecursor = new PrecursorType
24842485 {
24852486 selectedIonList =
2486- new SelectedIonListType { count = "1" , selectedIon = new ParamGroupType [ 1 ] } ,
2487+ new SelectedIonListType { count = "1" , selectedIon = new ParamGroupType [ 1 ] } ,
24872488 spectrumRef = spectrumRef
24882489 } ;
24892490
@@ -2792,7 +2793,7 @@ private static byte[] Get64BitArray(ICollection<double> array)
27922793 memoryStream . Position = 0 ;
27932794 bytes = memoryStream . ToArray ( ) ;
27942795 }
2795- }
2796+ }
27962797
27972798 return ( byte [ ] ) bytes ;
27982799 }
@@ -2812,8 +2813,8 @@ private static byte[] GetZLib64BitArray(ICollection<double> array)
28122813 using ( var memoryStream = new MemoryStream ( ) )
28132814 using ( var outZStream = new ZOutputStream ( memoryStream , zlibConst . Z_DEFAULT_COMPRESSION ) )
28142815 {
2815- outZStream . Write ( bytes , 0 , bytes . Length ) ;
2816-
2816+ outZStream . Write ( bytes , 0 , bytes . Length ) ;
2817+
28172818 outZStream . finish ( ) ;
28182819 memoryStream . Position = 0 ;
28192820 bytes = memoryStream . ToArray ( ) ;
0 commit comments