Esempio n. 1
0
def run(column_length, diameter, pore_size, conca, concb, flow_rate,
        gradientstart, gradientstop, gradientlength, input_type, peptide):
    """See biolccc documentation"""

    if len(peptide) == 0:
        raise ValueError('Must supply at least 1 peptide')
    if input_type == 'file':
        peptide = [x for y in [open(x).read().split() for x in peptide] for x in y]


    chroma = biolccc.ChromoConditions()

    chroma['columnLength'] = column_length
    chroma['columnDiameter'] = diameter
    chroma['columnPoreSize'] = pore_size
    chroma['secondSolventConcentrationA'] = conca
    chroma['secondSolventConcentrationB'] = concb
    chroma['gradient'] = biolccc.Gradient(gradientstart, gradientstop, gradientlength)
    chroma['flowRate'] = flow_rate

    results = dict()
    for p in peptide:
        RT = biolccc.calculateRT(str(p),
                                 biolccc.rpAcnFaRod,
                                 chroma
        )
        results[p] = RT


    print('Peptide', '\t', 'RTmin')
    for p, rt in results.items():
        print(p, '\t', rt)
Esempio n. 2
0
from pyteomics import biolccc

peptide = 'Ac-PEPTIDE-NH2'
myChromoConditions = biolccc.ChromoConditions()
myGradient = biolccc.Gradient()
myGradient.addPoint(0.0, 5.0)
myGradient.addPoint(20.0, 5.0)
myGradient.addPoint(60.0, 45.0)
myGradient.addPoint(65.0, 100.0)
myGradient.addPoint(85.0, 100.0)
myChromoConditions.setGradient(myGradient)

RT = biolccc.calculateRT(peptide, biolccc.rpAcnFaRod, myChromoConditions)
print 'The retention time of', peptide, 'in the custom gradient is', RT
print('Calculating retention times...')

# Designating BioLCCC model to use:
if model_type == 'TFA':
	model_to_use = biolccc.rpAcnTfaChain
elif model_type == 'FA':
	model_to_use = biolccc.rpAcnFaRod

peptide_rts = []
i = 0

print('Calculating retention times...')
for tryp_pep in mod_pep:
    rt_temp = biolccc.calculateRT(tryp_pep,
                                  model_to_use,
                                  myChromoConditions)

    peptide_rts.append(rt_temp)
    i += 1

# Combining the sequences, times, and physicochemical characteristics.
peptides_pd = pd.Series(z_removed_peps, name = 'peptide_sequence')
peptide_rts = pd.Series(peptide_rts, name = 'rts')
iso_electric_points_pd = pd.Series(iso_electric_points, name = 'iso_point')
pep_charges_pd = pd.Series(pep_charges, name = 'charge')
pep_mass_pd = pd.Series(pep_mass, name = 'mass')
contig_pd = pd.Series(contig_vec_no_x, name = 'contig')

peptide_dataframe = pd.concat([peptides_pd,
                               peptide_rts,
Esempio n. 4
0
from pyteomics import biolccc

peptide = 'Ac-PEPTIDE-NH2'
RT = biolccc.calculateRT(peptide, biolccc.rpAcnFaRod,
                         biolccc.standardChromoConditions)
print 'The retention time of', peptide, 'is', RT
Esempio n. 5
0
from pyteomics import biolccc

print biolccc.calculateRT('QWERTYIPASDFGHKLCVNM', biolccc.rpAcnTfaChain,
                          biolccc.standardChromoConditions)

# Using 21 interpolating points.
print biolccc.calculateRT('QWERTYIPASDFGHKLCVNM', biolccc.rpAcnTfaChain,
                          biolccc.standardChromoConditions, 21)
def executeBioLCCC(tool):
    
  ##wenn fehler, dann print fehler
    
    general = Util.readConfigFile(Util.TOOL_CONFIG, "General")
    paramToValue = Util.readConfigFile(Util.TOOL_CONFIG, tool)
    
    fobjOut = open(general["outputDirectory"]+paramToValue["ioFile"], 'w')    

    # read values from configfile
    # myChromoConditions
    myChromoConditions = biolccc.standardChromoConditions
    
    if ("columnLength" in paramToValue):
        myChromoConditions['columnLength'] = float("%(columnLength)s" % paramToValue)
    elif("columnDiameter"in paramToValue):    
        myChromoConditions['columnDiameter'] = float("%(columnDiameter)s" % paramToValue)
    elif("columnPoreSize"in paramToValue): 
        myChromoConditions['columnPoreSize'] = float("%(columnPoreSize)s" % paramToValue)
    elif("secondSolventConcentrationA"in paramToValue): 
        myChromoConditions['secondSolventConcentrationA'] = float("%(secondSolventConcentrationA)s" % paramToValue)
    elif("secondSolventConcentrationB"in paramToValue): 
        myChromoConditions['secondSolventConcentrationB'] = float("%(secondSolventConcentrationB)s" % paramToValue)
    elif("gradient"in paramToValue): 
        myChromoConditions['gradient'] = biolccc.Gradient("%initialConcentrationB", "%finalConcentrationB", "%time" % paramToValue)
    elif("flowRate"in paramToValue): 
        myChromoConditions['flowRate'] = float("%(flowRate)s" % paramToValue)
        
    #myGradient settings
    myGradient = biolccc.Gradient()
    addPointList=()    
    strList = paramToValue["myGradient.addPoint"]
    addPointList = ast.literal_eval(strList)
    for key in addPointList:
        myGradient.addPoint(float(key[0]), float(key[1]))  
    myChromoConditions.setGradient(myGradient)
    
    # calculateRT
    continueGradient=bool("%(continuegradient)s" % paramToValue)
    numinterpolationspoints=int("%(numinterpolationspoints)s" % paramToValue)
    chem_basis_map = {}
    chem_basis_map["rpAcnFaRod"] = biolccc.rpAcnFaRod
    chem_basis_map["rpAcnTfaChain"] = biolccc.rpAcnTfaChain
    chemBasis = chem_basis_map["%(chembasis)s" %paramToValue]
    
#     print "BioLCCC starts calculating"
    # calculate RT and write tmp_output
    with open(general["testDirectory"]+paramToValue["ioFile"], 'r') as output:
        content = output.readlines()     
        for fileLine in content:
            sequence = fileLine.strip() 
            retentionTime = biolccc.calculateRT(sequence, chemBasis, myChromoConditions)
            fobjOut.write(sequence + "\t" + str(retentionTime) + "\n")
    fobjOut.close()
            
#     print "BioLCCC finished calculating"
    # take output and connect with input rt
    output_RT_fh = open(Util.TOOLS_OUTPUT+"BioLCCC.txt", 'r')
    content = output_RT_fh.readlines()
    output_RT = content
    output_RT_fh.close()
    output_set = {}
     
    for seq in output_RT:
        seq = seq.strip()
        data = re.split('\t', seq)
        if len(data) != 2:
            print "ERROR in len data", data
            exit(-1)
        unimod = data[0]
        rt = data[1]
        output_set[unimod] = rt
 
    testRef_RT = open(Util.PATH_TO_TMP+"BioLCCC_test_reference.txt", 'r')
    test_set = {}
# verknuepfe mir meine zwei sachen  modseq : rt fuer output
    for line in testRef_RT:
        sseq = line.split('\t')[1]
        sseq = sseq.strip()
        unimod = line.split('\t')[0] #key: toolinput
        unimod = unimod.strip()
        test_set[unimod] = sseq #returns value
    testRef_RT.close()    
 
    os.unlink(Util.TOOLS_OUTPUT+"BioLCCC.txt")
    # write Tooloutput    
    biolc = open(Util.TOOLS_OUTPUT+"BioLCCC.txt", 'w')
    for key in output_set.keys():
        #rt = output_set[key]
        seq = test_set[key]
        seq = "-"+ seq + "-" # for PredictionToolReader.getSequence
        key = key.strip()
        biolc.write("\t".join((  str(seq), str(output_set[key])) )) #Ausgabe: value testRef_RT = modSeq mit phosphos, RT Zeit  
        biolc.write("\n")
Esempio n. 7
0
peptides = []
random.seed()
for i in [5] * 5 + [10] * 5 + [20] * 5 + [40] * 5:
    peptides.append(''.join(
        [random.choice("QWERTYIPASDFGHKLCVNM") for j in range(i)]))
pylab.figure(figsize=(9, 4))
pylab.subplots_adjust(top=0.85, hspace=0.30, wspace=0.30, right=0.96)
pylab.suptitle('The difference of RT calculated by the fast and standard '
               'algorithm for 20 random peptides')
for chembasis, subplot_num, title in [(biolccc.rpAcnTfaChain, 121,
                                       'rpAcnTfaChain'),
                                      (biolccc.rpAcnFaRod, 122, 'rpAcnFaRod')]:
    pylab.subplot(subplot_num)
    for peptide in peptides:
        x = range(5, 31, 1)
        RTs = [
            biolccc.calculateRT(peptide, chembasis,
                                biolccc.standardChromoConditions, i) for i in x
        ]
        ref_RT = biolccc.calculateRT(peptide, chembasis,
                                     biolccc.standardChromoConditions)
        y = [(RT / ref_RT) * 100.0 - 100.0 for RT in RTs]
        pylab.plot(x, y, label=peptide)
    pylab.title(title)
    pylab.xlabel('Number of interpolating points')
    pylab.ylabel('$\Delta RT, \; \%$')
    pylab.rcParams['legend.fontsize'] = 10
    #pylab.legend(loc='upper right')
    #pylab.legend(loc='lower right')
pylab.show()
Esempio n. 8
0
# Changing the bind energy of a chemical group.
myChemicalBasis.chemicalGroups()['E'].setBindEnergy(0.0)
myChemicalBasis.chemicalGroups()['-NH2'].setBindEnergy(0.0)

print "The bind energy of E is", \
    myChemicalBasis.chemicalGroups()['E'].bindEnergy()
print "The bind energy of -NH2 is", \
    myChemicalBasis.chemicalGroups()['-NH2'].bindEnergy()

# Adding a new chemical group. The energy is not valid.
myChemicalBasis.addChemicalGroup(
    biolccc.ChemicalGroup(
        'Hydroxyproline',  # full name
        'hoP',  # label
        0.40,  # bind energy
        97.1167 + 15.9994,  # average mass
        97.05276 + 15.9994915))  # monoisotopic mass

# Setting a new type of model. Without a massive recalibration
# it will ruin the accuracy of prediction.
myChemicalBasis.setModel(biolccc.CHAIN)

peptide = "Ac-PEhoPTIDE-NH2"
RT = biolccc.calculateRT(peptide, myChemicalBasis,
                         biolccc.standardChromoConditions)

monoisotopicMass = biolccc.calculateMonoisotopicMass(peptide, myChemicalBasis)

print 'The retention time of', peptide, 'is', RT
print 'The monoisotopic mass of', peptide, 'is', monoisotopicMass, 'Da'
Esempio n. 9
0
        [random.choice("QWERTYIPASDFGHKLCVNM") for j in range(i)]))
pylab.figure(figsize=(9, 8))
pylab.subplots_adjust(top=0.9, hspace=0.30, wspace=0.30, right=0.96)
pylab.suptitle('The effect of changing dV for ten random peptides'
               ' of different length')
for chembasis, chromoconditions, subplot_num, title in [
    (biolccc.rpAcnTfaChain, nanocolumn, 221, 'Nanocolumn, rpAcnTfaChain'),
    (biolccc.rpAcnFaRod, nanocolumn, 222, 'Nanocolumn, rpAcnFaRod'),
    (biolccc.rpAcnTfaChain, macrocolumn, 223, 'Macrocolumn, rpAcnTfaChain'),
    (biolccc.rpAcnFaRod, macrocolumn, 224, 'Macrocolumn, rpAcnFaRod')
]:
    pylab.subplot(subplot_num)
    for peptide in peptides:
        divisors = [(2.0**i) for i in range(11)]
        chromoconditions['dV'] = chromoconditions['flowRate'] / divisors[-1]
        reference_time = (biolccc.calculateRT(peptide, chembasis,
                                              chromoconditions))
        y = []
        for divisor in divisors:
            chromoconditions['dV'] = chromoconditions['flowRate'] / divisor
            y.append(
                (biolccc.calculateRT(peptide, chembasis, chromoconditions) /
                 reference_time - 1.0) * 100.0)
        pylab.plot(divisors, y, label=peptide)
    pylab.title(title)
    pylab.xlabel('Flow rate divisor')
    pylab.ylabel('$\Delta RT, \; \%$')
    pylab.gca().set_xscale('log')
    pylab.rcParams['legend.fontsize'] = 10
    #pylab.legend(loc='upper right')
    #pylab.legend(loc='lower right')
pylab.show()