{"action":"created","issue":{"url":"https://api.github.com/repos/fulcrumgenomics/fg-idprimer/issues/11","repository_url":"https://api.github.com/repos/fulcrumgenomics/fg-idprimer","labels_url":"https://api.github.com/repos/fulcrumgenomics/fg-idprimer/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/fulcrumgenomics/fg-idprimer/issues/11/comments","events_url":"https://api.github.com/repos/fulcrumgenomics/fg-idprimer/issues/11/events","html_url":"https://github.com/fulcrumgenomics/fg-idprimer/issues/11","id":397938748,"node_id":"MDU6SXNzdWUzOTc5Mzg3NDg=","number":11,"title":"issue with the 'start' and 'end' in the match_type_info in outputBam","user":{"login":"ShengyaoChen","id":20647165,"node_id":"MDQ6VXNlcjIwNjQ3MTY1","avatar_url":"https://avatars0.githubusercontent.com/u/20647165?v=4","gravatar_id":"","url":"https://api.github.com/users/ShengyaoChen","html_url":"https://github.com/ShengyaoChen","followers_url":"https://api.github.com/users/ShengyaoChen/followers","following_url":"https://api.github.com/users/ShengyaoChen/following{/other_user}","gists_url":"https://api.github.com/users/ShengyaoChen/gists{/gist_id}","starred_url":"https://api.github.com/users/ShengyaoChen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShengyaoChen/subscriptions","organizations_url":"https://api.github.com/users/ShengyaoChen/orgs","repos_url":"https://api.github.com/users/ShengyaoChen/repos","events_url":"https://api.github.com/users/ShengyaoChen/events{/privacy}","received_events_url":"https://api.github.com/users/ShengyaoChen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-01-10T17:33:45Z","updated_at":"2019-03-27T22:17:19Z","closed_at":null,"author_association":"NONE","body":"I noticed that there might be an issue with the ‘start’ and ‘end’ in the match_type_info for the gapped alignment. From the description: the ‘start’ and the ‘end’ are the offset from the start of the read where the match starts and ends.\r\nHere is an example:\r\n![f3tagissue](https://user-images.githubusercontent.com/20647165/50986109-c7cbb700-14ba-11e9-8384-bd697027ec30.png)\r\n\r\n\r\n**In f3 tag, the start and the end is “1,23”, suggesting that they are calculated based on the offset from the primer where the match starts and ends**. Can you look into it to see if there is an issue in reporting the start/end in the match_type_info?\r\n"},"comment":{"url":"https://api.github.com/repos/fulcrumgenomics/fg-idprimer/issues/comments/477368540","html_url":"https://github.com/fulcrumgenomics/fg-idprimer/issues/11#issuecomment-477368540","issue_url":"https://api.github.com/repos/fulcrumgenomics/fg-idprimer/issues/11","id":477368540,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3NzM2ODU0MA==","user":{"login":"ShengyaoChen","id":20647165,"node_id":"MDQ6VXNlcjIwNjQ3MTY1","avatar_url":"https://avatars0.githubusercontent.com/u/20647165?v=4","gravatar_id":"","url":"https://api.github.com/users/ShengyaoChen","html_url":"https://github.com/ShengyaoChen","followers_url":"https://api.github.com/users/ShengyaoChen/followers","following_url":"https://api.github.com/users/ShengyaoChen/following{/other_user}","gists_url":"https://api.github.com/users/ShengyaoChen/gists{/gist_id}","starred_url":"https://api.github.com/users/ShengyaoChen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShengyaoChen/subscriptions","organizations_url":"https://api.github.com/users/ShengyaoChen/orgs","repos_url":"https://api.github.com/users/ShengyaoChen/repos","events_url":"https://api.github.com/users/ShengyaoChen/events{/privacy}","received_events_url":"https://api.github.com/users/ShengyaoChen/received_events","type":"User","site_admin":false},"created_at":"2019-03-27T22:17:19Z","updated_at":"2019-03-27T22:17:19Z","author_association":"NONE","body":"Hi Nils\r\n\r\nTo follow up with my observation. I think that the issue lies in this function in PrimerMatcher.scala:\r\n``` /** Returns a primer match given a set of alignments and primers. */\r\n  def getBestGappedAlignment(primersAndAlignments: Seq[(Primer, Alignment)]): Option[GappedAlignmentPrimerMatch] = {\r\n    if (primersAndAlignments.isEmpty) None\r\n    else {\r\n      primersAndAlignments\r\n        .sortBy { case (_, alignment) => -alignment.normalizedScore } // get the maximum normlaized score\r\n        .take(2) match {\r\n          case Seq()                    =>\r\n            unreachable(\"Should have found at least one.\")\r\n          case Seq((primer, alignment)) =>\r\n            if (alignment.score < 0) None else {\r\n              Some(GappedAlignmentPrimerMatch(primer, alignment.score, 0, alignment.queryStart, alignment.queryEnd))\r\n            }\r\n          case Seq((bestPrimer, bestAlignment), (_, nextAlignment)) =>\r\n            Some {\r\n              GappedAlignmentPrimerMatch(\r\n                bestPrimer,\r\n                bestAlignment.normalizedScore,\r\n                nextAlignment.normalizedScore,\r\n                bestAlignment.queryStart,\r\n                bestAlignment.queryEnd)\r\n            }\r\n        }\r\n    }\r\n  }\r\n```\r\n The issue here is we are returning the queryStart, which are the offset position on the Primers where the match starts, not the the offset from the start of the read where the primer match starts. And the same applies to queryEnd.\r\n\r\nI changed the queryStart to targetStart; queryEnd to targetEnd. And I see the position of the primers on the reads are successfully identified.\r\n\r\n![image](https://user-images.githubusercontent.com/20647165/55116034-40e2af80-50a3-11e9-931a-5b0c581f5fdb.png)\r\n\r\n\r\nCan you confirm my observation?\r\nThanks very much!"}}
{"actor":{"display_login":"ShengyaoChen"}}