{"action":"created","issue":{"url":"https://api.github.com/repos/samtools/htsjdk/issues/607","repository_url":"https://api.github.com/repos/samtools/htsjdk","labels_url":"https://api.github.com/repos/samtools/htsjdk/issues/607/labels{/name}","comments_url":"https://api.github.com/repos/samtools/htsjdk/issues/607/comments","events_url":"https://api.github.com/repos/samtools/htsjdk/issues/607/events","html_url":"https://github.com/samtools/htsjdk/pull/607","id":155308755,"number":607,"title":"Header SO:sorted instead of SO:coordinate","user":{"login":"lindenb","id":33838,"avatar_url":"https://avatars.githubusercontent.com/u/33838?v=3","gravatar_id":"","url":"https://api.github.com/users/lindenb","html_url":"https://github.com/lindenb","followers_url":"https://api.github.com/users/lindenb/followers","following_url":"https://api.github.com/users/lindenb/following{/other_user}","gists_url":"https://api.github.com/users/lindenb/gists{/gist_id}","starred_url":"https://api.github.com/users/lindenb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindenb/subscriptions","organizations_url":"https://api.github.com/users/lindenb/orgs","repos_url":"https://api.github.com/users/lindenb/repos","events_url":"https://api.github.com/users/lindenb/events{/privacy}","received_events_url":"https://api.github.com/users/lindenb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-05-17T16:51:28Z","updated_at":"2016-05-17T18:49:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/samtools/htsjdk/pulls/607","html_url":"https://github.com/samtools/htsjdk/pull/607","diff_url":"https://github.com/samtools/htsjdk/pull/607.diff","patch_url":"https://github.com/samtools/htsjdk/pull/607.patch"},"body":"### Description\r\n\r\nSome old BAMs contain a wrong SO field in the SAM header. e.g: http://hgdownload.cse.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeCaltechRnaSeq/wgEncodeCaltechRnaSeqGm12891R2x75Il200AlignsRep2V2.bam \r\n\r\nthis BAM use 'sorted' instead of 'coordinate'\r\n\r\n```\r\n$ curl -s \"http://hgdownload.cse.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeCaltechRnaSeq/wgEncodeCaltechRnaSeqGm12891R2x75Il200AlignsRep2V2.bam\"  | samtools view -H - | head\r\n@HD\tVN:1.0\tSO:sorted\r\n@SQ\tSN:chr1\tLN:249250621\r\n@SQ\tSN:chr10\tLN:135534747\r\n@SQ\tSN:chr11\tLN:135006516\r\n@SQ\tSN:chr12\tLN:133851895\r\n@SQ\tSN:chr13\tLN:115169878\r\n@SQ\tSN:chr14\tLN:107349540\r\n@SQ\tSN:chr15\tLN:102531392\r\n@SQ\tSN:chr16\tLN:90354753\r\n@SQ\tSN:chr17\tLN:81195210\r\n```\r\n\r\nI've modified SamFileHeader.getSortOrder(), if SO is \"sorted\" and the version is \"1.0\"  the SortOrder.coordinate is returned.\r\n\r\nThis PR also contains lbergelson 's  https://github.com/samtools/htsjdk/pull/606\r\n\r\n### Checklist\r\n\r\n- [x] Code compiles correctly\r\n- [x] New tests covering changes and new functionality\r\n- [x] All tests passing\r\n- [x] Extended the README / documentation, if necessary\r\n- [ ] Is not backward compatible (breaks binary or source compatibility)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/samtools/htsjdk/issues/comments/219816195","html_url":"https://github.com/samtools/htsjdk/pull/607#issuecomment-219816195","issue_url":"https://api.github.com/repos/samtools/htsjdk/issues/607","id":219816195,"user":{"login":"lindenb","id":33838,"avatar_url":"https://avatars.githubusercontent.com/u/33838?v=3","gravatar_id":"","url":"https://api.github.com/users/lindenb","html_url":"https://github.com/lindenb","followers_url":"https://api.github.com/users/lindenb/followers","following_url":"https://api.github.com/users/lindenb/following{/other_user}","gists_url":"https://api.github.com/users/lindenb/gists{/gist_id}","starred_url":"https://api.github.com/users/lindenb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindenb/subscriptions","organizations_url":"https://api.github.com/users/lindenb/orgs","repos_url":"https://api.github.com/users/lindenb/repos","events_url":"https://api.github.com/users/lindenb/events{/privacy}","received_events_url":"https://api.github.com/users/lindenb/received_events","type":"User","site_admin":false},"created_at":"2016-05-17T18:49:26Z","updated_at":"2016-05-17T18:49:26Z","body":"The oldest spec I found is https://sourceforge.net/p/samtools/code/849/tree/trunk/sam-spec/SAMv1.tex\r\nSadly, does it mean that we cannot use the Encode BAMs ? "}}