{"action":"created","issue":{"url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment/issues/106","repository_url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment","labels_url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment/issues/106/comments","events_url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment/issues/106/events","html_url":"https://github.com/vjcitn/MultiAssayExperiment/issues/106","id":134382867,"number":106,"title":"Instantiating new MultiAssayExperiment in .subsetMultiAssayExperiment() leads to loss of metadata","user":{"login":"PeteHaitch","id":1049741,"avatar_url":"https://avatars.githubusercontent.com/u/1049741?v=3","gravatar_id":"","url":"https://api.github.com/users/PeteHaitch","html_url":"https://github.com/PeteHaitch","followers_url":"https://api.github.com/users/PeteHaitch/followers","following_url":"https://api.github.com/users/PeteHaitch/following{/other_user}","gists_url":"https://api.github.com/users/PeteHaitch/gists{/gist_id}","starred_url":"https://api.github.com/users/PeteHaitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PeteHaitch/subscriptions","organizations_url":"https://api.github.com/users/PeteHaitch/orgs","repos_url":"https://api.github.com/users/PeteHaitch/repos","events_url":"https://api.github.com/users/PeteHaitch/events{/privacy}","received_events_url":"https://api.github.com/users/PeteHaitch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-17T19:53:39Z","updated_at":"2016-02-24T16:08:49Z","closed_at":null,"body":"Here's an example of whether I think instantiating a new MultiAssayExperiment in a subsetting operation (https://github.com/vjcitn/MultiAssayExperiment/blob/master/R/MultiAssayExperiment-methods.R#L160) is a bad idea because it leads to loss of metadata:\r\n\r\n```r\r\n> library(MultiAssayExperiment)\r\n> ## Run the example Elist\r\n> example(\"Elist\")\r\n\r\n### SNIP OUTPUT ###\r\n\r\n> ## Run the sample map example\r\n> example(\"listToMap\")\r\n\r\n### SNIP OUTPUT ###\r\n\r\n> ## Create an example phenotype data\r\n> myPheno <- data.frame(sex = c(\"M\", \"F\", \"M\", \"F\"),\r\n+                       age = 38:41,\r\n+                       row.names = c(\"Jack\", \"Jill\", \"Bob\", \"Barbara\"))\r\n> \r\n> ## Auto-creation of map\r\n> myMultiAssayExperiment <- MultiAssayExperiment(Elist = myElist,\r\n+                                                pData = myPheno,\r\n+                                                sampleMap = myDF)\r\n> \r\n> pData(myMultiAssayExperiment)\r\nDataFrame with 4 rows and 2 columns\r\n             sex       age\r\n        <factor> <integer>\r\nJack           M        38\r\nJill           F        39\r\nBob            M        40\r\nBarbara        F        41\r\n> # If deliberately/accidentally create an \"empty\" MAE, we lose the metadata\r\n> pData(myMultiAssayExperiment[\"a\", ])\r\nDataFrame with 0 rows and 0 columns\r\n```\r\n\r\nCompare to behaviour of a RangedSummarizedExperiment:\r\n```r\r\n> library(SummarizedExperiment)\r\n> example(\"RangedSummarizedExperiment\")\r\n\r\n### SNIP OUTPUT ###\r\n\r\n> colData(rse)\r\nDataFrame with 6 rows and 1 column\r\n    Treatment\r\n  <character>\r\nA        ChIP\r\nB       Input\r\nC        ChIP\r\nD       Input\r\nE        ChIP\r\nF       Input\r\n> # If deliberately/accidentally create a 0-range RSE the metadata is retained\r\n> colData(subsetByOverlaps(rse, GRanges(\"chr88\", IRanges(1, 2))))\r\nDataFrame with 6 rows and 1 column\r\n    Treatment\r\n  <character>\r\nA        ChIP\r\nB       Input\r\nC        ChIP\r\nD       Input\r\nE        ChIP\r\nF       Input\r\nWarning message:\r\nIn .Seqinfo.mergexy(x, y) :\r\n  The 2 combined objects have no sequence levels in common. (Use\r\n  suppressWarnings() to suppress this warning.)\r\n```"},"comment":{"url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment/issues/comments/188325116","html_url":"https://github.com/vjcitn/MultiAssayExperiment/issues/106#issuecomment-188325116","issue_url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment/issues/106","id":188325116,"user":{"login":"lwaldron","id":639942,"avatar_url":"https://avatars.githubusercontent.com/u/639942?v=3","gravatar_id":"","url":"https://api.github.com/users/lwaldron","html_url":"https://github.com/lwaldron","followers_url":"https://api.github.com/users/lwaldron/followers","following_url":"https://api.github.com/users/lwaldron/following{/other_user}","gists_url":"https://api.github.com/users/lwaldron/gists{/gist_id}","starred_url":"https://api.github.com/users/lwaldron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lwaldron/subscriptions","organizations_url":"https://api.github.com/users/lwaldron/orgs","repos_url":"https://api.github.com/users/lwaldron/repos","events_url":"https://api.github.com/users/lwaldron/events{/privacy}","received_events_url":"https://api.github.com/users/lwaldron/received_events","type":"User","site_admin":false},"created_at":"2016-02-24T16:08:49Z","updated_at":"2016-02-24T16:08:49Z","body":"Validity check for non-zero nrow and ncol has been removed. To close this issue, just do not re-create MultiAssayExperiment as a result of any subset operation."}}