Should “we” prefer more expensive medical treatments?

Imagine a disease with two possible treatments: Treatment A works OKish people and is cheap (50-500 USD per treatment).

Treatment B works as well as A (studies typically find no statistical difference, if anything B sometimes performs slightly worse), but is 10-100x more expensive than treatment A (1-10k USD per treatment).

Some patients prefer A and other prefer B as the side-effects and compliance requirements are different (none are very serious medically, but cause some annoyances). Some doctors are agnostic between A and B, while others tend to prefer A or B. The doctors who prefer and recommend B will often get some of the extra cash that B generates (but not always).


  • Should A be preferred to B?
  • Should the extra cost of B be supported by the patient themselves (as opposed to insurance covering both A and at similar reimbursement rates, private or public)?
  • Should B be allowed by regulation?

Now, the hard questions (with comments):

  • Does it matter if the disease is “major depression”, A is “anti-depressants”, and B is “cognitive behavioral therapy” (or other forms of talk-therapy)?

This is one specific context in which I keep hearing the argument that “B should be recommended as its as good as A“. It just seems like a very weak argument. SSRIs or other pharmacological anti-depressants should be the default treatment as they have lower costs.

Generic SSRI are about 10$/month: no therapist will give you a comparable rate: in fact, the major cost of generic SSRI therapy is whatever the physician charges to renew the prescription.

Perhaps if the technology for bot-based cognitive behavioral therapy catches up, then CBT may become as cheap as medication.

  • What if A is “physiotherapy” and B is “back surgery”?

Same: the cheaper treatment should be the default.

Eager Error Detection in Ngless: A big advantage of a DSL

One of the advantages of ngless is its error detection. For example, consider the following ngless script:

ngless "0.0"
input = fastq("input.fq.gz")
mapped = map(input, ref='hg19')
write(mapped, ofile="output/mapped.bam")

If the directory output does not exist (maybe you meant to write outputs; I know I make this sort of mistake all the time), then ngless will immediately give you an error message:

Line 4: File name ‘outputs/output.sam’ used as output, but directory outputs does not exist.

This is a big advantage compared with traditional tools which would run the pipeline until the last step and then fail. Until last week, though, it would not check the following code:

ngless "0.0"
import "parallel" version "0.0"
sample = lock1(readlines("samples.txt"))
input = fastq(sample + ".fq.gz")
mapped = map(input, ref='hg19')
write(mapped, ofile="output/" + sample + ".mapped.bam")

The parallel module adds the lock1 function which will take the list of samples (in this case read from a file using the readlines function) and select one using a locking mechanism so that several ngless processes can run at the same time and each one will work on a different sample. Now, the output name is being formed depending on inputs. So, ngless could not check it before it starts interpreting the script.

With a commit last week, ngless will now check the script by performing the following transformation:

ngless "0.0"
import "parallel" version "0.0"
sample = lock1(readlines("samples.txt"))
__check_ofile("output/" + sample + ".mapped.bam")
input = fastq(sample + ".fq.gz")
mapped = map(input, ref='hg19')
write(mapped, ofile="output/" + sample + ".mapped.bam")

Now, immediately after the variable sample is set, ngless will build the output path and check that it is available with the right permissions. In this case, readlines and lock1 are very fast functions, so any errors will be reported within a few miliseconds of starting ngless before any expensive computation is performed.

This is only possible because we are working with a domain specific language.

The immune system as a policeman

To say that the immune system is the body’s policeman a typical metaphor and is a useful metaphor.

But you need to understand what kind of policeman it is. The immune system is like the British police in colonial India: they’ll keep the peace, but no respect for human rights: if one person in a village misbehaves, they’ll beat up the whole village and engage in some administrative massacres if necessary.

So, if you think about the immune system like the policeman, remember it’s more like these guys:

Police militarization


than a friendly neighbourhood cop:

[Images taken from a Washington State University news item about police militarization.]

Self-driving cars kill, but they can improve; humans just kill

A Tesla self-driving car killed its “driver”:

According to Tesla’s account of the crash, the car’s sensor system, against a bright spring sky, failed to distinguish a large white 18-wheel truck and trailer crossing the highway.

Pretty awful failure of compute vision.


I have had more than one person tell me that while they agree with me that self-driving cars can be safer, they will never be allowed by the regulators because the politics are not working in their favor. While I understand some of the concerns, I don’t understand how you can believe such a thing and not turn into a full-blown libertarian.

If you believe that government regulations cause the unnecessary death of circa 92 people a day in the US (many more globally) how can you not become a libertarian raging against government intervention?

I actually have a better opinion of both regulators (who can delay life saving products, sure, but will probably not stop such a technology all together) and lobbyists (lobbyist can and do influence regulations).


There is a point to this post though: I’m pretty confident that pretty soon (in a matter of days, perhaps), Tesla will roll out an update that will make sure that white truck trailers against a bright sun are properly detected. So, this particular type of accident will be less likely to ever happen again. Self-driving car accidents expose flaws in the system which can be fixed.

Oh, but there are many other types of accidents, I hear you say. Of course, thousands of them, but if every time one of them happens, that particular type of accident gets fixed, the death rate will keep going down.

Compare with how “we” improve human drivers: educational campaigns and fines for every bad behaviour we uncover (and how many people still text while driving). Sure, it has an effect, but it’s not half as efficient as a patch.

Self-driving cars will have accidents, but unlike human drivers, they can improve rapidly. Until eventually, driving will be as safe as flying.

How to get FastQ reads from a SAM/BAM file

Using ngless, of course. Just run the following on the command line to take the sequences from

ngless -e 'write(as_reads(samfile("input.bam")), ofile="sequences.fq.gz")'

Let me unpack that a bit. This is equivalent to writing the following script:

ngless "0.0"

# Load a SAM or BAM file
sam_or_bam = samfile("input.bam")

# Get the reads out
reads = as_reads(sam_or_bam)

# Write them out
write(reads, ofile="sequences.fq.gz")

The exact behaviour will depend on whether you have paired or single-ended reads. If you have single-ended reads, they will be saved to sequences.fq.gz. If you have paired-end reads, they will be saved to sequences.pair.1.fq.gz and sequences.pair.2.fq.gz (and if there are any single-ends mixed in,

Why I dislike the expression Darwinism

Political feuds have the ability to morph you into the caricature your opponents draw of you.

Natural selection is the means by which the human species came about, but I don’t like calling this Darwinism, for two reasons. The first one is that Darwin’s theory of natural selection had its flaws: he thought it was a continuous matter, that offspring was the average of its parents rather than a mix of indivisible genes (curiously enough, Mendel who did discover that there are discrete traits, was not a Darwinist). Secondly, most importantly, is that it does make the whole enterprise feel a bit like religion where Darwin was the prophet.

If Darwin had been struck by a tree early in his life, we’d still think that natural selection is true (in fact, we’d have found out about it at more or less the same time, as Wallace was about to scoop Darwin and forced him to rush to print his book).

This is also why I have absolutely no interest in his views on religion.


I was reminded of this when I recently read the allegations that Darwin plagiarized his ideas. Not from Wallace, but from some obscure Scotsman.

Patrick Matthew was a rich Scotsman who basically published the Theory of Evolution 30 years before Darwin, but nobody paid attention to him as he published in a low impact-factor journal [yeah, not really, but the 1800s equivalent of a low-impact journal: a book on Naval Timber].

Perhaps Patrick Matthew should be better known and Darwin a footnote. But because “we” have accepted the term “Darwinism” to refer to natural selection, there is more resistance to throwing Darwin out of the pedestal than there should be.