src/Reader/MgfReader.php
private function parseFragments(PrecursorIon $precursor)
    {
        $line = trim($this->getLine());

        if (strlen($line) == 0) {
            return;
        }

        $pair = preg_split('/\\s/', $line, 3);

        $ion = new FragmentIon();
        $fragmentMz = (float) $pair[0];
        $fragmentCharge = 1;
        
        if (count($pair) > 1) {
            $ion->setIntensity((float) $pair[1]);
        }

        if (count($pair) > 2) {
            $fragmentCharge = (int) $pair[2];
        }

        $ion->setMonoisotopicMassCharge($fragmentMz, $fragmentCharge);

        $precursor->addFragmentIon($ion);
    }
private function parseFragments(PrecursorIon $precursor)
    {
        $line = trim($this->getLine());

        if (strlen($line) == 0) {
            return;
        }

        $pair = preg_split('/\\s/', $line, 3);

        $ion = new FragmentIon();
        $fragmentMz = (float) $pair[0];
        $fragmentCharge = 1;
        
        if (count($pair) > 1) {
            $ion->setIntensity((float) $pair[1]);
        }

        if (count($pair) > 2) {
            $fragmentCharge = (int) $pair[2];
        }

        $ion->setMonoisotopicMassCharge($fragmentMz, $fragmentCharge);

        $precursor->addFragmentIon($ion);
    }
private function parseFragments ( PrecursorIon $ precursor ) { $ line = trim ( $ this -> getLine ( ) ) ; if ( strlen ( $ line ) == 0 ) { return ; } $ pair = preg_split ( '/\\s/' , $ line , 3 ) ; $ ion = new FragmentIon ( ) ; $ fragmentMz = ( float ) $ pair [ 0 ] ; $ fragmentCharge = 1 ; if ( count ( $ pair ) > 1 ) { $ ion -> setIntensity ( ( float ) $ pair [ 1 ] ) ; } if ( count ( $ pair ) > 2 ) { $ fragmentCharge = ( int ) $ pair [ 2 ] ; } $ ion -> setMonoisotopicMassCharge ( $ fragmentMz , $ fragmentCharge ) ; $ precursor -> addFragmentIon ( $ ion ) ; }
Parses the fragment information from the scan and writes it to the precursor entry

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