src/Reader/MgfReader.php
private function parseMeta(PrecursorIon $precursor)
    {
        $line = trim($this->getLine());
        $pair = explode('=', $line, 2);

        $value = $pair[1];
        if (is_numeric($value)) {
            $value += 0;
        }

        if ($pair[0] == 'TITLE') {
            $precursor->setTitle($pair[1]);
        } elseif ($pair[0] == 'PEPMASS') {
            $chunks = explode(' ', $pair[1]);
            if (count($chunks) > 1) {
                $precursor->setIntensity((float) $chunks[1] + 0);
            }

            $this->massCharge = (float) $chunks[0] + 0;
        } elseif ($pair[0] == 'CHARGE') {
            $this->charge = (int) $pair[1];
        } elseif ($pair[0] == 'SCANS') {
            $precursor->setScan((int) $pair[1] + 0);
        } elseif ($pair[0] == 'RTINSECONDS') {
            $window = explode(',', $pair[1]);
            if (count($window) == 1) {
                $precursor->setRetentionTime((float) $window[0] + 0);
            } else {
                $precursor->setRetentionTimeWindow((float) $window[0] + 0, (float) $window[1] + 0);
            }
        }
    }
private function parseMeta(PrecursorIon $precursor)
    {
        $line = trim($this->getLine());
        $pair = explode('=', $line, 2);

        $value = $pair[1];
        if (is_numeric($value)) {
            $value += 0;
        }

        if ($pair[0] == 'TITLE') {
            $precursor->setTitle($pair[1]);
        } elseif ($pair[0] == 'PEPMASS') {
            $chunks = explode(' ', $pair[1]);
            if (count($chunks) > 1) {
                $precursor->setIntensity((float) $chunks[1] + 0);
            }

            $this->massCharge = (float) $chunks[0] + 0;
        } elseif ($pair[0] == 'CHARGE') {
            $this->charge = (int) $pair[1];
        } elseif ($pair[0] == 'SCANS') {
            $precursor->setScan((int) $pair[1] + 0);
        } elseif ($pair[0] == 'RTINSECONDS') {
            $window = explode(',', $pair[1]);
            if (count($window) == 1) {
                $precursor->setRetentionTime((float) $window[0] + 0);
            } else {
                $precursor->setRetentionTimeWindow((float) $window[0] + 0, (float) $window[1] + 0);
            }
        }
    }
private function parseMeta ( PrecursorIon $ precursor ) { $ line = trim ( $ this -> getLine ( ) ) ; $ pair = explode ( '=' , $ line , 2 ) ; $ value = $ pair [ 1 ] ; if ( is_numeric ( $ value ) ) { $ value += 0 ; } if ( $ pair [ 0 ] == 'TITLE' ) { $ precursor -> setTitle ( $ pair [ 1 ] ) ; } elseif ( $ pair [ 0 ] == 'PEPMASS' ) { $ chunks = explode ( ' ' , $ pair [ 1 ] ) ; if ( count ( $ chunks ) > 1 ) { $ precursor -> setIntensity ( ( float ) $ chunks [ 1 ] + 0 ) ; } $ this -> massCharge = ( float ) $ chunks [ 0 ] + 0 ; } elseif ( $ pair [ 0 ] == 'CHARGE' ) { $ this -> charge = ( int ) $ pair [ 1 ] ; } elseif ( $ pair [ 0 ] == 'SCANS' ) { $ precursor -> setScan ( ( int ) $ pair [ 1 ] + 0 ) ; } elseif ( $ pair [ 0 ] == 'RTINSECONDS' ) { $ window = explode ( ',' , $ pair [ 1 ] ) ; if ( count ( $ window ) == 1 ) { $ precursor -> setRetentionTime ( ( float ) $ window [ 0 ] + 0 ) ; } else { $ precursor -> setRetentionTimeWindow ( ( float ) $ window [ 0 ] + 0 , ( float ) $ window [ 1 ] + 0 ) ; } } }
Parses the meta information from the scan and writes it to the precursor entry

@param PrecursorIon $precursor
The precursor to append to
Parses the meta information from the scan and writes it to the precursor entry