{"action":"closed","issue":{"url":"https://api.github.com/repos/samtools/htsjdk/issues/349","labels_url":"https://api.github.com/repos/samtools/htsjdk/issues/349/labels{/name}","comments_url":"https://api.github.com/repos/samtools/htsjdk/issues/349/comments","events_url":"https://api.github.com/repos/samtools/htsjdk/issues/349/events","html_url":"https://github.com/samtools/htsjdk/issues/349","id":111176611,"number":349,"title":"CRAIEntry overflow","user":{"login":"superbobry","id":185856,"avatar_url":"https://avatars.githubusercontent.com/u/185856?v=3","gravatar_id":"","url":"https://api.github.com/users/superbobry","html_url":"https://github.com/superbobry","followers_url":"https://api.github.com/users/superbobry/followers","following_url":"https://api.github.com/users/superbobry/following{/other_user}","gists_url":"https://api.github.com/users/superbobry/gists{/gist_id}","starred_url":"https://api.github.com/users/superbobry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superbobry/subscriptions","organizations_url":"https://api.github.com/users/superbobry/orgs","repos_url":"https://api.github.com/users/superbobry/repos","events_url":"https://api.github.com/users/superbobry/events{/privacy}","received_events_url":"https://api.github.com/users/superbobry/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-13T13:12:00Z","updated_at":"2015-10-13T15:57:47Z","closed_at":"2015-10-13T15:57:47Z","body":"I have a 25G CRAM file indexed by [`cramtools`](https://github.com/enasequence/cramtools). Reading it with `htsjdk` leads to an exception in `CRAIEntry`:\r\n\r\n```java\r\nException in thread \"main\" htsjdk.samtools.cram.CRAIIndex$CRAIIndexException: java.lang.NumberFormatException: For input string: \"2147560457\"\r\n\tat htsjdk.samtools.cram.CRAIEntry.fromCraiLine(CRAIEntry.java:60)\r\n\tat htsjdk.samtools.cram.CRAIIndex.readIndex(CRAIIndex.java:43)\r\n\tat htsjdk.samtools.cram.CRAIIndex.openCraiFileAsBaiStream(CRAIIndex.java:128)\r\n\tat htsjdk.samtools.CRAMFileReader.<init>(CRAMFileReader.java:138)\r\n\tat htsjdk.samtools.CRAMFileReader.<init>(CRAMFileReader.java:147)\r\n\tat htsjdk.samtools.CRAMFileReader.<init>(CRAMFileReader.java:153)\r\n\tat htsjdk.samtools.SamReaderFactory$SamReaderFactoryImpl.open(SamReaderFactory.java:270)\r\n\tat htsjdk.samtools.SamReaderFactory$SamReaderFactoryImpl.open(SamReaderFactory.java:133)\r\n```\r\n\r\nThe exception is caused by the container start byte offset being too large to fit into a signed int. Section \"12 Indexing\" of the CRAM [spec](http://samtools.github.io/hts-specs/CRAMv3.pdf) doesn't mention any restrictions on this field.\r\n\r\nHere's a relevant chunk of the CRAI index:\r\n```\r\n1       102792674       29413   2147560457      1001    261258\r\n1       102821988       22969   2147822745      782     254201\r\n1       102844858       22856   2148077757      743     262815\r\n1       102867614       20780   2148341344      965     251332\r\n1       102888289       20388   2148593670      960     257108\r\n```"}}