{"action":"created","issue":{"url":"https://api.github.com/repos/lamortenera/bamsignals/issues/16","repository_url":"https://api.github.com/repos/lamortenera/bamsignals","labels_url":"https://api.github.com/repos/lamortenera/bamsignals/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/lamortenera/bamsignals/issues/16/comments","events_url":"https://api.github.com/repos/lamortenera/bamsignals/issues/16/events","html_url":"https://github.com/lamortenera/bamsignals/issues/16","id":164402715,"number":16,"title":"Extending reads in bamCoverage?","user":{"login":"AliciaSchep","id":6809790,"avatar_url":"https://avatars.githubusercontent.com/u/6809790?v=3","gravatar_id":"","url":"https://api.github.com/users/AliciaSchep","html_url":"https://github.com/AliciaSchep","followers_url":"https://api.github.com/users/AliciaSchep/followers","following_url":"https://api.github.com/users/AliciaSchep/following{/other_user}","gists_url":"https://api.github.com/users/AliciaSchep/gists{/gist_id}","starred_url":"https://api.github.com/users/AliciaSchep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AliciaSchep/subscriptions","organizations_url":"https://api.github.com/users/AliciaSchep/orgs","repos_url":"https://api.github.com/users/AliciaSchep/repos","events_url":"https://api.github.com/users/AliciaSchep/events{/privacy}","received_events_url":"https://api.github.com/users/AliciaSchep/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-07T20:42:42Z","updated_at":"2016-07-08T11:22:52Z","closed_at":"2016-07-07T21:58:35Z","body":"For single end data, is there a way for reads to be extended?  I.e. if you know that fragments are expected to be 200 bp, can you extend the reads to be that length when computing coverage?  Such extensions are common practice when analyzing ChIP-seq data. Thanks!  "},"comment":{"url":"https://api.github.com/repos/lamortenera/bamsignals/issues/comments/231336577","html_url":"https://github.com/lamortenera/bamsignals/issues/16#issuecomment-231336577","issue_url":"https://api.github.com/repos/lamortenera/bamsignals/issues/16","id":231336577,"user":{"login":"your-highness","id":1949888,"avatar_url":"https://avatars.githubusercontent.com/u/1949888?v=3","gravatar_id":"","url":"https://api.github.com/users/your-highness","html_url":"https://github.com/your-highness","followers_url":"https://api.github.com/users/your-highness/followers","following_url":"https://api.github.com/users/your-highness/following{/other_user}","gists_url":"https://api.github.com/users/your-highness/gists{/gist_id}","starred_url":"https://api.github.com/users/your-highness/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/your-highness/subscriptions","organizations_url":"https://api.github.com/users/your-highness/orgs","repos_url":"https://api.github.com/users/your-highness/repos","events_url":"https://api.github.com/users/your-highness/events{/privacy}","received_events_url":"https://api.github.com/users/your-highness/received_events","type":"User","site_admin":false},"created_at":"2016-07-08T11:22:52Z","updated_at":"2016-07-08T11:22:52Z","body":"Hi @AliciaSchep and @lamortenera ,\r\n\r\nhaving an argument for `bamCoverage()` that enables for computing coverage with an estimated fragment length is indeed a feature we thought about.\r\n\r\nFor now, you might use the following workaround for a coverage with a 200bp estimated fragment length (similar to @lamortenera 's suggestion):\r\n```r\r\nbamCoverageFrags <- function(bampath, gr, fragLength=200, ss = TRUE, ...) {\r\n  prf <- bamProfile(bampath, gr, binsize=1, ss = TRUE, ...)\r\n  cov <- lapply(as.list(prf), function(p) {\r\n    l <- dim(p)[2]\r\n    x1 <- cumsum(as.numeric(p[1,]))\r\n    y1 <- c(rep(0, fragLength), x1[1:(l-200)])\r\n    x2 <- cumsum(as.numeric(rev(p[2,])))\r\n    y2 <- c(rep(0, fragLength), x2[1:(l-200)])\r\n    matrix(c(x1-y1, rev(x2-y2)), ncol = l, byrow = T,\r\n           dimnames = list(c(\"sense\", \"antisense\"), NULL))\r\n  })\r\n  if (ss == TRUE) {\r\n    prf@signals <- cov\r\n  } else {\r\n    prf@signals <- lapply(cov, colSums)\r\n  }\r\n  invisible(prf)\r\n}\r\n```"}}
{"actor":{"display_login":"your-highness"}}