-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: mzxml * fix: requests
- Loading branch information
Showing
6 changed files
with
117 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,5 @@ | ||
import { processSpectrumList } from './processSpectrumList'; | ||
|
||
export function processMZXML(topLevel, result) { | ||
processSpectrumList(topLevel, result.series.ms); | ||
let offset = topLevel.index.offset; | ||
for (let i = 0; i < offset.length; i++) { | ||
let index = offset[i]._attr.id; | ||
let data = offset[i]._data; | ||
result.times[index - 1] = data; | ||
} | ||
result.metadata = { | ||
msManufacturer: topLevel.msRun.msInstrument.msManufacturer._attr, | ||
msModel: topLevel.msRun.msInstrument.msModel._attr, | ||
msIonisation: topLevel.msRun.msInstrument.msIonisation._attr, | ||
msMassAnalyzer: topLevel.msRun.msInstrument.msMassAnalyzer._attr, | ||
msDetector: topLevel.msRun.msInstrument.msDetector._attr, | ||
software: topLevel.msRun.msInstrument.software._attr, | ||
}; | ||
processSpectrumList(topLevel, result.times, result.series.ms); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
import { parseBinaryDataArray } from './parseBinaryDataArray'; | ||
|
||
export function processSpectrumList(parsed, msData) { | ||
export function processSpectrumList(parsed, times, msData) { | ||
if (!parsed.msRun.scan) return; | ||
let scanList = parsed.msRun.scan; | ||
if (Array.isArray(scanList) === false) scanList = [scanList]; | ||
if (scanList[0]._attr) { | ||
msData.info = []; | ||
} | ||
if (scanList[0]._attr) msData.info = []; | ||
for (let scan of scanList) { | ||
if (typeof scan !== 'object') continue; | ||
if (Array.isArray(scan)) { | ||
throw new Error('processSpectrumList: scan may not be an array'); | ||
} | ||
let dataArray = parseBinaryDataArray(scan); | ||
let first = new Float64Array(dataArray.data.length / 2); | ||
let second = new Float64Array(dataArray.data.length / 2); | ||
for (let i = 0; i < dataArray.data.length / 2; i++) { | ||
const dataArray = parseBinaryDataArray(scan); | ||
let length = dataArray.data.length / 2; | ||
let first = new Float64Array(length); | ||
let second = new Float64Array(length); | ||
for (let i = 0; i < length; i++) { | ||
first[i] = dataArray.data[i * 2]; | ||
second[i] = dataArray.data[i * 2 + 1]; | ||
} | ||
msData.data.push([first, second]); | ||
msData.info.push(scan._attr); | ||
times.push( | ||
parseFloat(scan._attr.retentionTime.replace(/(P*)(T*)(S*)/gi, '')), | ||
); | ||
} | ||
} |
please remove this dependency