src/Search/Parameters/MsgfPlusSearchParameters.php
public static function createModificationFile(array $modifications, $numMods = 2)
    {
        // TODO:
        // All array must be this class
        // NumMods must be uint
        $data = 'NumMods=' . $numMods . PHP_EOL;

        foreach ($modifications as $modification) {
            $entry = $modification->getMonoisotopicMass() . ',';
            $entry .= count($modification->getResidues()) == 0 ? '*' : implode('', $modification->getResidues());
            $entry .= ',';

            $entry .= $modification->isFixed() ? 'fix,' : 'opt,';

            $position = '';
            switch ($modification->getPosition()) {
                case Modification::POSITION_PROTEIN_NTERM:
                    $position = 'Prot-N-term';
                    break;
                case Modification::POSITION_PROTEIN_CTERM:
                    $position = 'Prot-C-term';
                    break;
                case Modification::POSITION_NTERM:
                    $position = 'N-term';
                    break;
                case Modification::POSITION_CTERM:
                    $position = 'C-term';
                    break;
                case Modification::POSITION_ANY:
                default:
                    $position = 'any';
                    break;
            }

            $entry .= $position . ',';
            $entry .= $modification->getName();

            $data .= $entry . PHP_EOL;
        }

        $modFile = tempnam(sys_get_temp_dir(), 'php-msMsgfMods');
        file_put_contents($modFile, $data);

        return $modFile;
    }
public static function createModificationFile(array $modifications, $numMods = 2)
    {
        // TODO:
        // All array must be this class
        // NumMods must be uint
        $data = 'NumMods=' . $numMods . PHP_EOL;

        foreach ($modifications as $modification) {
            $entry = $modification->getMonoisotopicMass() . ',';
            $entry .= count($modification->getResidues()) == 0 ? '*' : implode('', $modification->getResidues());
            $entry .= ',';

            $entry .= $modification->isFixed() ? 'fix,' : 'opt,';

            $position = '';
            switch ($modification->getPosition()) {
                case Modification::POSITION_PROTEIN_NTERM:
                    $position = 'Prot-N-term';
                    break;
                case Modification::POSITION_PROTEIN_CTERM:
                    $position = 'Prot-C-term';
                    break;
                case Modification::POSITION_NTERM:
                    $position = 'N-term';
                    break;
                case Modification::POSITION_CTERM:
                    $position = 'C-term';
                    break;
                case Modification::POSITION_ANY:
                default:
                    $position = 'any';
                    break;
            }

            $entry .= $position . ',';
            $entry .= $modification->getName();

            $data .= $entry . PHP_EOL;
        }

        $modFile = tempnam(sys_get_temp_dir(), 'php-msMsgfMods');
        file_put_contents($modFile, $data);

        return $modFile;
    }
public static function createModificationFile ( array $ modifications , $ numMods = 2 ) { // TODO: // All array must be this class // NumMods must be uint $ data = 'NumMods=' . $ numMods . PHP_EOL ; foreach ( $ modifications as $ modification ) { $ entry = $ modification -> getMonoisotopicMass ( ) . ',' ; $ entry .= count ( $ modification -> getResidues ( ) ) == 0 ? '*' : implode ( '' , $ modification -> getResidues ( ) ) ; $ entry .= ',' ; $ entry .= $ modification -> isFixed ( ) ? 'fix,' : 'opt,' ; $ position = '' ; switch ( $ modification -> getPosition ( ) ) { case Modification :: POSITION_PROTEIN_NTERM : $ position = 'Prot-N-term' ; break ; case Modification :: POSITION_PROTEIN_CTERM : $ position = 'Prot-C-term' ; break ; case Modification :: POSITION_NTERM : $ position = 'N-term' ; break ; case Modification :: POSITION_CTERM : $ position = 'C-term' ; break ; case Modification :: POSITION_ANY : default : $ position = 'any' ; break ; } $ entry .= $ position . ',' ; $ entry .= $ modification -> getName ( ) ; $ data .= $ entry . PHP_EOL ; } $ modFile = tempnam ( sys_get_temp_dir ( ) , 'php-msMsgfMods' ) ; file_put_contents ( $ modFile , $ data ) ; return $ modFile ; }
Creates a modification file from an array of modifications

@param Modification[] $modifications
@param number $numMods
Max number of modifications to search per peptide
@return string File path the newly created modification file
Creates a modification file from an array of modifications