comparison Tryp_V_T.py @ 28:be77587bdfda draft

Uploaded
author johnheap
date Thu, 06 Jun 2019 08:21:58 -0400
parents 92c5ecb025b6
children b3d2d0a771e1
comparison
equal deleted inserted replaced
27:92c5ecb025b6 28:be77587bdfda
145 temp_df = temp_df.sort_values(by=['evalue']) 145 temp_df = temp_df.sort_values(by=['evalue'])
146 b_df = b_df.append(temp_df.iloc[[0]]) 146 b_df = b_df.append(temp_df.iloc[[0]])
147 147
148 b_df.sort_values(by=['qaccver']) 148 b_df.sort_values(by=['qaccver'])
149 b_df.to_csv(test_name + '_transcript.csv') 149 b_df.to_csv(test_name + '_transcript.csv')
150 b_df.to_csv(html_resource+'/'+test_name + '_transcript.csv')
151
150 return b_df 152 return b_df
151 153
152 154
153 def createMultiHTML(tdict,composite_df): 155 def createMultiHTML(tdict,composite_df):
154 labelList = composite_df.columns.tolist() 156 labelList = composite_df.columns.tolist()
226 htmlString += tabString + "</table><br><br><br><br><br>" 228 htmlString += tabString + "</table><br><br><br><br><br>"
227 htmlString += r"<h3>Weighted Relative Frequencies of Detected Phylotypes.</h3>" 229 htmlString += r"<h3>Weighted Relative Frequencies of Detected Phylotypes.</h3>"
228 imgString = r"<img src = '"+ tdict['name']+"_phylotypes.png' alt='Bar chart of phylotype variation' style='max-width:100%'><br><br>" 230 imgString = r"<img src = '"+ tdict['name']+"_phylotypes.png' alt='Bar chart of phylotype variation' style='max-width:100%'><br><br>"
229 htmlString += imgString 231 htmlString += imgString
230 232
231 with open(tdict['html_resource']+'/'+tdict['html_file'], "w") as htmlfile: 233 with open(+tdict['html_file'], "w") as htmlfile:
232 htmlfile.write(htmlString) 234 htmlfile.write(htmlString)
233 235
234 236
235 237
236 def getPhyloNumber(sac): 238 def getPhyloNumber(sac):
277 FPKMsum2_df = FPKMsum_df.groupby('Phylotype')['FPKM'].sum().reset_index() 279 FPKMsum2_df = FPKMsum_df.groupby('Phylotype')['FPKM'].sum().reset_index()
278 FPKMsum2_df = FPKMsum2_df.sort_values(by=['Phylotype']) 280 FPKMsum2_df = FPKMsum2_df.sort_values(by=['Phylotype'])
279 281
280 # print(FPKMsum2_df) 282 # print(FPKMsum2_df)
281 FPKMsum2_df.to_csv('FPKM_sum2.csv') # in case more than one entry for a particular phylotype 283 FPKMsum2_df.to_csv('FPKM_sum2.csv') # in case more than one entry for a particular phylotype
284 htmlres = tdict['html_resource']
285 FPKMsum2_df.to_csv(htmlres+'/FPKM_sum2.csv') # in case more than one entry for a particular phylotype
286
282 return FPKMsum_df, FPKMsum2_df 287 return FPKMsum_df, FPKMsum2_df
283 288
284 289
285 290
286 def normalisef(f,max): 291 def normalisef(f,max):