def draw_boxPlotPeptideIntensity(self,category_intensityList,exptCycle,nbrframes=7,nbrchannels=2):
     """
     Makes a series of boxplot where the intensity of the peptides are applied.  
     """
     edmanCycle = exptCycle - 2 #(nbrMock=4;)
     desired_category = peptracks.getDesiredCategory('staggered',nbrframes)       
     category = desired_category[exptCycle]
     all_peptrack_intensity = category_intensityList[tuple(category)]
     title = 'intensity_edman_'+str(edmanCycle)
     iTracks.plot_boxPlots(self.pathDir,self.peptracks_destDir,all_peptrack_intensity,title)
     return True
 def writeTracks(self,category_dict_ch1,category_dict_ch2,nbrframes=7,nbrchannels=2):
     if len(category_dict_ch2) <= 1: 
         assert nbrchannels == 1
     desired_category = peptracks.getDesiredCategory('staggered',nbrframes)
     if nbrchannels == 2:
         self.desired_categoryList_ch1 = peptracks.getIntensityList_category(category_dict_ch1,desired_category)
         self.desired_categoryList_ch2 = peptracks.getIntensityList_category(category_dict_ch2,desired_category)
         ofname = peptracks.writeCountsFile([self.desired_categoryList_ch1,self.desired_categoryList_ch2],self.peptracks_destDir,nbrchannels)
     else:
         self.desired_categoryList_ch1 = peptracks.getIntensityList_category(category_dict_ch1,desired_category)           
         self.desired_categoryList_ch2 = None
         ofname = peptracks.writeCountsFile([self.desired_categoryList_ch1],self.peptracks_destDir,nbrchannels)       
     print "Peptide track counts and intensity file created ",ofname
     return self.desired_categoryList_ch1, self.desired_categoryList_ch2,ofname
 def writeTracks_quartilesCutoff(self,ofname,nbrframes=7,nbrchannels=2,cycle=3):
     cycle = 2  
     desired_category = peptracks.getDesiredCategory('staggered',nbrframes)
     ofname = ofname[:-4]+'.quartileCutoff.tab'
     ofile = open(ofname,'w')
     ofile.write('#Category \t Counts \n')
     ofile.write('\n Cycle used for cutoff - \t '+str(cycle)+'\n')
     if nbrchannels == 2:
         print len(self.desired_categoryList_ch1)
         print len(self.desired_categoryList_ch2)
     else:
         all_trackCounts = list()
         for q_range in ([0,25],[25,50],[50,75],[75,100]):
             
             trackCounts = peptracks.applyCutoff(self.desired_categoryList_ch1,desired_category,q_range, cycle)
             ofile.write('\n \n Quartile '+str(q_range)+ '\n') 
             for cat, counts_qTracks,q_intensityList in trackCounts:
                 ofile.write(str(cat)+'\t'+str(counts_qTracks)+'\n')
         ofile.close()
     print ofname
     return True