Thursday, December 15, 2011

Productivity in writing, and otherwise

I just read a wonderful post by writer Rachel Aaron (whom I haven't read anything by) about how she boosted her writing from 2000 words per day to over 10000. Yes, that is right, the equivalent of two articles per day. However, she is a novelist, not a scientist. What she suggests is that if you just try to make sure you have three things in place before you actually start writing, you can be much more productive.

Those things are:

  1. Know what you are going to write.
  2. Track how much you are writing.
  3. Get excited about what you are writing.
Sounds pretty straight forward. Number one is easy, there is a way you are supposed to write your articles. It is known as the IMRAD-format:
I ntroduction
M ethods
R esults
A well kept secret
D iscussion
Each of the sections have fairly well established patterns. Like the introduction:
Sentence describing a public ill. Sentence tying said ill to something vaguely connected with present study. Sentence about how present study is novel and interesting. 
New paragraph describing the actual background of the study. 
A paragraph describing what has actually been done. 
Final paragraph stating the aim and hypothesis of the study in a way that fits with the conclusion without giving it away.
The second point is more difficult. The end result of a day's writing may be a section of an article, say the abstract, that is 250 words. But in actuality you have probably written more like 1000 words, and thrown most of them away. So, given the word-limits of scientific articles, how do you track how much work you get done?

The third point is easy the first time, but then you re-write, submit, get refused, re-write, submit, get a revision, re-write, re-submit, get refused, rewrite... At some point here you aren't so excited anymore, and that is when you pick a bottom-line journal and submit one last time suggesting your best friends as reviewers.

 The strategy is also applicable to lab-work, teaching  and many other things.

  1. Know what you are going to do in the lab.
  2. Track how much you are getting done.
  3. Get excited about the work you do.
Anyway, I think her post is more well-written. You should read it.

Sunday, December 11, 2011

How many hits do you want?

Data mining is a huge business today and also an area of intense investigation. After an intense week of trying to compare gene-expressionmicroarray data from different experiments during my recent spout in Glasgow, I thought I would share some thoughts on analysis methods. Basically the choice comes down to the number of hits you might want, which in-turn is decided by how you intend to analyse and validate your results.

With modern high-throughput methods one of the main problems is choosing candidates for validation and further study. As long as you are just doing PCRs for validation, you can run quite a number, but proper validation will often require knock-out, and/or knock-in experiments, possibly both in-vivo and in-vitro. Picking the wrong candidate can cost you years of work. So, you had better be correct when you make your decision. This is a reason that it is common to filter high-throughput data by the size of change. Whether that is advisable depends on what you want to do with the data. Modern high-level data analysis often works much better if you have more to work with. Not to mention that many of the new methods of analysis are designed to look for systems of changes, each of which may be negligible, that together may cause significant physiological effects.

The calculation of a p-value comes in two steps. First you calculate a value and then you correct that value for multiple comparisons.
  • Anova: Mathematically elegant but computationally heavy and quite strict, producing not so many significant hits. It also depends on there being similar variations and similar number of samples per group.
  • Rank product: Basically ranks each gene in each sample multiply these across samples and compares the results to similar products from randomly generated datasets. Of all the heavy methods this is one of the heavier. i.e. long computations times.
  • Empirical Bayesian methods: I won't say I understand what exactly this does, but it is described as "reducing the standard error toward a common mean." This means that you are in the end comparing the estimates of the means of your samples, i.e. a variant of Student's T-test, but one that somehow takes the rest of your expression data into account. This is a quick method that is also well regarded.
  • T-test: Your favourite statistical test, seldom used by itself in microarrays, se SAM for more details.
  • SAM: Significance Analysis of Microarrays, using T-tests to test the contrast of interest and compare it to other permutations of the samples. If the contrast of interest shows a better significance (by a set level) than the random configurations then it is deemed significant. Depending on the number of permutations you use the analysis is more or less computationally heavy, but it does by necessity take quite a bit of processing.
  • Signal to noise ratio: You basically divide the the mean (difference in mean) by the standard deviation. This in itself does not produce a P-value, but it does provide a way to rank genes that can be used to pick the most probably changed genes. If you compare the list you get to lists produced by random permutations of your data, then you can produce proper p-values, but that makes it more onerous.
Once you have your p-values, they have to be corrected for the number of comparisons. The thing is that if you use a probability of chance difference cut-off of 5%, as is common, fully 1/20th of your significant genes are probably false-positives.

When correcting your p-values the first important distinction (that many are not aware of) is post-hoc versus à-priori. Mostly these relate to how to test samples after an ANOVA. Post-hoc testing means that you do not know which comparisons you want to make, so you just make them all. 
For example: You want to assess the effect of a treatment on two populations, say men and women. 
This gives rise to four groups: untreated-men, treated-men, untreated-women and treated-women. Or, you may even have before and after measurements in each of these, giving you eight groups. Between four groups there are six (x*(x-1)/2) possible comparisons, and between eight groups there are 28. If you correct your p-value for all these you may introduce a lot of false-negative results, i.e. expression changes that really are there, but that does not make your corrected cut-off. However, many of these comparisons may be nonsensical.

The difference between untreated-men-before-treatment to treated-women-after-treatment, could be one such example. It is difficult to interpret without knowing what the baseline for the women was. What you can do in this kind of situation is decide à-priori (eng. beforehand) to only run some of the comparisons. 
For example: You compare men to women before treatment, before and after treatment only in the same group, the change between before and after only within each sex, and the difference between the changes in the treated and untreated men to the same difference in women*.
This is only eight comparisons out of the possible 28, and some of these would not be included in the 28 at all, i.e. the differences. By cutting the number of comparisons you also cut the correction you have to make to your p-values. In addition, you can argue that the absolute differences are independent from the change caused by treatment and correct these comparisons separately, giving you only a four-fold correction to your p-value instead of a 28-fold. 

Anyway, that was only corrections between groups for one parameter. In a typical microarray experiment you will have 20000 parameters across your groups, so that the total number of comparisons would be 28*20000, or a lot.

Just multiplying your p-values by the number of comparisons was the original and most conservative correction. It is called Bonferroni, because that's the guy who described it. This is generally too conservative and will produce false-negatives even in experiments with a small number of comparisons. However, it is useful for narrowing the number of hits if you think you have too many, or if you need to be really certain of the hits you pick.

The family-wise error rate correction is what ANOVA uses across all samples and it is what post-hoc tests like Tukey's honest significant difference uses for post-hoc testing between individual samples. It is quite strict in large, relatively low signal-to-noise data, like microarrays, but quite relaxed in smaller data-sets. This is difficult to use in à-priori-type designs since these make the estimation of the family-wise variation difficult.

False discovery rate, or FDR, is an iterative correction across a ranked list. Basically, the first hit is uncorrected, the second somewhat corrected and so on. What it is actually saying is that; out of all the genes, from the top of the list to the point you are looking at, a given percentage will be false discoveries. So if you get 3000 with an FDR <0.05 you have 5% or 150 false positives in that sample. This is one of the least strict corrections. It is often used in microarray analysis for that very reason.

The final question is if you correct your FDR values by the number of group-wise comparisons you are doing. Or, maybe you are comparing similar, but independent, experiments, which you could argue strengthens your p-values by as much as p1*p2.

As they say: If it was easy, anyone could do it.

* in this kind of design you should really use a multi-way ANOVA instead of a plain one, and that choice often makes it obvious that you should use à-priori contrasts instead of a post-hoc.

Thursday, November 17, 2011

Shopping in Glasgow

While my trusted side-kick is off on some well deserved shopping I decided to try blogging from the iPhone. It does not seem impossible, although I get to correct myself a lot.

I'm not going to write about shopping in Glasgow, but I am going to mention that the very small Mexican take-out west of the Glasgow Uni is amazingly good. Best fajita east of San Diego as far as I am concerned.

Now, I guess I will have to return to the Uni for the afternoon analysis session.

Monday, November 14, 2011

Traveling noob

I am back in Glasgow, in the same hotel room as last time. It was still cheap, and still quite nice.

Just as with Bergen, it is close to the end of the world. Instead of flying directly, you can choose between Copenhagen, London and Amsterdam; or a combination. This time it was Amsterdam and a five-hour flight and transfer time.

Travelling with an orthosis is really quite alright. Security suddely treats you like a porcelain doll, and everyone is most helpful. It does, however, make it more difficult to manage the transfer when you are 30 minutes late because of fog.

Anyway. Now I must sleep, it's been a 19-hour day. 12 of them actually working. I just hope the rest of the week will be as productive. Might be once I get a new adapter so that I can charge the computer. Noob.



- Posted using BlogPress from my iPad

Location:

Thursday, November 10, 2011

Understanding Criticism

Critique (also known as peer-review) is an integral part of science. You can handle it in two ways. Either you do it the Nazi-way, or in a more civilised way. Alain Briot is a renown landscape photographer who has written several (that's 1, 2, several) books about working as a photographer. In addition he quite regularly writes for Luminous Landscape, one of the premier photography sites in the world. Recently they published his essay "Understanding Criticism", which is what inspired me to write this little blog-post. It is actually a trilogy: Understanding Criticism, Responding to Criticism and the up-coming just published: Staying Motivated, which changed title to "A few words on perseverance."

I think you should read them. Below is just the alternative introduction, so that it is more about science than art. Where criticism in the arts is often a matter of taste and happens after the art as such is finished, criticism is an integral part of the scientific method. Without critique there would be no science.

Alain writes that: "It is the nature of art that we do not all agree on what is art." This is not true about science. There are some easy criteria by which any work or statement can be judged as scientific or not. I think the easiest test is whether it opens up for more research or not. If it purports to be a final answer, then it is probably hyperbole. However, there are still differences of opinion regarding the quality and importance of different areas of science from different perspectives. The to big divides are the natural sciences versus the humanities, and basic versus applied science. These can give rise to unwarranted criticism, although they can also give rise to very interesting questions. Scientific criticism basically involves four valid targets.
  • The rationale.
  • The methods.
  • The conclusions.
  • The presentation.
Note that I do not include criticism of the data as such, because data is inviolable as long as the methods are sound. When receiving criticism it is very important to decide which of the targets are actually under fire. For example: When they attack your rationale, it is often because the presentation of said rationale is weak and difficult to understand.

Finally, there is the unscientific criticism, which I will leave for now. I have to prepare to go to Glasgow to write a new and exciting paper so that I can send it in for organised criticism by highly trained terriers esteemed colleagues. But, seriously read the series.

Monday, October 24, 2011

Illustrating on the iPad

Yes, it is white with a pink cover, and I put it on the boxer.
I finally caved in, or rather my better half did. Now I have an iPad (Ho, Ho, Ho). It's not a machine-gun but affords some other, equally amazing, possibilities, you can surf in bed, surf in cafes, and you can even surf on the loo. Amazing, I say! What I really want it for is drawing. For research-articles there is seldom any real use for drawing, but when writing reviews, presentations, and when teaching, it is indispensable.

Different lecturers and teachers have different approaches, and different students require different teaching strategies, but everything gets better with good pictures. For review-articles and formal presentations you need high quality illustrations, while for teaching I find it better to draw live, so that the students can follow along. There is of course some middle-ground, students that need original data and high-quality illustrations that they get hand-outs of, and formal presentations that can include free-hand drawing.

Anyway, these two ways of working need somewhat different programs, or Apps, as I have understood they are called. Before we start drawing however, one does need an implement. I got the stylish aluminium stylus from "Just | mobile". It has a solid feel, looks stylish (oh, no I said it again), and... well that's it really.

Now, to the actual drawing. Let's start with free-hand drawing that you can use just to show things. There is a multitude of simple drawing programs for the iPad, and you can also use a more advanced application for your quick sketching. The one I got was Bamboo Paper from Wacom (that otherwise makes professional digitisers).

It has three features I like,

1: It organises drawings by notebooks. That means that all drawings and notes from one lecture is automatically connected. They can even be exported directly as a multi-page PDF for use as hand-outs.

2: When connected to an external screen it just shows the drawing area. The controls are only visible on the iPad.

3: The interface is really simple. You can draw, erase and undo/redo. Then pen has three different settings for line thickness and six colours (well, actually three since half the colours are shades of blue).

Let us turn to real drawing and the creation of publication quality illustrations. For this you need two things: a sketching program and a line-art/vector program. The first is necessary because that's how you, or at least I, develop and refine the concept. The second is what constitutes "publication quality", i.e. freely scalable line-drawings that can be output as EPS or PDF, depending on your publisher.

I found two programs for each function with slightly different capabilities. For sketching I got SketchBook from AutoDesk (the maker of AutoCad) and ArtRage. These are two very different programs. Artrage was created to simulate working with real media. You have a wide choice of paper and canvas variants (and can change after the fact), and an equally wide range of simulated media; from   pencil to oil, water-colour and inks. The amazing thing with it is that it simulates how these media behave in the real world. Oil-colour mixes on the canvas, and water-colour bleeds.

Three examples from Artrage, oil and water-colour with photographs as originals, and a pencil sketch of Madicken sleeping in the office chair.

As a bonus it has a well designed ability to work with layers so you can put the sketch, background colour fields and shadows & highlights on different layers and work with them independently. It even has a special layer for a photograph or some other image you want to use as basis for your work of art. The interface is very clean, and at the same time powerful. There is a implement selector in the left corner and a palette in the right, if you leave them open they are single click interfaces. To say that I am happy with Artrage would be an understatement. It is an achievement in programming and design. I may never use paper again.

SketchBook is more of an honest computer drawing-program and has all the usual things, pencil, brush, air brush and so on, but it doesn't try to be oil on canvas. The interface is very clean and the most important things can be controlled with gestures (pencil type and colour, layer and undo/redo), but otherwise it is a two- to four-click interface. In my hands it is a lot like drawing with ink on paper. Not for absolute scale-drawing, but good for illustration purposes.

Quick concept for the two kidney, one clip model of renal hypertension made in SketchBook. I used three layers, one for the sketch, one for colouring, and one for shadows.
Something like that may be good enough, or we may want something a bit more stylised for publication. In that case we can use the sketch as a basis for a vector-based drawing. I got two programs rumored to be the best vector-Apps on the iPad: iDesign and Inkpad. iDesign is supposedly the more competent of the two, allowing true cad-like features like absolute scaling, and exact positioning and angling by numbers. However, it took me over a minute to find the undo-button. That's when I quit and tried Inkpad instead. There will be no review of iDesign at this time.

Addendum: I figured out how iDesign works. I had to make a more exact graph-like illustration, and Inkpad turned out to be completely useless since it just doesn't handle that level och precision. Even the undo/redo button was much easier to find once I figured out how the interface works. There are four extendable tool-strips, one per side, with all the frequently used commands and tools. There is a snapping-grid that increases in exactness with zoom, and can be set to scale. Each point and line can be exactly positioned by number: X, Y, height, width and rotation. Colour gradients are not as easy as in Inkpad (i.e. I cannot find it). In summary it is a CAD application on the iPad, and as such it makes you work in a more precise manner.
Inkpad just worked for me. The interface is completely self-explanatory. It does not have that many functions, you can basically draw paths and fill them. In addition filling with gradients is as easy and versatile as I have ever seen it done, simply marvelous. It is also easy to import one, or more, pictures to use as originals. Most importantly the undo and redo buttons are immediately obvious at the bottom of the page.

Using the previous image as original it took me about 20 minutes to create this scalable version with smooth lines and even gradients in Inkpad. Looks professional, is what it does. It also has no personality, but that is what is expected from scientific illustrations.
Although I have done mostly photography the last couple of years, drawing and painting were my original passions. In a fortuitous turn of events the sale of my camera allowed me to return to the original fold, with new and improved tools. The down side is that the quality of the photographs has degraded significantly.

Sunday, October 16, 2011

Pain and morphine

The ligaments and the joint capsule are very well innervated structures. That is why it hurt so much when you rip them asunder, and, apparently, after you stitch them back together. Pain, as you know, is just weakness leaving the body, and drugs make you strong. Strong drugs makes you stronger.

It is now three weeks since I ruptured my medial collateral ligament, and anterior cruciate ligament of the left knee. The ligaments are not only well innervated, they are also well endowed with blood vessels. So, after the injury my knee promptly filled up with blood. When the blood cells die and break up they release a huge amount of proteins into the joint and this will attract even more fluid by osmosis. Three days after the injury my knee was so full it was all but immobilised, and it looked more like a melon than any part of a human being. Sadly, I did not have the wherewithal to take a picture either before or during the draining of the joint. That was the first use of strong drugs, or derivatives of strong drugs anyway.

The local anaesthetic Xylocain has the innocuous ending -cain because it is derived from Cocaine. Cocaine is a brilliant local anaesthetic, which is still used in Ear-Nose-Throat surgery, but otherwise it has been superseded by variants that do not give you as much of a high. After a little dose of Xylocain, you can take a 0.8 mm needle (or thicker if you wish) in your knee without flinching.

While the acute pain was rather intense, the following week was not worse than that I could get along with only ibuprofen and paracetamol. Then I let the surgeons at my knee. That gave me the opportunity to test another drug: Propofol. It is what Michael Jackson used to sleep on, which is like killing a mosquito with a nuclear bomb. Anyway, propofol makes you sleep like a baby. The surgeons stitched up my collateral ligament and after that the real pain started, and then it disappeared. I woke up after surgery, quite groggy. A moment later I noticed that my knee hurt, and one of the nurses asked if it hurt, I said yes and they gave me morphine.

Morphine takes the pain away. It is quite amazing, where one minute you have an intense, penetrating pain that makes it impossible to think, the next minute it is just gone. At the same time it does not affect your faculties so much, at least not at the doses I have tried. Where local anaesthetics are just inhibiting the nerve transmission at the exact site where you give it, and narcosis basically makes you sleep so that you don't experience the pain, opiates directly affect the activation of the pain nerves. And only the pain nerves (well mostly).

It binds to special morphine receptors (well they are really endorphin receptors, but I always thought it was amazing that the body had receptors for drugs. That was until I realised that it was the other way around: That drugs are things we have receptors for). These morphine receptors can be found both on peripheral nerves, in the spinal cord and in the brain. At all these levels they lessen the feeling of pain. So, the painful stimulus elicits a weaker signal in your peripheral pain nerves. Then the pain nerve enters the spinal cord through the dorsal root and synapses to another pain nerve which runs up the anterolateral system of the spinal cord to the spinothalamic tract of the brain stem and then into the brain. In the spinal cord there are descending pain moderating nerves that release endorphins and makes you less sensitive to pain when you don't have the time to bother with it. It for example you are fleeing from a crocodile, or playing judo. Morphine activates the same receptors. They are also present in the brain where the sensation of pain is actually created, here their activation increases your pain threshold.

Morphine only has two draw backs: 1: It is addictive as hell, and 2: It is excreted through the kidneys, which makes it inappropriate for patients with acute or chronic kidney disease (I have heard something about opiates and breathing, the GI-tract, nausia but I never understood exactly how it involves the kidneys). The problem with addictiveness was realised hundreds, if not thousands of years ago. It was not morphine then, it was opium. Interestingly, at the turn of the last century heroin was thought to be a milder, non-addictive version of morphine. It was used as cough-syrop and even used to treat morphine and opium addiction. To say that it was a little embarrassing for Bayer when it was shown to be a faster acting, even more addictive, version of morphine, is probably true.

The addictiveness of opiates depends on three things: 1: Tolerance, or down regulation of receptor mediated signaling due to receptor activation, 2: You get high, 3: You get abstinent.

The problem for patients with kidney disease is that morphine is usually metabolised by glucuronidation  which makes it more water soluble and then it is excreted by the kidneys. Reduced kidney function increases the risk of toxicity. Luckily, my kidneys work just fine.

If you want some more reading Pubmed is good for all that boring stuff, but for your literary side I have some suggestions: Confessions of an English Opium Eater by Thomas De Quincey, available for free through the Gutenberg project. The always nice The Adventures of Sherlock Holmes by Sir Arthur Conan Doyle is a well known book with a cocaine addicted hero. I don't know of any classic literature involving NSAIDs or general anaesthesia. On the other hand pain features prominently in practically all books, it is called into action to shape and destroy characters. It is the reason they rise above their peers, and the reason they fall. The great heroes of literature (and film) overcome great pain, thus showing that all weakness has left them. Then they alone can stand up to the evil that previously was threatening the whole world.

Ok, so literature and film is not the best place to find realism, but with music and special effects it makes the days go by when your physiotherapist says you should not put too much strain the knee after surgery, even though morphine takes the pain away.