{"action":"created","comment":{"url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/comments/78124967","id":78124967,"diff_hunk":"@@ -201,12 +202,21 @@ def process_sample(job, config, input_tar=None, input_r1=None, input_r2=None, gz\n     for root, subdir, files in os.walk(work_dir):\n         fastqs.extend([os.path.join(root, x) for x in files])\n     if config.paired:\n-        r1 = sorted([x for x in fastqs if 'R1' in x])\n-        r2 = sorted([x for x in fastqs if 'R2' in x])\n-        if not r1 or not r2:\n-            r1 = sorted([x for x in fastqs if '_1' in x])\n-            r2 = sorted([x for x in fastqs if '_2' in x])\n-        require(len(r1) == len(r2), 'Check fastq naming, uneven number of pairs found: r1: {}, r2: {}'.format(r1, r2))\n+        r1, r2 = [], []\n+        # Pattern convention: Look for R1/R2 or _1/_2 at the end of files named .fastq.gz, .fastq, .fq.gz, or .fq\n+        pattern = re.compile('(?:^|[._-])R?([12])(\\\\.fastq(\\\\.gz)?|\\\\.fq(\\\\.gz)?)$')\n+        for fastq in sorted(fastqs):\n+            match = pattern.search(os.path.basename(fastq))\n+            if not match:\n+                raise UserError('FASTQ file name fails to meet required convention for paired reads '\n+                                '(see documentation). ' + fastq)\n+            elif match.group(1) == '1':\n+                r1.append(fastq)\n+            elif match.group(1) == '2':\n+                r2.append(fastq)\n+            else:\n+                assert False","path":"src/toil_scripts/rnaseq_cgl/rnaseq_cgl_pipeline.py","position":31,"original_position":31,"commit_id":"8762fcd4654eb660a50374d47f27895e20fc2eff","original_commit_id":"8762fcd4654eb660a50374d47f27895e20fc2eff","user":{"login":"fnothaft","id":3752466,"avatar_url":"https://avatars.githubusercontent.com/u/3752466?v=3","gravatar_id":"","url":"https://api.github.com/users/fnothaft","html_url":"https://github.com/fnothaft","followers_url":"https://api.github.com/users/fnothaft/followers","following_url":"https://api.github.com/users/fnothaft/following{/other_user}","gists_url":"https://api.github.com/users/fnothaft/gists{/gist_id}","starred_url":"https://api.github.com/users/fnothaft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fnothaft/subscriptions","organizations_url":"https://api.github.com/users/fnothaft/orgs","repos_url":"https://api.github.com/users/fnothaft/repos","events_url":"https://api.github.com/users/fnothaft/events{/privacy}","received_events_url":"https://api.github.com/users/fnothaft/received_events","type":"User","site_admin":false},"body":"I think it is correct to assert here (vs. `require`), but I'd give a meaningful error message.","created_at":"2016-09-09T03:41:18Z","updated_at":"2016-09-09T03:41:18Z","html_url":"https://github.com/BD2KGenomics/toil-scripts/pull/439#discussion_r78124967","pull_request_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/439","_links":{"self":{"href":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/comments/78124967"},"html":{"href":"https://github.com/BD2KGenomics/toil-scripts/pull/439#discussion_r78124967"},"pull_request":{"href":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/439"}}},"pull_request":{"url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/439","id":84415309,"html_url":"https://github.com/BD2KGenomics/toil-scripts/pull/439","diff_url":"https://github.com/BD2KGenomics/toil-scripts/pull/439.diff","patch_url":"https://github.com/BD2KGenomics/toil-scripts/pull/439.patch","issue_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/issues/439","number":439,"state":"open","locked":false,"title":"Improve mate pair heuristic (resolves #436)","user":{"login":"jvivian","id":7576256,"avatar_url":"https://avatars.githubusercontent.com/u/7576256?v=3","gravatar_id":"","url":"https://api.github.com/users/jvivian","html_url":"https://github.com/jvivian","followers_url":"https://api.github.com/users/jvivian/followers","following_url":"https://api.github.com/users/jvivian/following{/other_user}","gists_url":"https://api.github.com/users/jvivian/gists{/gist_id}","starred_url":"https://api.github.com/users/jvivian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvivian/subscriptions","organizations_url":"https://api.github.com/users/jvivian/orgs","repos_url":"https://api.github.com/users/jvivian/repos","events_url":"https://api.github.com/users/jvivian/events{/privacy}","received_events_url":"https://api.github.com/users/jvivian/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-08T05:05:16Z","updated_at":"2016-09-09T03:41:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5c615478ae4a350a473a1555d2f3d38f393946d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/439/commits","review_comments_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/439/comments","review_comment_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/issues/439/comments","statuses_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/statuses/8762fcd4654eb660a50374d47f27895e20fc2eff","head":{"label":"BD2KGenomics:issues/436-improve-mate-pair-heuristic","ref":"issues/436-improve-mate-pair-heuristic","sha":"8762fcd4654eb660a50374d47f27895e20fc2eff","user":{"login":"BD2KGenomics","id":8701293,"avatar_url":"https://avatars.githubusercontent.com/u/8701293?v=3","gravatar_id":"","url":"https://api.github.com/users/BD2KGenomics","html_url":"https://github.com/BD2KGenomics","followers_url":"https://api.github.com/users/BD2KGenomics/followers","following_url":"https://api.github.com/users/BD2KGenomics/following{/other_user}","gists_url":"https://api.github.com/users/BD2KGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/BD2KGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BD2KGenomics/subscriptions","organizations_url":"https://api.github.com/users/BD2KGenomics/orgs","repos_url":"https://api.github.com/users/BD2KGenomics/repos","events_url":"https://api.github.com/users/BD2KGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/BD2KGenomics/received_events","type":"Organization","site_admin":false},"repo":{"id":39923176,"name":"toil-scripts","full_name":"BD2KGenomics/toil-scripts","owner":{"login":"BD2KGenomics","id":8701293,"avatar_url":"https://avatars.githubusercontent.com/u/8701293?v=3","gravatar_id":"","url":"https://api.github.com/users/BD2KGenomics","html_url":"https://github.com/BD2KGenomics","followers_url":"https://api.github.com/users/BD2KGenomics/followers","following_url":"https://api.github.com/users/BD2KGenomics/following{/other_user}","gists_url":"https://api.github.com/users/BD2KGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/BD2KGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BD2KGenomics/subscriptions","organizations_url":"https://api.github.com/users/BD2KGenomics/orgs","repos_url":"https://api.github.com/users/BD2KGenomics/repos","events_url":"https://api.github.com/users/BD2KGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/BD2KGenomics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BD2KGenomics/toil-scripts","description":"Toil workflows for common genomic pipelines","fork":false,"url":"https://api.github.com/repos/BD2KGenomics/toil-scripts","forks_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/forks","keys_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/teams","hooks_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/hooks","issue_events_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/events","assignees_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/tags","blobs_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/languages","stargazers_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/stargazers","contributors_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/contributors","subscribers_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/subscribers","subscription_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/subscription","commits_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/merges","archive_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/downloads","issues_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/labels{/name}","releases_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/releases{/id}","deployments_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/deployments","created_at":"2015-07-30T00:42:23Z","updated_at":"2016-09-06T18:52:00Z","pushed_at":"2016-09-09T00:14:53Z","git_url":"git://github.com/BD2KGenomics/toil-scripts.git","ssh_url":"git@github.com:BD2KGenomics/toil-scripts.git","clone_url":"https://github.com/BD2KGenomics/toil-scripts.git","svn_url":"https://github.com/BD2KGenomics/toil-scripts","homepage":"","size":1193,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":69,"forks":13,"open_issues":69,"watchers":17,"default_branch":"master"}},"base":{"label":"BD2KGenomics:master","ref":"master","sha":"849a7607c3cd0e0dabf121da4b9e9dcd449835c8","user":{"login":"BD2KGenomics","id":8701293,"avatar_url":"https://avatars.githubusercontent.com/u/8701293?v=3","gravatar_id":"","url":"https://api.github.com/users/BD2KGenomics","html_url":"https://github.com/BD2KGenomics","followers_url":"https://api.github.com/users/BD2KGenomics/followers","following_url":"https://api.github.com/users/BD2KGenomics/following{/other_user}","gists_url":"https://api.github.com/users/BD2KGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/BD2KGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BD2KGenomics/subscriptions","organizations_url":"https://api.github.com/users/BD2KGenomics/orgs","repos_url":"https://api.github.com/users/BD2KGenomics/repos","events_url":"https://api.github.com/users/BD2KGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/BD2KGenomics/received_events","type":"Organization","site_admin":false},"repo":{"id":39923176,"name":"toil-scripts","full_name":"BD2KGenomics/toil-scripts","owner":{"login":"BD2KGenomics","id":8701293,"avatar_url":"https://avatars.githubusercontent.com/u/8701293?v=3","gravatar_id":"","url":"https://api.github.com/users/BD2KGenomics","html_url":"https://github.com/BD2KGenomics","followers_url":"https://api.github.com/users/BD2KGenomics/followers","following_url":"https://api.github.com/users/BD2KGenomics/following{/other_user}","gists_url":"https://api.github.com/users/BD2KGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/BD2KGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BD2KGenomics/subscriptions","organizations_url":"https://api.github.com/users/BD2KGenomics/orgs","repos_url":"https://api.github.com/users/BD2KGenomics/repos","events_url":"https://api.github.com/users/BD2KGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/BD2KGenomics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BD2KGenomics/toil-scripts","description":"Toil workflows for common genomic pipelines","fork":false,"url":"https://api.github.com/repos/BD2KGenomics/toil-scripts","forks_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/forks","keys_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/teams","hooks_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/hooks","issue_events_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/events","assignees_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/tags","blobs_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/languages","stargazers_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/stargazers","contributors_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/contributors","subscribers_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/subscribers","subscription_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/subscription","commits_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/merges","archive_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/downloads","issues_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/labels{/name}","releases_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/releases{/id}","deployments_url":"https://api.github.com/repos/BD2KGenomics/toil-scripts/deployments","created_at":"2015-07-30T00:42:23Z","updated_at":"2016-09-06T18:52:00Z","pushed_at":"2016-09-09T00:14:53Z","git_url":"git://github.com/BD2KGenomics/toil-scripts.git","ssh_url":"git@github.com:BD2KGenomics/toil-scripts.git","clone_url":"https://github.com/BD2KGenomics/toil-scripts.git","svn_url":"https://github.com/BD2KGenomics/toil-scripts","homepage":"","size":1193,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":69,"forks":13,"open_issues":69,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/439"},"html":{"href":"https://github.com/BD2KGenomics/toil-scripts/pull/439"},"issue":{"href":"https://api.github.com/repos/BD2KGenomics/toil-scripts/issues/439"},"comments":{"href":"https://api.github.com/repos/BD2KGenomics/toil-scripts/issues/439/comments"},"review_comments":{"href":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/439/comments"},"review_comment":{"href":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BD2KGenomics/toil-scripts/pulls/439/commits"},"statuses":{"href":"https://api.github.com/repos/BD2KGenomics/toil-scripts/statuses/8762fcd4654eb660a50374d47f27895e20fc2eff"}}}}
{"actor":{"display_login":"fnothaft"}}