Jan 5, 2018 - Labkey Via Wget

Accessing LabKey resources from the wget/curl

LabKey has good API support for most of its resources, but I recently needed to download blobs in a LabKey database (.fcs flow files) that didn’t have any obvious API support. For some resources, LabKey will accept credentials via HTTP auth, but for others authentication occurs solely via a session cookie. These blobs appeared to only authenticate with the session cookie.

This session cookie is called JSESSIONID, and you can look it up in Chrome->settings->cookies->details or by browsing to: chrome://settings/cookies/detail?site=<LABKEY SERVER URL>&search=cookie . Grab the JSESSIONID “content” and then add it to your wget command line:


Sep 22, 2017 - Hygiene Of The R Library Path

Some further commentary on proper hygiene of the R library search path (especially w/r/t MacOS)


Only put stable, universal packages in the default R system library (/Library/Frameworks/R.framework/Resources/library). Write protect it to enforce this policy.

Long version:

  1. By default, not-root has write permissions to the default R system library
  2. There’s no way to remove the default R system library from R’s search path, that I can tell, on Mac OS.
  3. If a package is present at the default R system library, biocLite will try to update and over-write the package at this location, rather than adding a new version atR_LIBS_USER. Hence ignoring the search order in .libPaths() and argument lib.loc.
  4. Therefore, to avoid unintentionally altering your configuration, change the permissions of the R system library so that you can’t casually write there (eg with sudo chmod -R 755 /Library/Frameworks/R.framework/Resources/library)
  5. Now, however, if a package is present in the now write-protected site library, biocLite and install.packages will moan and die about a lack of permissions, rather than falling back (well, actually forward) to a write-able, higher-order location in .libPaths().
  6. Therefore, move all packages that you might have to manage on a per-project basis to a separate, user-writable folder, and set this as R_LIBS_USER in your .Renviron file.
  7. Now you may override or add to this value on a per-project basis.

Apr 25, 2017 - Blogoverflow

Blogoverflow: those pesky unix idioms that you keep googling

Mainly relating escaping shell globs, it seems. Maybe next time I will find my own blog?

Rsync only files matching the pattern “*.R”

sh rsync -rv --include="*/" --include="*.R" --exclude="*" . bluehive:HurdleNormal/

Remove non-printable characters from a text file

sh perl -i.bak -pe 's/[^[:ascii:]]//g' lecture3-variance-bias-crossvalidation.Rmd