MCPcopy Create free account
hub / github.com/andreariba/DeepCycle / process_gene

Function process_gene

DeepCycle.py:281–316  ·  view source on GitHub ↗
(gene, adata=adata, hot_dir=hot_dir)

Source from the content-addressed store, hash-verified

279hot_dir = CycleAE_dir+'/hotelling/'
280
281def process_gene(gene, adata=adata, hot_dir=hot_dir):
282 try:
283 n = gene_list.index(gene)
284 hotelling = 0
285 df = pd.DataFrame({ 'spliced':adata.layers['Ms'][:,n], 'unspliced':adata.layers['Mu'][:,n] })
286 if (df.mean()<0.5).all():
287 return
288 hot = Hotelling( x=df['spliced'], y=df['unspliced'], dt=0.1, eta=10 )
289 if hot.flag!='OK':
290 lock.acquire()
291 print('['+gene+']: discarded because of', hot.flag)
292 lock.release()
293 return
294 hotelling = abs(hot.hotelling_t_squared)
295 except ValueError:
296 lock.acquire()
297 print('['+gene+']: discarded because of ValueError')
298 lock.release()
299 return
300 if hotelling<0.5:
301 lock.acquire()
302 print('['+gene+']: discarded because of low T-squared')
303 lock.release()
304 return
305 else:
306 svgfile_hotelling = hot_dir+gene+'.svg'
307 try:
308 hot.plot_density(svgfile_hotelling)
309 except Exception as e:
310 lock.acquire()
311 print('['+gene+']: error saving',svgfile_hotelling, e)
312 lock.release()
313 lock.acquire()
314 print('['+gene+']: OK')
315 lock.release()
316 return(gene)
317
318if HOTELLING:
319 try:

Callers

nothing calls this directly

Calls 2

plot_densityMethod · 0.95
HotellingClass · 0.85

Tested by

no test coverage detected