def test_readfile_content(self): pepxml_file = pyopenms.PepXMLFile() peps = [] prots = [] pepxml_file.load(self.filename, prots, peps) assert len(prots) == 1 assert len(peps) == 3 assert peps[0].getHits()[0].getSequence().toString() == "LAPSAAEDGAFR"
def test_readfile_content(self): pepxml_file = pyopenms.PepXMLFile() peps = [] prots = [] pepxml_file.load(self.filename, prots, peps) self.assertEqual( len(prots), 3) self.assertEqual( len(peps), 19) self.assertEqual( peps[0].getHits()[0].getSequence().toString(), b'(Glu->pyro-Glu)ELNKEMAAEKAKAAAG')
def test_readfile_content(self): pepxml_file = pyopenms.PepXMLFile() peps = [] prots = [] pepxml_file.load(self.filename, prots, peps) self.assertEqual(len(prots), 1) self.assertEqual(len(peps), 3) self.assertEqual(peps[0].getHits()[0].getSequence().toString(), "LAPSAAEDGAFR")
def get_peptides_protein_seq(): # Read in PepXML protein_ids = [] peptide_ids = [] pyopenms.PepXMLFile().load(pepxml_file, protein_ids, peptide_ids) peptides = [ pid.getHits()[0].getSequence().toString() for pid in peptide_ids ] # Sequence could be from FASTA file (or just provided here) sequence = "".join(""" MNKKKLGIRLLSLLALGGFVLANPVFADQNFARNEKEAKDSAITFIQKSAAIKAGARSAE DIKLDKVNLGGELSGSNMYVYNISTGGFVIVSGDKRSPEILGYSTSGSFDANGKENIASF MESYVEQIKENKKLDTTYAGTAEIKQPVVKSLLNSKGIHYNQGNPYNLLTPVIEKVKPGE QSFVGQHAATGCVATATAQIMKYHNYPNKGLKDYTYTLSSNNPYFNHPKNLFAAISTRQY NWNNILPTYSGRESNVQKMAISELMADVGISVDMDYGPSSGSAGSSRVQRALKENFGYNQ SVHQINRSDFSKQDWEAQIDKELSQNQPVYYQGVGKVGGHAFVIDGADGRNFYHVNWGWG GVSDGFFRLDALNPSALGTGGGAGGFNGYQSAVVGIKP """.split()) return peptides, sequence
def test_readfile(self): pepxml_file = pyopenms.PepXMLFile() peps = [] prots = [] pepxml_file.load(self.filename, prots, peps)
pepxml_file = "data/sample_xtandem_output.pep.xml" mzml_file = "data/sample_spectra.mzML" output = "sample_ascore_output.csv" fh = open(output, "w") writer = csv.writer(fh) # Cutoff for filtering peptide hits by their score cutoff_score = 0.75 # # Data I/O : load the pep.xml file and the mzXML file # protein_ids = [] peptide_ids = [] pyopenms.PepXMLFile().load(pepxml_file, protein_ids, peptide_ids) exp = pyopenms.MSExperiment() pyopenms.FileHandler().loadExperiment(mzml_file, exp) def compute_spectrum_bins(exp): rt_bins = {} for s in exp: if s.getMSLevel() == 1: continue tmp = rt_bins.get(int(s.getRT()), []) tmp.append(s) rt_bins[int(s.getRT())] = tmp return rt_bins