{"action":"created","comment":{"url":"https://api.github.com/repos/biocore/micronota/pulls/comments/54033163","id":54033163,"diff_hunk":"@@ -0,0 +1,78 @@\n+# ----------------------------------------------------------------------------\n+# Copyright (c) 2015--, micronota development team.\n+#\n+# Distributed under the terms of the Modified BSD License.\n+#\n+# The full license is in the file COPYING.txt, distributed with this software.\n+# ----------------------------------------------------------------------------\n+\n+from os.path import splitext, basename, join\n+from importlib import import_module\n+\n+from skbio.sequence import IntervalMetadata\n+from skbio import read, DNA\n+\n+from .util import _tmp_file\n+from . import bfillings\n+\n+\n+def annotate(in_fp, in_fmt, out_dir, out_fmt, cpus, config):\n+    '''Annotate the sequences in the input file.'''\n+    fn = splitext(basename(in_fp))[0]\n+    # store annotated seq file.\n+    out_fp = join(out_dir, '%s.gbk' % fn)\n+    # append the file for multiple sequences\n+    out = open(out_fp, 'a')\n+    sec = 'WORKFLOW'\n+    workflows = config[sec]['order'].split(' > ')\n+    for seq in read(in_fp, format=in_fmt):\n+        # interval_metadata\n+        im = {}\n+        with _tmp_file() as f:\n+            _, fp = f\n+            seq.write(fp, format='fasta')\n+            # output dir for the current input seq\n+            out_dir_seq = join(out_dir, seq.metadata['id'])\n+            for k in workflows:\n+                tasks = config[sec][k].split(' > ')\n+                if k == 'features':\n+                    im_ = identify_all_features(fp, out_dir_seq, tasks, config)\n+                    im.update(im_)\n+                if k == 'CDS':\n+                    annotate_all_cds()\n+        seq.interval_metadata = IntervalMetadata(im)\n+        seq.write(out, format=out_fmt)\n+    out.close()\n+\n+\n+def identify_all_features(fp, out_dir, tasks, config,\n+                          id_func='identify_features',\n+                          parse_func='parse_output'):\n+    '''Identify all the features on the sequence in the input file.\n+\n+    It runs thru all the tasks specified in sequential order.\n+\n+    Parameters\n+    ----------\n+\n+    Returns\n+    -------\n+    '''\n+    im = {}\n+    for task in tasks:\n+        items = task.split(':')\n+        tool = items[0]\n+        submodule = import_module('.%s' % tool, bfillings.__name__)","path":"micronota/workflow.py","position":65,"original_position":65,"commit_id":"100f7829ba8c25e0e6713f5cba8277bd846f07b7","original_commit_id":"100f7829ba8c25e0e6713f5cba8277bd846f07b7","user":{"login":"wasade","id":474290,"avatar_url":"https://avatars.githubusercontent.com/u/474290?v=3","gravatar_id":"","url":"https://api.github.com/users/wasade","html_url":"https://github.com/wasade","followers_url":"https://api.github.com/users/wasade/followers","following_url":"https://api.github.com/users/wasade/following{/other_user}","gists_url":"https://api.github.com/users/wasade/gists{/gist_id}","starred_url":"https://api.github.com/users/wasade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wasade/subscriptions","organizations_url":"https://api.github.com/users/wasade/orgs","repos_url":"https://api.github.com/users/wasade/repos","events_url":"https://api.github.com/users/wasade/events{/privacy}","received_events_url":"https://api.github.com/users/wasade/received_events","type":"User","site_admin":false},"body":"you know what could be cool here is to leverage the python logger...","created_at":"2016-02-25T00:46:24Z","updated_at":"2016-02-25T00:46:24Z","html_url":"https://github.com/biocore/micronota/pull/46#discussion_r54033163","pull_request_url":"https://api.github.com/repos/biocore/micronota/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/biocore/micronota/pulls/comments/54033163"},"html":{"href":"https://github.com/biocore/micronota/pull/46#discussion_r54033163"},"pull_request":{"href":"https://api.github.com/repos/biocore/micronota/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/biocore/micronota/pulls/46","id":60560831,"html_url":"https://github.com/biocore/micronota/pull/46","diff_url":"https://github.com/biocore/micronota/pull/46.diff","patch_url":"https://github.com/biocore/micronota/pull/46.patch","issue_url":"https://api.github.com/repos/biocore/micronota/issues/46","number":46,"state":"open","locked":false,"title":"WIP: final pr before alpha release","user":{"login":"RNAer","id":1000056,"avatar_url":"https://avatars.githubusercontent.com/u/1000056?v=3","gravatar_id":"","url":"https://api.github.com/users/RNAer","html_url":"https://github.com/RNAer","followers_url":"https://api.github.com/users/RNAer/followers","following_url":"https://api.github.com/users/RNAer/following{/other_user}","gists_url":"https://api.github.com/users/RNAer/gists{/gist_id}","starred_url":"https://api.github.com/users/RNAer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RNAer/subscriptions","organizations_url":"https://api.github.com/users/RNAer/orgs","repos_url":"https://api.github.com/users/RNAer/repos","events_url":"https://api.github.com/users/RNAer/events{/privacy}","received_events_url":"https://api.github.com/users/RNAer/received_events","type":"User","site_admin":false},"body":"This sets up the annotation workflow with `configparser` and implements the function so the workflow can be configured dynamically.\r\n\r\nthis PR is not finished.","created_at":"2016-02-24T19:06:15Z","updated_at":"2016-02-25T00:46:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ea36dc81f18d21a910240440eae845ba3352137","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/biocore/micronota/pulls/46/commits","review_comments_url":"https://api.github.com/repos/biocore/micronota/pulls/46/comments","review_comment_url":"https://api.github.com/repos/biocore/micronota/pulls/comments{/number}","comments_url":"https://api.github.com/repos/biocore/micronota/issues/46/comments","statuses_url":"https://api.github.com/repos/biocore/micronota/statuses/100f7829ba8c25e0e6713f5cba8277bd846f07b7","head":{"label":"RNAer:bf","ref":"bf","sha":"100f7829ba8c25e0e6713f5cba8277bd846f07b7","user":{"login":"RNAer","id":1000056,"avatar_url":"https://avatars.githubusercontent.com/u/1000056?v=3","gravatar_id":"","url":"https://api.github.com/users/RNAer","html_url":"https://github.com/RNAer","followers_url":"https://api.github.com/users/RNAer/followers","following_url":"https://api.github.com/users/RNAer/following{/other_user}","gists_url":"https://api.github.com/users/RNAer/gists{/gist_id}","starred_url":"https://api.github.com/users/RNAer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RNAer/subscriptions","organizations_url":"https://api.github.com/users/RNAer/orgs","repos_url":"https://api.github.com/users/RNAer/repos","events_url":"https://api.github.com/users/RNAer/events{/privacy}","received_events_url":"https://api.github.com/users/RNAer/received_events","type":"User","site_admin":false},"repo":{"id":43989569,"name":"micronota","full_name":"RNAer/micronota","owner":{"login":"RNAer","id":1000056,"avatar_url":"https://avatars.githubusercontent.com/u/1000056?v=3","gravatar_id":"","url":"https://api.github.com/users/RNAer","html_url":"https://github.com/RNAer","followers_url":"https://api.github.com/users/RNAer/followers","following_url":"https://api.github.com/users/RNAer/following{/other_user}","gists_url":"https://api.github.com/users/RNAer/gists{/gist_id}","starred_url":"https://api.github.com/users/RNAer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RNAer/subscriptions","organizations_url":"https://api.github.com/users/RNAer/orgs","repos_url":"https://api.github.com/users/RNAer/repos","events_url":"https://api.github.com/users/RNAer/events{/privacy}","received_events_url":"https://api.github.com/users/RNAer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RNAer/micronota","description":"annotation pipeline for microbial genomes and metagenomes","fork":true,"url":"https://api.github.com/repos/RNAer/micronota","forks_url":"https://api.github.com/repos/RNAer/micronota/forks","keys_url":"https://api.github.com/repos/RNAer/micronota/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RNAer/micronota/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RNAer/micronota/teams","hooks_url":"https://api.github.com/repos/RNAer/micronota/hooks","issue_events_url":"https://api.github.com/repos/RNAer/micronota/issues/events{/number}","events_url":"https://api.github.com/repos/RNAer/micronota/events","assignees_url":"https://api.github.com/repos/RNAer/micronota/assignees{/user}","branches_url":"https://api.github.com/repos/RNAer/micronota/branches{/branch}","tags_url":"https://api.github.com/repos/RNAer/micronota/tags","blobs_url":"https://api.github.com/repos/RNAer/micronota/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RNAer/micronota/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RNAer/micronota/git/refs{/sha}","trees_url":"https://api.github.com/repos/RNAer/micronota/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RNAer/micronota/statuses/{sha}","languages_url":"https://api.github.com/repos/RNAer/micronota/languages","stargazers_url":"https://api.github.com/repos/RNAer/micronota/stargazers","contributors_url":"https://api.github.com/repos/RNAer/micronota/contributors","subscribers_url":"https://api.github.com/repos/RNAer/micronota/subscribers","subscription_url":"https://api.github.com/repos/RNAer/micronota/subscription","commits_url":"https://api.github.com/repos/RNAer/micronota/commits{/sha}","git_commits_url":"https://api.github.com/repos/RNAer/micronota/git/commits{/sha}","comments_url":"https://api.github.com/repos/RNAer/micronota/comments{/number}","issue_comment_url":"https://api.github.com/repos/RNAer/micronota/issues/comments{/number}","contents_url":"https://api.github.com/repos/RNAer/micronota/contents/{+path}","compare_url":"https://api.github.com/repos/RNAer/micronota/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RNAer/micronota/merges","archive_url":"https://api.github.com/repos/RNAer/micronota/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RNAer/micronota/downloads","issues_url":"https://api.github.com/repos/RNAer/micronota/issues{/number}","pulls_url":"https://api.github.com/repos/RNAer/micronota/pulls{/number}","milestones_url":"https://api.github.com/repos/RNAer/micronota/milestones{/number}","notifications_url":"https://api.github.com/repos/RNAer/micronota/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RNAer/micronota/labels{/name}","releases_url":"https://api.github.com/repos/RNAer/micronota/releases{/id}","deployments_url":"https://api.github.com/repos/RNAer/micronota/deployments","created_at":"2015-10-10T02:13:27Z","updated_at":"2016-01-12T22:32:28Z","pushed_at":"2016-02-24T21:04:06Z","git_url":"git://github.com/RNAer/micronota.git","ssh_url":"git@github.com:RNAer/micronota.git","clone_url":"https://github.com/RNAer/micronota.git","svn_url":"https://github.com/RNAer/micronota","homepage":null,"size":522,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"biocore:master","ref":"master","sha":"f9fe646a573a444377af2e7f2ad997251be6910f","user":{"login":"biocore","id":6241857,"avatar_url":"https://avatars.githubusercontent.com/u/6241857?v=3","gravatar_id":"","url":"https://api.github.com/users/biocore","html_url":"https://github.com/biocore","followers_url":"https://api.github.com/users/biocore/followers","following_url":"https://api.github.com/users/biocore/following{/other_user}","gists_url":"https://api.github.com/users/biocore/gists{/gist_id}","starred_url":"https://api.github.com/users/biocore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biocore/subscriptions","organizations_url":"https://api.github.com/users/biocore/orgs","repos_url":"https://api.github.com/users/biocore/repos","events_url":"https://api.github.com/users/biocore/events{/privacy}","received_events_url":"https://api.github.com/users/biocore/received_events","type":"Organization","site_admin":false},"repo":{"id":43972497,"name":"micronota","full_name":"biocore/micronota","owner":{"login":"biocore","id":6241857,"avatar_url":"https://avatars.githubusercontent.com/u/6241857?v=3","gravatar_id":"","url":"https://api.github.com/users/biocore","html_url":"https://github.com/biocore","followers_url":"https://api.github.com/users/biocore/followers","following_url":"https://api.github.com/users/biocore/following{/other_user}","gists_url":"https://api.github.com/users/biocore/gists{/gist_id}","starred_url":"https://api.github.com/users/biocore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biocore/subscriptions","organizations_url":"https://api.github.com/users/biocore/orgs","repos_url":"https://api.github.com/users/biocore/repos","events_url":"https://api.github.com/users/biocore/events{/privacy}","received_events_url":"https://api.github.com/users/biocore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/biocore/micronota","description":"annotation pipeline for microbial genomes and metagenomes","fork":false,"url":"https://api.github.com/repos/biocore/micronota","forks_url":"https://api.github.com/repos/biocore/micronota/forks","keys_url":"https://api.github.com/repos/biocore/micronota/keys{/key_id}","collaborators_url":"https://api.github.com/repos/biocore/micronota/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/biocore/micronota/teams","hooks_url":"https://api.github.com/repos/biocore/micronota/hooks","issue_events_url":"https://api.github.com/repos/biocore/micronota/issues/events{/number}","events_url":"https://api.github.com/repos/biocore/micronota/events","assignees_url":"https://api.github.com/repos/biocore/micronota/assignees{/user}","branches_url":"https://api.github.com/repos/biocore/micronota/branches{/branch}","tags_url":"https://api.github.com/repos/biocore/micronota/tags","blobs_url":"https://api.github.com/repos/biocore/micronota/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/biocore/micronota/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/biocore/micronota/git/refs{/sha}","trees_url":"https://api.github.com/repos/biocore/micronota/git/trees{/sha}","statuses_url":"https://api.github.com/repos/biocore/micronota/statuses/{sha}","languages_url":"https://api.github.com/repos/biocore/micronota/languages","stargazers_url":"https://api.github.com/repos/biocore/micronota/stargazers","contributors_url":"https://api.github.com/repos/biocore/micronota/contributors","subscribers_url":"https://api.github.com/repos/biocore/micronota/subscribers","subscription_url":"https://api.github.com/repos/biocore/micronota/subscription","commits_url":"https://api.github.com/repos/biocore/micronota/commits{/sha}","git_commits_url":"https://api.github.com/repos/biocore/micronota/git/commits{/sha}","comments_url":"https://api.github.com/repos/biocore/micronota/comments{/number}","issue_comment_url":"https://api.github.com/repos/biocore/micronota/issues/comments{/number}","contents_url":"https://api.github.com/repos/biocore/micronota/contents/{+path}","compare_url":"https://api.github.com/repos/biocore/micronota/compare/{base}...{head}","merges_url":"https://api.github.com/repos/biocore/micronota/merges","archive_url":"https://api.github.com/repos/biocore/micronota/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/biocore/micronota/downloads","issues_url":"https://api.github.com/repos/biocore/micronota/issues{/number}","pulls_url":"https://api.github.com/repos/biocore/micronota/pulls{/number}","milestones_url":"https://api.github.com/repos/biocore/micronota/milestones{/number}","notifications_url":"https://api.github.com/repos/biocore/micronota/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/biocore/micronota/labels{/name}","releases_url":"https://api.github.com/repos/biocore/micronota/releases{/id}","deployments_url":"https://api.github.com/repos/biocore/micronota/deployments","created_at":"2015-10-09T18:17:37Z","updated_at":"2016-02-04T18:32:46Z","pushed_at":"2016-02-24T21:04:06Z","git_url":"git://github.com/biocore/micronota.git","ssh_url":"git@github.com:biocore/micronota.git","clone_url":"https://github.com/biocore/micronota.git","svn_url":"https://github.com/biocore/micronota","homepage":null,"size":570,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":17,"forks":4,"open_issues":17,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/biocore/micronota/pulls/46"},"html":{"href":"https://github.com/biocore/micronota/pull/46"},"issue":{"href":"https://api.github.com/repos/biocore/micronota/issues/46"},"comments":{"href":"https://api.github.com/repos/biocore/micronota/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/biocore/micronota/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/biocore/micronota/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/biocore/micronota/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/biocore/micronota/statuses/100f7829ba8c25e0e6713f5cba8277bd846f07b7"}}}}