|
22 | 22 | import time |
23 | 23 | from matplotlib.ticker import FormatStrFormatter |
24 | 24 |
|
25 | | -def GOI_Scatterplot(sample,GOI='None',Annot='none',NonT='none',Transp='none'): |
| 25 | +def GOI_Scatterplot(sample,GOI='none',Annot='none',NonT='none',Transp='none'): |
26 | 26 | # ------------------------------------------------ |
27 | 27 | # Print header |
28 | 28 | # ------------------------------------------------ |
@@ -121,7 +121,7 @@ def GOI_Scatterplot(sample,GOI='None',Annot='none',NonT='none',Transp='none'): |
121 | 121 | if len(K_nonT)>0 and ShowNonTargets: |
122 | 122 | plt.scatter(control_nonT,sample_nonT,s=dotsize,facecolor='orange',lw=0,alpha=0.35,\ |
123 | 123 | label='Non Targeting') |
124 | | - if GOI != 'None': |
| 124 | + if GOI != 'none': |
125 | 125 | plt.scatter(control_goi,sample_goi,s=2*dotsize,facecolor='red',lw=0,alpha=1.00,label=GOI) |
126 | 126 | if len(K_sig)>0: |
127 | 127 | xmax = 1.05*max([max(control_rest),max(control_sig)]) |
@@ -149,20 +149,29 @@ def GOI_Scatterplot(sample,GOI='None',Annot='none',NonT='none',Transp='none'): |
149 | 149 | for label, x, y in zip(goi_sgIDs,control_goi,sample_goi): |
150 | 150 | plt.annotate(label,xy=(x,y),color='red',fontsize=5,fontweight='bold') |
151 | 151 | plt.tight_layout() |
152 | | - if GOI != 'None': |
| 152 | + # Define file name |
| 153 | + figurename = 'counts_'+sample+'.png' |
| 154 | + if GOI != 'none': |
| 155 | + figurename = figurename[:-4]+'_'+GOI+'.png' |
| 156 | + if Annot not in ['none','False']: |
| 157 | + figurename = figurename[:-4]+'_IDs.png' |
| 158 | + if NonT not in ['none','False']: |
| 159 | + figurename = figurename[:-4]+'_nonT.png' |
| 160 | + # Save figure |
| 161 | + if GOI != 'none': |
153 | 162 | if not os.path.exists(HiLiteDir): |
154 | 163 | os.makedirs(HiLiteDir) |
155 | | - os.chdir(HiLiteDir) |
156 | | - plt.savefig(sample+'_'+GOI+'_counts.png', dpi=res) |
157 | | - os.chdir(PlotDir) |
| 164 | + os.chdir(HiLiteDir) |
| 165 | + plt.savefig(figurename, dpi=res) |
| 166 | + os.chdir(PlotDir) |
158 | 167 | else: |
159 | | - plt.savefig(sample+'_counts.png', dpi=res) |
| 168 | + plt.savefig(figurename, dpi=res) |
160 | 169 | plt.close() |
161 | 170 |
|
162 | 171 | # ------------------------------------------------ |
163 | 172 | # Printing |
164 | 173 | # ------------------------------------------------ |
165 | | - if GOI != 'None': |
| 174 | + if GOI != 'none': |
166 | 175 | print('-----------------------------------------------') |
167 | 176 | print('sgID\t\tCounts\tControl\tSignificant') |
168 | 177 | print('-----------------------------------------------') |
|
0 commit comments