Archives for cmbarbu

libPath in R fucked up

In case of libPath not working correctly, something like that should do the trick:

mkdir -p ~/R/x86_64-pc-linux-gnu-library/3.4

And add in ~/.Renviron

R_LIBS_USER=${R_LIBS_USER-‘~/R/x86_64-pc-linux-gnu-library/3.4′}

Remote graphics on linux server

So you have a great ubuntu server running somewhere and you want to display graphics from the server?

Visualize the current user desktop

That is actually really easy through VNC in ubuntu:

  1. On the server use Desktop sharing (simply enter “Desktop sharing” in the Dash)
    1. click on “Allow users to see your desktop”
    2. click on “Require … password” and set a password
    3. Give the ip address (click on the screen icon at the top of your screen to see it) and the password to the person
  2. On the (ubuntu) client
    1. start “Remote desktop viewer”
    2. select VNC protocol, enter IP address
  3. User on the server need to accept the connection

All set! I used these more complete instructions.

Open an independant graphic session

The problem with the vnc approach is that you cannot have two different users on the same server at the same time.
The best option I found for now is to use xRDP, the windows protocol. The set up is very well described here. Hereafter a short summary.

Server set up

It requires to install xrdp and xfce4 on the server, It’s quick, don’t worry:
sudo apt-get install xrdp xfce4

Then for each user allowed to connect simply run users terminal:
echo xfce4-session >~/.xsession

When done for all users, restart xrdp:
sudo service xrdp restart

Then give the ip to the users, you can get it in the terminal with hostname -I.

Client connection

  •  Windows: simply open “Desktop client”, enter your ip address and user name on the ubuntu machine
  • Ubuntu: I recommand installing Remmina
    • Be sure to choose “RDP” protocol, enter IP and linux user name
    • play with the options to make sure you have the best possible experience with your network
  • RDP should work ok under mac but I didn’t test it (yet)
    • Install from the mac app store
    • start it and enter IP and linux user name
    • Works ok but for non qwerty keyboard that are not correctly recognized

With a ubuntu client this is the best experience I had (careful though, if the user is already connected graphically, some softwares may not like to be relaunched, firefox typically doesn’t like it).

Just launch graphic application through ssh (slow)

If nothing else is possible, you can always to simple X11 forwarding under ssh, but it’s slow.

Specific linux client

None.

Specific mac client

You need to first install XQuartz
Then open XQuartz.app, and in the terminal follow intructions for all clients.

Specific windows client

Install putty, and enable X11 Forwarding

All clients

In the terminal:
ssh -X myserver
Then you can test xdisplay with
xclock
You can even launch a file explorer:
nautilus
It’s real slow for the set up but then file exploration is ok.
This solution still is really slow (try for example plotting complex graphics in R…

Are we more bacteria than human ?

Didn’t you have this discussion with your scientific minded friends: so many bacteria in your intestine, on your skin etc. that actually you may be more bacteria than human? I sure had this discussion with two Ivy League university professors who were 100% sure there was more bacteria than human DNA in the typical 70kg man.

So what are the orders of magnitude?

A recently published PNAS article sets the records straight:

  1. There are slightly (<3%) more bacteria than human cells in a human body
  2. Their total mass is 350 times less than that of human cells

That implies that total DNA content is about 1000 times less than total human DNA as the number of cells is about the same and the human genome at ~3 billion base pair is 1000 times the typical bacterial genome size.

Of course that’s without counting mitochondria which might be considered as endosymbiotic bacteria.

So sure, bacteria in a human body are important, but not completely overwhelming our “own” genetic information :-)

tmap R package

R has been my environment of choice for plotting spatial data for some time now and this great piece of software got even better with the tmap package.

It easily allow to plot maps such as :

Screenshot from 2015-11-06 12:38:55

You plot using the function `qtm` and can easily customize the map by providing options to intuitively named subroutines such as tm_fill.

I specially love the different algorithms proposed to choose the classes for the legend, quantiles, k-means … You can simply plot the above with:


library("tmap")
data(World)
qtm(World,fill="pop_est_dens",fill.style="quantile",
fill.palette="Blues")

where fill simply is the name of the field in the data frame, fill.style is the algorithm used to make the classes of colors and fill.palette the name of the pallette that can be checked up using :

RColorBrewer::display.brewer.all()

Check up the help for tm_fill to understand the fill.xxx parameters!

Two thumbs up for tmap!!!

News coverage for the access to care in Philadelphia study

Wednesday, May 8th was the official release date for the report on access to primary care in Philadelphia.

We’ve got some nice coverage of our study by the LDI periodical of course but also by NewsWorks and Philly.com (Philadelphia Inquirer).

Cheers!

Quick and easy cartography with “My Maps”

For quick and easy cartography, “My maps” service from Google allows to make and publish online maps.

Adding features

A csv with coordinates can easily be uploaded. It also supports drawing of points, polygons and polylines on multiple layers.

Maps are easily modifiable using a smartphone: a must have for field cartography :-)

Export

Note that the export format is kml/kmz. The kmz exported can be unzipped with any zipping utility returning a kml. The kml can be imported directly in R using readOGR in the the rgdal package. It can also be imported in QGIS and from there exported to many formats.

Delivery of the review report on Access to Care in Philadelphia

This significant expertise on the access to primary care in the Philadelphia, PA involved several of our key know-how:

  • Data Management with merging of practitioners and population information from over 10 data sources
  • Spatial analysis based on driving distances
  • Cartography with the constitution of interactive Google maps involving spatial statistics under the hood
  • Web development to interface the whole

It is reaching an end with the recent delivery of the review report.

Our next steps are to:

  1. Make available online the interactive map engine, without proprietary data :-)
  2. Publish in medical journals the key findings of the study (yes, access to care has social determinants…)

We will keep you posted.

Cheers!