Friday 30 June 2017

Mac Library folder and fonts...

Your Mac Is Hiding Your Library Folder
https://www.lifewire.com/g00/os-x-is-hiding-your-library-folder-2260833?i10c.referrer=https%3A%2F%2Fwww.lifewire.com%2Fg00%2Fhow-to-manually-install-fonts-on-mac-2260815%3Fi10c.referrer%3Dhttps%253A%252F%252Fwww.google.co.uk%252F



Adding a font manually

https://www.lifewire.com/g00/how-to-manually-install-fonts-on-mac-2260815?i10c.referrer=https%3A%2F%2Fwww.google.co.uk%2F

Thursday 29 June 2017

Selected links from browser...

Testing

  • https://tgmstat.wordpress.com/2013/06/26/devtools-and-testthat-r-packages/
  • http://r-pkgs.had.co.nz/tests.html
  • https://itsalocke.com/the-making-of-datasaurus/

  • https://cran.r-project.org/web/packages/purrr/purrr.pdf
  • https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html

ggplot extension
http://www.ggplot2-exts.org/gallery/

link to uniprot api
https://www.ebi.ac.uk/proteins/api/doc/#/proteins

stargazer - to make output from R prettier?
https://www.princeton.edu/~otorres/NiceOutputR.pdf

plotting polygon 
https://github.com/tidyverse/ggplot2/wiki/plotting-polygon-shapefiles

Ope's package
https://cran.r-project.org/web/packages/PLSbiplot1/index.html


Dot plots in R
http://www.sthda.com/english/wiki/ggplot2-stripchart-jitter-quick-start-guide-r-software-and-data-visualization
http://www.eighteenchains.com/lake-chad-basin
https://stackoverflow.com/questions/35226008/add-pair-lines-in-r

Wednesday 28 June 2017

Managed to plot output from multiple from base R and ggplot... not perfect yet...

 This is the output - 3 rel sequences in base R


This is the output - 3 rel sequences in ggplot2 using geom_rect()


Good - some progress...



Three human rel proteins



Q04864 (REL_HUMAN)

 
Q04206 (TF65_HUMAN)

Q01201 (RELB_HUMAN)

proteins_acc <- c("Q04864", "Q04206", "Q01201")

For the API, no spaces between the commas

Tuesday 27 June 2017

Plan to extend drawProteins to draw multiple proteins (and testing)....

Challenges to think about in terms of drawing multiple proteins 

So test case:
Draw three rel A family members:

(do we want one data.table for each or all three combined? but then we have a name for each protein)...

Need to arrange names on left (default) - option on right or space more?

Divide window vertically by three (number of proteins)..
Scale y axis to longest
Conserve colour of domains - how.

Other ideas:

  • add a custom domain 
  • Add other PTMs, conflicts, etc....
  • Change plotting so domains are slightly wider than chain. 
  • Colour chain... 
  • Scale by area not length...



N.B. What about p105? Two isoforms? How does my API handle this?
TEST/investigate

N.B. Better to focus on improving minimal deliverable unit rather than getting into interactions at this time, I think...



For testing - have some data within github - within package
For example a JSON object...
Transform it into a data.table
Check that they are the same....

Can I get a plot object and check that?

drawProteins package...

So very excited that I have been able to make my first R package.

I've really enjoyed the learning curve.

More to do of course.

Testing, vignettes...

Draw multiple proteins, I suspect - play with API more?

I wonder about using ggplot as the output rather than base R.

I can probably use
geom_rect()
http://sape.inf.usi.ch/quick-reference/ggplot2/geom_rect

maybe :
https://stackoverflow.com/questions/6862742/draw-a-circle-with-ggplot2
geom_circle() in the ggforce package....

Somebody else grappling with this....:
http://dozenoaks.ghost.io/ggplot2-to-plot-proteins/




Web pages with help about making packages...

Package Root

Got an error message about not being able to find "package root" because I hadn't got the path to the package.
Need to point to the path that contains the package file and all the documentation.
At the moment, I am loading from github not local.


Roxygen tags and NAMESPACES


My first deploy gave me functions from one .R file but not the other.
I needed to add info to the NAMESPACES. This is done by Roxygen but requires the addition of Roxygen tags.
Link about NAMESPACES here:
http://r-pkgs.had.co.nz/namespace.html

Link about Roxygen tags here:
http://kbroman.org/pkg_primer/pages/docs.html

Key was the addition of a Roxygen tag  to each function in the .R file.
#' @export

Detail in the Workflow section on Hadley's Packages book:
http://r-pkgs.had.co.nz/namespace.html#namespace-workflow

Cut and paste:
"The workflow is the same:
  1. Add roxygen comments to your .R files.
  2. Run devtools::document() (or press Ctrl/Cmd + Shift + D in RStudio) to convert roxygen comments to .Rd files.
  3. Look at NAMESPACE and run tests to check that the specification is correct.
  4. Rinse and repeat until the correct functions are exported."

Still have lots to do. Most importantly testing, vignettes and licencing. 

Useful blog post here: 


Stef's post (very inspiring):


Next steps:
  • Adding testing:  http://r-pkgs.had.co.nz/tests.html
  • Adding Vignette






Wednesday 7 June 2017

Interesting link about making maps in R...

http://eriqande.github.io/rep-res-web/lectures/making-maps-with-R.html

Also talks about ggmap


Making all the different graphs use the same scale ...

Use the
limits=c(1, 8)
argument.

https://stackoverflow.com/questions/21537782/how-to-set-fixed-continuous-colour-values-in-ggplot2