Skip to content

Instantly share code, notes, and snippets.

@amergin
Created October 10, 2012 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amergin/3867199 to your computer and use it in GitHub Desktop.
Save amergin/3867199 to your computer and use it in GitHub Desktop.
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