percolatorPeptides = per.getPeptides(elems) uniquePeptides = set([pept.peptide for pept in percolatorPeptides]) prosolvePeptides = list() f = open(infile2).readlines() #(self,isdecoy=False,pep=0.0,q=0.0,empq=0.0,p=0.0,sequence="",score=0.0,psms=[],proteins=[]): for line in f: words = line.split() prob = float(words[0]) sequence = str(words[1]) proteins = list(words[2:]) isdecoy = False if(str(proteins[0]).find(decoy_pattern) != -1 ): isdecoy = True peptide = hit.Peptide(isdecoy,float(1 - prob),float(0.0),float(0.0),float(0.0),str(sequence),float(prob),[],proteins) if(sequence in uniquePeptides): prosolvePeptides.append(peptide) if(len(prosolvePeptides) > 0 and len(percolatorPeptides) > 0): if(verbose): print "writing in " + str(OutputFile) utils.writePeptides(prosolvePeptides,"peptides_prosolve_" + OutputFile) else: sys.stderr.write("the input file does not contain any information\n") sys.exit() if(verbose): print "Prosolve file parsed" if __name__ == "__main__": main(sys.argv[1:])
percolatorPSMs = [ psm for psm in percolatorPSMs if psm.qvalue <= fdr ] percolatorPeptides = [ pep for pep in percolatorPeptides if pep.qvalue <= fdr ] percolatorProteins = [ prot for prot in percolatorProteins if prot.qvalue <= fdr ] if (len(percolatorPSMs) > 0): if (verbose): print "writing in " + str(OutputFile) utils.writePsms(percolatorPSMs, "psms_" + OutputFile) if (len(percolatorPeptides) > 0): utils.writePeptides(percolatorPeptides, "peptides_" + OutputFile) if (len(percolatorProteins) > 0): utils.writeProteins(percolatorProteins, "proteins_" + OutputFile) else: sys.stderr.write( "the input file does not contain any information\n") sys.exit() if (verbose): print "Percolator file parsed" if __name__ == "__main__": main(sys.argv[1:])
for line in f: words = line.split() prob = float(words[0]) sequence = str(words[1]) proteins = list(words[2:]) isdecoy = False if (str(proteins[0]).find(decoy_pattern) != -1): isdecoy = True peptide = hit.Peptide(isdecoy, float(1 - prob), float(0.0), float(0.0), float(0.0), str(sequence), float(prob), [], proteins) if (sequence in uniquePeptides): prosolvePeptides.append(peptide) if (len(prosolvePeptides) > 0 and len(percolatorPeptides) > 0): if (verbose): print "writing in " + str(OutputFile) utils.writePeptides(prosolvePeptides, "peptides_prosolve_" + OutputFile) else: sys.stderr.write( "the input file does not contain any information\n") sys.exit() if (verbose): print "Prosolve file parsed" if __name__ == "__main__": main(sys.argv[1:])
percolatorPeptides = per.getPeptides(elems) percolatorProteins = per.getProteins(elems) if(verbose): print "Read " + str(len(percolatorPSMs)) + " PSMs" print "Read " + str(len(percolatorPeptides)) + " Peptides" print "Read " + str(len(percolatorProteins)) + " Proteins" if(fdr < 1.0 and fdr > 0.0): percolatorPSMs = [psm for psm in percolatorPSMs if psm.qvalue <= fdr] percolatorPeptides = [pep for pep in percolatorPeptides if pep.qvalue <= fdr] percolatorProteins = [prot for prot in percolatorProteins if prot.qvalue <= fdr] if(len(percolatorPSMs) > 0): if(verbose): print "writing in " + str(OutputFile) utils.writePsms(percolatorPSMs, "psms_" + OutputFile) if(len(percolatorPeptides) > 0): utils.writePeptides(percolatorPeptides,"peptides_" + OutputFile) if(len(percolatorProteins) > 0): utils.writeProteins(percolatorProteins,"proteins_" + OutputFile) else: sys.stderr.write("the input file does not contain any information\n") sys.exit() if(verbose): print "Percolator file parsed" if __name__ == "__main__": main(sys.argv[1:])
tree2 = etree.parse(infile2,parser) except Exception, inst: sys.stderr.write("Unexpected error opening %s or %s: %s\n" % (infile,infile2, inst)) sys.exit() if(verbose): print "Reading " + str(argv[0]) print "Reading " + str(argv[1]) elems = tree.getroot() elems2 = tree2.getroot() tppPSMs,tppPeptides = tpp.readIprophetPSMsPeptides(elems,decoy_prefix) tppProteins = tpp.readIprophetProteins(elems2,decoy_prefix) if(len(tppPSMs) > 0 and len(tppPeptides) > 0 and len(tppProteins) > 0): if(verbose): print "writing in " + str(OutputFile) utils.writePsms(tppPSMs, "psms_" + OutputFile) utils.writePeptides(tppPeptides,"peptides_" + OutputFile) utils.writeProteins(tppProteins,"proteins_" + OutputFile) else: sys.stderr.write("\nThe input files does not contain any information\n") sys.exit() if(verbose): print "iProphet and Protein Prophet files parsed" if __name__ == "__main__": main(sys.argv[1:])
sys.exit() if (verbose): print "Reading " + str(argv[0]) print "Reading " + str(argv[1]) elems = tree.getroot() elems2 = tree2.getroot() tppPSMs, tppPeptides = tpp.readIprophetPSMsPeptides( elems, decoy_prefix) tppProteins = tpp.readIprophetProteins(elems2, decoy_prefix) if (len(tppPSMs) > 0 and len(tppPeptides) > 0 and len(tppProteins) > 0): if (verbose): print "writing in " + str(OutputFile) utils.writePsms(tppPSMs, "psms_" + OutputFile) utils.writePeptides(tppPeptides, "peptides_" + OutputFile) utils.writeProteins(tppProteins, "proteins_" + OutputFile) else: sys.stderr.write( "\nThe input files does not contain any information\n") sys.exit() if (verbose): print "iProphet and Protein Prophet files parsed" if __name__ == "__main__": main(sys.argv[1:])