-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmark_interactions.py
More file actions
24 lines (23 loc) · 1.27 KB
/
mark_interactions.py
File metadata and controls
24 lines (23 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import common, objects, loaders
with common.runtool(5) as parameters:
interLayer, query, interStrengthFld, interFromIDFld, interToIDFld = parameters
inSlots = {'from' : interFromIDFld, 'to' : interToIDFld, 'value' : interStrengthFld}
outOrdSlots = {'in' : 'ORD_IN', 'out' : 'ORD_OUT'}
outRelSlots = {'in' : 'RELS_IN', 'out' : 'RELS_OUT'}
outSigSlots = {'in' : 'SIG_IN', 'out' : 'SIG_OUT'}
common.progress('loading interactions')
inter = loaders.InteractionReader(interLayer, inSlots, where=query).read()
# common.message(inter)
common.progress('ordering interactions')
orders = objects.Interactions.transform(inter, 'orders')
# common.message(orders)
common.progress('counting relative interaction strength')
relst = objects.Interactions.transform(inter, 'relativeStrengths')
# common.message(relst)
common.progress('selecting significant interactions')
signif = objects.Interactions.transform(inter, 'significant')
# common.message(signif)
common.progress('writing output')
loaders.InteractionTwosideMarker(interLayer, inSlots, outOrdSlots, where=query).mark(orders)
loaders.InteractionTwosideMarker(interLayer, inSlots, outRelSlots, where=query).mark(relst)
loaders.InteractionPresenceMarker(interLayer, inSlots, outSigSlots, where=query).mark(signif)