Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gremlin test script for bulbs
def regulatory(clinicalNodeId, distanceThreshold, middleNodeType, mutatedType, targetType) {
if( targetType == 'GNAB' )
{
if( mutatedType == 'aberrated' )
{
/*distanceThreshold = 100000;
middleNodeType = 'GEXP';
clinicalNodeId = 137059;
mutatedType = 'aberrated';
targetType = 'GNAB'; */
middle = null;
rel2 = null;
resultEdgeIds = [];
return query = g.v(clinicalNodeId).outE.filter{ it.inV.next().getProperty('source') == middleNodeType }.inV.as('middle').sideEffect{middle = it}.outE.sideEffect{rel2 = it}.inV.filter
{
target = it;
return
(
( ( target.hasProperty('label') && middle.hasProperty('label') && target.getProperty('label') == middle.getProperty('label') ) &&
( target.chr == middle.chr ) && ( middle.source == targetType ) ) ||
( ( target.chr == middle.chr ) && ( target.source == 'CNVR' )
&& ( rel2.getProperty('distance') < distanceThreshold ) && ( rel2.getProperty('correlation') > 0 ) ) ||
( ( target.chr == middle.chr ) && ( target.source == 'METH' ) &&
( rel2.getProperty('distance') < distanceThreshold ) && ( rel2.getProperty('correlation') < 0 ) ) ||
( (target.source == 'MIRN') && (rel2.correlation < 0) )
);
}.paths.transform{ it.findAll{ it instanceof Edge} }.toList().flatten().unique();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment