{"action":"created","issue":{"url":"https://api.github.com/repos/ComputationalProteomicsUnit/Pbase/issues/29","repository_url":"https://api.github.com/repos/ComputationalProteomicsUnit/Pbase","labels_url":"https://api.github.com/repos/ComputationalProteomicsUnit/Pbase/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/ComputationalProteomicsUnit/Pbase/issues/29/comments","events_url":"https://api.github.com/repos/ComputationalProteomicsUnit/Pbase/issues/29/events","html_url":"https://github.com/ComputationalProteomicsUnit/Pbase/issues/29","id":188436211,"number":29,"title":"mapToGenome fails to map - strand features correctly","user":{"login":"jotsetung","id":5506112,"avatar_url":"https://avatars.githubusercontent.com/u/5506112?v=3","gravatar_id":"","url":"https://api.github.com/users/jotsetung","html_url":"https://github.com/jotsetung","followers_url":"https://api.github.com/users/jotsetung/followers","following_url":"https://api.github.com/users/jotsetung/following{/other_user}","gists_url":"https://api.github.com/users/jotsetung/gists{/gist_id}","starred_url":"https://api.github.com/users/jotsetung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jotsetung/subscriptions","organizations_url":"https://api.github.com/users/jotsetung/orgs","repos_url":"https://api.github.com/users/jotsetung/repos","events_url":"https://api.github.com/users/jotsetung/events{/privacy}","received_events_url":"https://api.github.com/users/jotsetung/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-10T07:11:42Z","updated_at":"2016-11-10T07:17:21Z","closed_at":null,"body":"The `.mapToGenome` function fails to map peptide features from proteins encoded by transcripts on the - strand correctly.\r\n\r\nExample: \r\n+ transcript with 3 exons on - strand, genomic coordinates: ex1 50-60, ex2 30-40, ex3 10-20.\r\n+ peptide features and coordinates on AA sequence: pf_1 3-5, pf_2 6-7, pf_3 7-10.\r\n\r\nThe drawing below illustrates this example, first line representing the 3 exons on genomic coords, then the cDNA sequence (ex1 from nt 1-11, ex2 from 12-22, ex3 from 23-33) with the position of the peptide features.\r\n![negative-strand-example](https://cloud.githubusercontent.com/assets/5506112/20167456/0ca866c0-a71c-11e6-8ec4-f11b682efd88.png)\r\n\r\nFor this example we expect the mapping: \r\n+ pf_1 to genomic coordinates 37-40 and 50-54\r\n+ pf_2 to genomic coords 31-36\r\n+ pf_3 to genomic coords 13-20 and 30-33\r\n\r\nNow for the R code:\r\n```{r}\r\nlibrary(Pbase)\r\nlibrary(GenomicFeatures)\r\nlibrary(Biostrings)\r\n## Define the exons:\r\nexs <- GRanges(seqnames = \"test\",\r\n               ranges = IRanges(start = c(50, 30, 10),\r\n                                end = c(60, 40, 20)), strand = \"-\")\r\nmcols(exs) <- DataFrame(gene = \"a\", symbol = \"b\", transcript = \"c\")\r\n\r\n## Now the protein:\r\nprot_seq <- paste0(rep(\"Y\", sum(width(exs))/3), collapse = \"\")\r\naa <- AAStringSet(x = prot_seq)\r\nnames(aa) <- \"test_tx\"\r\nmcols(aa) <- DataFrame(gene = \"test_gene\")\r\n## Features:\r\n## pf_1: 3-5, pf_2: 6-7, pf_3: 7-10\r\nprng <- IRangesList(IRanges(start = c(3, 6, 7), end = c(5, 7, 10)))\r\nnames(prng[[1]]) <- c(\"pf_1\", \"pf_2\", \"pf_3\")\r\nmcols(prng[[1]]) <- DataFrame(source = rep(\"manual\", 3))\r\nprt <- new(\"Proteins\", aa = aa, pranges = prng)\r\n\r\n## Finally, map this (have to sort exs):\r\nPbase:::.mapToGenome(prt, sort(exs))\r\nGRanges object with 5 ranges and 7 metadata columns:\r\n       seqnames    ranges strand |      pepseq   accession        gene\r\n          <Rle> <IRanges>  <Rle> | <character> <character> <character>\r\n  pf_1     test  [16, 20]      - |         YYY     test_tx           a\r\n  pf_1     test  [30, 33]      - |         YYY     test_tx           a\r\n  pf_2     test  [34, 39]      - |          YY     test_tx           a\r\n  pf_3     test  [37, 40]      - |        YYYY     test_tx           a\r\n  pf_3     test  [50, 57]      - |        YYYY     test_tx           a\r\n        transcript      symbol exonJunctions     group\r\n       <character> <character>     <logical> <integer>\r\n  pf_1           c           b          TRUE         1\r\n  pf_1           c           b          TRUE         1\r\n  pf_2           c           b         FALSE         3\r\n  pf_3           c           b          TRUE         2\r\n  pf_3           c           b          TRUE         2\r\n  -------\r\n  seqinfo: 1 sequence from an unspecified genome; no seqlengths\r\n\r\n```\r\n\r\n`.mapToGenome` maps the features as the tx would have been on the + strand."},"comment":{"url":"https://api.github.com/repos/ComputationalProteomicsUnit/Pbase/issues/comments/259618494","html_url":"https://github.com/ComputationalProteomicsUnit/Pbase/issues/29#issuecomment-259618494","issue_url":"https://api.github.com/repos/ComputationalProteomicsUnit/Pbase/issues/29","id":259618494,"user":{"login":"jotsetung","id":5506112,"avatar_url":"https://avatars.githubusercontent.com/u/5506112?v=3","gravatar_id":"","url":"https://api.github.com/users/jotsetung","html_url":"https://github.com/jotsetung","followers_url":"https://api.github.com/users/jotsetung/followers","following_url":"https://api.github.com/users/jotsetung/following{/other_user}","gists_url":"https://api.github.com/users/jotsetung/gists{/gist_id}","starred_url":"https://api.github.com/users/jotsetung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jotsetung/subscriptions","organizations_url":"https://api.github.com/users/jotsetung/orgs","repos_url":"https://api.github.com/users/jotsetung/repos","events_url":"https://api.github.com/users/jotsetung/events{/privacy}","received_events_url":"https://api.github.com/users/jotsetung/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T07:17:21Z","updated_at":"2016-11-10T07:17:21Z","body":"Unit test in `test_mapToGenome-ensembldb.R` addresses this issue too."}}
{"actor":{"display_login":"jotsetung"}}