Tuesday 9 October 2018

Getting requests_oauthlib in python working...

This feels like an important thing to do...

First, check what python version I have

In console, type:

python --version
Answer:

Python 2.7.10

Need to update to Python 3.
Go to:
https://www.python.org/downloads/release/python-370/
Download Python 3.7
And install...

So I can't make that work right now, continue with Python 3.6

So I want to use the library requests_oauthlib

Need to install pip first.
https://stackoverflow.com/questions/49768770/not-able-to-install-python-packages-ssl-tlsv1-alert-protocol-version
Seems to have worked to download pip:
curl https://bootstrap.pypa.io/get-pip.py | sudo python

Now try using pip to download the python library
pip install requests requests_oauthlib

Needed to sudo this to make it work...

Says:
Installing collected packages: oauthlib, idna, certifi, urllib3, chardet, requests, requests-oauthlib

Successfully installed certifi-2018.8.24 chardet-3.0.4 idna-2.7 oauthlib-2.1.0 requests-2.19.1 requests-oauthlib-1.0.0 urllib3-1.23

BUT
how do I make this available to PyCharm?

Well, I found it in

/Library/Python/2.7/site-packages

But I need it to be in...

/Library/Frameworks/Python.framework/Versions/3.6/bin
I think...
let's try copying in console...


Some PyCharm specific stuff:
https://www.jetbrains.com/help/pycharm/2016.1/installing-uninstalling-and-upgrading-packages.html

Want to make the library available in PyCharm...
Select requests and install stuff from there...
I'm a bit confused!!

Close down PyCharm and try again.
Still getting an error message:
ModuleNotFoundError: No module named 'requests_oauthlib'

I've got confused between requests_oauthlib and requests_oauth - a bit annoying...

Copied the library

cp -R /Library/Python/2.7/site-packages/requests_oauthlib /Library/Frameworks/Python.framework/Versions/3.6/bin

Installed with PyCharm

WORKED!!!

Things to learn - with sudo they go to python 2.7 library.
Copying them will work...
Great!!!







Monday 17 September 2018

Using python with SVG - part 1

Trying to follow the instructions here:
https://jespermaag.github.io/blog/2018/gganatogram/
to help create some more tissues for gganatogram.

Unfortunately fail at first step:
Downloading SVG files using npm install --save anatomogram
This gave an error message...
Similar to this: https://github.com/npm/npm/issues/3190
I think I probably need to reinstall npm
Following this: https://stackoverflow.com/questions/11284634/upgrade-node-js-to-the-latest-version-on-mac-os

using Node -v gives a nice up todate version number v10.10.0

Try again with sudo npm install --save anatomogram
This has worked but gave warnings:
> styled-components@3.4.6 postinstall /Users/paulbrennan/Documents/anatomogram/node_modules/styled-components
> node ./scripts/postinstall.js || exit 0

Use styled-components at work? Consider supporting our development efforts at opencollective.com/styled-components
npm WARN saveError ENOENT: no such file or directory, open '/Users/paulbrennan/Documents/anatomogram/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/paulbrennan/Documents/anatomogram/package.json'
npm WARN anatomogram No description
npm WARN anatomogram No repository field.
npm WARN anatomogram No README data
npm WARN anatomogram No license field.

+ anatomogram@2.0.0
added 21 packages from 24 contributors, updated 1 package, moved 23 packages and audited 102 packages in 21.306s

found 0 vulnerabilities

Checked the file organisation and there are outline SVG files...

At the moment I can only find outlines not organs, etc...

Open PyCharm.
Cut and paste in code...

Hmm, check Python version and packages...
Pauls-MBP-2:anatomogram paulbrennan$ python --version

Python 2.7.10

Should probably update...
Maybe just do this:

Pauls-MBP-2:anatomogram paulbrennan$ python3


Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04) 

And gives:

>>> 

Test this:
>>> print("Hello world")
Hello world

Works.
Control D to exit (https://apple.stackexchange.com/questions/62164/how-do-i-exit-python-in-the-mountain-lion-terminal)

Wednesday 12 September 2018

ggplot object test framework....

Not generic but needs to be adapted to the object.
Useful though so here it is...

Adapted from here:
https://github.com/brennanpincardiff/drawProteins/blob/master/tests/testthat/test-geoms.R
with info from here:
https://stackoverflow.com/questions/13457562/how-to-determine-the-geom-type-of-each-layer-of-a-ggplot2-object/43982598#43982598

# testing framework for a ggplot object...

# these are the parts of the ggplot object:
## p$data
## p$layers
## p$scales
## p$mapping
## p$theme
## p$coordinates
## p$facet
## p$plot_env
## p$labels


# confirm its a ggplot
expect_is(ggseg(),c("gg","ggplot"))

p <- ggseg()

# should be a list of 9
# a ggplot object should be a list of 9
expect_equal(mode(p), "list")
expect_equal(length(p), 9)

## p$data
expect_equal(dim(p$data)[1], 10913)
expect_equal(dim(p$data)[2], 11)
expect_equal(colnames(p$data)[1], "long")

## p$layers
# should have a defined number of layers
expect_equal(length(p$layers), 1)
# https://stackoverflow.com/questions/13457562/how-to-determine-the-geom-type-of-each-layer-of-a-ggplot2-object/43982598#43982598
# layer should be a specific geom
expect_equal(class(p$layers[[1]]$geom)[1], "GeomPolygon")
# if there are multiple layers we can test more than one...

## p$labels
# should have x but not y labels
expect_equal(p$labels$x, "hemisphere")
expect_equal(p$labels$y, "")

Worked through adding tests to gganatogram...

Workflow


  1. Fork (online)
  2. Open in R-Studio - as a git repository
  3. Check the build before going forward (devtools::check())
  4. Write a test
  5. Run tests using R-Studio
  6. 19 different tests run today.
  7. Check the build again at the end - R-Studio tabs worked
  8. Commit in R-Studio
  9. Push to Github in R-Studio
  10. Create Pull Request online 
  11. Feel happy with some high quality coding done :-)


Used R-Studio for it all - advice from here (http://r-bio.github.io/intro-git-rstudio/) very useful.


Tuesday 11 September 2018

Drawing bodies, brains and protein structures...

Bodies

ggplot for bodies with expression data...
https://twitter.com/JesperMaag/status/1038914309957607424

https://github.com/jespermaag/gganatogram

https://github.com/ebi-gene-expression-group/anatomogram


Semantic Body Illustrations 
https://github.com/flekschas/sbi
https://academic.oup.com/bioinformatics/article/31/5/794/2748201
http://sbb.cellfinder.org/human-adult-female-body

Brains

https://github.com/LCBC-UiO/ggseg
https://github.com/LCBC-UiO/ggseg/wiki/Creating-and-contributing-atlases



https://rud.is/b/2016/02/11/plot-the-new-svg-r-logo-with-ggplot2/

Most importantly:
https://github.com/davidmcclure/svg-to-wkt
Convert SVG into text....


https://drmowinckels.io/blog/adding-external-images-to-plots/



And then proteins too...

http://thegrantlab.org/bio3d/index.php

Bio3D is an R package containing utilities for the analysis of protein structure, sequence and trajectory data.

https://www.rcsb.org/3d-view/1AYC




But still SVG to data.frame to plot...
I don't know the way!
https://github.com/davidmcclure/svg-to-wkt - maybe!

Info here: https://github.com/LCBC-UiO/ggseg/wiki/Creating-and-contributing-atlases


Thursday 30 August 2018

I want to try to push my development version to Bioconductor...

https://bioconductor.org/developers/how-to/git/push-to-github-bioc/

Tried but failed.
This is the message:

v3431-0a7785bc:drawProteins paulbrennan$ git push upstream devel
Counting objects: 68, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (65/65), done.
Writing objects: 100% (68/68), 14.42 KiB | 2.88 MiB/s, done.
Total 68 (delta 39), reused 0 (delta 0)
remote: FATAL: W refs/heads/devel packages/drawProteins brennanpincardiff DENIED by fallthru
remote: error: hook declined to update refs/heads/devel
To git.bioconductor.org:packages/drawProteins.git
 ! [remote rejected] devel -> devel (hook declined)
error: failed to push some refs to 'git@git.bioconductor.org:packages/drawProteins.git'
v3431-0a7785bc:drawProteins paulbrennan$ 



I wonder why?
Does bumping version number make a difference?

No hook declined.


Very helpful answer back from Lori:

Bioconductor assumes the master branch of a github repository is the devel branch.  There is no devel branch on the git.bioconductor server so you will have to push the changes to upstream master.  This is slightly confusing but stated on the git help pages


http://bioconductor.org/developers/how-to/git/


http://bioconductor.org/developers/how-to/git/push-to-github-bioc/


Merging master into devel branches....

So I found that I had made changes to devel but I was using an old branch of devel that was different from the master.

This was not ideal so I tried to "Update from Master" using Github Desktop.
This created conflicts in DESCRIPTION, NEWS and README.Rmd.

To resolve the conflicts, I opened the files in R-Studio and edited them in the way I thought was necessary using advice from here:
https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/

Then I used git add, i.e. git add DESCRIPTION after the file was updated to resolve the conflict and the conflict markers.

Finally I typed: 
git commit -m "Updating devel from master and resolving conflicts"

to resolve the whole thing. 
This allowed me to update devel all from master and only has the changes in the devel since I started working on it this month (August)

All in all a successful use of Git, I think. 

Friday 24 August 2018

Some links and learning from CaRdiff User Group

Breaking down functions
https://kbroman.org/steps2rr/pages/functions.html

How to Datapasta
https://cran.r-project.org/web/packages/datapasta/vignettes/how-to-datapasta.html

Adding column if it does not exist
https://stackoverflow.com/questions/45857787/adding-column-if-it-does-not-exist
https://stackoverflow.com/a/45858044/3793923

What they forgot to teach you about R
https://blog.rstudio.com/2018/08/07/what-they-forgot-to-teach-you-about-r/
- project-oriented workflows, version control for data science (Git/GitHub!), and how to plan for collaboration, communication, and iteration (incl. RMarkdown)

Code > Insert roxygen skeleton
http://stat545.com/packages05_foofactors-package-02.html


Wednesday 22 August 2018

Steps to turn a function into a package...

1. Downloaded Sefa Github repo.
2. Opened R Studio and made package - called tweetParsR

Here is a screen shot of the file structure:

3. Let's look at the function first.

Remove the library(tidyverse) at top.
Add some documentation using Roxygen tags

Here is some recommended stuff..
### parse_function
#' Turn JSON file of tweets into a CSV file
#'
#' \code{parse_function} uses the dataframe containing the protein features to
#' creates the basic plot element by determining the length of the longest
#' protein.
#'
#' @param x describe the input
#'
#' @return describe the output.
#'
#' @examples
#'
#' @import dlpyr, stringr
#'
#' @export


4. Add some double colon stuff
e.g. dplyr::filter

5. Need to design some tests...

6. DESCRIPTION edited to add some imports...


Sources:
http://tinyheero.github.io/jekyll/update/2015/07/26/making-your-first-R-package.html
https://itsalocke.com/blog/the-making-of-datasaurus/
http://r-pkgs.had.co.nz/
https://ropensci.github.io/dev_guide/building.html#building

http://happygitwithr.com/rstudio-git-github.html
https://github.com/lockedata/pRojects/blob/master/R/createPackageProject.R


Friday 17 August 2018

Some more R resources...

Gapminder links:
http://staff.math.su.se/hoehle/blog/2018/07/02/factfulness.html
and raw content:
https://raw.githubusercontent.com/hoehleatsu/hoehleatsu.github.io/master/_source/2018-07-02-factfulness.Rmd
http://rstudio-pubs-static.s3.amazonaws.com/116038_0ebe7e3db5dd4f29ac10e0c994373f99.html
http://stat545.com/block019_enforce-color-scheme.html#circle-area-population


dplyr
https://dplyr.tidyverse.org/articles/programming.html
https://datacarpentry.org/R-ecology-lesson/03-dplyr.html
http://stat545.com/bit001_dplyr-cheatsheet.html


https://cran.r-project.org/web/packages/tibble/vignettes/tibble.html


http://www.sthda.com/english/wiki/ggplot2-box-plot-quick-start-guide-r-software-and-data-visualization


http://r4ds.had.co.nz/

Friday 6 July 2018

Making changes online on Overleaf...

I needed to learn some Latex.

Here is some info about captions - i.e. a figure legends:
https://tex.stackexchange.com/questions/268554/how-to-put-a-legend-under-a-figure

https://www.overleaf.com/help/52-how-do-i-insert-an-image-at-a-specific-point-in-the-document#.Wz9ALxJKhR0
https://www.overleaf.com/17638816rrfvjhxbxqjh#/66943761/
https://www.sharelatex.com/project/515c83650651e57e1975aeb2


Here is the way to have bold and normal text in the caption:
https://tex.stackexchange.com/questions/3276/caption-is-bold-can-i-have-part-of-it-not-bold


Lots about captions here:
http://www.ctex.org/documents/packages/float/caption.pdf


FINAL point:
Making a DOI for my code:
https://guides.github.com/activities/citable-code/

Wednesday 13 June 2018

Trying to test drawProteins with new version of ggplot2...

A new version of ggplot2 is being launched.
I need to check this with my package drawProteins.

Here is the information about the new version of ggplot2:
https://github.com/tidyverse/ggplot2/blob/master/NEWS.md#ggplot2-2219000

Here is a link about how to a development version of ggplot2:
https://gist.github.com/kohske/1150934

Step 1: Create new Project in RStudio
Step 2: The script:
# script to test drawProteins with new version of ggplot2
# install devtools
install.packages('devtools')

# install dependency of scales package
install.packages(c("RColorBrewer", "stringr", "dichromat", "munsell", "plyr", "colorspace"))
install.packages("Rcpp")
# install dependency of ggplot2 package
install.packages("rlang")

# Open devtools package
library(devtools)

# move to development mode
# scales and ggplot2 are installed in "~/R-dev" directory, so official version of ggplot2 are not removed.
dev_mode(TRUE)

# download development version of scales and ggplot2
install_github("hadley/scales", force=TRUE)
# main branch of development
install_github("hadley/ggplot2")
# (Optional) install_github("ggplot2", "kohske", "feature/new-guides-with-gtable")

# activate development version of ggplot2
library(ggplot2)


# install bioconductor version of drawProteins

source("https://bioconductor.org/biocLite.R")
biocLite("drawProteins")
library(drawProteins)

source("https://bioconductor.org/biocLite.R")
biocLite("BiocStyle")

# run some tests...
# try to compile vignette
# vignette seems to assembled OK....


Comments
Interestingly we now have a d> cursor...

Needed to download version 3.5 of R.
Then need lots of new installs....

Needed a new version of Rccp and rlang packages as well.

html of vignette seems like an easy way to test.
All looks good...
Figures assembled without errors.
Session info:


Says drawProteins_1.0.0
and
ggplot2_2.2.1.9000
so new version.

Basically this implies that these two should work together OK.
Good news.

Monday 9 April 2018

Some MAP kinase links...

I want to prepare a visualisation of MAP Kinase proteins in different species:
- probably fly, chicken, mouse and human as a starting point.

Search reveals these sources:

  • Evolutionary History of the Vertebrate Mitogen Activated Protein Kinases Family

http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0026999

  • Evolutionary history of mitogen-activated protein kinase (MAPK) genes in LotusMedicago, and Phaseolus

these are plants - soya bean.
https://www.tandfonline.com/doi/full/10.4161/psb.27189



UniProt search:

family:"protein kinase superfamily cmgc ser thr protein kinase family map kinase subfamily" AND organism:"Gallus gallus (Chicken) [9031]"


API Queries for UniProt

Uniprot search for: 
protein kinase superfamily cmgc ser thr protein kinase family map kinase subfamily

Gives 205 protein entries across various species. 


Go Ontology


F1000 Bioconductor Gateway

New article describing the tool, I used:

https://f1000research.com/articles/7-431/v1?utm_medium=email&utm_source=tracked_articles_alert

Authoring Bioconductor workflows with BiocWorkflowTools [version 1; referees: awaiting peer review]


Animal pics - Phylopic...

A search revealed this StackOverflow post:
https://stackoverflow.com/questions/28206611/adding-custom-image-to-geom-polygon-fill-in-ggplot
which led to rphylopic (https://github.com/sckott/rphylopic)

which seems interesting and relevant.


Link here to the parent site: http://phylopic.org/about/



Friday 6 April 2018

Grappling with writing a paper in RMarkdown...

I have submitted a manuscript to F1000Research as part of the Bioconductor Gateway. It's about drawProteins.

The workflow involved:

  1. Writing text and code in RMarkdown using R Studio
  2. Using BiocWorkflowTools (https://www.bioconductor.org/packages/release/bioc/html/BiocWorkflowTools.html)
  3. Putting in citations from Bibdesk
  4. Knitting with knitr in R Studio which creates multiple files...
    1. A PDF
    2. A tex file
    3. A folder of latex figures (names not ideal, I think).
  5. Uploading files to Overleaf
  6. Logging into F1000Research
  7. Linking into Overleaf
  8. The uploading a Word file too (separate Rmd file and Knit required and some manual editing - WHY?)
  9. Adding cover letter
  10. Identifying referees - finding emails can be difficult!

A busy day of work...

Here are a few of the resources I used to help write the manuscript:

Monday 12 February 2018

git remote show upstream seems to work :-)

Update (14:23): Changed to version 0.99.10 to be sure that I know what is going to be built and thus tested on Github.

git push upstream master

says that it's on Bioconductor so worked!


Checking the git status of drawProteins


Steps
1.  Open Terminal
2.  Using cd, navigate to drawProteins folder
3.  git status
Possible output
On branch master
Your branch is up-to-date with 'origin/master'.


nothing to commit, working tree clean

4.  Check the upstream connection with git remote show upstream
Possible output:
* remote upstream
  Fetch URL: git@git.bioconductor.org:packages/drawProteins.git
  Push  URL: git@git.bioconductor.org:packages/drawProteins.git
  HEAD branch: master
  Remote branch:
    master new (next fetch will store in remotes/upstream)
  Local ref configured for 'git push':

    master pushes to master (up to date)

5.  Pull Upstream Changes (http://bioconductor.org/developers/how-to/git/pull-upstream-changes/)
 git checkout master
 git fetch upstream
git merge upstream/master
Possible output:

Already up-to-date.

v1791-0a670637:drawProteins paulbrennan$ git fetch --all
Fetching origin
Fetching upstream

v1791-0a670637:drawProteins paulbrennan$ git merge upstream/master
Already up-to-date.

v1791-0a670637:drawProteins paulbrennan$ git push upstream master
Counting objects: 23, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (23/23), done.
Writing objects: 100% (23/23), 3.38 KiB | 3.38 MiB/s, done.
Total 23 (delta 18), reused 0 (delta 0)
To git.bioconductor.org:packages/drawProteins.git
   4150fc6..ec5455e  master -> master


This seems to have worked.
Hopefully, build problems with Bioconductor will go away.

Check overnight build and see how it goes tomorrow.


Friday 9 February 2018

Trying to make my SSH work with Bioconductor...


OK, so today, I am trying to see if I can make sure that my master branch in Github and the drawProtein master branch on Bioconductor are synced.

I have to do this through Terminal because I want to link two upstream repos to my computer.

So it's an attempt to follow the New Package Workflow page...
http://bioconductor.org/developers/how-to/git/new-package-workflow/
According to the page:
"Bioconductor needs to know your SSH ‘public key’."

I have submitted this or at least I thought I did...
Today, I created a new SSH key for Github and Bioconductor and I submitted it again to Bioconductor:
So that's good.

A key step to submitting the SSH keys is copying id_rsa.pub to clipboard
On this page:
https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

Code for copying id_rsa.pub to clipboard
$ pbcopy < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard



Some useful git commands to check remotes:

git remote show

In my case this gives two:
origin

upstream

So then:

git remote show upstream

and it returns:
* remote origin
  Fetch URL: https://github.com/brennanpincardiff/drawProteins.git
  Push  URL: https://github.com/brennanpincardiff/drawProteins.git
  HEAD branch: master
  Remote branches:
    devel  tracked
    master tracked
  Local branches configured for 'git pull':
    devel  merges with remote devel
    master merges with remote master
  Local refs configured for 'git push':
    devel  pushes to devel  (up to date)

    master pushes to master (up to date)

Good news! :-)

So try:

git remote show upstream

and it returns:
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

So this is not so good!
Try again tomorrow or Monday in the hope that the SSH key has been accepted and that I have some access rights.

As added info:
More here: https://git-scm.com/book/be/v2/Git-Basics-Working-with-Remotes















Remote Git Repositories....

If I understand correctly from here:
https://bioconductor.org/developers/how-to/git/new-package-workflow/
then,
I need to link two repositories to the master version of drawProteins on my computer.


Configure the “remotes” of your local git repository. You will need to push any future changes to your package to the Bioconductor repository, and pull changes the Bioconductor core team will make (e.g., bug fixes or bumping a version number for a new release). Add a remote to your machine’s local git repository using:
 git remote add upstream git@git.bioconductor.org:packages/<YOUR-REPOSITORY-NAME>.g


One of these will be my own github repository and the other will be the Bioconductor drawProtein repository....

Here are some resources about how to organise that:
https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes


I may be misunderstanding something but it seems that I have to use command line...
https://help.github.com/desktop-classic/faq/articles/can-i-work-with-multiple-remotes/

Friday 5 January 2018

Getting a human body silhouette in svg format...

Well Wikipedia is clearly a good option...

Various types available...

https://commons.wikimedia.org/wiki/File:Human_body_silhouette.svg
https://commons.wikimedia.org/wiki/File:Female_shadow.svg
https://commons.wikimedia.org/wiki/Category:SVG_human_body_features
https://commons.wikimedia.org/wiki/Category:Diagrams_of_the_human_body_features
https://commons.wikimedia.org/wiki/Category:Diagrams_of_the_human_anatomy
https://commons.wikimedia.org/wiki/Category:Diagrams_of_organs_of_the_human_body




R packages
https://cran.r-project.org/web/packages/rcorpora/rcorpora.pdf
has a body part list: https://github.com/dariusk/corpora/blob/master/data/humans/bodyParts.json

R Shiny app
https://sidderb.wordpress.com/2013/01/30/a-shiny-app-to-display-the-human-body-map-dataset/


Websearch reveals these questions:
https://stackoverflow.com/questions/10670751/r-plot-human-body-in-2d

https://stackoverflow.com/questions/28664798/how-to-make-a-heat-map-in-r-based-on-a-gif-of-the-human-body

https://stackoverflow.com/questions/4993189/overlay-data-onto-background-image

https://stackoverflow.com/questions/16409935/plot-data-over-background-image-with-ggplot/16418186#16418186

https://stackoverflow.com/questions/24839363/how-to-use-more-than-6-shapes-in-ggplot

Thursday 4 January 2018

development packages page for Bioconductor

So here is the development packages page for Bioconductor

http://bioconductor.org/packages/devel/bioc/

I guess drawProteins should be here soon...

I think this code should install development version from Bioconductor when it's there:


install.packages("drawProteins",
 repos = "http://www.bioconductor.org/packages/devel/bioc",
     type  = "source")

I will check back and test it in a few days...

N.B. Will it work?

For the development version on github:


Wednesday 3 January 2018

Merging a branch using git desktop...

learning from here: https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging
Seems to make sense to update devel branch from master first...

This worked.

Also both master and devel branch pass build on Travis - GOOD!


Now try to merge branch....

https://www.attosol.com/create-and-merge-branches-using-github-desktop-client/

tells us to Create a Pull Request

Then:
Compare
Update
Sync

Tuesday 2 January 2018

Not doing this but I should...

https://www.bioconductor.org/developers/how-to/useDevel/

Addressing comments from Bioconductor...

A few relatively minor comments:

"Looks good. Just a couple of comments -
  1. LazyData: true
    Any particular reason why you're setting this to 'true'? I ask because we've seen this cause problems (long delays) when loading packages with substantial data. My recommendation would be to leave this as 'False'.
  2. Both httr and ggplot2 are imported in DESCRIPTION. They should be selectively or fully imported in the NAMESPACE."




Changing LazyData: false means adding data() functions before each command in examples as mentioned here: http://kbroman.org/pkg_primer/pages/data.html
No good reason not to do this so - DONE. 

Using the Roxygen tags to @import ggplot2 and @import httr at the appropriate times changes the NAMESPACE in the appropriate way. 
Advice here:
Once, I worked out how to do this - DONE. 

So basically all done - testing and version bumping required.