Esempio n. 1
0
 /**
  * Retrieves the index mass including all modifications
  * @param string $weighttype The weighttype to use for masses
  * @param int $index The index of the amino acid in sequence
  * @return float The total mass of the amino acid including all modifications
  */
 public function getIndexMass($weighttype, $index)
 {
     $loc = basename(__FILE__) . '/' . __METHOD__;
     $arrModifications;
     $dblAddMass = 0;
     $dblMass = 0;
     $objMod = null;
     $strAa = '';
     if (!isset($this->Sequence) || $this->Sequence === '') {
         $this->toLog('error', $loc, 'Sequence not set', 'Failed to get modification for index. Sequence not set yet.', '');
         return;
     }
     if ($index >= strlen($this->Sequence)) {
         $this->toLog('error', $loc, 'Index out of bounds', 'Specified index is out of sequence bounds.', '');
         return -1;
     }
     $strAa = substr($this->Sequence, $index, 1);
     $dblMass = parent::getIndexMass($weighttype, $index);
     $arrModifications = $this->getIndexModifications($index, $weighttype);
     for ($i = 0, $j = count($arrModifications); $i < $j; $i++) {
         $objMod = $arrModifications[$i];
         $dblAddMass += $this->getModificationMass($objMod['accession'], $strAa, $index, $weighttype);
     }
     return $dblMass + $dblAddMass;
 }
Esempio n. 2
0
$seq = 'HGYIGEF4EYVDDHR';
print 'Peptide: ' . $seq . '<br />';
if ($pep->validateSequence($seq) === true) {
    print 'TRUE<br />';
} else {
    print 'FALSE<br />';
}
$seq = 'HGYIGEFEYV*DDHR';
print 'Peptide: ' . $seq . '<br />';
if ($pep->validateSequence($seq) === true) {
    print 'TRUE<br />';
} else {
    print 'FALSE<br />';
}
// ###### NAKED PEPTIDE ######
$pep = new Peptide();
$pep->Sequence = 'HGYIGEFEYVDDHR';
$pep->NTerminus = 'H';
$pep->CTerminus = 'OH';
print '<br><h1>Testing naked peptide</h1>';
print 'Peptide: ' . $pep->Sequence . '<br />';
print 'N-Terminus: ' . $pep->NTerminus . '<br />';
print 'C-Terminus: ' . $pep->CTerminus . '<br />';
print '<h3>Masses monoisotopic</h3>';
print 'Mass C-Terminus: ' . strval($pep->getCTerminusMass('monoisotopic')) . '<br />';
print 'Mass N-Terminus: ' . strval($pep->getNTerminusMass('monoisotopic')) . '<br />';
print 'Peptide mass: ' . strval($pep->getMass('monoisotopic')) . '<br />';
print 'Calculated MCR 2: ' . strval($pep->getTheoreticalMCR('monoisotopic', 2)) . '<br />';
print '<h3>Masses average</h3>';
print 'Mass C-Terminus: ' . strval($pep->getCTerminusMass('average')) . '<br />';
print 'Mass N-Terminus: ' . strval($pep->getNTerminusMass('average')) . '<br />';
Esempio n. 3
0
 $mod3acc = array_key_exists('mod3acc', $_POST) ? $_POST['mod3acc'] : '';
 $mod4acc = array_key_exists('mod4acc', $_POST) ? $_POST['mod4acc'] : '';
 $mod5acc = array_key_exists('mod5acc', $_POST) ? $_POST['mod5acc'] : '';
 $mod1pos = array_key_exists('mod1pos', $_POST) ? $_POST['mod1pos'] : '';
 $mod2pos = array_key_exists('mod2pos', $_POST) ? $_POST['mod2pos'] : '';
 $mod3pos = array_key_exists('mod3pos', $_POST) ? $_POST['mod3pos'] : '';
 $mod4pos = array_key_exists('mod4pos', $_POST) ? $_POST['mod4pos'] : '';
 $mod5pos = array_key_exists('mod5pos', $_POST) ? $_POST['mod5pos'] : '';
 $arrIons = array_key_exists('ioncalc', $_POST) ? $_POST['ioncalc'] : '';
 $iccharge = array_key_exists('iccharge', $_POST) ? $_POST['iccharge'] : '';
 $spectrum = array_key_exists('spectrum', $_POST) ? $_POST['spectrum'] : '';
 if ($ismodified === 'true') {
     $pep = new ModifiedPeptide();
     $pepvalid = $pep->setModifiedSequence($sequence) ? 'true' : 'false';
 } else {
     $pep = new Peptide();
     $pep->Sequence = $sequence;
     $pepvalid = $pep->validateSequence($sequence) ? 'true' : 'false';
 }
 if ($nterminus !== '') {
     $pep->NTerminus = $nterminus;
 }
 if ($cterminus !== '') {
     $pep->CTerminus = $cterminus;
 }
 if ($pepvalid === 'true') {
     if ($cterminus !== '') {
         $ctermmass = strval($pep->getCTerminusMass('monoisotopic'));
     }
     if ($nterminus !== '') {
         $ntermmass = strval($pep->getNTerminusMass('monoisotopic'));