예제 #1
0
 public override void Open()
 {
     if (IsOpen)
     {
         return;
     }
     _msdr = new MassSpecDataReader();
     _msdr.OpenDataFile(FilePath);
     base.Open();
 }
예제 #2
0
        protected override void DoRealGo()
        {
            reader.CloseDataFile();

            reader.OpenDataFile(GetOriginFile());

            firstScan = 1;

            lastScan = (int)reader.MSScanFileInformation.TotalScansPresent;

            retentionTimes = reader.GetRetentionTimes();

            txtScan.Text = firstScan.ToString();

            DisplayScan();
        }
예제 #3
0
 private void OpenDataset()
 {
     m_reader = new MassSpecDataReader();
     m_reader.OpenDataFile(this.Filename);
 }
예제 #4
0
 public override void Open()
 {
     if (IsOpen)
         return;
     _msdr = new MassSpecDataReader();
     _msdr.OpenDataFile(FilePath);
     base.Open();
 }
예제 #5
0
 private void OpenDataset()
 {
     m_reader = new MassSpecDataReader();
     m_reader.OpenDataFile(DatasetFileOrDirectoryPath);
 }
예제 #6
0
        public override int LoadIndex(string FileName)
        {
            this.RawFileName = FileName;

            RawFile  = new MassSpecDataReader();
            MSReader = RawFile;
            MSReader.OpenDataFile(FileName);
            Spectra = (int)(MSReader.MSScanFileInformation.TotalScansPresent);

            bool PosMode = false, NegMode = false;

            if (Spectra <= 0)
            {
                return(0);
            }

            int i, LastFull = 0, Total = 0;

            //there will be fake [0] spectra with no data and fake last spectra with no data
            //it is made to make any chromatogram start and end with zero
            IndexDir   = new int[Spectra + 2];
            IndexRev   = new int[Spectra + 2];
            RawSpectra = new RawSpectrum[Spectra + 2];
            for (int j = 0; j <= Spectra + 1; j++)
            {
                RawSpectra[j] = new RawSpectrum();
            }
            TimeStamps = new double[Spectra + 2];
            TimeCoefs  = new double[Spectra + 2];

            LowRT  = 0.0;
            HighRT = 0.0;

            int Progress = 0;

            for (i = 1; i <= Spectra; i++)
            {
                if ((int)(100.0 * ((double)i / (double)Spectra)) > Progress)//report progress
                {
                    Progress = (int)(100.0 * ((double)i / (double)Spectra));
                    RepProgress?.Invoke(Progress);
                }

                IMSScanRecord ScanRecord = MSReader.GetScanRecord(i - 1);

                if (ScanRecord.MSScanType == MSScanType.Scan && ScanRecord.MSLevel == MSLevel.MS && ScanRecord.CollisionEnergy == 0.0)          //if spectra is a FULL MS

                {
                    PosMode |= ScanRecord.IonPolarity == IonPolarity.Positive;
                    NegMode |= ScanRecord.IonPolarity == IonPolarity.Negative;

                    RawSpectra[i].RT   = ScanRecord.RetentionTime;
                    TimeStamps[i]      = RawSpectra[i].RT - RawSpectra[LastFull].RT;
                    RawSpectra[i].Scan = i;

                    IndexDir[LastFull] = i;
                    IndexRev[i]        = LastFull;

                    LastFull = i;

                    Total++;
                }
            }
            IndexDir[LastFull]    = Spectra + 1;
            IndexDir[Spectra + 1] = -1;
            IndexRev[Spectra + 1] = LastFull;

            TotalRT          = RawSpectra[LastFull].RT;
            AverageTimeStamp = TotalRT / Total;

            //time interval bias coefficients
            for (i = IndexDir[0]; IndexDir[i] != -1; i = IndexDir[i])
            {
                TimeCoefs[i] = (TimeStamps[i] + TimeStamps[IndexDir[i]]) / (2.0 * AverageTimeStamp);
            }
            TimeCoefs[i] = 1.0;

            //Fake spectra number 0 has to have reasonable RT
            double FRT = RawSpectra[IndexDir[0]].RT;
            double SRT = RawSpectra[IndexDir[IndexDir[0]]].RT;

            RawSpectra[0].RT = Math.Max(0, FRT - (SRT - FRT));
            //Last spectra also has to have reasonable RT
            FRT = RawSpectra[LastFull].RT;
            SRT = RawSpectra[IndexRev[LastFull]].RT;
            RawSpectra[Spectra + 1].RT = FRT + (FRT - SRT);

            RawSpectra[0].Data           = new MZData[0];
            RawSpectra[Spectra + 1].Data = new MZData[0];

            PeakFilter = new MsdrPeakFilter();
            PeakFilter.AbsoluteThreshold = 5.0;

            if (PosMode && !NegMode)
            {
                Mode = 1;
            }
            if (!PosMode && NegMode)
            {
                Mode = -1;
            }

            return(Spectra);
        }