class: center, middle, inverse, title-slide # RaukR presentation - vikingr demo ## RaukR 2019 • Advanced R for Bioinformatics ###
Ben Pontiller, Andreas Schneider, Markus Skyttner
--- exclude: true count: false <link href="https://fonts.googleapis.com/css?family=Roboto|Source+Sans+Pro:300,400,600|Ubuntu+Mono&subset=latin-ext" rel="stylesheet"> <!-- ----------------- Only edit title & author above this ----------------- --> --- name: intro class: middle, spaced ## Introduction ### "Decode this AIS message" > .large[1560376557, !AIVDM,1,1,,A,13uDcBP0001CcmjPvca;d6Cn0<09,0*27,1121886915] ### Reference: [AIS format - https://gpsd.gitlab.io/gpsd/AIVDM.html](https://gpsd.gitlab.io/gpsd/AIVDM.html) > .large[More than 50 lookup tables and descriptions of possibly valid approaches for parsing along with some sample data] --- name: intro class: middle, spaced ## Introduction ### AIS: Automatic Identification System + intended to assist a vessel's watchstanding officers and allow maritime authorities to track and monitor vessel movements + info such as unique identification, position, course, and speed; sent in regular intervals by every vessel <img src="assets/Screenshot 2019-06-19 at 23.28.05.png" width="350px" align="right"> <img src="assets/Screenshot 2019-06-19 at 23.28.28.png" width="400px" align="left"> --- name: inspiration class: middle, spaced ## Inspiration * One or many messages - baked into lines in a log file - are to be read and decoded * Tidyverse `readr` offers `read_lines()` and can read from text streams * If there are parsing issues - inspect them with `readr::problems()` > Let's do it like that! * The reference materials mentions `ais.py` - a file somewhere on the Internet * Let's use that one - maybe we can call it with `reticulate` from R? --- name: lessons class: middle, spaced ## Lessons ### Data and python issues * Laptop crash! -> new laptop - this old one doesn't like `reticulate` - memory leaks? * Log example data contains (timestamp, message) tuples but also other junk * Big differences in data between ships (7000/10000 from one little coast guard boat, NAs) * Wrapping `ais.py` needs a timestamp to link messages to the original log * So this needs a small edit of the `ais.py` file to add this to the JSON output * Turns out `ais.py` works well but the JSON could be more detailed ### Package development * Rebuilding vignettes and reloading package documentation is shaky * Live with restarting R session and wiping environment for the vignettes * A vignette can be a flexdashboard - but can get big embedding data, would annoy CRAN --- name: results class: middle, spaced ## Results Repo: [https://github.com/mskyttner/vikingr](https://github.com/mskyttner/vikingr) Cloud-friendly distro: [rstudio.cloud + vikingr etc](https://hub.docker.com/r/mskyttner/raukr/tags) ### Functions * Function to read the log * Function to decode the AIS message(s) ### Data * Sample data from Visby Harbor * Should work with other sample dataset ### Visuals * Flexdashboard with leaflet map > .large[Try it from [https://mskyttner.github.io/vikingr/vikingr-x.html](https://mskyttner.github.io/vikingr/vikingr-x.html)!] Bonus: [Dockerized](https://github.com/mskyttner/vikingr/tree/master/docker) --- name: thanks class: middle, spaced # Thank you. Questions? <p>R version 3.4.4 (2018-03-15)<br><p>Platform: x86_64-pc-linux-gnu (64-bit)</p><p>OS: Ubuntu 18.04.2 LTS</p><br> Built on : <i class='fa fa-calendar' aria-hidden='true'></i> 20-jun-2019 at <i class='fa fa-clock-o' aria-hidden='true'></i> 09:05:54 __2019__ • [SciLifeLab](https://www.scilifelab.se/) • [NBIS](https://nbis.se/)