Example #1
0
import re
import pepxml

usage_mesg = 'Usage: TPP-pep-xml2hit_list.py <PeptideProphet .xml file>'

if (len(sys.argv) != 2):
    print usage_mesg
    sys.exit(1)

filename_pepxml = sys.argv[1]
if (not os.access(filename_pepxml, os.R_OK)):
    print "%s is not accessible." % filename_pepxml
    print usage_mesg
    sys.exit(1)

PSM = pepxml.parse_by_filename(filename_pepxml)

filename_out = filename_pepxml.replace('.pepxml', '').replace('.xml',
                                                              '') + '.hit_list'
sys.stderr.write("Write %s ... \n" % filename_out)
f_out = open(filename_out, 'w')
f_out.write("# pepxml: %s\n" % filename_pepxml)
f_out.write(
    "#Spectrum_id\tCharge\tNeutralMass\tPeptide\tProtein\tMissedCleavages\tAbsScore(Xcorr)\tRelScore(DeltaCn)\tProbability\n"
)
f_out95 = open(filename_out + "_P095", 'w')
f_out95.write("# pepxml: %s\n" % filename_pepxml)
f_out95.write(
    "#Spectrum_id\tCharge\tNeutralMass\tPeptide\tProtein\tMissedCleavages\tAbsScore(Xcorr)\tRelScore(DeltaCn)\tProbability\n"
)
for spectrum_id in PSM.keys():
import re
import pepxml

usage_mesg = 'Usage: myrimatch_pepxml-to-mvh_hit_list.py <.pepxml file>'

if( len(sys.argv) != 2 ):
    print usage_mesg
    sys.exit(1)

filename_pepxml = sys.argv[1]
if( not os.access(filename_pepxml,os.R_OK) ):
    print "%s is not accessible."%filename_pepxml
    print usage_mesg
    sys.exit(1)

PSM = pepxml.parse_by_filename(filename_pepxml)

filename_out = filename_pepxml
filename_out = re.sub('.pepxml$','',filename_out)
filename_out += '.mvh_hit_list'
sys.stderr.write("Write %s ... \n"%filename_out)
f_out = open(filename_out,'w')
f_out.write("# pepxml: %s\n"%filename_pepxml)
f_out.write("#Spectrum_id\tCharge\tPrecursorMz\tMassDiff\tPeptide\tProtein\tMissedCleavages\tScore(mvh)\n")
for spectrum_id in PSM.keys():
    charge = PSM[spectrum_id]['charge']
    precursor_mz = PSM[spectrum_id]['precursor_mz']
    best_peptide = ''
    best_protein = ''
    best_mvh = -100
    best_mzMAE = 0