{"action":"created","issue":{"url":"https://api.github.com/repos/sgibb/MALDIquant/issues/58","repository_url":"https://api.github.com/repos/sgibb/MALDIquant","labels_url":"https://api.github.com/repos/sgibb/MALDIquant/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/sgibb/MALDIquant/issues/58/comments","events_url":"https://api.github.com/repos/sgibb/MALDIquant/issues/58/events","html_url":"https://github.com/sgibb/MALDIquant/issues/58","id":375574177,"node_id":"MDU6SXNzdWUzNzU1NzQxNzc=","number":58,"title":"raw MSI spectra as MassSpectra objects - size in memory","user":{"login":"dsammour","id":44615117,"node_id":"MDQ6VXNlcjQ0NjE1MTE3","avatar_url":"https://avatars0.githubusercontent.com/u/44615117?v=4","gravatar_id":"","url":"https://api.github.com/users/dsammour","html_url":"https://github.com/dsammour","followers_url":"https://api.github.com/users/dsammour/followers","following_url":"https://api.github.com/users/dsammour/following{/other_user}","gists_url":"https://api.github.com/users/dsammour/gists{/gist_id}","starred_url":"https://api.github.com/users/dsammour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsammour/subscriptions","organizations_url":"https://api.github.com/users/dsammour/orgs","repos_url":"https://api.github.com/users/dsammour/repos","events_url":"https://api.github.com/users/dsammour/events{/privacy}","received_events_url":"https://api.github.com/users/dsammour/received_events","type":"User","site_admin":false},"labels":[{"id":26331522,"node_id":"MDU6TGFiZWwyNjMzMTUyMg==","url":"https://api.github.com/repos/sgibb/MALDIquant/labels/feature%20request","name":"feature request","color":"02e10c","default":false},{"id":1114772774,"node_id":"MDU6TGFiZWwxMTE0NzcyNzc0","url":"https://api.github.com/repos/sgibb/MALDIquant/labels/help-wanted","name":"help-wanted","color":"ba1ecc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-10-30T16:15:34Z","updated_at":"2018-11-06T20:00:23Z","closed_at":null,"author_association":"NONE","body":"Hi, \r\n\r\nI am using `MALDIquant `extensively to process MSI datasets. These datasets tend to be extremely large (<50GB when loaded into memory into lists of `MassSpectrum `objects). The issue here is that each `MassSpectrum `object stores intensities and corresponding m/z values, which means huge redundancy and unnecessary memory usage since the mass axis is exactly identical for every spectrum. I was wondering if it would be possible to exclude the mass axis from `MassSpectrum `objects and possibly create a new type of object, say `MassAxis`, which can be passed as an argument to the processing functions. Obviously, this cannot be applied to `MassPeak `objects. \r\n\r\nThanks,\r\nDenis\r\n"},"comment":{"url":"https://api.github.com/repos/sgibb/MALDIquant/issues/comments/436388610","html_url":"https://github.com/sgibb/MALDIquant/issues/58#issuecomment-436388610","issue_url":"https://api.github.com/repos/sgibb/MALDIquant/issues/58","id":436388610,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjM4ODYxMA==","user":{"login":"sgibb","id":1828443,"node_id":"MDQ6VXNlcjE4Mjg0NDM=","avatar_url":"https://avatars1.githubusercontent.com/u/1828443?v=4","gravatar_id":"","url":"https://api.github.com/users/sgibb","html_url":"https://github.com/sgibb","followers_url":"https://api.github.com/users/sgibb/followers","following_url":"https://api.github.com/users/sgibb/following{/other_user}","gists_url":"https://api.github.com/users/sgibb/gists{/gist_id}","starred_url":"https://api.github.com/users/sgibb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgibb/subscriptions","organizations_url":"https://api.github.com/users/sgibb/orgs","repos_url":"https://api.github.com/users/sgibb/repos","events_url":"https://api.github.com/users/sgibb/events{/privacy}","received_events_url":"https://api.github.com/users/sgibb/received_events","type":"User","site_admin":false},"created_at":"2018-11-06T20:00:23Z","updated_at":"2018-11-06T20:00:23Z","author_association":"OWNER","body":"In `R` it is not possible to overwrite the type of slots in inherited classes. An alternative approach (that requires the change of the parent class `AbstractMassObject` and will break backward compatibility but this feature is worth to break it) are *class unions* as members, see `setClassUnion`, e.g.:\r\n```r\r\n## create class unions (number or character/ mz&intensity or filename)\r\nsetClassUnion(\"NumericOrCharacter\", c(\"numeric\", \"character\"))\r\n\r\nsetClass(\"AbstractMassObject\",\r\n         slots=list(mass=\"NumericOrCharacter\", intensity=\"NumericOrCharacter\",\r\n                    metaData=\"list\"),\r\n         contains=\"VIRTUAL\")\r\n\r\nsetClass(\"MassSpectrum\",\r\n         slots=list(mass=\"numeric\", intensity=\"numeric\"),\r\n         prototype=list(mass=numeric(), intensity=numeric(),\r\n                        metaData=list()),\r\n         contains=\"AbstractMassObject\")\r\n\r\nsetClass(\"OnDiskMassSpectrum\",\r\n         slots=list(mass=\"character\", intensity=\"character\"),\r\n         prototype=list(mass=character(), intensity=character(), metaData=list()),\r\n         contains=\"AbstractMassObject\")\r\n\r\nms <- new(\"MassSpectrum\", mass=1:10, intensity=1:10)\r\noms <- new(\"OnDiskMassSpectrum\", mass=\"filename\", intensity=\"filename\")\r\n```\r\n\r\nA possible class hierarchy would be:\r\n```\r\nAbstractMassObject (VIRTUAL, mass/intensity = \"numeric\"/\"matter_vec\", metaData=\"list/matter\")\r\n├── AbstractMassSpectrum (VIRTUAL, just for method implementation)\r\n│   ├── MassSpectrum (mass/intensity = \"numeric\"/\"double\", metaData=\"list\")\r\n│   ├── MassSpectrumOnDisk (mass/intensity = \"matter_vec\", metaData=\"matter\")\r\n└── MassPeaks (mass/intensity = \"numeric\"/\"double\", metaData=\"list\")\r\n ```\r\n\r\nWhile I find `matter` is a really great, impressive package the decision to depend on `matter` is a tough one. Currently `MALDIquant` is on *CRAN* and `matter` on *bioconductor*. If we import `matter` the user can't install `MALDIquant` via `install.packages(\"MALDIquant\")` but has to use `install.packages(\"BiocManager\"); BiocManager::install(\"MALDIquant\")`. IMHO there are at least two solutions:\r\n\r\n1. Move `MALDIquant` to *bioconductor*.\r\n2. Avoid `matter` and use something else.\r\n\r\nI don't know which of the solutions is harder. I don't have any experience on moving from *CRAN* to *bioconductor* (IMHO it was the wrong decision in 2011 to send the package to *CRAN* and not to *bioconductor* ...)."}}
{"actor":{"display_login":"sgibb"}}