diff --git a/MSFileToolbox/src/umich/ms/datatypes/scancollection/ScanCollectionHelper.java b/MSFileToolbox/src/umich/ms/datatypes/scancollection/ScanCollectionHelper.java index 1b3c7ae..46f1372 100644 --- a/MSFileToolbox/src/umich/ms/datatypes/scancollection/ScanCollectionHelper.java +++ b/MSFileToolbox/src/umich/ms/datatypes/scancollection/ScanCollectionHelper.java @@ -112,9 +112,30 @@ public static void finalizeScanCollection(IScanCollection scans) throws FilePars Integer thisMsLevel = curScan.getMsLevel(); Integer chldMsLevel = childScan.getMsLevel(); - if (precursor.getParentScanNum() == null - && thisMsLevel != null && chldMsLevel != null && thisMsLevel + 1 == chldMsLevel) { - precursor.setParentScanNum(curScanNum); + if (precursor.getParentScanNum() == null && thisMsLevel != null && chldMsLevel != null && thisMsLevel + 1 == chldMsLevel) { + + Double pLo = precursor.getMzRangeStart(); + Double pHi = precursor.getMzRangeEnd(); + Double sLo = curScan.getScanMzWindowLower(); + Double sHi = curScan.getScanMzWindowUpper(); + if (pLo != null && pHi != null && sLo != null && sHi != null) { + // if we know precursor isolation window and the scan's m/z scan range + // they must overlap + if (pLo <= sHi && sLo <= pHi) { + // they overlap! + if (pLo.equals(pHi)) { // it's a single point + precursor.setParentScanNum(curScanNum); + } else { + final double minOverlap = 0.75; + double overlap = Math.min(pHi, sHi) - Math.max(pLo, sLo); + precursor.setParentScanNum(curScanNum); + } + } + + } else { + // otherwise blindly add it + precursor.setParentScanNum(curScanNum); + } } // this else condition seems to not hold when some scans were cut out from mzXML file with ProteoWizrd. diff --git a/MSFileToolbox/src/umich/ms/fileio/filetypes/LCMSDataSource.java b/MSFileToolbox/src/umich/ms/fileio/filetypes/LCMSDataSource.java index 6725889..d5c124d 100644 --- a/MSFileToolbox/src/umich/ms/fileio/filetypes/LCMSDataSource.java +++ b/MSFileToolbox/src/umich/ms/fileio/filetypes/LCMSDataSource.java @@ -1,18 +1,18 @@ -/* - * Copyright 2016 Dmitry Avtonomov. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +/* + * Copyright 2016 Dmitry Avtonomov. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package umich.ms.fileio.filetypes; import java.util.List; @@ -163,5 +163,5 @@ public interface LCMSDataSource> { * @throws umich.ms.fileio.exceptions.FileParsingException * @throws IllegalArgumentException */ - public List parse(List scanNums) throws FileParsingException; + List parse(List scanNums) throws FileParsingException; } diff --git a/MSFileToolbox/src/umich/ms/msfiletoolbox/MsftbxInfo.java b/MSFileToolbox/src/umich/ms/msfiletoolbox/MsftbxInfo.java index b6803cc..24c98fd 100644 --- a/MSFileToolbox/src/umich/ms/msfiletoolbox/MsftbxInfo.java +++ b/MSFileToolbox/src/umich/ms/msfiletoolbox/MsftbxInfo.java @@ -20,5 +20,5 @@ * @author Dmitry Avtonomov */ public class MsftbxInfo { - public static final String version = "1.1.0"; + public static final String version = "1.1.1"; }