コード例 #1
0
ファイル: vizLib.py プロジェクト: joeydavis/vizLib
def makePlotWithFileList(isoFileList, numerator, denominator, subunits=None, normProtein=None, yMax=1.5, title=None, legendCols=4,
                         median=False, names=None, colors=None, figSize=(22,5), markerSize=None, noFill=False, legend=False,
                        mew=1, yMin=-0.05, highlightMed=False, hms=2, hmFilled=True, yAxis=None, alpha=1.0, adjProt=None):
    """makePlotWithFileList is a  helper function that plots massage-style data from a list of files

    :param isoFileList: a list of the files to be ploted (shoudl be full path to _iso.csv files)
    :type isoFileList: list of strings
    :param numerator: strings of the keys in the numerator (ampu, ampl, amps)
    :type numerator: list of strings
    :param denominator: strings of the keys in the denominator (ampu, ampl, amps)
    :type denominator: list of strings
    :param subunits: a list of the proteins to be plotted - strings must match the keys of the 'proteins' field in _iso.csv
    :type subunits: list
    :param normProtein: string of the protein to normalize to for all datasets (defaults to None)
    :type normProtein: string
    :param yMax: float of maximum y value
    :type yMax: float
    :param median: bool to plot only the median values
    :type median: bool
    :param names: a list of the names to be listed in the legend; must be same length as isoFileList
    :type names: list of strings
    :param colors: a list of the colors to be used in plotting, again must be same length as isoFileList
    :type colors: list of strings
    :param figSize: the figure size (list - (10,10))
    :type figSize: list of floats
    :param noFill: a bool if you want open circles
    :type noFill: bool
    :param mew: a float of the marker edge width
    :type mew: float

    :returns: the plotted axis
    
    """
    if names is None:
        names = isoFileList
        
    namesList = [(isoFileList[i], names[i]) for i in range(len(isoFileList))]
    allStats = qMS.multiStatsDict(isoFileList, numerator, denominator, normalization=1.0, offset=0.0, normProtein=normProtein, noProcess=True, adjProt=adjProt)
    
    return makePlotWithStatsDictDict(allStats, subunits=subunits, yMax=yMax, title=title, legend=legend, legendCols=legendCols, yAxis=yAxis,
                                     median=median, namesList=namesList, colors=colors, figSize=figSize, markerSize=markerSize,
                                     noFill=noFill, mew=mew, yMin=yMin, highlightMed=highlightMed, hms=hms, hmFilled=hmFilled, alpha=alpha)
コード例 #2
0
ファイル: vizLib.py プロジェクト: joeydavis/vizLib
def plotPeptideCount(files, labels=None, colors=None, proteins=None, num=['AMP_U'], den=['AMP_U'], legend=True, figSize=(20,10)):
    
    if labels is None:
        labels=files
    
    if colors is None:
        colors = [pylab.cm.jet(float(i)/float(len(files))) for i in range(len(files))]
    
    numFiles=len(files)
    offset = 1.0/(numFiles+1)
    
    msd = qMS.multiStatsDict(files, num, den)
    
    f = pylab.figure(figsize=figSize)
    a = f.add_subplot(111)
    for j in range(0,numFiles):
        a.bar([i+offset*j for i in range(len(proteins))], [len(msd[files[j]][i]) for i in proteins], align='edge', width=1.0/(numFiles+2), color=colors[j], label=labels[j])
    a.set_xticks([i+0.4 for i in range(0,len(proteins))])
    a.set_xticklabels(proteins, size='medium', rotation='90')
    a.set_ylabel('number of peptides')
    cleanAxis(a, ticksOnly=True)
    if legend:
        a.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3, ncol=5, mode="expand", borderaxespad=0.)
    return a
コード例 #3
0
    
    '''
    labels1000 = labels1000[0:3]
    times1000 = times1000[0:3]
    names1000 = names1000[0:3]
    '''
 
    num = ['AMP_L']
    den = ['AMP_U', 'AMP_L']
    
##################Extract the data###########################
    
    csvs = {}
    dataByProtein = {}
    allProteins = set()
    dataByProtein = qMS.multiStatsDict(names10+names1000, num, den)
    
##################Plot the datasets###########################
    '''
    yMax=1.25
    pylab.close('all')
    ax = vizLib.makePlotWithFileList(names10, num, den, AllProteins=AllSubunits, yMax=yMax, names=labels10, colors=reds, figSize=(22,7),median=False)
    pylab.legend(loc='upper left', ncol=3)
    pylab.xticks(numpy.arange(1,len(AllSubunits)+1,1), [item[4:] for item in AllSubunits], rotation=45)
    ax.set_ylim([0,1])
    ax.set_title('non-permissive conditions : 45S\nfraction labeled', multialignment='center')
    ax.set_ylabel('Labeled/[Labeled+Unlabeled]')
    pylab.tight_layout()
    #pylab.savefig('10uM_fracLab_med.pdf')
    #pylab.savefig('10uM_fracLab_med.png')
    
コード例 #4
0
    names50SIF2 = qMS.sort_nicely([i.split('/')[-1] for i in glob.glob(rootPath+'45Sfiltered/*.csv')])
    names45S = qMS.sort_nicely([i.split('/')[-1] for i in glob.glob(rootPath+'50Sfiltered/*.csv')])

    namesMy70S = qMS.sort_nicely([i.split('/')[-1] for i in glob.glob(rootPath+'my70Sfiltered/*.csv')])
    namesMy50S = qMS.sort_nicely([i.split('/')[-1] for i in glob.glob(rootPath+'my50Sfiltered/*.csv')])
    
    names50SIF2Pulse = qMS.sort_nicely([i.split('/')[-1] for i in glob.glob(rootPath+'45Sfiltered/pulse/*.csv')])
    names45SPulse = qMS.sort_nicely([i.split('/')[-1] for i in glob.glob(rootPath+'50Sfiltered/pulse/*.csv')])
    
    reds = ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#de2d26', '#a50f15']
    blues = ['#eff3ff', '#c6dbef', '#93cae1', '#6baed6', '#3182bd', '#08519c']
    
##################Extract the data###########################
    num = ['AMP_U']
    den = ['AMP_U', 'AMP_S']
    dataByProtein70S = qMS.multiStatsDict(files45S, num, den)

##################Plot the datasets###########################
    
    pylab.close('all')    

    yMax=1.5
    figSize=(figWidth,figWidth/3.0)
    median=False    
    
    num = ['AMP_U']
    den = ['AMP_U', 'AMP_S']
    filtPlots_45S = plotDataSets(files45S, names45S, num, den, AllSubunits, '45S', 'U/[U+S]', reds,
                 saveName=None, yMax=yMax, figSize=figSize, median=median, legendLoc='upper left', legendCols=2, normProtein='BSubL24')

    filtPlots_50SIF2 = plotDataSets(files50SIF2, names50SIF2, num, den, AllSubunits, '50S IF2', 'U/[U+S]', blues,
コード例 #5
0
    
    times10 = [22, 49, 66, 88, 110, 132]
    times1000 = [11, 22, 33, 44, 55, 66]
    
    labels10 = ['10 $\mu$M, 22 min', '10 $\mu$M, 49 min', '10 $\mu$M, 66 min', '10 $\mu$M, 88 min', '10 $\mu$M, 110 min', '10 $\mu$M, 132 min']
    labels1000 = ['1 mM, 11 min', '1 mM, 22 min', '1 mM, 33 min', '1 mM, 44 min', '1 mM, 55 min', '1 mM, 66 min']
    
    labels1000 = labels1000[0:3]
    times1000 = times1000[0:3]
    names70S_1000 = names70S_1000[0:3]
    namesInter_1000 = namesInter_1000[0:3]

##################Extract the data###########################
    num = ['AMP_L']
    den = ['AMP_U', 'AMP_L']
    dataByProtein70S = qMS.multiStatsDict(names70S_10+names70S_1000, num, den)
    dataByProteinInter = qMS.multiStatsDict(namesInter_10+namesInter_1000, num, den)

##################Find the medians###########################
    medDict70S_10 = {}
    medDict70S_1000 = {}
    
    medDictInter_10 = {}
    medDictInter_1000 = {}
    
    ntDict70S_10 = {'names': names70S_10, 'times': times10}
    ntDict70S_1000 = {'names': names70S_1000, 'times': times1000}
    
    ntDictInter_10 = {'names': namesInter_10, 'times': times10}
    ntDictInter_1000 = {'names': namesInter_1000, 'times': times1000}