{"action":"created","issue":{"url":"https://api.github.com/repos/nanoporetech/tombo/issues/28","repository_url":"https://api.github.com/repos/nanoporetech/tombo","labels_url":"https://api.github.com/repos/nanoporetech/tombo/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/nanoporetech/tombo/issues/28/comments","events_url":"https://api.github.com/repos/nanoporetech/tombo/issues/28/events","html_url":"https://github.com/nanoporetech/tombo/issues/28","id":296948124,"number":28,"title":"minimap2/mappy parameters","user":{"login":"JohnUrban","id":7783314,"avatar_url":"https://avatars2.githubusercontent.com/u/7783314?v=4","gravatar_id":"","url":"https://api.github.com/users/JohnUrban","html_url":"https://github.com/JohnUrban","followers_url":"https://api.github.com/users/JohnUrban/followers","following_url":"https://api.github.com/users/JohnUrban/following{/other_user}","gists_url":"https://api.github.com/users/JohnUrban/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnUrban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnUrban/subscriptions","organizations_url":"https://api.github.com/users/JohnUrban/orgs","repos_url":"https://api.github.com/users/JohnUrban/repos","events_url":"https://api.github.com/users/JohnUrban/events{/privacy}","received_events_url":"https://api.github.com/users/JohnUrban/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-14T01:38:57Z","updated_at":"2018-02-14T22:02:25Z","closed_at":null,"author_association":"NONE","body":"Hi again,\r\n\r\nWhile I am working on #27, I also have other thoughts.\r\n\r\nI'd love to be able to have more control over the mapping step. When using the older version of Tombo I have, the default parameters for minimap2 results in almost 90% of reads not aligning whereas I can get 40% to align across most of their length using BLAST -- and can get partial alignments for nearly all of the reads.\r\n\r\nI suppose one way to increase the sensitivity would be to provide the minimap2 index myself with optimized parameters -- any suggestions on k, w? Nonetheless, there still would be no way to pass mapping/alignment parameters.\r\n\r\nAre there plans to allow parameter tuning? Is there any reason to not allow users to pass Tombo the already-minimap2-mapped (or otherwise mapped) reads?\r\n\r\nBest,\r\n\r\n  John\r\n"},"comment":{"url":"https://api.github.com/repos/nanoporetech/tombo/issues/comments/365759599","html_url":"https://github.com/nanoporetech/tombo/issues/28#issuecomment-365759599","issue_url":"https://api.github.com/repos/nanoporetech/tombo/issues/28","id":365759599,"user":{"login":"marcus1487","id":13755444,"avatar_url":"https://avatars1.githubusercontent.com/u/13755444?v=4","gravatar_id":"","url":"https://api.github.com/users/marcus1487","html_url":"https://github.com/marcus1487","followers_url":"https://api.github.com/users/marcus1487/followers","following_url":"https://api.github.com/users/marcus1487/following{/other_user}","gists_url":"https://api.github.com/users/marcus1487/gists{/gist_id}","starred_url":"https://api.github.com/users/marcus1487/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcus1487/subscriptions","organizations_url":"https://api.github.com/users/marcus1487/orgs","repos_url":"https://api.github.com/users/marcus1487/repos","events_url":"https://api.github.com/users/marcus1487/events{/privacy}","received_events_url":"https://api.github.com/users/marcus1487/received_events","type":"User","site_admin":false},"created_at":"2018-02-14T22:02:25Z","updated_at":"2018-02-14T22:02:25Z","author_association":"COLLABORATOR","body":"That is great that the minmap2 index is able to modify the mappable reads! I think I will consider that a solution for the central point of this issue. The only concern I have is that I am initializing the mappy aligner using the \"map-ont\" preset ([here](https://github.com/nanoporetech/tombo/blob/1.2/tombo/resquiggle.py#L921)), but given that the mappings are modulated I think this option might be ignored (at least partially) when the minimap2 index is provided. This might be a question for @lh3 ?\r\n\r\nAs for the parameter tuning, yes there is some potential there, but I have spent a good amount of effort tuning these parameters in this release so I think they are relatively close to the optimal settings (obviously this may not be the case for all users; so please do have a go at it!). I have not documented this (well let's just consider this here my documentation), but tuning the parameters is carried out using the [`tombo/scripts/debug_params.R`](https://github.com/nanoporetech/tombo/blob/master/scripts/debug_params.R) R script included in the repository. There is a comment at the top of the script indicating the steps to create the input to that script. This script will then produce plots like this: \r\n\r\n![image](https://user-images.githubusercontent.com/13755444/36229496-4422d0fa-118c-11e8-9802-e95c90c7587e.png)\r\n\r\nIn these plots each point is a read and it's y-value is the mean absolute value(z-score) across all bases using the standard model (and the indicated re-squiggle parameter). Each tuning pdf has two pages, where the second page shows only those reads passing the filter thresholds for all parameter values tested in this batch (and thus is usually the one to use; it should probably be the first plot come to think of it). This particular example plot shows that smaller values are better for the running_window parameter for this set of DNA test reads (ultimately resulting in that default parameter being set to 5 [here](https://github.com/nanoporetech/tombo/blob/1.2/tombo/_default_parameters.py#L28)).\r\n\r\nOne important note is that these parameters can change both the mean signal its as well as the number of reads passing filter thresholds (hence the two pages of the PDF). Reads that fail due to the \"Poor raw to expected signal matching\" error are actually set by the last `--signal-align-parameters` values (mean signal segmentation half-normal score threshold). Thus setting this value to a very large value will allow all reads to produce valid re-squiggled results. These reads were filtered for a reason though, so they may negatively effect downstream results. \r\n\r\nThe \"Read event to sequence alignment extends beyond --bandwidth\" error threshold is set [here](https://github.com/nanoporetech/tombo/blob/1.2/tombo/_default_parameters.py#L51) (not accessible on the command line), but turning the bandwidth parameter (third value to `--signal-align-parameters`) way up should allow most all reads to pass this filter. Note though that increasing the bandwidth will increase the run time. Similarly the \"Not enough raw signal around potential genomic deletion(s)\" error can be mostly bypassed by setting [this parameter](https://github.com/nanoporetech/tombo/blob/1.2/tombo/_default_parameters.py#L54) to 0.\r\n\r\nI generally turn these parameters up during tuning and then dial them in once I have tuned the other \"fitting-relevant\" parameters. I hope this is helpful!"}}
{"actor":{"display_login":"marcus1487"}}