def getPeptideFromLine(self, cols): return pcssPeptide.PcssPeptide( self.getValueForAttributeName("peptide_sequence", cols), int(self.getValueForAttributeName("peptide_start", cols)), int(self.getValueForAttributeName("peptide_end", cols)), self.pcssRunner)
def parseFastaSequence(self, seqRecord): """Use user-defined rules to read protein sequence, parse peptides, and return a list of those that conform to rules""" seqLength = len(seqRecord.seq) pcssPeptideList = [] for i in range(0, seqLength - self.pcssRunner.getPeptideLength() + 1): nextPeptide = str( seqRecord.seq[i:i + self.pcssRunner.getPeptideLength()]) if (self.rules.isValidPeptide(nextPeptide)): pcssPeptideList.append( pcssPeptide.PcssPeptide( nextPeptide, i, i + self.pcssRunner.getPeptideLength() - 1, self.pcssRunner)) return pcssPeptideList
def makePeptideFromCode(self, peptideCode, modbaseSeqId): if (len(peptideCode.split('_')) != 3): raise pcssErrors.PcssGlobalException( "Peptide code %s from protein %s is not proper form of peptideStart_peptideSequence_status" % (peptideCode, modbaseSeqId)) [peptideStart, peptideSequence, status] = peptideCode.split('_') if (peptideSequence == self.pcssRunner. internalConfig["keyword_peptide_sequence_mismatch"]): return None status = self.pcssRunner.validatePeptideCodeStatus(status, peptideCode) peptideStart = int(peptideStart) peptide = pcssPeptide.PcssPeptide( peptideSequence, peptideStart, peptideStart + len(peptideSequence) - 1, self.pcssRunner) peptide.addStringAttribute("status", status) return peptide
def processNormalSeqFeature(self): self.processResultFile() callString = self.getCallString() self.assertEquals(callString, self.seqData.getExpectedFullStringResult()) peptide = self.proteins[0].peptides[17] self.assertEquals( peptide.attributes[self.getStringFeatureName()].getValueString(), self.seqData.stringFeatureValue) self.assertEquals( peptide.attributes[self.getScoreFeatureName()].getValueString(), self.seqData.scoreFeatureValue) self.proteins[0].setPeptide( pcssPeptide.PcssPeptide("FAKE", 1000, 1003, self.runner)) self.processFeatureException(self.proteins[0].peptides[1000], self.getStringFeatureName(), self.getPeptideNotFoundCode(), self.processResultFile)
def parseFastaSequence(self, seqRecord): pcssPeptideList = [] firstPeptide = str(seqRecord.seq[0:1]) pcssPeptideList.append( pcssPeptide.PcssPeptide(firstPeptide, 0, 1, self.pcssRunner)) return pcssPeptideList