{"action":"created","comment":{"url":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/comments/218381320","pull_request_review_id":156303778,"id":218381320,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODM4MTMyMA==","diff_hunk":"@@ -3,23 +3,33 @@\n \n import pysam\n \n-def getOverlapingReads(fileName, chrom, start, n=0):\n+def get_overlaping_reads(fileName, chrom, start, end, padding = 300):\n+\"\"\"\n+\n+Extracts all read names from a bam file, overlapping the specified region.\n+\n+Args:\n+\n+    fileName (string): name of bam file\n+    chrom (string): name of chromosome\n+    start (int): start of region\n+    end (int): end of region\n+    padding (int): optional padding of region. i.e. Reads in the vicinity vill also be detected\n+    depending on the padding parameter. \n+\n+Returns:\n+\n+    reads (list): List of read identifiers. \n     \n-    with pysam.AlignmentFile(fileName, 'rb') as file:\n+\"\"\"\n+    sam_file = pysam.AlignmentFile(fileName, 'rb')\n         \n-        reads = file.fetch(chrom, start - n, start + n)\n+    reads = sam_file.fetch(reference = chrom, \n+            start = start - padding, \n+            end = end + padding)\n     \n     return [read.query_name for read in reads]","path":"mutacc/utils/bam_parse.py","position":32,"original_position":32,"commit_id":"97a06ba84915c03e9ce97f676c91c2b720be8839","original_commit_id":"97a06ba84915c03e9ce97f676c91c2b720be8839","user":{"login":"moonso","id":405278,"node_id":"MDQ6VXNlcjQwNTI3OA==","avatar_url":"https://avatars1.githubusercontent.com/u/405278?v=4","gravatar_id":"","url":"https://api.github.com/users/moonso","html_url":"https://github.com/moonso","followers_url":"https://api.github.com/users/moonso/followers","following_url":"https://api.github.com/users/moonso/following{/other_user}","gists_url":"https://api.github.com/users/moonso/gists{/gist_id}","starred_url":"https://api.github.com/users/moonso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moonso/subscriptions","organizations_url":"https://api.github.com/users/moonso/orgs","repos_url":"https://api.github.com/users/moonso/repos","events_url":"https://api.github.com/users/moonso/events{/privacy}","received_events_url":"https://api.github.com/users/moonso/received_events","type":"User","site_admin":false},"body":"To make this function more light weigth you could make this as a generator with the yield statement like\r\n\r\n```python\r\nfor read in reads:\r\n    yield read.query_name\r\n```\r\n\r\nThan any function that calls this can iterate the result just like a list. If there are many reads expected this is a good solution","created_at":"2018-09-18T10:37:54Z","updated_at":"2018-09-18T10:44:58Z","html_url":"https://github.com/adrosenbaum/mutacc/pull/16#discussion_r218381320","pull_request_url":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/16","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/comments/218381320"},"html":{"href":"https://github.com/adrosenbaum/mutacc/pull/16#discussion_r218381320"},"pull_request":{"href":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/16","id":216246197,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2MjQ2MTk3","html_url":"https://github.com/adrosenbaum/mutacc/pull/16","diff_url":"https://github.com/adrosenbaum/mutacc/pull/16.diff","patch_url":"https://github.com/adrosenbaum/mutacc/pull/16.patch","issue_url":"https://api.github.com/repos/adrosenbaum/mutacc/issues/16","number":16,"state":"open","locked":false,"title":"GET READ NAME FROM BAM AND FIND READ IN FASTQ","user":{"login":"adrosenbaum","id":42931633,"node_id":"MDQ6VXNlcjQyOTMxNjMz","avatar_url":"https://avatars3.githubusercontent.com/u/42931633?v=4","gravatar_id":"","url":"https://api.github.com/users/adrosenbaum","html_url":"https://github.com/adrosenbaum","followers_url":"https://api.github.com/users/adrosenbaum/followers","following_url":"https://api.github.com/users/adrosenbaum/following{/other_user}","gists_url":"https://api.github.com/users/adrosenbaum/gists{/gist_id}","starred_url":"https://api.github.com/users/adrosenbaum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrosenbaum/subscriptions","organizations_url":"https://api.github.com/users/adrosenbaum/orgs","repos_url":"https://api.github.com/users/adrosenbaum/repos","events_url":"https://api.github.com/users/adrosenbaum/events{/privacy}","received_events_url":"https://api.github.com/users/adrosenbaum/received_events","type":"User","site_admin":false},"body":"mutacc/utils/bam_parse contains a simple function that get read names from bam\r\nfile. mutacc/utils/fastq_parse contains function to find list of record\r\nIDs and write only them to new fastq files.","created_at":"2018-09-18T09:47:19Z","updated_at":"2018-09-18T10:44:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c820beec73b48380b3622acf8c027d8e38e1c3c","assignee":null,"assignees":[],"requested_reviewers":[{"login":"henrikstranneheim","id":584738,"node_id":"MDQ6VXNlcjU4NDczOA==","avatar_url":"https://avatars0.githubusercontent.com/u/584738?v=4","gravatar_id":"","url":"https://api.github.com/users/henrikstranneheim","html_url":"https://github.com/henrikstranneheim","followers_url":"https://api.github.com/users/henrikstranneheim/followers","following_url":"https://api.github.com/users/henrikstranneheim/following{/other_user}","gists_url":"https://api.github.com/users/henrikstranneheim/gists{/gist_id}","starred_url":"https://api.github.com/users/henrikstranneheim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrikstranneheim/subscriptions","organizations_url":"https://api.github.com/users/henrikstranneheim/orgs","repos_url":"https://api.github.com/users/henrikstranneheim/repos","events_url":"https://api.github.com/users/henrikstranneheim/events{/privacy}","received_events_url":"https://api.github.com/users/henrikstranneheim/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/16/commits","review_comments_url":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/16/comments","review_comment_url":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/adrosenbaum/mutacc/issues/16/comments","statuses_url":"https://api.github.com/repos/adrosenbaum/mutacc/statuses/97a06ba84915c03e9ce97f676c91c2b720be8839","head":{"label":"adrosenbaum:bam_fastq_parse","ref":"bam_fastq_parse","sha":"97a06ba84915c03e9ce97f676c91c2b720be8839","user":{"login":"adrosenbaum","id":42931633,"node_id":"MDQ6VXNlcjQyOTMxNjMz","avatar_url":"https://avatars3.githubusercontent.com/u/42931633?v=4","gravatar_id":"","url":"https://api.github.com/users/adrosenbaum","html_url":"https://github.com/adrosenbaum","followers_url":"https://api.github.com/users/adrosenbaum/followers","following_url":"https://api.github.com/users/adrosenbaum/following{/other_user}","gists_url":"https://api.github.com/users/adrosenbaum/gists{/gist_id}","starred_url":"https://api.github.com/users/adrosenbaum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrosenbaum/subscriptions","organizations_url":"https://api.github.com/users/adrosenbaum/orgs","repos_url":"https://api.github.com/users/adrosenbaum/repos","events_url":"https://api.github.com/users/adrosenbaum/events{/privacy}","received_events_url":"https://api.github.com/users/adrosenbaum/received_events","type":"User","site_admin":false},"repo":{"id":147179531,"node_id":"MDEwOlJlcG9zaXRvcnkxNDcxNzk1MzE=","name":"mutacc","full_name":"adrosenbaum/mutacc","private":false,"owner":{"login":"adrosenbaum","id":42931633,"node_id":"MDQ6VXNlcjQyOTMxNjMz","avatar_url":"https://avatars3.githubusercontent.com/u/42931633?v=4","gravatar_id":"","url":"https://api.github.com/users/adrosenbaum","html_url":"https://github.com/adrosenbaum","followers_url":"https://api.github.com/users/adrosenbaum/followers","following_url":"https://api.github.com/users/adrosenbaum/following{/other_user}","gists_url":"https://api.github.com/users/adrosenbaum/gists{/gist_id}","starred_url":"https://api.github.com/users/adrosenbaum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrosenbaum/subscriptions","organizations_url":"https://api.github.com/users/adrosenbaum/orgs","repos_url":"https://api.github.com/users/adrosenbaum/repos","events_url":"https://api.github.com/users/adrosenbaum/events{/privacy}","received_events_url":"https://api.github.com/users/adrosenbaum/received_events","type":"User","site_admin":false},"html_url":"https://github.com/adrosenbaum/mutacc","description":null,"fork":false,"url":"https://api.github.com/repos/adrosenbaum/mutacc","forks_url":"https://api.github.com/repos/adrosenbaum/mutacc/forks","keys_url":"https://api.github.com/repos/adrosenbaum/mutacc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adrosenbaum/mutacc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adrosenbaum/mutacc/teams","hooks_url":"https://api.github.com/repos/adrosenbaum/mutacc/hooks","issue_events_url":"https://api.github.com/repos/adrosenbaum/mutacc/issues/events{/number}","events_url":"https://api.github.com/repos/adrosenbaum/mutacc/events","assignees_url":"https://api.github.com/repos/adrosenbaum/mutacc/assignees{/user}","branches_url":"https://api.github.com/repos/adrosenbaum/mutacc/branches{/branch}","tags_url":"https://api.github.com/repos/adrosenbaum/mutacc/tags","blobs_url":"https://api.github.com/repos/adrosenbaum/mutacc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adrosenbaum/mutacc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adrosenbaum/mutacc/git/refs{/sha}","trees_url":"https://api.github.com/repos/adrosenbaum/mutacc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adrosenbaum/mutacc/statuses/{sha}","languages_url":"https://api.github.com/repos/adrosenbaum/mutacc/languages","stargazers_url":"https://api.github.com/repos/adrosenbaum/mutacc/stargazers","contributors_url":"https://api.github.com/repos/adrosenbaum/mutacc/contributors","subscribers_url":"https://api.github.com/repos/adrosenbaum/mutacc/subscribers","subscription_url":"https://api.github.com/repos/adrosenbaum/mutacc/subscription","commits_url":"https://api.github.com/repos/adrosenbaum/mutacc/commits{/sha}","git_commits_url":"https://api.github.com/repos/adrosenbaum/mutacc/git/commits{/sha}","comments_url":"https://api.github.com/repos/adrosenbaum/mutacc/comments{/number}","issue_comment_url":"https://api.github.com/repos/adrosenbaum/mutacc/issues/comments{/number}","contents_url":"https://api.github.com/repos/adrosenbaum/mutacc/contents/{+path}","compare_url":"https://api.github.com/repos/adrosenbaum/mutacc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adrosenbaum/mutacc/merges","archive_url":"https://api.github.com/repos/adrosenbaum/mutacc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adrosenbaum/mutacc/downloads","issues_url":"https://api.github.com/repos/adrosenbaum/mutacc/issues{/number}","pulls_url":"https://api.github.com/repos/adrosenbaum/mutacc/pulls{/number}","milestones_url":"https://api.github.com/repos/adrosenbaum/mutacc/milestones{/number}","notifications_url":"https://api.github.com/repos/adrosenbaum/mutacc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adrosenbaum/mutacc/labels{/name}","releases_url":"https://api.github.com/repos/adrosenbaum/mutacc/releases{/id}","deployments_url":"https://api.github.com/repos/adrosenbaum/mutacc/deployments","created_at":"2018-09-03T09:07:31Z","updated_at":"2018-09-14T11:46:58Z","pushed_at":"2018-09-18T09:47:19Z","git_url":"git://github.com/adrosenbaum/mutacc.git","ssh_url":"git@github.com:adrosenbaum/mutacc.git","clone_url":"https://github.com/adrosenbaum/mutacc.git","svn_url":"https://github.com/adrosenbaum/mutacc","homepage":null,"size":50,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"adrosenbaum:master","ref":"master","sha":"d0f562eea3d98c2eb0b5c16100128b34494963d5","user":{"login":"adrosenbaum","id":42931633,"node_id":"MDQ6VXNlcjQyOTMxNjMz","avatar_url":"https://avatars3.githubusercontent.com/u/42931633?v=4","gravatar_id":"","url":"https://api.github.com/users/adrosenbaum","html_url":"https://github.com/adrosenbaum","followers_url":"https://api.github.com/users/adrosenbaum/followers","following_url":"https://api.github.com/users/adrosenbaum/following{/other_user}","gists_url":"https://api.github.com/users/adrosenbaum/gists{/gist_id}","starred_url":"https://api.github.com/users/adrosenbaum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrosenbaum/subscriptions","organizations_url":"https://api.github.com/users/adrosenbaum/orgs","repos_url":"https://api.github.com/users/adrosenbaum/repos","events_url":"https://api.github.com/users/adrosenbaum/events{/privacy}","received_events_url":"https://api.github.com/users/adrosenbaum/received_events","type":"User","site_admin":false},"repo":{"id":147179531,"node_id":"MDEwOlJlcG9zaXRvcnkxNDcxNzk1MzE=","name":"mutacc","full_name":"adrosenbaum/mutacc","private":false,"owner":{"login":"adrosenbaum","id":42931633,"node_id":"MDQ6VXNlcjQyOTMxNjMz","avatar_url":"https://avatars3.githubusercontent.com/u/42931633?v=4","gravatar_id":"","url":"https://api.github.com/users/adrosenbaum","html_url":"https://github.com/adrosenbaum","followers_url":"https://api.github.com/users/adrosenbaum/followers","following_url":"https://api.github.com/users/adrosenbaum/following{/other_user}","gists_url":"https://api.github.com/users/adrosenbaum/gists{/gist_id}","starred_url":"https://api.github.com/users/adrosenbaum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrosenbaum/subscriptions","organizations_url":"https://api.github.com/users/adrosenbaum/orgs","repos_url":"https://api.github.com/users/adrosenbaum/repos","events_url":"https://api.github.com/users/adrosenbaum/events{/privacy}","received_events_url":"https://api.github.com/users/adrosenbaum/received_events","type":"User","site_admin":false},"html_url":"https://github.com/adrosenbaum/mutacc","description":null,"fork":false,"url":"https://api.github.com/repos/adrosenbaum/mutacc","forks_url":"https://api.github.com/repos/adrosenbaum/mutacc/forks","keys_url":"https://api.github.com/repos/adrosenbaum/mutacc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adrosenbaum/mutacc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adrosenbaum/mutacc/teams","hooks_url":"https://api.github.com/repos/adrosenbaum/mutacc/hooks","issue_events_url":"https://api.github.com/repos/adrosenbaum/mutacc/issues/events{/number}","events_url":"https://api.github.com/repos/adrosenbaum/mutacc/events","assignees_url":"https://api.github.com/repos/adrosenbaum/mutacc/assignees{/user}","branches_url":"https://api.github.com/repos/adrosenbaum/mutacc/branches{/branch}","tags_url":"https://api.github.com/repos/adrosenbaum/mutacc/tags","blobs_url":"https://api.github.com/repos/adrosenbaum/mutacc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adrosenbaum/mutacc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adrosenbaum/mutacc/git/refs{/sha}","trees_url":"https://api.github.com/repos/adrosenbaum/mutacc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adrosenbaum/mutacc/statuses/{sha}","languages_url":"https://api.github.com/repos/adrosenbaum/mutacc/languages","stargazers_url":"https://api.github.com/repos/adrosenbaum/mutacc/stargazers","contributors_url":"https://api.github.com/repos/adrosenbaum/mutacc/contributors","subscribers_url":"https://api.github.com/repos/adrosenbaum/mutacc/subscribers","subscription_url":"https://api.github.com/repos/adrosenbaum/mutacc/subscription","commits_url":"https://api.github.com/repos/adrosenbaum/mutacc/commits{/sha}","git_commits_url":"https://api.github.com/repos/adrosenbaum/mutacc/git/commits{/sha}","comments_url":"https://api.github.com/repos/adrosenbaum/mutacc/comments{/number}","issue_comment_url":"https://api.github.com/repos/adrosenbaum/mutacc/issues/comments{/number}","contents_url":"https://api.github.com/repos/adrosenbaum/mutacc/contents/{+path}","compare_url":"https://api.github.com/repos/adrosenbaum/mutacc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adrosenbaum/mutacc/merges","archive_url":"https://api.github.com/repos/adrosenbaum/mutacc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adrosenbaum/mutacc/downloads","issues_url":"https://api.github.com/repos/adrosenbaum/mutacc/issues{/number}","pulls_url":"https://api.github.com/repos/adrosenbaum/mutacc/pulls{/number}","milestones_url":"https://api.github.com/repos/adrosenbaum/mutacc/milestones{/number}","notifications_url":"https://api.github.com/repos/adrosenbaum/mutacc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adrosenbaum/mutacc/labels{/name}","releases_url":"https://api.github.com/repos/adrosenbaum/mutacc/releases{/id}","deployments_url":"https://api.github.com/repos/adrosenbaum/mutacc/deployments","created_at":"2018-09-03T09:07:31Z","updated_at":"2018-09-14T11:46:58Z","pushed_at":"2018-09-18T09:47:19Z","git_url":"git://github.com/adrosenbaum/mutacc.git","ssh_url":"git@github.com:adrosenbaum/mutacc.git","clone_url":"https://github.com/adrosenbaum/mutacc.git","svn_url":"https://github.com/adrosenbaum/mutacc","homepage":null,"size":50,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/16"},"html":{"href":"https://github.com/adrosenbaum/mutacc/pull/16"},"issue":{"href":"https://api.github.com/repos/adrosenbaum/mutacc/issues/16"},"comments":{"href":"https://api.github.com/repos/adrosenbaum/mutacc/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/adrosenbaum/mutacc/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/adrosenbaum/mutacc/statuses/97a06ba84915c03e9ce97f676c91c2b720be8839"}},"author_association":"OWNER"}}
{"actor":{"display_login":"moonso"}}