{"action":"created","issue":{"url":"https://api.github.com/repos/samtools/samtools/issues/520","repository_url":"https://api.github.com/repos/samtools/samtools","labels_url":"https://api.github.com/repos/samtools/samtools/issues/520/labels{/name}","comments_url":"https://api.github.com/repos/samtools/samtools/issues/520/comments","events_url":"https://api.github.com/repos/samtools/samtools/issues/520/events","html_url":"https://github.com/samtools/samtools/issues/520","id":130468212,"number":520,"title":"samtools sort -n moves two mates of a same read apart","user":{"login":"bli25wisc","id":593426,"avatar_url":"https://avatars.githubusercontent.com/u/593426?v=3","gravatar_id":"","url":"https://api.github.com/users/bli25wisc","html_url":"https://github.com/bli25wisc","followers_url":"https://api.github.com/users/bli25wisc/followers","following_url":"https://api.github.com/users/bli25wisc/following{/other_user}","gists_url":"https://api.github.com/users/bli25wisc/gists{/gist_id}","starred_url":"https://api.github.com/users/bli25wisc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bli25wisc/subscriptions","organizations_url":"https://api.github.com/users/bli25wisc/orgs","repos_url":"https://api.github.com/users/bli25wisc/repos","events_url":"https://api.github.com/users/bli25wisc/events{/privacy}","received_events_url":"https://api.github.com/users/bli25wisc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-01T20:04:12Z","updated_at":"2016-03-14T07:32:16Z","closed_at":null,"body":"Dear samtools developers,\r\n\r\nThis is Bo Li, the developer of RSEM. When I used samtools sort -n to make sure the alignments are grouped by read names, I found an issue. If we have paired-end reads, samtools sort -n will arrange the first mates of different alignments together, and then followed by the second mates. Because most RNA-Seq transcript quantification programs assume that the two mates of a read should be adjacent to each other, this behavior of SAMtools is not convenient. \r\n\r\nI wonder if it is possible to change the behavior of -n or provide a new option that does not move the mates of a same read apart.\r\n\r\nThanks,\r\nBo\r\n"},"comment":{"url":"https://api.github.com/repos/samtools/samtools/issues/comments/196182886","html_url":"https://github.com/samtools/samtools/issues/520#issuecomment-196182886","issue_url":"https://api.github.com/repos/samtools/samtools/issues/520","id":196182886,"user":{"login":"bli25wisc","id":593426,"avatar_url":"https://avatars.githubusercontent.com/u/593426?v=3","gravatar_id":"","url":"https://api.github.com/users/bli25wisc","html_url":"https://github.com/bli25wisc","followers_url":"https://api.github.com/users/bli25wisc/followers","following_url":"https://api.github.com/users/bli25wisc/following{/other_user}","gists_url":"https://api.github.com/users/bli25wisc/gists{/gist_id}","starred_url":"https://api.github.com/users/bli25wisc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bli25wisc/subscriptions","organizations_url":"https://api.github.com/users/bli25wisc/orgs","repos_url":"https://api.github.com/users/bli25wisc/repos","events_url":"https://api.github.com/users/bli25wisc/events{/privacy}","received_events_url":"https://api.github.com/users/bli25wisc/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T07:32:15Z","updated_at":"2016-03-14T07:32:15Z","body":"@jkbonfield Sorry for my late reply. \r\n\r\nI guess what RSEM wants is to have a stable sort for sorting reads by names only. Even without the /1 vs   /2 comparison. If you wish, it is OK to put primary alignments before secondary alignments. \r\n\r\nThe reason is that generally, for RNA-Seq data, the two mates of an alignment are always together. Thus, if we sort only by name, we can keep the adjacent structure. \r\n\r\nBecause all RNA-Seq transcript quantification tools rely on the assumption that the two mates of an paired-end read alignment are adjacent, keeping this property will be ** critical ** for all RNA-Seq data sets.  \r\n "}}