{"action":"created","issue":{"url":"https://api.github.com/repos/enasequence/cramtools/issues/17","labels_url":"https://api.github.com/repos/enasequence/cramtools/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/enasequence/cramtools/issues/17/comments","events_url":"https://api.github.com/repos/enasequence/cramtools/issues/17/events","html_url":"https://github.com/enasequence/cramtools/issues/17","id":55598514,"number":17,"title":"Exception running ValidateCramFile","user":{"login":"hreuver","id":10669181,"avatar_url":"https://avatars.githubusercontent.com/u/10669181?v=3","gravatar_id":"","url":"https://api.github.com/users/hreuver","html_url":"https://github.com/hreuver","followers_url":"https://api.github.com/users/hreuver/followers","following_url":"https://api.github.com/users/hreuver/following{/other_user}","gists_url":"https://api.github.com/users/hreuver/gists{/gist_id}","starred_url":"https://api.github.com/users/hreuver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hreuver/subscriptions","organizations_url":"https://api.github.com/users/hreuver/orgs","repos_url":"https://api.github.com/users/hreuver/repos","events_url":"https://api.github.com/users/hreuver/events{/privacy}","received_events_url":"https://api.github.com/users/hreuver/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-27T10:11:55Z","updated_at":"2015-01-29T10:04:21Z","closed_at":null,"body":"Best,\r\n\r\nWe would like to use CRAMtools to archive large amounts of BAM files. We want to make sure the proces of cramming went without problems and therefor we run ValidateCramFile afterward. \r\n\r\nYesterday I crammed about 400 BAM files. For all files I ran ValidateCramFile like this:\r\n\r\njava -cp /share/apps/cramtools-2.1.jar net.sf.cram.ValidateCramFile -I /scratch/DNAXXXXX.cram -R /data/references/GrCh37/GrCh37_reference.fa\r\n\r\nFor all 400 samples I run into the following exception:\r\n\r\nException in thread \"main\" net.sf.samtools.SAMException: Exception counting mismatches for read 4923571 1/2 100b aligned read.\r\n        at net.sf.samtools.util.SequenceUtil.countMismatches(SequenceUtil.java:296)\r\n        at net.sf.samtools.util.SequenceUtil.calculateSamNmTag(SequenceUtil.java:481)\r\n        at net.sf.picard.sam.SamFileValidator.validateNmTag(SamFileValidator.java:461)\r\n        at net.sf.picard.sam.SamFileValidator.validateSamRecords(SamFileValidator.java:296)\r\n        at net.sf.cram.ValidateCramFile.main(ValidateCramFile.java:116)\r\nCaused by: java.lang.ArrayIndexOutOfBoundsException: 142535434\r\n        at net.sf.samtools.util.SequenceUtil.countMismatches(SequenceUtil.java:282)\r\n        ... 4 more\r\n\r\nDoes someone know what goes wrong and what I can do to fix this?\r\n\r\nMany thanks,\r\n\r\nRick"},"comment":{"url":"https://api.github.com/repos/enasequence/cramtools/issues/comments/71998671","html_url":"https://github.com/enasequence/cramtools/issues/17#issuecomment-71998671","issue_url":"https://api.github.com/repos/enasequence/cramtools/issues/17","id":71998671,"user":{"login":"hreuver","id":10669181,"avatar_url":"https://avatars.githubusercontent.com/u/10669181?v=3","gravatar_id":"","url":"https://api.github.com/users/hreuver","html_url":"https://github.com/hreuver","followers_url":"https://api.github.com/users/hreuver/followers","following_url":"https://api.github.com/users/hreuver/following{/other_user}","gists_url":"https://api.github.com/users/hreuver/gists{/gist_id}","starred_url":"https://api.github.com/users/hreuver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hreuver/subscriptions","organizations_url":"https://api.github.com/users/hreuver/orgs","repos_url":"https://api.github.com/users/hreuver/repos","events_url":"https://api.github.com/users/hreuver/events{/privacy}","received_events_url":"https://api.github.com/users/hreuver/received_events","type":"User","site_admin":false},"created_at":"2015-01-29T10:04:21Z","updated_at":"2015-01-29T10:04:21Z","body":"Hi Vadim,\r\n\r\nConverting from CRAM to BAM seems to go Ok: no exceptions or error messages. I didn't recall the variants and compared them with our previous calls though. Since we are planning to archive thousands of BAM files a year, we would like to be as sure as possible no problems occured during conversion from BAM to CRAM. I really would like to have some kind of validation.\r\n\r\nWhen I look at the header of a BAM and CRAM file all chromosome lengths match with the chromosome lengths of our reference genome (hg19 + contigs). it seems therefor unlikely that reads are mapped outside the reference genome, but I could be wrong. \r\n\r\nIs there a wat to extract a read from a CRAM file based on an index (4923571 in this case) to see where it is mapped. Is there an easy way to check wether reads are mapped outside the reference genome?\r\n\r\nMany thanks,\r\n\r\nRick\r\n"}}