{"action":"created","comment":{"url":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/comments/30945814","id":30945814,"diff_hunk":"@@ -12,40 +45,302 @@\n     # 'genbank': '--gbk',\n }\n \n+INSTALLED_TO = os.path.dirname(os.path.realpath(__file__))\n+\n+\n+class JbrowseConnector(object):\n+\n+    def __init__(self, jbrowse, jbrowse_dir, outdir, genome):\n+        self.jbrowse = jbrowse\n+        self.jbrowse_dir = jbrowse_dir\n+        self.outdir = outdir\n+        self.genome_path = genome\n+        self.brewer_colour_idx = 0\n+\n+        self.clone_jbrowse(self.jbrowse, self.outdir)\n+        self.process_genome()\n+\n+    def subprocess_check_call(self, command):\n+        print 'cd %s && %s' % (self.jbrowse_dir, ' '.join(command))\n+        subprocess.check_call(command, cwd=self.jbrowse_dir)\n+\n+    def _get_colours(self):\n+        r, g, b = BREWER_COLOUR_SCHEMES[self.brewer_colour_idx]\n+        self.brewer_colour_idx += 1\n+        return r, g, b\n+\n+    def process_genome(self):\n+        self.subprocess_check_call(['perl', 'bin/prepare-refseqs.pl',\n+                                    '--fasta', self.genome_path])\n+\n+    def _add_json(self, json_data):\n+        if len(json_data.keys()) == 0:\n+            return\n+\n+        tmp = tempfile.NamedTemporaryFile(delete=False)\n+        tmp.write(json.dumps(json_data))\n+        tmp.close()\n+        cmd = ['perl', 'bin/add-track-json.pl', tmp.name,\n+               os.path.join('data', 'trackList.json')]\n+        self.subprocess_check_call(cmd)\n+        os.unlink(tmp.name)\n+\n+    def add_blastxml(self, data, key, **kwargs):\n+        gff3_unrebased = tempfile.NamedTemporaryFile(delete=False)\n+        cmd = ['python', os.path.join(INSTALLED_TO, 'blastxml_to_gapped_gff3.py'),\n+               '--trim_end', '--min_gap', str(kwargs['min_gap']), data]\n+        subprocess.check_call(cmd, cwd=self.jbrowse_dir, stdout=gff3_unrebased)\n+        gff3_unrebased.close()\n+\n+        gff3_rebased = tempfile.NamedTemporaryFile(delete=False)\n+        cmd = ['python', os.path.join(INSTALLED_TO, 'gff3_rebase.py')]\n+        if kwargs['protein']:\n+            cmd.append('--protein2dna')\n+        cmd.extend([kwargs['parent'], gff3_unrebased.name])\n+        print ' '.join(cmd)","path":"tools/jbrowse/jbrowse.py","position":100,"original_position":100,"commit_id":"d6f46e00d30e61cdafb6894bc305bfe57f4152ae","original_commit_id":"d6f46e00d30e61cdafb6894bc305bfe57f4152ae","user":{"login":"bgruening","id":469983,"avatar_url":"https://avatars.githubusercontent.com/u/469983?v=3","gravatar_id":"","url":"https://api.github.com/users/bgruening","html_url":"https://github.com/bgruening","followers_url":"https://api.github.com/users/bgruening/followers","following_url":"https://api.github.com/users/bgruening/following{/other_user}","gists_url":"https://api.github.com/users/bgruening/gists{/gist_id}","starred_url":"https://api.github.com/users/bgruening/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgruening/subscriptions","organizations_url":"https://api.github.com/users/bgruening/orgs","repos_url":"https://api.github.com/users/bgruening/repos","events_url":"https://api.github.com/users/bgruening/events{/privacy}","received_events_url":"https://api.github.com/users/bgruening/received_events","type":"User","site_admin":false},"body":"debug?","created_at":"2015-05-23T15:45:07Z","updated_at":"2015-05-23T15:45:07Z","html_url":"https://github.com/galaxyproject/tools-iuc/pull/141#discussion_r30945814","pull_request_url":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/141","_links":{"self":{"href":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/comments/30945814"},"html":{"href":"https://github.com/galaxyproject/tools-iuc/pull/141#discussion_r30945814"},"pull_request":{"href":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/141"}}},"pull_request":{"url":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/141","id":35377651,"html_url":"https://github.com/galaxyproject/tools-iuc/pull/141","diff_url":"https://github.com/galaxyproject/tools-iuc/pull/141.diff","patch_url":"https://github.com/galaxyproject/tools-iuc/pull/141.patch","issue_url":"https://api.github.com/repos/galaxyproject/tools-iuc/issues/141","number":141,"state":"open","locked":false,"title":"JBrowse Update","user":{"login":"erasche","id":458683,"avatar_url":"https://avatars.githubusercontent.com/u/458683?v=3","gravatar_id":"","url":"https://api.github.com/users/erasche","html_url":"https://github.com/erasche","followers_url":"https://api.github.com/users/erasche/followers","following_url":"https://api.github.com/users/erasche/following{/other_user}","gists_url":"https://api.github.com/users/erasche/gists{/gist_id}","starred_url":"https://api.github.com/users/erasche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erasche/subscriptions","organizations_url":"https://api.github.com/users/erasche/orgs","repos_url":"https://api.github.com/users/erasche/repos","events_url":"https://api.github.com/users/erasche/events{/privacy}","received_events_url":"https://api.github.com/users/erasche/received_events","type":"User","site_admin":false},"body":"## New Features\r\n\r\n- [x] bam\r\n- [x] [auto-generated](http://gmod.org/wiki/JBrowse_Configuration_Guide#SNPCoverage) SNP from BAM\r\n- [x] bigwig\r\n- [x] bigwig options like XY vs Density, display of variance_band\r\n- [x] bigwig options like min, max\r\n- [x] vcf\r\n- [x] blast XML\r\n\r\n## Preview:\r\n\r\n[Visualize ALL the data](https://cpt.tamu.edu/dot/jb/w/?loc=Merlin%3A1..24858&tracks=DNA%2C89b4b9280761aacde16640100508bde7%2C6173b502210234b165b8b3d2d14de5a3%2C4f7b543c8c801f07c0a17cb2660158ca%2C746f43b6c68cd47ff74ac2e18f623953%2Caf15404c6dd609d3861ff788b3b2acc3%2Ce916ccc3d8307099bbb569a15258a515_autosnp%2Ce916ccc3d8307099bbb569a15258a515)\r\n\r\n## Questions:\r\n\r\n- [x] is it OK to run bgzip/tabix on vcf data, or is there another way I should be accessing that? (Yes)\r\n- [x] should I expose colouring options? Isn't there a new UI element for colours? (Not yet)\r\n- [x] should I re-add wig support? I removed it in lieu of bigWig only (No)\r\n- [x] should I support pre-set min/max values for BigWig data (normally it auto-scales)? (Yes)\r\n\r\n","created_at":"2015-05-13T22:29:51Z","updated_at":"2015-05-23T15:45:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f0245aa4d4650c444b94cfae24747be47f39a0b8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/141/commits","review_comments_url":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/141/comments","review_comment_url":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/galaxyproject/tools-iuc/issues/141/comments","statuses_url":"https://api.github.com/repos/galaxyproject/tools-iuc/statuses/d6f46e00d30e61cdafb6894bc305bfe57f4152ae","head":{"label":"galaxyproject:jbrowse_02","ref":"jbrowse_02","sha":"d6f46e00d30e61cdafb6894bc305bfe57f4152ae","user":{"login":"galaxyproject","id":7937847,"avatar_url":"https://avatars.githubusercontent.com/u/7937847?v=3","gravatar_id":"","url":"https://api.github.com/users/galaxyproject","html_url":"https://github.com/galaxyproject","followers_url":"https://api.github.com/users/galaxyproject/followers","following_url":"https://api.github.com/users/galaxyproject/following{/other_user}","gists_url":"https://api.github.com/users/galaxyproject/gists{/gist_id}","starred_url":"https://api.github.com/users/galaxyproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galaxyproject/subscriptions","organizations_url":"https://api.github.com/users/galaxyproject/orgs","repos_url":"https://api.github.com/users/galaxyproject/repos","events_url":"https://api.github.com/users/galaxyproject/events{/privacy}","received_events_url":"https://api.github.com/users/galaxyproject/received_events","type":"Organization","site_admin":false},"repo":{"id":23992530,"name":"tools-iuc","full_name":"galaxyproject/tools-iuc","owner":{"login":"galaxyproject","id":7937847,"avatar_url":"https://avatars.githubusercontent.com/u/7937847?v=3","gravatar_id":"","url":"https://api.github.com/users/galaxyproject","html_url":"https://github.com/galaxyproject","followers_url":"https://api.github.com/users/galaxyproject/followers","following_url":"https://api.github.com/users/galaxyproject/following{/other_user}","gists_url":"https://api.github.com/users/galaxyproject/gists{/gist_id}","starred_url":"https://api.github.com/users/galaxyproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galaxyproject/subscriptions","organizations_url":"https://api.github.com/users/galaxyproject/orgs","repos_url":"https://api.github.com/users/galaxyproject/repos","events_url":"https://api.github.com/users/galaxyproject/events{/privacy}","received_events_url":"https://api.github.com/users/galaxyproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/galaxyproject/tools-iuc","description":"Tool Shed repositories maintained and developed by the Intergalactic Utilities Commission","fork":false,"url":"https://api.github.com/repos/galaxyproject/tools-iuc","forks_url":"https://api.github.com/repos/galaxyproject/tools-iuc/forks","keys_url":"https://api.github.com/repos/galaxyproject/tools-iuc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/galaxyproject/tools-iuc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/galaxyproject/tools-iuc/teams","hooks_url":"https://api.github.com/repos/galaxyproject/tools-iuc/hooks","issue_events_url":"https://api.github.com/repos/galaxyproject/tools-iuc/issues/events{/number}","events_url":"https://api.github.com/repos/galaxyproject/tools-iuc/events","assignees_url":"https://api.github.com/repos/galaxyproject/tools-iuc/assignees{/user}","branches_url":"https://api.github.com/repos/galaxyproject/tools-iuc/branches{/branch}","tags_url":"https://api.github.com/repos/galaxyproject/tools-iuc/tags","blobs_url":"https://api.github.com/repos/galaxyproject/tools-iuc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/galaxyproject/tools-iuc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/galaxyproject/tools-iuc/git/refs{/sha}","trees_url":"https://api.github.com/repos/galaxyproject/tools-iuc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/galaxyproject/tools-iuc/statuses/{sha}","languages_url":"https://api.github.com/repos/galaxyproject/tools-iuc/languages","stargazers_url":"https://api.github.com/repos/galaxyproject/tools-iuc/stargazers","contributors_url":"https://api.github.com/repos/galaxyproject/tools-iuc/contributors","subscribers_url":"https://api.github.com/repos/galaxyproject/tools-iuc/subscribers","subscription_url":"https://api.github.com/repos/galaxyproject/tools-iuc/subscription","commits_url":"https://api.github.com/repos/galaxyproject/tools-iuc/commits{/sha}","git_commits_url":"https://api.github.com/repos/galaxyproject/tools-iuc/git/commits{/sha}","comments_url":"https://api.github.com/repos/galaxyproject/tools-iuc/comments{/number}","issue_comment_url":"https://api.github.com/repos/galaxyproject/tools-iuc/issues/comments{/number}","contents_url":"https://api.github.com/repos/galaxyproject/tools-iuc/contents/{+path}","compare_url":"https://api.github.com/repos/galaxyproject/tools-iuc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/galaxyproject/tools-iuc/merges","archive_url":"https://api.github.com/repos/galaxyproject/tools-iuc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/galaxyproject/tools-iuc/downloads","issues_url":"https://api.github.com/repos/galaxyproject/tools-iuc/issues{/number}","pulls_url":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls{/number}","milestones_url":"https://api.github.com/repos/galaxyproject/tools-iuc/milestones{/number}","notifications_url":"https://api.github.com/repos/galaxyproject/tools-iuc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/galaxyproject/tools-iuc/labels{/name}","releases_url":"https://api.github.com/repos/galaxyproject/tools-iuc/releases{/id}","created_at":"2014-09-13T11:18:49Z","updated_at":"2015-05-22T11:58:11Z","pushed_at":"2015-05-23T15:27:15Z","git_url":"git://github.com/galaxyproject/tools-iuc.git","ssh_url":"git@github.com:galaxyproject/tools-iuc.git","clone_url":"https://github.com/galaxyproject/tools-iuc.git","svn_url":"https://github.com/galaxyproject/tools-iuc","homepage":"https://wiki.galaxyproject.org/IUC","size":38891,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":25,"forks":22,"open_issues":25,"watchers":12,"default_branch":"master"}},"base":{"label":"galaxyproject:master","ref":"master","sha":"7b784f6f2540a5438f0e9153cdbcd60de4455867","user":{"login":"galaxyproject","id":7937847,"avatar_url":"https://avatars.githubusercontent.com/u/7937847?v=3","gravatar_id":"","url":"https://api.github.com/users/galaxyproject","html_url":"https://github.com/galaxyproject","followers_url":"https://api.github.com/users/galaxyproject/followers","following_url":"https://api.github.com/users/galaxyproject/following{/other_user}","gists_url":"https://api.github.com/users/galaxyproject/gists{/gist_id}","starred_url":"https://api.github.com/users/galaxyproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galaxyproject/subscriptions","organizations_url":"https://api.github.com/users/galaxyproject/orgs","repos_url":"https://api.github.com/users/galaxyproject/repos","events_url":"https://api.github.com/users/galaxyproject/events{/privacy}","received_events_url":"https://api.github.com/users/galaxyproject/received_events","type":"Organization","site_admin":false},"repo":{"id":23992530,"name":"tools-iuc","full_name":"galaxyproject/tools-iuc","owner":{"login":"galaxyproject","id":7937847,"avatar_url":"https://avatars.githubusercontent.com/u/7937847?v=3","gravatar_id":"","url":"https://api.github.com/users/galaxyproject","html_url":"https://github.com/galaxyproject","followers_url":"https://api.github.com/users/galaxyproject/followers","following_url":"https://api.github.com/users/galaxyproject/following{/other_user}","gists_url":"https://api.github.com/users/galaxyproject/gists{/gist_id}","starred_url":"https://api.github.com/users/galaxyproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galaxyproject/subscriptions","organizations_url":"https://api.github.com/users/galaxyproject/orgs","repos_url":"https://api.github.com/users/galaxyproject/repos","events_url":"https://api.github.com/users/galaxyproject/events{/privacy}","received_events_url":"https://api.github.com/users/galaxyproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/galaxyproject/tools-iuc","description":"Tool Shed repositories maintained and developed by the Intergalactic Utilities Commission","fork":false,"url":"https://api.github.com/repos/galaxyproject/tools-iuc","forks_url":"https://api.github.com/repos/galaxyproject/tools-iuc/forks","keys_url":"https://api.github.com/repos/galaxyproject/tools-iuc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/galaxyproject/tools-iuc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/galaxyproject/tools-iuc/teams","hooks_url":"https://api.github.com/repos/galaxyproject/tools-iuc/hooks","issue_events_url":"https://api.github.com/repos/galaxyproject/tools-iuc/issues/events{/number}","events_url":"https://api.github.com/repos/galaxyproject/tools-iuc/events","assignees_url":"https://api.github.com/repos/galaxyproject/tools-iuc/assignees{/user}","branches_url":"https://api.github.com/repos/galaxyproject/tools-iuc/branches{/branch}","tags_url":"https://api.github.com/repos/galaxyproject/tools-iuc/tags","blobs_url":"https://api.github.com/repos/galaxyproject/tools-iuc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/galaxyproject/tools-iuc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/galaxyproject/tools-iuc/git/refs{/sha}","trees_url":"https://api.github.com/repos/galaxyproject/tools-iuc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/galaxyproject/tools-iuc/statuses/{sha}","languages_url":"https://api.github.com/repos/galaxyproject/tools-iuc/languages","stargazers_url":"https://api.github.com/repos/galaxyproject/tools-iuc/stargazers","contributors_url":"https://api.github.com/repos/galaxyproject/tools-iuc/contributors","subscribers_url":"https://api.github.com/repos/galaxyproject/tools-iuc/subscribers","subscription_url":"https://api.github.com/repos/galaxyproject/tools-iuc/subscription","commits_url":"https://api.github.com/repos/galaxyproject/tools-iuc/commits{/sha}","git_commits_url":"https://api.github.com/repos/galaxyproject/tools-iuc/git/commits{/sha}","comments_url":"https://api.github.com/repos/galaxyproject/tools-iuc/comments{/number}","issue_comment_url":"https://api.github.com/repos/galaxyproject/tools-iuc/issues/comments{/number}","contents_url":"https://api.github.com/repos/galaxyproject/tools-iuc/contents/{+path}","compare_url":"https://api.github.com/repos/galaxyproject/tools-iuc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/galaxyproject/tools-iuc/merges","archive_url":"https://api.github.com/repos/galaxyproject/tools-iuc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/galaxyproject/tools-iuc/downloads","issues_url":"https://api.github.com/repos/galaxyproject/tools-iuc/issues{/number}","pulls_url":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls{/number}","milestones_url":"https://api.github.com/repos/galaxyproject/tools-iuc/milestones{/number}","notifications_url":"https://api.github.com/repos/galaxyproject/tools-iuc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/galaxyproject/tools-iuc/labels{/name}","releases_url":"https://api.github.com/repos/galaxyproject/tools-iuc/releases{/id}","created_at":"2014-09-13T11:18:49Z","updated_at":"2015-05-22T11:58:11Z","pushed_at":"2015-05-23T15:27:15Z","git_url":"git://github.com/galaxyproject/tools-iuc.git","ssh_url":"git@github.com:galaxyproject/tools-iuc.git","clone_url":"https://github.com/galaxyproject/tools-iuc.git","svn_url":"https://github.com/galaxyproject/tools-iuc","homepage":"https://wiki.galaxyproject.org/IUC","size":38891,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":25,"forks":22,"open_issues":25,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/141"},"html":{"href":"https://github.com/galaxyproject/tools-iuc/pull/141"},"issue":{"href":"https://api.github.com/repos/galaxyproject/tools-iuc/issues/141"},"comments":{"href":"https://api.github.com/repos/galaxyproject/tools-iuc/issues/141/comments"},"review_comments":{"href":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/141/comments"},"review_comment":{"href":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/galaxyproject/tools-iuc/pulls/141/commits"},"statuses":{"href":"https://api.github.com/repos/galaxyproject/tools-iuc/statuses/d6f46e00d30e61cdafb6894bc305bfe57f4152ae"}}}}