{"action":"created","issue":{"url":"https://api.github.com/repos/road2stat/protr/issues/10","labels_url":"https://api.github.com/repos/road2stat/protr/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/road2stat/protr/issues/10/comments","events_url":"https://api.github.com/repos/road2stat/protr/issues/10/events","html_url":"https://github.com/road2stat/protr/issues/10","id":62539622,"number":10,"title":"extractCTDD fails when less than four amino acids maps to any one group","user":{"login":"koefoed","id":6853847,"avatar_url":"https://avatars.githubusercontent.com/u/6853847?v=3","gravatar_id":"","url":"https://api.github.com/users/koefoed","html_url":"https://github.com/koefoed","followers_url":"https://api.github.com/users/koefoed/followers","following_url":"https://api.github.com/users/koefoed/following{/other_user}","gists_url":"https://api.github.com/users/koefoed/gists{/gist_id}","starred_url":"https://api.github.com/users/koefoed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koefoed/subscriptions","organizations_url":"https://api.github.com/users/koefoed/orgs","repos_url":"https://api.github.com/users/koefoed/repos","events_url":"https://api.github.com/users/koefoed/events{/privacy}","received_events_url":"https://api.github.com/users/koefoed/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-17T23:11:54Z","updated_at":"2015-05-31T16:57:46Z","closed_at":null,"body":"```R\r\n> packageVersion('protr')\r\n[1] ‘0.5.1’\r\n> extractCTDD(\"NAKADQASSDAQTANAKADQASNDANAARSDAQAAKDDAARANQRADNAA\")\r\nError in D[[i]][2, ] = (inds[c(1, floor(length(inds) * c(0.25, 0.5, 0.75)),  : \r\n  number of items to replace is not a multiple of replacement length\r\n> \r\n```\r\nIf one, two, or three amino acids maps to a group, `floor(length(inds) * c(0.25, 0.5, 0.75))` from lines 94, 96, and 98 in R/desc09CTDD.R will have one or more `0`'s and thus the dimensions will not match in the assignment shown in the error message.\r\n\r\nOne way to solve this is to ensure that `0`'es are replaced with `1`'s in the results of the calculation mentioned above, thus selecting the position of the first amino acid in the group.\r\n\r\n\r\nIf zero amino acids maps to a group `inds` in lines 93, 95, and 97 will be empty, and indexing into `inds` in lines 94, 96, and 98 will return `NA`'s.\r\n\r\nMaybe it would be better to return zeroes in this case?\r\nThen zero will only occur if there are no amino acids mapping to the group because if just one does, it will give a (small) value > 0.\r\nOne could also return `NA`'s, but this may cause problems depending on how you use the results."},"comment":{"url":"https://api.github.com/repos/road2stat/protr/issues/comments/107223264","html_url":"https://github.com/road2stat/protr/issues/10#issuecomment-107223264","issue_url":"https://api.github.com/repos/road2stat/protr/issues/10","id":107223264,"user":{"login":"Rnewbie","id":8380791,"avatar_url":"https://avatars.githubusercontent.com/u/8380791?v=3","gravatar_id":"","url":"https://api.github.com/users/Rnewbie","html_url":"https://github.com/Rnewbie","followers_url":"https://api.github.com/users/Rnewbie/followers","following_url":"https://api.github.com/users/Rnewbie/following{/other_user}","gists_url":"https://api.github.com/users/Rnewbie/gists{/gist_id}","starred_url":"https://api.github.com/users/Rnewbie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rnewbie/subscriptions","organizations_url":"https://api.github.com/users/Rnewbie/orgs","repos_url":"https://api.github.com/users/Rnewbie/repos","events_url":"https://api.github.com/users/Rnewbie/events{/privacy}","received_events_url":"https://api.github.com/users/Rnewbie/received_events","type":"User","site_admin":false},"created_at":"2015-05-31T16:57:46Z","updated_at":"2015-05-31T16:57:46Z","body":"Hey KoeFoed I also have this problem. Thanks for fixing this . "}}