Monday, December 28, 2009

Enable X11 Forwarding in MacOS

e.g. to use the GIMP,
edit field `X11Forwarding' in file `/etc/sshd_config'

See: http://developer.apple.com/qa/qa2004/qa1383.html.

Showing all files in MacOS Finder


defaults write com.apple.finder ShowAllFiles TRUE
killall Finder

Monday, December 21, 2009

Normalizing Affymetrix Data with bioconductor


#!/usr/bin/env Rscript
# Normalize a set of CEL files

## Note: To use biocLite packages (i.e. 'affy,' 'rma()', ...), it may be
# necessary to do a one-time [re-]install of the related packages. This can be
# done with the following sequence:

# > source("http://bioconductor.org/biocLite.R"); # Tell R where to download package info from
# > biocLite(); # Update biocLite package grounds. This turns out to be necessary 1-time step before a call to rma(...), which requires up-to-date biocLite library functions
# > biocLite("affy"); # d/l, install 'affy' package (1-time req. only)

library("affy");
# We'll be using this library

# Read CEL files
filenames <- list.files("path/to/CEL", full.names=TRUE);
affy.data <- ReadAffy(filenames=filenames, verbose=TRUE);

## Normalize using RMA
write.table( exprs( rma(affy.data, verbose=TRUE)), file="rma.matrix", sep='\t', quote=FALSE); # file="" to write to stdout, but watch for verbose output from rma(...) and/or ReadAffy(...)

## Using Quantile Norm (this post is edited--the old way didn't collapse measurements per probe)
library("affyPLM")
eset <- threestep (affy.data, background.method="IdealMM", normalize.method="quantile", summary.method="tukey.biweight" )
write.table(eset, file="qnorm.matrix", sep='\t', quote=FALSE)
# for some reason, this transposes the data and adds an "X" in front of every numeric probe ID?

Friday, December 4, 2009

Recursively downloading from an FTP site


  1. ncftp

    $ sudo port install ncftp
    $ cd ~/Downloads/uci
    $ time ncftpget -R -v -u "anonymous" ftp.ics.uci.edu ~/Downloads/uci pub/machine-learning-databases


    So far, I'm not finding this to be doing a very good job of being recursive.

    Source:
    http://www.cyberciti.biz/tips/linux-download-all-file-from-ftp-server-recursively.html

  2. wget


    $ sudo port install wget
    $ cd ~/Downloads/uci2
    $ time wget -r ftp://ftp.ics.uci.edu/pub/machine-learning-databases

    Source: http://www.editcorp.com/Personal/Lars_Appel/wget/v1/wget_7.html, http://www.gnu.org/software/wget/manual/html_node/Recursive-Download.html.
    See also: gwget


Tuesday, December 1, 2009

Installing LaTeX on a Mac

Download and unzip MacTeX.mpkg.zip from http://www.tug.org/mactex
and run the mkpg.

Monday, November 23, 2009

Using rsync (ssh) on a nonstandard port

Use the --rsh option


$ rsync <options> --rsh='ssh -p<port>' "joe@coolhost:/Users/joe/foo\ bar/..." "/local/path/..."

Sunday, November 22, 2009

Using Pacifist to uninstall a program (MacOS/Tiger)

New versions of Safari crash immediately for me, so I stick with 3.2.1 (Tiger). I can't update iTunes, either, because newer versions of iTunes require a newer version of Safari (for the iTunes store).

If I want to install an old version of Safari, Mac won't let me because there's already a newer version, but how to get rid of that?

Solution: Remove with Pacifist (e.g. Pacifist_2.6.dmg)

Directions:
Mount Safari 3.2.1 dmg package,
Run Pacifist.app,
Open Safari 3.2.1 package,
Select the lot,
Click install,
(Choose "Replace" when asked about the other version)

Embedding fonts in a PDF

For papers that require a PDF with all fonts embedded, often the fonts in PDF figures (imported via pdflatex) are not embedded (I have this problem with my figures created from gnuplot that use Helvetica). This trick worked nicely to convert the figure to one with Helvetica embedded (and pdflatex takes care of the rest)

gs -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=letter -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=fig/figure1-embeddedfonts.pdf -f fig/figure1.pdf

Source: http://colinm.org/tips/latex

Followers