{"action":"created","comment":{"url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/comments/39337103","id":39337103,"diff_hunk":"@@ -0,0 +1,251 @@\n+import os\n+import shutil\n+import tempfile\n+import unittest\n+import json\n+\n+from pathfinderlib.main import main, get_config, Alignment, Assignment\n+\n+class PathfinderTest(unittest.TestCase):\n+    def setUp(self):\n+        self.config = get_config(None) # get user specific config\n+        self.output_dir = tempfile.mkdtemp()\n+        self.summary_fp = os.path.join(self.output_dir, \"summary.txt\")\n+\n+    def tearDown(self):\n+        shutil.rmtree(self.output_dir)\n+\n+    def run_pipeline(self, r1, r2, config_file):\n+\n+        args = [\n+            \"--forward-reads\", r1.name,\n+            \"--reverse-reads\", r2.name,\n+            \"--summary-file\", self.summary_fp,\n+            \"--output-dir\", self.output_dir,\n+            \"--config-file\", config_file.name\n+            ]\n+\n+        main(args)\n+\n+    def test_main_RAP_bestHit(self):\n+        #generate the correct config file\n+        self.config['mapping_method'] = 'best_hit'\n+        config_file = tempfile.NamedTemporaryFile(suffix=\".json\")\n+        json.dump(self.config, config_file)\n+        config_file.seek(0)\n+        \n+        # create the fake input file\n+        r1 = tempfile.NamedTemporaryFile(suffix=\".fastq\")\n+        r1.write(MOCK_R1)\n+        r1.seek(0)\n+        r2 = tempfile.NamedTemporaryFile(suffix=\".fastq\")\n+        r2.write(MOCK_R2)\n+        r2.seek(0)\n+\n+        # run the pipeline\n+        self.run_pipeline(r1, r2, config_file)\n+\n+        # check if the output is correct\n+        myoutput_fp = os.path.join(self.output_dir, os.path.basename(os.path.splitext(r1.name)[0]+'.ko'))\n+        observed = open(myoutput_fp).read()\n+        self.assertEqual(observed, EXPECTED_OUTPUT)\n+        \n+        # check if the summary file is correct\n+        with open(self.summary_fp) as f:\n+            observed = json.load(f)\n+        self.assertEqual(observed.get('data', {}), EXPECTED_SUMMARY)\n+\n+    def test_make_index_bestHit(self):\n+        # create the mock kegg file\n+        kegg = tempfile.NamedTemporaryFile()\n+        kegg.write(MOCK_KEGG)\n+        kegg.seek(0)\n+        \n+        # create temp directory for the index\n+        kegg2ko = tempfile.NamedTemporaryFile()\n+        self.config['kegg_fp'] = kegg.name\n+        self.config['kegg_to_ko_fp'] = kegg2ko.name\n+\n+        # make index\n+        assignerApp = Assignment(self.config)","path":"test/test_main.py","position":70,"original_position":70,"commit_id":"3cc1ee2e27cd8575027e66ad587396228f68a279","original_commit_id":"3cc1ee2e27cd8575027e66ad587396228f68a279","user":{"login":"kylebittinger","id":6689,"avatar_url":"https://avatars.githubusercontent.com/u/6689?v=3","gravatar_id":"","url":"https://api.github.com/users/kylebittinger","html_url":"https://github.com/kylebittinger","followers_url":"https://api.github.com/users/kylebittinger/followers","following_url":"https://api.github.com/users/kylebittinger/following{/other_user}","gists_url":"https://api.github.com/users/kylebittinger/gists{/gist_id}","starred_url":"https://api.github.com/users/kylebittinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kylebittinger/subscriptions","organizations_url":"https://api.github.com/users/kylebittinger/orgs","repos_url":"https://api.github.com/users/kylebittinger/repos","events_url":"https://api.github.com/users/kylebittinger/events{/privacy}","received_events_url":"https://api.github.com/users/kylebittinger/received_events","type":"User","site_admin":false},"body":"Assigner or AssignmentMethod would be a better name for the class","created_at":"2015-09-12T12:57:19Z","updated_at":"2015-09-12T12:57:19Z","html_url":"https://github.com/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pull/4#discussion_r39337103","pull_request_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/comments/39337103"},"html":{"href":"https://github.com/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pull/4#discussion_r39337103"},"pull_request":{"href":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/4","id":44480910,"html_url":"https://github.com/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pull/4","diff_url":"https://github.com/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pull/4.diff","patch_url":"https://github.com/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pull/4.patch","issue_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/issues/4","number":4,"state":"open","locked":false,"title":"Test script","user":{"login":"ctanes","id":1043292,"avatar_url":"https://avatars.githubusercontent.com/u/1043292?v=3","gravatar_id":"","url":"https://api.github.com/users/ctanes","html_url":"https://github.com/ctanes","followers_url":"https://api.github.com/users/ctanes/followers","following_url":"https://api.github.com/users/ctanes/following{/other_user}","gists_url":"https://api.github.com/users/ctanes/gists{/gist_id}","starred_url":"https://api.github.com/users/ctanes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctanes/subscriptions","organizations_url":"https://api.github.com/users/ctanes/orgs","repos_url":"https://api.github.com/users/ctanes/repos","events_url":"https://api.github.com/users/ctanes/events{/privacy}","received_events_url":"https://api.github.com/users/ctanes/received_events","type":"User","site_admin":false},"body":"Please do not merge yet..\r\nI would appreciate some feedback regarding general organization.\r\nI also have a few questions regarding tests:\r\n1) This pipeline has multiple selections / combinations on methods such as Rapsearch or blast and best_hit or humann (although humann is not yet implemented). Should I test for each combination?\r\n2) I am only testing for the final result and not intermediate steps for the best_hit approach, mostly because I have made the intermediate steps private. Is testing for those intermediate functions necessary?","created_at":"2015-09-08T20:47:06Z","updated_at":"2015-09-12T12:57:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac35e7fd8a4c746bd1eac54238b52c68eedb3143","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/4/commits","review_comments_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/4/comments","review_comment_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/issues/4/comments","statuses_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/statuses/3cc1ee2e27cd8575027e66ad587396228f68a279","head":{"label":"ctanes:master","ref":"master","sha":"3cc1ee2e27cd8575027e66ad587396228f68a279","user":{"login":"ctanes","id":1043292,"avatar_url":"https://avatars.githubusercontent.com/u/1043292?v=3","gravatar_id":"","url":"https://api.github.com/users/ctanes","html_url":"https://github.com/ctanes","followers_url":"https://api.github.com/users/ctanes/followers","following_url":"https://api.github.com/users/ctanes/following{/other_user}","gists_url":"https://api.github.com/users/ctanes/gists{/gist_id}","starred_url":"https://api.github.com/users/ctanes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctanes/subscriptions","organizations_url":"https://api.github.com/users/ctanes/orgs","repos_url":"https://api.github.com/users/ctanes/repos","events_url":"https://api.github.com/users/ctanes/events{/privacy}","received_events_url":"https://api.github.com/users/ctanes/received_events","type":"User","site_admin":false},"repo":{"id":41505244,"name":"PathwayAbundanceFinder","full_name":"ctanes/PathwayAbundanceFinder","owner":{"login":"ctanes","id":1043292,"avatar_url":"https://avatars.githubusercontent.com/u/1043292?v=3","gravatar_id":"","url":"https://api.github.com/users/ctanes","html_url":"https://github.com/ctanes","followers_url":"https://api.github.com/users/ctanes/followers","following_url":"https://api.github.com/users/ctanes/following{/other_user}","gists_url":"https://api.github.com/users/ctanes/gists{/gist_id}","starred_url":"https://api.github.com/users/ctanes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctanes/subscriptions","organizations_url":"https://api.github.com/users/ctanes/orgs","repos_url":"https://api.github.com/users/ctanes/repos","events_url":"https://api.github.com/users/ctanes/events{/privacy}","received_events_url":"https://api.github.com/users/ctanes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ctanes/PathwayAbundanceFinder","description":"A short wrapper for finding presence/absence/abundance of pathways from metagenomic data.","fork":true,"url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder","forks_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/forks","keys_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/teams","hooks_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/hooks","issue_events_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/issues/events{/number}","events_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/events","assignees_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/assignees{/user}","branches_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/branches{/branch}","tags_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/tags","blobs_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/git/refs{/sha}","trees_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/statuses/{sha}","languages_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/languages","stargazers_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/stargazers","contributors_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/contributors","subscribers_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/subscribers","subscription_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/subscription","commits_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/commits{/sha}","git_commits_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/git/commits{/sha}","comments_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/comments{/number}","issue_comment_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/issues/comments{/number}","contents_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/contents/{+path}","compare_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/merges","archive_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/downloads","issues_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/issues{/number}","pulls_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/pulls{/number}","milestones_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/milestones{/number}","notifications_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/labels{/name}","releases_url":"https://api.github.com/repos/ctanes/PathwayAbundanceFinder/releases{/id}","created_at":"2015-08-27T18:53:05Z","updated_at":"2015-08-27T18:53:05Z","pushed_at":"2015-09-08T20:39:30Z","git_url":"git://github.com/ctanes/PathwayAbundanceFinder.git","ssh_url":"git@github.com:ctanes/PathwayAbundanceFinder.git","clone_url":"https://github.com/ctanes/PathwayAbundanceFinder.git","svn_url":"https://github.com/ctanes/PathwayAbundanceFinder","homepage":"","size":115,"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":"PennChopMicrobiomeProgram:master","ref":"master","sha":"81086b1b34257e0f03496a24f089c9a2c2a05eea","user":{"login":"PennChopMicrobiomeProgram","id":12732995,"avatar_url":"https://avatars.githubusercontent.com/u/12732995?v=3","gravatar_id":"","url":"https://api.github.com/users/PennChopMicrobiomeProgram","html_url":"https://github.com/PennChopMicrobiomeProgram","followers_url":"https://api.github.com/users/PennChopMicrobiomeProgram/followers","following_url":"https://api.github.com/users/PennChopMicrobiomeProgram/following{/other_user}","gists_url":"https://api.github.com/users/PennChopMicrobiomeProgram/gists{/gist_id}","starred_url":"https://api.github.com/users/PennChopMicrobiomeProgram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PennChopMicrobiomeProgram/subscriptions","organizations_url":"https://api.github.com/users/PennChopMicrobiomeProgram/orgs","repos_url":"https://api.github.com/users/PennChopMicrobiomeProgram/repos","events_url":"https://api.github.com/users/PennChopMicrobiomeProgram/events{/privacy}","received_events_url":"https://api.github.com/users/PennChopMicrobiomeProgram/received_events","type":"Organization","site_admin":false},"repo":{"id":37483222,"name":"PathwayAbundanceFinder","full_name":"PennChopMicrobiomeProgram/PathwayAbundanceFinder","owner":{"login":"PennChopMicrobiomeProgram","id":12732995,"avatar_url":"https://avatars.githubusercontent.com/u/12732995?v=3","gravatar_id":"","url":"https://api.github.com/users/PennChopMicrobiomeProgram","html_url":"https://github.com/PennChopMicrobiomeProgram","followers_url":"https://api.github.com/users/PennChopMicrobiomeProgram/followers","following_url":"https://api.github.com/users/PennChopMicrobiomeProgram/following{/other_user}","gists_url":"https://api.github.com/users/PennChopMicrobiomeProgram/gists{/gist_id}","starred_url":"https://api.github.com/users/PennChopMicrobiomeProgram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PennChopMicrobiomeProgram/subscriptions","organizations_url":"https://api.github.com/users/PennChopMicrobiomeProgram/orgs","repos_url":"https://api.github.com/users/PennChopMicrobiomeProgram/repos","events_url":"https://api.github.com/users/PennChopMicrobiomeProgram/events{/privacy}","received_events_url":"https://api.github.com/users/PennChopMicrobiomeProgram/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PennChopMicrobiomeProgram/PathwayAbundanceFinder","description":"A short wrapper for finding presence/absence/abundance of pathways from metagenomic data.","fork":false,"url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder","forks_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/forks","keys_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/teams","hooks_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/hooks","issue_events_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/issues/events{/number}","events_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/events","assignees_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/assignees{/user}","branches_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/branches{/branch}","tags_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/tags","blobs_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/git/refs{/sha}","trees_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/statuses/{sha}","languages_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/languages","stargazers_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/stargazers","contributors_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/contributors","subscribers_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/subscribers","subscription_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/subscription","commits_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/commits{/sha}","git_commits_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/git/commits{/sha}","comments_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/comments{/number}","issue_comment_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/issues/comments{/number}","contents_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/contents/{+path}","compare_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/merges","archive_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/downloads","issues_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/issues{/number}","pulls_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls{/number}","milestones_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/milestones{/number}","notifications_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/labels{/name}","releases_url":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/releases{/id}","created_at":"2015-06-15T18:25:59Z","updated_at":"2015-06-24T19:00:50Z","pushed_at":"2015-09-08T20:47:06Z","git_url":"git://github.com/PennChopMicrobiomeProgram/PathwayAbundanceFinder.git","ssh_url":"git@github.com:PennChopMicrobiomeProgram/PathwayAbundanceFinder.git","clone_url":"https://github.com/PennChopMicrobiomeProgram/PathwayAbundanceFinder.git","svn_url":"https://github.com/PennChopMicrobiomeProgram/PathwayAbundanceFinder","homepage":"","size":211,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/4"},"html":{"href":"https://github.com/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pull/4"},"issue":{"href":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/issues/4"},"comments":{"href":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/PennChopMicrobiomeProgram/PathwayAbundanceFinder/statuses/3cc1ee2e27cd8575027e66ad587396228f68a279"}}}}