changeset 15:4ec317901ac3 draft

Uploaded
author alenail
date Fri, 15 Apr 2016 11:46:20 -0400
parents 0412ae182f38
children 8dae9fdd2afe
files pieplot_macs/pieplots_macs.py
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pieplot_macs/pieplots_macs.py	Fri Apr 15 11:31:29 2016 -0400
+++ b/pieplot_macs/pieplots_macs.py	Fri Apr 15 11:46:20 2016 -0400
@@ -26,11 +26,11 @@
 import pandas as pd
 from argparse import ArgumentParser
 
-def map_peaks(gene,peak,outfile,macsFlag):
+def map_peaks(gene, peak, outfile, macsFlag):
     genefile = open(gene, 'r')
     peakfile = open(peak, 'r')
 
-    types = {'promoter':0, 'after':0, 'intron':0, 'exon': 0}
+    types = {'promoter':0, 'after':0, 'intron':0, 'exon':0}
 
     #read mapped gene file, store closest map for each peak
     peaks={} #{chrom:{peakStart:[dist, type]}}
@@ -46,7 +46,6 @@
             maptype = words[14]
             if maptype == 'gene':
                 maptype = words[15]
-
         else:
             try:
                 start = int(words[3])
@@ -58,7 +57,6 @@
                 print 'there probably were not enough columns in the genefile'
                 pass
 
-
         if chrom not in peaks:
             #new chrom
             peaks[chrom] = {start:[dist,maptype]}
@@ -102,10 +100,10 @@
     plt.pie(fracs, labels=labels) #, autopct='%1.1f%%')
 
     #Export data frame with all the counts
-    indexDataFrame = ['exon','intron','promoter','intergenic','after']
-    df = pd.DataFrame(data=fracs, index=indexDataFrame)
-    dfFileName = outfile.replace("pdf","csv")
-    df.to_csv(dfFileName, sep=',')
+    # indexDataFrame = ['exon','intron','promoter','intergenic','after']
+    # df = pd.DataFrame(data=fracs, index=indexDataFrame)
+    # dfFileName = outfile.replace("pdf","csv")
+    # df.to_csv(dfFileName, sep=',')
     #plt.title('MACS peaks in %s'%(name))
     plt.figtext(.5, .1, 'Total: %i'%totalpks, ha='center')
     fig.savefig(outfile)