{"action":"opened","issue":{"url":"https://api.github.com/repos/pysam-developers/pysam/issues/93","labels_url":"https://api.github.com/repos/pysam-developers/pysam/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/pysam-developers/pysam/issues/93/comments","events_url":"https://api.github.com/repos/pysam-developers/pysam/issues/93/events","html_url":"https://github.com/pysam-developers/pysam/issues/93","id":64029641,"number":93,"title":"Pileup is wrong with spliced reads","user":{"login":"TyberiusPrime","id":1257580,"avatar_url":"https://avatars.githubusercontent.com/u/1257580?v=3","gravatar_id":"","url":"https://api.github.com/users/TyberiusPrime","html_url":"https://github.com/TyberiusPrime","followers_url":"https://api.github.com/users/TyberiusPrime/followers","following_url":"https://api.github.com/users/TyberiusPrime/following{/other_user}","gists_url":"https://api.github.com/users/TyberiusPrime/gists{/gist_id}","starred_url":"https://api.github.com/users/TyberiusPrime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TyberiusPrime/subscriptions","organizations_url":"https://api.github.com/users/TyberiusPrime/orgs","repos_url":"https://api.github.com/users/TyberiusPrime/repos","events_url":"https://api.github.com/users/TyberiusPrime/events{/privacy}","received_events_url":"https://api.github.com/users/TyberiusPrime/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-24T15:41:28Z","updated_at":"2015-03-24T15:41:28Z","closed_at":null,"body":"If you have  read spliced across a region, pileup will still happily report reference and query positions\r\neven for positions where the read actually has no aligned base.\r\n\r\nToy example: Should not output anything, outputs [(100, 2), (101, 2)...]\r\n\r\n\r\nimport pysam\r\n\r\nsam = pysam.AlignmentFile(\"shu.bam\", 'wb', reference_names = ['chr1'], reference_lengths=[100000])\r\nr = pysam.AlignedSegment()\r\nr.query_name = \"test1\"\r\nr.seq = \"ACCT\"\r\nr.qual = \"xxxx\"\r\nr.pos = 100\r\nr.cigartuples = [ (0,2), (3, 500), (0,2)]\r\nsam.write(r)\r\nsam.close()\r\npysam.index('shu.bam')\r\n\r\nsam = pysam.AlignmentFile('shu.bam')\r\nfor p in sam.pileup('chr1', 100, 200, truncate=True, stepper='nofilter'):\r\n    for read in p.pileups:\r\n        print 'reference pos', p.reference_pos, 'query pos', read.query_position\r\n"}}