{"action":"opened","issue":{"url":"https://api.github.com/repos/smithlabcode/methpipe/issues/71","labels_url":"https://api.github.com/repos/smithlabcode/methpipe/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/smithlabcode/methpipe/issues/71/comments","events_url":"https://api.github.com/repos/smithlabcode/methpipe/issues/71/events","html_url":"https://github.com/smithlabcode/methpipe/issues/71","id":95867678,"number":71,"title":"to-mr output sort-order can differ from sorted input BAM order and from that required by duplicate-remover","user":{"login":"cviner","id":10501947,"avatar_url":"https://avatars.githubusercontent.com/u/10501947?v=3","gravatar_id":"","url":"https://api.github.com/users/cviner","html_url":"https://github.com/cviner","followers_url":"https://api.github.com/users/cviner/followers","following_url":"https://api.github.com/users/cviner/following{/other_user}","gists_url":"https://api.github.com/users/cviner/gists{/gist_id}","starred_url":"https://api.github.com/users/cviner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cviner/subscriptions","organizations_url":"https://api.github.com/users/cviner/orgs","repos_url":"https://api.github.com/users/cviner/repos","events_url":"https://api.github.com/users/cviner/events{/privacy}","received_events_url":"https://api.github.com/users/cviner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-18T23:22:46Z","updated_at":"2015-07-18T23:22:46Z","closed_at":null,"body":"```to-mr``` outputs data in a sort-order distinct from that required by ```duplicate-remover```, even when provided with a position-sorted BAM file as input. This prevents one from taking advantage of sorted input files, since it becomes necessary to always sort ```to-mr``` output, prior to input into ```duplicate-remover``` (per the instructions provided in Section 2.2 of the MethPipe manual).\r\n\r\nI provide below an example of this problem (only pertinent columns are shown, i.e. columns 1–3, 6 of ```to-mr``` output and 2–4, 9 of the BAM file, as formatted tables):\r\n\r\n```bash\r\nsamtools view input.sorted.bam | fgrep -m 1 -C 2 3000596\r\n```\r\n\r\nFLAG\t|\tRNAME\t|\tPOS\t|\tTLEN\r\n------|------------------|-------------------|--------------\r\n163\t|\tchr10\t|\t3000512\t|\t169\r\n83\t|\tchr10\t|\t3000581\t|\t-169\r\n99\t|\tchr10\t|\t**3000596**\t|\t289\r\n163\t|\tchr10\t|\t*3000623*\t|\t122\r\n83\t|\tchr10\t|\t3000645\t|\t-122\r\n\r\n```bash\r\nto-mr -o /dev/stdout -m 'bismark' input.sorted.bam | fgrep -m 1 -C 2 '3000595'\r\n```\r\n\r\nChrom.\t|\tStart\t\t|\tEnd\t|\tStrand\r\n------|------------------|-------------------|--------------\r\nchr10\t|\t3000511\t|\t3000680\t|\t-\r\nchr10\t|\t*3000622*\t|\t3000744\t|\t-\r\nchr10\t|\t**3000595**\t|\t3000884\t|\t+\r\nchr10\t|\t3000793\t|\t3000956\t|\t+\r\nchr10\t|\t3000860\t|\t3001074\t|\t-\r\n\r\n```bash\r\nto-mr -o /dev/stdout -m 'bismark' input.sorted.bam | fgrep -m 1 -C 2 '3000595' | \\\r\nduplicate-remover -stdin -o /dev/stdout\r\n```\r\n\r\nChrom.\t|\tStart\t\t|\tEnd\t|\tStrand\r\n------|------------------|-------------------|--------------\r\nchr10\t|\t3000511\t|\t3000680\t|\t-\r\n**input not properly sorted:**\t|\t\t|\t\t|\t\r\nchr10\t|\t*3000622*\t|\t3000744\t|\t-\r\nchr10\t|\t**3000595**\t|\t3000884\t|\t+\r\n\r\n\r\n```bash\r\nto-mr -o /dev/stdout -m 'bismark' input.sorted.bam | fgrep -m 1 -C 2 '3000595' | \\\r\nsort -k1,1 -k2,2n -k3,3n -k6,6 | duplicate-remover -stdin -o /dev/stdout\r\n```\r\n\r\nChrom.\t|\tStart\t\t|\tEnd\t|\tStrand\r\n------|------------------|-------------------|--------------\r\nchr10\t|\t3000511\t|\t3000680\t|\t-\r\nchr10\t|\t**3000595**\t|\t3000884\t|\t+\r\nchr10\t|\t*3000622*\t|\t3000744\t|\t-\r\nchr10\t|\t3000793\t|\t3000956\t|\t+\r\nchr10\t|\t3000860\t|\t3001074\t|\t-\r\n"}}