Showing posts with label books. Show all posts
Showing posts with label books. Show all posts

Wednesday, November 23, 2011

Tie-dying your charts: inserting backgrounds in R plots

Ben Bolker (author of a great R ecology text book) just put out a cool chunk of code that lets you add some fancy touches to charts. The overall goals was make R do some of the fancier - and admittedly pointless - things Excel does. This includes background images on plots, rounded corners on plots, and shadowed points.

Tuesday, November 22, 2011

Webscrapping baby names


This exercise in webscraping and plotting with ggplot, courtesy of the Command-Line Worldview blog, reminds me of the chapter in Freakanomics where these discuss trends in -- and trendy -- baby names.

Monday, November 14, 2011

Handy book for using a Mac efficiently



A handy book for new Mac users trying to whip your Mac into shape is My MacBook by John Ray. While much of what it covers is VERY basic it has tons of hints and walk through for dialing in features like Expose, Spaces, and Finder.

My Mac has been bogging down as it enters its third year of use and particularly helpful was the bit on using the Disk Utility feature to repair disk permissions, which I suspect is one reason why things are bogging down

Sunday, November 6, 2011

The Unix shell in Macs


After working through Practical Computing for Biologist, I've been turned on to using the Linux shell on my MacBook. A immediately useful feature is being able to run a while script in R without having to open the file.

A short and helpful book for learning more about the shell is Learning Unix for Mac OS X, 2nd Edition from O'Reilly. This was published in 2002 and and is superseded by more recent editions on Tiger and Leopard, but for beginners and dabblers I'm guessing this older (and cheaper) edition is probably just fine (Isn't one of the reasons to use Linux is that it doesn't change much?).

Thursday, November 3, 2011

A Primer on Scientific Programming With Python by Jans Pette Langtangen

A Primer on Scientific Programming With Python by Jans Pette Langtangen is the standard introductory text for the field. The second edition was published in 2009 and apparently contains important updates for the newer versions of Python. Langtangen's follow up book is Python Scripting for Computational Science (2010). He also has several scary-sounding books on "computational differential equations"

Wednesday, November 2, 2011

Beautiful Code from O'Reilly

Beautiful Code: Leading Programmers Explain How They Think (2007) has several chapters that relate to the deeper logic behind scientific programming. While not related to the everyday chores of applied programing and statistics, these look like they would be useful for appreciating what goes on under the hood of well-designed programming languages, packages, and functions.

Chapter 1: "A regular expression matcher" by Brian Kerigham (one of the luminaries of computer science), dissects a simple regular expression editor written in C and extends a discussion on regular expressions started started in his book The Practice of Programming.
Chapter 4: "Finding things," by Tim Bray, also deals with regular expressions.
Chapter 14: "How elegant code evolves with hardware: the case of Gaussian Elimination" discuss some of the mechanics behind computation of systems of linear equations.

Two chapters focus on aspects of how Python works:
Chapter 18: Python's dictionary implementation: being all things to all people
Chapter 19: Multidimensional iterators in Numpy

And two chapters relate specifically to the design of bioinformatics tools.
Chapter 12: Growing beautiful code in BioPerl
Chapter 13: The deign of the Gene Sorter


Also in this series of books is Beautiful Data.

Friday, October 28, 2011

"Shebang" lines in Haddock and Dunn 2010

I've noticed a few minor typos in Chapter 9 of Haddock and Dunn's Practical Computing for Biologists. As already noted on their errata, pg 151 has an extra space in the Shebang line.

The line appears as
#!/ usr/bin/env python

with a space between the "/" and "usr/"

It should be either
#! /usr/bin/env python

with a space between "!" and "/user"

or
#!/usr/bin/env python

With no spaces at all.

This is the first time I've had any problems with the code, making the book a breeze to work with.

Thursday, October 27, 2011

Rocking the Shell: Basic Mac OS X Shell commands

I'm using Haddock and Dunn's excellent Practical Computing For Biologists to learn how to use the "shell" to access files on my Mac.

Here are the basic shell commands they discuss in Chapter 4. I'm only annotating those that don't have an analog in R, or that I don't remember from using the DOS prompt on my family's 386 desktop back in the '90s!

Directory/file information:
ls
ls -a
ls -l
ls -l -a
pwd

Navigation:
cd ..
exit

View files
cat
less -- view text files
man -- view "manuals"/help files

Directory/file manipulation
mkdir
rmdir
cp -- copying files
mv -- moving files
rm

Misc.
alias -- in your bash_profile; creates shortcuts
chmod -- "change mode"
cat .bash_profile -- print the contents of the file that set your shell settings
echo $PATH -- print the locations where the shell looks for programs to be located
which -- shows the location of a program or command is stored
curl --
"see URL"; download web data
wc
file -- character, word, and line count for a file
history

history | grep "search" -- "pipe" your command history over to grep and have grep locate commands with the term "search" in them.


Curl
-0 -- output operator


Modifiers to grep
-i -- ignore case of search term
-v -- "not" or "except"
-c
-E
-l
-n
-h

Sunday, October 23, 2011

Corrections in Roff (2010) Modeling Evolution: An Introduction to Numerical Methods


I just started working through Dr. Derek Roff's newest book, Modeling Evolution. Overall the book is great, but my printing has a lot of typos and (as of page 49) some missing lines of code.

There is updated code on his webpage on the bottom in a Word file. Everything I've cross-checked appears to be good in the version posted on the site.

Tonight I was working on plotting a 3D surface with code from page 49 of chapter 1. The plot, shown above, is cool, but I could not figure out what was missing from the code in the book. I eventually was able to reproduce the graph in the book (Figure 1.9, page 50) using code that is similar to that posted on his website.

The correction occurs on page 49. In the middle of the page the text should read:

"Same lines as previously except for deletion of plotting codes

mean(Npop.Sizes[900:1000])

} # End of function MAIN.PROG"


The "mean(Npop.Sizes[900:1000])" Is missing from the book.

Software Carpentry Reading List

A post-doc in my department just pointed me towards softwarecarpentry.org as a place to learn more about using Python, and for resources for applied programming in general. They have a long, annotated book list which I've whittled down to books that look most applicable to Python and data manipulation.

Data Munging with Perl

Practical Programming: An Introduction to Computer Science Using Python

SQL by Chris Fehily

Python Scripting for Computational Science

A Primer on Scientific Programming with Python

Learning Python: Powerful Object-Oriented Programming

Tuesday, October 18, 2011

Programming With Data: A Guide to the S Language


Book: Programming With Data: A Guide to the S Language
by John Chambers
published 1997

This is one of the definitive books on programming with R and S, by the architect of S. It alternates between the esoterica of programming and brilliant explanations of how S and R work.

Chambers more recent book Software for Data Analysis (Springer, 2008) appears to be a re-working and updating of Programming With Data, bringing the content into focus on R.


Its call number at the University of Pittsburgh is
Information Sciences: QA 76.9.A25 F77 1998

Book: A First Course in Statistical Computing

Book: A First Course in Statistical Computing
by W. John Braun and Duncan Murdoch

162 pages

Used copies start at $15

This looks like a good introduction to advanced topics, but is a relatively short and lean book, so its depth is necessarily limited.

The latter chapters provide some advanced topics
Chapt/Title/Topics
5 / "Simulation" / Monte Carlo simulation/integration
6 / "Computational Linear Algebra" /
7 / "Numerical Optimization" / Newton-Raphson, Linear Programming

Its call number at the University of Pittsburgh is
Hillman: QA 276.45 R3B73 2007