Exemplo n.º 1
0
 /// <summary>
 /// Returns the search result (e.g. pepXML, mzIdentML) filenpath corresponding with the given searchFilepath.
 /// </summary>
 /// <param name="searchFilepath">The raw data filepath (e.g. RAW, WIFF, mzML)</param>
 public virtual string GetSearchResultFilepath(MsDataFileUri searchFilepath)
 {
     return(Path.ChangeExtension(searchFilepath.GetFilePath(), @".mzid"));
 }
 public void ClearGraph(MsDataFileUri filePath)
 {
     _graphs.Remove(filePath.GetFilePath());
 }
Exemplo n.º 3
0
 public override string GetSearchResultFilepath(MsDataFileUri searchFilepath)
 {
     return(Path.ChangeExtension(searchFilepath.GetFilePath(), @".mzid.gz"));
 }
Exemplo n.º 4
0
        private IsolationRange[] ReadIsolationRanges(MsDataFileUri dataSource, IsolationRange[] isolationRanges)
        {
            var    dictRangeCounts = isolationRanges.ToDictionary(r => r, r => 0);
            var    listRanges = new List <IsolationRange>(isolationRanges);
            double minStart = double.MaxValue, maxStart = double.MinValue;

            string path    = dataSource.GetFilePath();
            bool   isPasef = Equals(DataSourceUtil.GetSourceType(new DirectoryInfo(path)), DataSourceUtil.TYPE_BRUKER);

            using (var dataFile = new MsDataFileImpl(path, simAsSpectra: true))
            {
                int lookAheadCount = Math.Min(MAX_MULTI_CYCLE, dataFile.SpectrumCount);
                for (int i = 0; i < lookAheadCount; i++)
                {
                    if (dataFile.GetMsLevel(i) != 2)
                    {
                        continue;
                    }

                    var spectrum = dataFile.GetSpectrum(i);
                    isPasef = isPasef && spectrum.IonMobilities != null;
                    foreach (var precursor in spectrum.Precursors)
                    {
                        if (!precursor.IsolationWindowLower.HasValue || !precursor.IsolationWindowUpper.HasValue)
                        {
                            throw new IOException(string.Format(Resources.EditIsolationSchemeDlg_ReadIsolationRanges_Missing_isolation_range_for_the_isolation_target__0__m_z_in_the_file__1_, precursor.IsolationWindowTargetMz, dataSource));
                        }
                        double start = precursor.IsolationWindowTargetMz.Value - precursor.IsolationWindowLower.Value;
                        double end   = precursor.IsolationWindowTargetMz.Value + precursor.IsolationWindowUpper.Value;
                        var    range = new IsolationRange(start, end);
                        int    count;
                        if (!dictRangeCounts.TryGetValue(range, out count))
                        {
                            count = 0;
                            dictRangeCounts.Add(range, count);
                            listRanges.Add(range);
                        }
                        if (count == 2)
                        {
                            // Repeating for the third time
                            i = lookAheadCount;
                            break;
                        }
                        dictRangeCounts[range] = count + 1;
                        minStart = Math.Min(minStart, range.Start);
                        maxStart = Math.Max(maxStart, range.Start);
                    }
                }
            }
            if (dictRangeCounts.Values.Any(c => c == 1))
            {
                if (dictRangeCounts.Count > 2)
                {
                    // Sometime demux of overlapping schemes leaves wings that repeat only every other cycle
                    RemoveRangeSingleton(minStart, dictRangeCounts, listRanges);
                    RemoveRangeSingleton(maxStart, dictRangeCounts, listRanges);
                }

                if (dictRangeCounts.Values.Any(c => c == 1))
                {
                    throw new IOException(string.Format(Resources.EditIsolationSchemeDlg_ReadIsolationRanges_No_repeating_isolation_scheme_found_in__0_, dataSource));
                }
            }
            // diaPASEF comes in out of order and will be misinterpreted unless ordered
            // Multiplexing, however, requires that the acquired order by maintained
            if (isPasef)
            {
                listRanges.Sort((r1, r2) => r1.Start.CompareTo(r2.Start));
            }
            return(listRanges.ToArray());
        }
Exemplo n.º 5
0
        private IsolationRange[] ReadIsolationRanges(MsDataFileUri dataSource, IsolationRange[] isolationRanges)
        {
            var    dictRangeCounts = isolationRanges.ToDictionary(r => r, r => 0);
            var    listRanges = new List <IsolationRange>(isolationRanges);
            double minStart = double.MaxValue, maxStart = double.MinValue;

            using (var dataFile = new MsDataFileImpl(dataSource.GetFilePath(), simAsSpectra: true))
            {
                int lookAheadCount = Math.Min(MAX_MULTI_CYCLE, dataFile.SpectrumCount);
                for (int i = 0; i < lookAheadCount; i++)
                {
                    if (dataFile.GetMsLevel(i) != 2)
                    {
                        continue;
                    }

                    var spectrum = dataFile.GetSpectrum(i);
                    foreach (var precursor in spectrum.Precursors)
                    {
                        if (!precursor.IsolationWindowLower.HasValue || !precursor.IsolationWindowUpper.HasValue)
                        {
                            throw new IOException(string.Format(Resources.EditIsolationSchemeDlg_ReadIsolationRanges_Missing_isolation_range_for_the_isolation_target__0__m_z_in_the_file__1_, precursor.IsolationWindowTargetMz, dataSource));
                        }
                        double start = precursor.IsolationWindowTargetMz.Value - precursor.IsolationWindowLower.Value;
                        double end   = precursor.IsolationWindowTargetMz.Value + precursor.IsolationWindowUpper.Value;
                        var    range = new IsolationRange(start, end);
                        int    count;
                        if (!dictRangeCounts.TryGetValue(range, out count))
                        {
                            count = 0;
                            dictRangeCounts.Add(range, count);
                            listRanges.Add(range);
                        }
                        if (count == 2)
                        {
                            // Repeating for the third time
                            i = lookAheadCount;
                            break;
                        }
                        dictRangeCounts[range] = count + 1;
                        minStart = Math.Min(minStart, range.Start);
                        maxStart = Math.Max(maxStart, range.Start);
                    }
                }
            }
            if (dictRangeCounts.Values.Any(c => c == 1))
            {
                if (dictRangeCounts.Count > 2)
                {
                    // Sometime demux of overlapping schemes leaves wings that repeat only every other cycle
                    RemoveRangeSingleton(minStart, dictRangeCounts, listRanges);
                    RemoveRangeSingleton(maxStart, dictRangeCounts, listRanges);
                }

                if (dictRangeCounts.Values.Any(c => c == 1))
                {
                    throw new IOException(string.Format(Resources.EditIsolationSchemeDlg_ReadIsolationRanges_No_repeating_isolation_scheme_found_in__0_, dataSource));
                }
            }
            return(listRanges.ToArray());
        }