Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate into Refinery #2

Open
mccalluc opened this issue Jan 4, 2017 · 1 comment
Open

Integrate into Refinery #2

mccalluc opened this issue Jan 4, 2017 · 1 comment
Assignees

Comments

@mccalluc
Copy link
Member

mccalluc commented Jan 4, 2017

@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?

  • How do you want to manage the dependencies? Should I just download then all and put them in a vendor directory? Or should I try a package.json or something like that and leave it to Refinery to pull everything during build?
  • (Assuming we do want to avoid dependencies on CDNs?)
  • Extra input from the user: Getting the genome from the user, if it's missing, is pretty adhoc, but it gets the job done? I think that trying to get more user input from inside the refinery space doesn't scale well.
  • Naming: On the refinery side it needs to know which repo to check out, and what the key js file is, and what the human-readable name for the menu is: we could agree that the same name might be shared across more roles, or the convention could be index.js?
  • Since there's no compilation here, everything is src... but probably not a pattern to rely on.
  • I need to write a real refinery.js: There are probably tools that build js from an API spec... but if we only need one method, writing it by hand seems fine for now?
@mccalluc
Copy link
Member Author

mccalluc commented Jan 4, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants