All Together Now

In the lab we use IgorPro from Wavemetrics for analysis. Here is a useful procedure to plot all XY pairs in an experiment. I was plotting out some cell tracking data with a colleague and I knew that I had this useful function buried in an experiment somewhere. I eventually found it and thought I’d post it here. I’ll add it to the code section of the website soon. Looking at it, it doesn’t look like it was written by me. A search of IgorExchange didn’t reveal its author, so maybe it was me. Apologies if it wasn’t.

The point is: if you have a bunch of XY pairs and you just want to plot all of them in one window to look at them. If they are 2D waves or a small number of 1D waves, this is straightforward. If you have hundreds, you need a function!

An example would be fluorescence recordings versus time (where each time wave is unique to the fluorescence trace) or XY co-ordinates of a particle in space.

To use this procedure, you need an experiment with a logical naming system for 1D waves. something like X_ctrl1, X_ctrl2, X_ctrl3 etc. and Y_ctrl1, Y_ctrl2, Y_ctrl3 etc. Paste the following into the Procedure Window (command+m).

Function PlotAllWaves(theYList,theXlist)
	String theYList
	String theXList
	Variable i=0
	string aWaveName = ""
	string bWaveName = ""
		aWaveName = StringFromList(i, theYList)
		bWavename = StringFromList(i, theXList)
		WAVE/Z aWave = $aWaveName
		WAVE/Z bWave = $bWaveName
		if (!WaveExists(aWave))
 		appendtograph aWave vs bWave
		i += 1

After compiling you can call the function by typing in the Command Window:

PlotAllWaves(wavelist("x_*", ";", ""),wavelist("y_*", ";", ""))

You’ll need to change this for whatever convention you are using for your wave naming system. You will know how to do this if you have got this far!

This function is very useful for just eyeballing the data after you have imported it. The databrowser shows only one wave at a time, but it is preferable to look at all the waves to find errors, spot outliers or trends etc.

Edit 28/4/15: the logical naming system and the order in which the waves were added to the experiment are crucial for this to work. We’re now using two different versions of this code that either a) check that the waves are compatible or b) concatenate the waves into a 2D wave before plotting. This reduces errors in plotting.

The post title is taken from All Together Now – The Beatles from the Yellow Submarine soundtrack.

A Day In The Life

#paperoftheday #potd

A common complaint from other PIs is that they “don’t read enough any more”. I feel like this too and a solution was proposed by a friend of a friend*: try to read one paper per day.

This seemed like a good idea and I started to do this in 2013. The rules, obviously, can be set by you. Here’s my version:

  1. Read one paper each working day.
  2. If I am away, or reviewing a paper for a journal or colleague, then I get a pass.
  3. Read it sufficiently to be able to explain it to somebody else, i.e. don’t just scan the abstract and look at the figures. Really read it and understand it. Scan and skim as many other papers as you normally would!
  4. Only papers reporting primary research count towards #paperoftheday.
  5. If it was really good or worth telling people about – tweet about it.
  6. Make a simple database in Excel or Papers – this helps you keep track, make notes about the paper (to see if you meet #3) and allows you to find the paper easily in the future (this last point turned out to be very useful).

I started this in 2013 (for one full year) and am trying to continue in 2014. I feel that this is succeeding in making me read more than I would have otherwise done.

My stats for 2013 were:

  • 85% success rate. Filling that last 15% will be tough.
  • Stats errors in 48% of papers! Most common error was incorrect use of Student’s  t-test.
  • 68% of papers were from 2013 and 22% were from 2009-2012.

The big surprise was which journals I read most:

  1. J Cell Biol 13
  2. PLOS One 12
  3. Nat Cell Biol 10
  4. PNAS 10
  5. Curr Biol 9
  6. Mol Biol Cell 8
  7. Nature 8
  8. Dev Cell 7
  9. eLife 7
  10. Nature Methods 7
  11. Cell 6
  12. Neuron 6
  13. Traffic 6
  14. J Cell Sci 4
  15. Science 4

I thought that Cell would be much higher and PNAS would be much lower. Since where we publish is dictated by who is likely to see and read the paper, this list was thought-provoking.

*I think this was a colleague of @david_s_bristol who suggested it, sometime in 2012.

The post title is of course from A Day in The Life – The Beatles from the LP Sgt Pepper’s Lonely Hearts Club Band. For the first line…

So Long

How long does it take to publish a paper?

I posted the picture below on Twitter to show how long it takes for us to publish a paper.


The answer is 235 days. This is the median time from submission at the first journal to publication online or in print. The data are from our last ten papers.

The infographic proved popular with 40 retweets and 22 favourites. It was pointed out to me that the a few things would improve this visualisation:

1. Showing the names of the journals

2. Showing when the 1st submission was relative to the 1st submission at the journal that finally accepted the paper

3. What about reviews and other types of publication.

I am working on updating the graph to show all of these things… watch this space.

My point was really to show (perhaps to non-scientists) how long the process of publishing a paper can be. There is other information that can be gleaned from this, e.g. what proportion of time is at the journal’s side and how much is at our end?

The people who are eager to see which journals perform badly (slowly) will be disappointed: this is a very small subset of papers from one lab. I’d be interested in scraping the information on journal tardiness on a larger scale and synthesising this so that it can inform journal choice. Recently though major publishers have taken steps to make this information less accessible so don’t hold your breath.

The title of this post is from So Long by Cian Ciarán from the LP ‘Outside In’

Counting backwards

I thought I would start add a blog to our lab website. The plan is to update maybe once a week with content that is too long for twitter but doesn’t fit in the categories on the lab website. I’m thinking extra analysis, paper commentaries, outreach activities etc. Let’s see how it goes.

First up: how do you count the number of words or characters in a text file?

Microsoft Word has a nice feature for doing this, but poor old TextEdit does not. Fortunately, AppleScript can come to the rescue! I found a script on the web to count the number of words in a TextEdit file and modified it slightly to give the number of characters as well.

Why would you want to do this? When editing fields on a web form (particularly grant application forms) it’s not practical to do this in the browser and these fields often have strict limits on words and characters.

Here is the code:

tell application "TextEdit"
	set wc to count words of document 1
	set cc to count characters of document 1
	if wc is equal to 1 then
		set txt to " word, "
		set txt to " words, "
	end if
	if cc is equal to 1 then
		set txtc to " character."
		set txtc to " characters."
	end if

	set result to "This text comprises " & (wc as string) & txt & (cc as string) & txtc
	display dialog result with title "WordStats" buttons {"OK"} default button "OK"
end tell

If you are new to this: open AppleScript Editor. New file. Paste in the code above. Click Compile. It should look something like this:



Now Save it to your Scripts folder in home/Library. Call it something sensible e.g. TextEditCounter. Now, in AppleScript Editor. Click Preferences and check the box ‘Show script menu in menu bar’. This shows the AppleScript icon in your menu bar and if you click there, you should see your script there waiting for you to use it.

This blog title is taken from Counting Backwards – Throwing Muses from their LP The Real Ramona.