refinery-platform / igv-wrapper-for-refinery

Wrap IGV as an AMD which accepts Node IDs
MIT License
0 stars 0 forks source link

Integrate into Refinery #2

Open mccalluc opened 7 years ago

mccalluc commented 7 years ago

@scottx611x : Here's one attempt at an IGV wrapper. What's the simplest contract we can require for integrating this or any future visualization into refinery? What still needs to happen here?

mccalluc commented 7 years ago

In my view, part of the contract may be for vis packages to identify themselves as such, rather than maintaining a separate configuration list with all the details. This script does that... but it is unacceptably slow: Perhaps figure out where the package.jsons are stored and parse them directly?

import os
import json

look_for = 'refinery-vis'
matches = []

npm_list_json = os.popen('npm list --json true --depth 0').read()
dependencies = json.loads(npm_list_json)['dependencies']
for name, info in dependencies.iteritems():
  command = 'npm view %s@%s keywords --json' % (name, info['version']) # Security of string interpolation?
  npm_view_json = os.popen(command).read()
  if npm_view_json:
    keywords = json.loads(npm_view_json)
    if look_for in keywords:
      matches.append(name)

print matches

Alternatively parse the each package.json yourself: I think it would suffice to iterate over

node_modules/*/package.json # for locals
`npm root -g`/*/package.json # for globals