
I'm not talking about Fortran, I'm talking about the actual reptiles here. Or protobirds. For as long as I can remember I believed that fossilized bones are just a poor substitute for real genetic information and people use it only because dinosaurs happened to die out without living too many descendant lines. But having seen this BBC documentary I was shocked how much behavioral information they could get from just a bunch of bones plus some experimentation. In addition to scientific value it's simply awesome. Links: part 1, part 2.
The best kittens, technology, and video games blog in the world.
Wednesday, October 17, 2007
Dinosaurs
Thursday, April 19, 2007
Dieting for geeks
I have no idea if it's going to be useful for anyone or not. I played a bit with USDA Nutrient Database, trying to score different foods on their "healthiness".
There is a very widespread belief that eating has an enormous impact on health. Different sources suggests eating more or less of certain foods, or getting more or less of certain nutrients. Such advice tends to have very little basis in hard evidence.
What is basically known is that very low intake of vitamins and minerals, and that diet has a moderate impact on cardiovascular health. There's hardly any evidence associating high or very high intakes of particular vitamins, minerals, or other nutrients with major improvement in health, and little evidence that dieting can have more than just a minor effect on cancer or diseases other than cardiovascular diseases.
If you're interested in dieting and health, probably the first thing you should read is paper "Diet quality and major chronic disease risk in men and women: moving toward improved dietary guidance".
The paper explored some alternative indexes of healthy eating, knowing from previous research that the USDA Food Pyramid" failed miserably at predicting anything.
After adjusting for other risk factors in the multivariate adjusted analysis, men in the highest quintile of AHEI scores had a 39% lower risk of CVD than did men in the lowest quintile (RR = 0.61; 95% CI: 0.49, 0.75), whereas men in the highest quintile of RFS had a 23% reduction in CVD risk (RR = 0.77; 95% CI: 0.64, 0.93). Neither score predicted cancer risk, after multivariate adjustment.
The associations of both the AHEI score and RFS with risk of major chronic disease, CVD, and cancer in women are shown in Table 5. Overall, the findings were weaker than those for men. The AHEI score predicted a weak but significant reduction in major chronic disease risk in our multivariate models (RR = 0.89; 95% CI: 0.82, 0.96; P = 0.008). AHEI scores in the highest quintile compared with the lowest quintile were associated with a 28% lower risk of CVD in women (RR = 0.72; 95% CI: 0.60, 0.86; P < 0.001). As with men, we observed no significant associations between AHEI score and cancer risk. All models evaluating the RFS in women were nonsignificant after multivariate adjustment.So AHEI only moderately correlates with risk of CVD, and with very little else. As indexes which measure whole diet get such weak results, there's really little hope that measuring individual nutrient intakes, or individual food products will predict anything at all. Yet, just for fun, here's a tool for building such indexes. Just don't consider the results meaningful.
# The data can be downloaded from the following URLs:
# http://www.nal.usda.gov/fnic/foodcomp/Data/SR19/asc/FD_GROUP.txt
# http://www.nal.usda.gov/fnic/foodcomp/Data/SR19/asc/FOODS_DES.txt
# http://www.nal.usda.gov/fnic/foodcomp/Data/SR19/dnload/sr19abbr.zip
# * (Unpack ABBREV.txt file from the zip)
def parse_sr19(file_name)
fh = File.open(file_name)
fh.each{|line|
fields = line.chomp.split(/\^/).map{|entry| if entry =~ /\A~(.*)~\Z/ then $1 else entry.to_f end }
yield(*fields)
}
end
$food_group = {}
parse_sr19('FD_GROUP.txt') {|food_id, name|
$food_group[food_id] = name
}
$food_des = {}
parse_sr19('FOOD_DES.txt') {|food_id, food_group_id, long_dsc, *rest|
$food_des[food_id] = [$food_group[food_group_id], long_dsc]
}
food = {}
parse_sr19('ABBREV.txt') {|*fields|
ndb_no = fields[0]
group, dsc = $food_des[ndb_no]
short_dsc = fields[1]
energy = fields[3]
next if energy == 0.0
# Conversion factor:
# * Assume 2000.0 kcal diet
# *
cf = 2000.0 / energy
# Score in RDAs for male, 19-30y
# * http://www.iom.edu/Object.File/Master/21/372/0.pdf
ca = fields[10]*cf/1000.0 # mg -> RDA
fe = fields[11]*cf/8.0 # mg -> RDA
mg = fields[12]*cf/400.0 # mg -> RDA
phosphorus = fields[13]*cf/700.0 # mg -> RDA
k = fields[14]*cf/4700.0 # mg -> RDA
na = fields[15]*cf/1500.0 # mg -> RDA
zn = fields[16]*cf/11.0 # mg -> RDA
cu = fields[17]*cf/900.0 # mg -> RDA
mn = fields[18]*cf/2.3 # mg -> RDA
se = fields[19]*cf/55.0 # ug -> RDA
vit_c = fields[20]*cf/90.0 # mg -> RDA
thiamin = fields[21]*cf/1.2 # mg -> RDA
riboflavin = fields[22]*cf/1.3 # mg -> RDA
niacin = fields[23]*cf/16.0 # mg -> RDA
panto_acid = fields[24]*cf/5.0 # mg -> RDA
vit_b6 = fields[25]*cf/1.3 # mg -> RDA
folate = fields[26]*cf/400.0 # ug -> RDA
vit_b12 = fields[30]*cf/2.4 # ug -> RDA
vit_a_rae = fields[32]*cf/900.0 # ug rae -> RDA
vit_e = fields[34]*cf/15.0 # mg -> RDA
vit_k = fields[35]*cf/120.0 # ug -> RDA
# More than 5x RDA density doesn't give any extra score
score_vits = [vit_c,thiamin,riboflavin,niacin,panto_acid,vit_b6,folate,vit_b12,vit_a_rae,vit_e,vit_k,
ca,fe,phosphorus,k,na,zn,cu,mn,se].
map{|e| if e > 5.0 then 5.0 else e end}.
inject{|a,b| a+b}
vitamins = [[vit_c,thiamin,riboflavin,niacin,panto_acid,vit_b6,folate,vit_b12,vit_a_rae,vit_e,vit_k].map{|e| (100*e).round*0.01}].map{|x|
"#{x[8]}A #{x[1]}B1 #{x[2]}B2 #{x[3]}B3 #{x[4]}B5 #{x[5]}B6 #{x[6]}B9 #{x[7]}B12 #{x[0]}C #{x[9]}E #{x[10]}K"}[0]
minerals = [[ca,fe,phosphorus,k,na,zn,cu,mn,se].map{|e| (100*e).round*0.01}].map{|x|
"#{x[0]}Ca #{x[1]}Fe #{x[2]}P #{x[3]}K #{x[4]}Na #{x[5]}Zn #{x[6]}Cu #{x[7]}Mn #{x[8]}Se"}[0]
protein = fields[4]*cf # g
lipid = fields[5]*cf # g
carb = fields[7]*cf # g
fiber = fields[8]*cf # g
fa_sat = fields[41]*cf # g
fa_mono = fields[42]*cf # g
fa_poly = fields[43]*cf # g
choles = fields[44]*cf/1000.0 # g
# And now the scoring
score = 0.3 * protein + fa_poly - fa_sat + 3 * score_vits - 10.0 * choles
fa_poly = fa_poly.round
fa_mono = fa_mono.round
fa_sat = fa_sat.round
choles = (10.0*choles).round*0.1
food[group] ||= []
food[group] << [-score, "* #{dsc}
* Score: #{score}
* Fats: #{fa_poly}/#{fa_mono}/#{fa_sat}/#{choles}
* VM-Score: #{score_vits}
* Vitamins: #{vitamins}
* Minerals: #{minerals}
"]
}
food.to_a.sort.each{|group, foods|
puts "Group: #{group}"
puts foods.sort.map{|sc,dsc| dsc}
}
The script parses USDA data and converts it to useful format, namely "how many times the RDA would you get if you ate only such food, 2000 kcal/day". Vitamins and minerals are in RDA, polyunsaturated, monounsaturated, and saturated fatty acids, protein and cholesterol in grams/day, assuming only this particular type of food is eaten. Scores of this kind are pretty useful, as mixing different foods simply corresponds to computing a weighted average.
To avoid giving overly high scores to single-nutrient foods, nutrient content above 5x RDA is ignored. The output with the default scoring function looks something like that:
Group: Ethnic Foods
* Buffalo, free range, top round steak, raw (Shoshone Bannock)
* Score: 259.922257628
* Fats: 2/9/8/0.0
* VM-Score: 45.4825033844174
* Vitamins: 0.0A 2.58B1 5.05B2 8.74B3 3.07B5 12.12B6 0.0B9 9.68B12 0.0C 0.0E 0.0K
* Minerals: 0.06Ca 6.59Fe 5.77P 1.53K 0.58Na 5.51Zn 0.0Cu 0.1Mn 2.57Se
* Caribou, shoulder meat, dried (Alaska Native)
* Score: 253.402785187772
* Fats: 3/9/12/1.2
* VM-Score: 47.6705470921111
* Vitamins: 0.09A 1.92B1 7.38B2 6.83B3 6.13B5 2.83B6 0.15B9 46.43B12 0.0C 0.03E 0.0K
* Minerals: 0.1Ca 10.15Fe 5.8P 1.27K 0.97Na 6.31Zn 0.01Cu 0.35Mn 4.94Se
Group: Fast Foods
* McDONALD'S, Hamburger
* Score: 64.1448551547567
* Fats: 2/25/23/0.2
* VM-Score: 19.4689199722205
* Vitamins: 0.0A 1.63B1 1.46B2 2.25B3 0.0B5 0.0B6 1.27B9 2.74B12 0.05C 0.0E 0.0K
* Minerals: 0.96Ca 2.62Fe 1.21P 0.34K 2.68Na 1.35Zn 0.0Cu 0.89Mn 0.0Se
Group: Baked Products
* ARCHWAY Home Style Cookies, Coconut Macaroon
* Score: -74.9294687966982
* Fats: 4/7/87/0.0
* VM-Score: 1.66698866197016
* Vitamins: 0.0A 0.07B1 0.2B2 0.06B3 0.0B5 0.0B6 0.05B9 0.0B12 0.0C 0.0E 0.0K
* Minerals: 0.02Ca 0.45Fe 0.0P 0.11K 0.7Na 0.0Zn 0.0Cu 0.0Mn 0.0SeTwo more things - a lot of data is missing. Usually the amount of nutrient for which there's no data is negligible, so the score isn't be affected, but that's not always so. And there's a huge subject of bioavailability, which the data completely ignores, even though the difference can be quite significant.
Tuesday, November 21, 2006
Modern drug design for dummies

Designing new drugs is an important part of medical science that people know very little about, and about which there are many misconceptions. It would take way too long to tell the full story, so here's an abridged version. Details and variations are skipped, but it should give you a good big picture view.
First rule of designing new drugs - don't. It's extremely expensive. Exact figures are difficult to get, but they're in hundreds of millions euro. Finding a promising molecule is expensive, and running all tests imposed by health authorities like FDA even more so. So most research is actually into improving existing drugs, mixing them and so on - it's faster, cheaper, and the authorities require a lot less testing.
Even when scientists actually work on new drugs, they tend to work on ones similar to existing drugs - either similar molecules, or different molecules working in similar way.
Why drugs ?
Why is medicine so much into drugs as opposed to other kinds of therapy ? The main reason is price - drugs are extremely cheap, and need no specialized medical personel to apply, especially orally taken drugs. Year's worth of drugs is typically much cheaper than a single surgical procedure or a week at a hospital. That doesn't mean drugs are cheap. Patent protection for drugs is just a few years, and when it's over the competition immediately enters the market with identical generic equivalents causing the prices to plummet, so the full costs of research must be recuperated very quickly, by heavily overpricing new drugs. Add to that costs of huge marketing campaigns without which adoption would be too slow, and you have the answer for high drug prices. That and the fact that neither the patient nor the doctor (who decide which drugs to use) pay for the drugs - most of the price is typically covered by either state healthcare system or private insurance. So there is usually little incentive for taking cheaper but less efficient older drug, situation rarely found in other fields of economy.
Drugs are also popular because they can handle so many different health issues, and pretty much any doctor can prescribe them. Most other therapies can handle very narrow range of conditions and require highly-specialized personel.
The target
In the ancient past (like 50 years ago) people discovered drugs mostly accidentally. They knew they worked, but had really little idea how. In modern drug design the "how" question is asked before the search for drugs even starts. Most commonly we want to affect some molecular process associated with the disease. Most commonly we want to block one of the enzymes, with minimal effects on everything else.
For example to treat HIV infection, we want to block reverse transcriptase (enzyme which copies viral genome to cell genome), or protease (enzyme used to assemble new viruses). To fight inflamation, we want to block cyclooxygenase enzymes. Against depression - we block serotonin reuptake by neurons. In most diseases there are at least a few promising molecular targets. How do we even know where to start ? That's what the basic medical research is for ! By studying how diseases work, we are later able to target their vulnerable aspects. Unlike drug design itself, this research is more often than not publically funded.
Selected target must then be verified. If you think HIV needs reverse transcriptase to be infectious, genetically engineer HIV without reverse transcriptase and check if it really worked.
Some diseases have many targets to choose from. Bacterial infections are particularly easy. Because bacteria are complex cells very far evolutionary from humans, it is extremely simple to find vital enzymes in them that don't have counterparts in humans and block them. That's why antibiotics were so successful (the main problem here is not harming the mitochondria, which were originally symbiotic bacteria, and still share many enzymes with their free-living cousins). Viruses are far more difficult, because they simply reuse host's cellular machinery, and have only a few enzymes of their own. Even more difficult are cancer cells, which are genetically almost identical to normal cells.
How to block the target ?
So we selected a target and convinced ourselves that it will work. What now ? Most commonly the target is a protein enzyme, which has one or more active sites - parts where the reaction occurs. Usually we want to design a drug that will bind to one of them so tightly as to disrupt all normal functionality (competitive inhibition). A common alternative is binding somewhere else that disrupts enzyme shape and makes it inactive (noncompetitive inhibition). Enzymes can be disrupted in two ways - either we destroy the enzyme chemically (irreversible inhibition, like acetylsalicylic acid or aspirin), or simply bind very tightly without causing any chemical changes (reversible inhibition, like ibuprofen). Reversible inhibition is more popular, as it is less likely to produce side effects, and they're usually equally efficient.
It is usually trivial to find sequence of aminoacids forming the enzyme by simply looking at the genome. The harder part is finding 3D structure of the enzyme. This problem (protein folding) considered too expensive to compute now, but projects like Folding@home begin to change it. Not everybody is optimistic about it, but perhaps in 10-20 years folding will be routinely performed in silico (on a computer). For now experimental methods are typically used, the most popular of which are X-ray crystalography and Nuclear Magnetic Resonance. 3D structures are published in public databases like the famous Protein Data Bank.
Unfortunately proteins take many different forms, and it's difficult to guess which one is the biologically active form. It's most difficult for transmembrane proteins - a very large and important group of proteins that live in cellular membranes. We don't know how to get accurate 3D structure while they're in the membrane, and taking them out changes their structure completely. This is one of the hottest areas of drug design research.
When we have an accurate 3D structure, we need to find active sites. There are many methods. If 3D structures were taken of protein together with some known inhibitor drug (very common case - more often than not we design better drugs for old targets), we simply need to take a look where the drug is. We can guess active site by finding aminoacids that are most "conserved". Enzymes are almost never unique - humans, mice, rats, and so on have typically similar but not identical enzymes. Changes in the active site are very rare (the enzyme wouldn't normally work any more, causing disease or death), while changes in other sites are pretty common. If conserved aminoacids are all in one place, that's most likely our active site. We can also use geometric methods (active sites tend to look like small "cavities") or a computer simulation.
What does a good drug look like ?
Before going any further, we should consider a question what do we want to develop. A drug should definitely be able to treat some disease, but that's only part of the story. It must be cheap to manufacture, reasonably stable for storage, and fit many other criteria, but the main issues are: Absorption, Distribution, Metabolism, Excretion, and Toxicity:
- Absorption - Drugs that can be administered orally are strongly preferred, other methods like injection (insulin before introduction of insulin pumps) or inhalation (like anti-flu drug zanamivir) are used only when oral use would be impossible. In case of oral drugs, it is extremely important for them to be well absorbed from digestive tract, other routes are more tolerant. Drugs must also be able to pass through the cellular membrane from blood to cells, and in case of drugs affecting the central nervous system, to pass the blood-brain barrier. One example is neurotransmitter serotonin, which cannot pass the blood-brain barrier. Instead either its precursor 5-HTP is taken, or drugs like SSRI that increase effects of existing serotonin.
- Distribution - Drugs are commonly needed in some parts of the body. They also tend to be distributed inequally in various organs and tissues. It is important for significant portion of the drug to reach the intended site. If the drug isn't distributed well, it lowers efficiency and increases side effects. It is probably most crucial in case of cancer, as anti-cancer drugs tend to have severe side effects.
- Metabolism - the body doesn't let foreign substances to move around freely - it uses a wide range of methods to break them down. If drugs are metabolized too easily, efficiency will be low. It would be even worse if products of such metabolism were harmful. A good example is methanol, which isn't overly harmful itself, but alcohol dehydrogenase enzyme breaks it to extremely dangerous formic acid and formaldehyde. Sometimes we actually want the drug to be metabolized, as the product is active, not the original drug (which is usually called prodrug). Prodrugs are most commonly used for easier absorption.
- Excretion - drugs would be very dangerous if they could freely accumulate in the body, and keep affecting it long after administration of the drug ceased. Most drugs are either excreted by urine (partially metabolized, partially unchanged) or broken down into simple molecules like carbon dioxide and water.
- Toxicity - drugs do have side effects, and it is not going to change. More drugs than not may cause nausea, dizziness, headaches, and an ocasional allergic reaction, and many important drugs are significantly worse than that. If possible, side effects in new drugs should be less severe, but they won't rule out drug approval if they are offset by increased efficiency, different range of applicability, or at least are significantly different. A good example is antibiotic vancomycin, which has more severe side effects than most other antibiotics. But many bacteria are resistant to other antibiotics, so vancomycin is very useful in spite of the side effects. It isn't necessarily more efficient - as more benign antibiotics were more commonly used, the bacteria had higher chances of developing resistance to them. So paradoxically, vancomycin is more useful because of more severe side effects. Another example is rofecoxib (Vioxx) (a selective COX-2 inhibitor), which causes fewer disturbances in the gastrointestinal tract than traditional non-steroidal anti-inflamatory drugs like naproxen (non-selective COX inhibitors), while increasing cardiovascular risk. Depending on the patient, either of them may be preferable.
List of all aspects taken into account is very long. The short story - the new drug should be drug-like, that is similar to successful drugs.
The famous Lipinski's Rule of Five states that typical orally administered drug has:
- no more than 5 hydrogen bond donors (like OH and NH groups),
- no more than 10 hydrogen bond acceptors (like N and O atoms in rings),
- molecular weight under 500,
- partition coefficient (relative solubility in octanol and water, it estimates how hydrophobic the molecule is) log P under 5.
One drug that is far away from this description is insulin, with molecular weight of 5808. And indeed, it is impossible to administer it orally and the only known way to synthesize it is to use genetically modified organisms.
Getting a Hit
So we have a 3D structure of a verified target, know where to bind, and know the intended result. What to do next ? There are a few ways, but by far the most popular is docking. Simply take a database of let's say - 100 million molecules, and run a computer simulation to see how strongly each of them binds to the target. This is pretty easy - atoms and groups of some kinds attract when they are close to each other, while other kinds repel. Just sum all such interactions to get a rough estimate of binding free energy. This isn't particularly accurate, but it's very fast - and we simply want to go down from 100 million molecules to a small number like a few hundreds. First the fastest and crudest methods are used to rule out the obviously bad matches. Then increasingly more accurate and increasingly slower methods are applied until we get a reasonable number of hits.
Unfortunately, nobody really believes in docking. All results are verified in vitro. Due to sheer number of experiments that need to be performed, automated facilities are used. This is the so called High-throughput screening, and a major fully automated laboratory can test as many as 100 000 compounds a day. Molecules that bind best are our "hits".
Hit to Lead
Not all hits will become drugs, a still fairly large number of "hits" must be reduced to a small (like 5) number of leads. Many experiments are performed in silico and in vitro (from simple chemical assays to cell cultures). Is the molecule absorbed well by cellular membranes ? Is it stable ? Is it soluble in water ? Is it non-toxic ? Can we easily synthesize it ? Is it selective enough (doesn't significantly affect other enzymes) ? Isn't it metabolized too rapidly ? Finally, is it free of other companies' patents ? Probably none of the hits fits all the criteria, so they're modified until they do reasonably well.
A very diverse set of tests is applied, but basically we want to develop drugs that are "drug-like", or similar to successful drugs (using rules like Lipinski's Rule of Five). But we don't want "drug-like" leads. What we're looking for are "lead-like" leads, or similar to successful leads. Turning a lead into a drug candidate usually makes it bigger, more complex, and more hydrophobic, so we're interested in leads that are smaller, simpler, and less hydrophobic than good drugs.
Lead optimization
By now we have a few promising molecules. It's still not the time for human testing. First, we want to optimize the leads. For each lead, a vast number of similar molecules is synthesized and tested, and the most successful ones become drug candidates. The testing is again in silico and in vitro. Usually modification is addition of some chemical group or replacement of one group by another, so the drug candidates tend to be bigger and more complex than leads.
It is important to develop cheap and efficient methods of drug synthesis at this point, as previously only miligram quantities were required, and large-scale testing will require kilogram quantities.
Animal testing
After many experiments with computers, test tubes, and cell cultures, we hopefully have a few promising drug candidates. However, no regulatory authority is going to let us proceeding directly to human testing. Safety and efficiency of drugs must be tested on animals first. This is a very annoying part, because it's very expensive, and the results are only weakly correlated to results on humans. The most common test animals are mice (about 80%), rats (about 20%), and all others including other rodents, primates, rabbits, dogs, etc. together make up less than 2%.
Rodents are reasonably cheap, but very different from humans, so sometimes rodents with some human genes are used. Other animals are even more expensive, so they're used mostly when the rodents won't do. For example there is no way to infect mice with HIV, so primates need to be used to test HIV drugs.
In drug development less expensive methods are always preferred to more expensive ones. So whenever possible, human testing is replaced by animal testing, animal testing by cell cultures, cell cultures by simple chemical assays, and assays by computations. By Moore's law, computers get 100x more powerful every 10 years. In vitro testing becomes more automated and cheaper very rapidly too, and more complex experiments with cell cultures start to become automated too. As they get cheaper, they can handle more complex and more realistic setups, and be more accurate. But there is no way to automate animal testing, to make it cheaper, to significantly increase throughput, or to make it significantly more accurate (human-mouse hybrids would probably do, but that would be a public relations disaster). So in my opinion animal testing is going to greadually become less and less relevant, and at some not so distant point in the future to disappear completely.
Related to increasing automation is the fail early doctrine. Early phases of drug development are relatively cheap, while late phases like human testing are very expensive. So if the drug doesn't show much promise, experimentation should be terminated as early as possible. Many drugs that would eventually work are rejected this way, but it's cheaper overall.
In many countries (EU, USA) but not all (Japan) animal experimentation requires a licence or even a government approval of every single experiment.
Human testing - Phase I
You're probably wondering when do we start testing whether the drug works on humans. It's not this point yet. We need to apply to a regulatory authorities for permission to start human testing, but it's only going to be safety testing, the so called Phase I clinical trials.
Safety testing verifies that the drug has no unexpected adverse effects on a small group (like 30, exact numbers vary a lot depending on the condition so don't care much about them) of healthy individuals. Most drugs are expected to have some side effects, but they should all be documented. If an unexpected side effect is found, even a relatively insignificant one, the regulator is likely to require further testing at some earlier stage before proceeding any further.
In addition to safety, pharmacokinetics (what happens with the drug in the body, how is it absorbed, distributed, metabolized, and eliminated) and pharmacodynamics (what desired and undesired effects the drug has in the body) of the drug at different dosages are evaluated.
At this point companies typically apply for patents. In most countries (including EU) only the "first to file" a patent application can get the patent, and in the few that follow the "first to invent" rule (like USA), it would take a long and costly lawsuit to recover the patent if someone else filed first. So companies don't want to wait too long. On the other hand, the patent only lasts 20 years (previously 17 years), so filling too early means shorter monopoly. Because clinical trials tests and waiting for all approvals take many years, especially if there were some problems, the actual patent monopoly is often just a few years.
Human testing - Phase II
Hopefully everything went well, and we can finally test how well the drug works. This requires another approval from the authorities. Phase II clinical trials measure drug efficiency on a limited number (like 200) of actual patients in highly controlled conditions. This point, very late in drug development, is the first time where efficiency is evaluated under realistic conditions, and unfortunately many drugs fail here, and such late failures are very expensive.
The tested drug is supposed to be more efficient than all existing drugs, have less severe side effects, be more widely applicable, and so on. The rules are not exactly fair - if a more efficient drug is registered first, a less efficient one will be rejected. But if a less efficient drug is registered first, and a more efficient one is found later, the former won't be pulled from the market. The most extreme example is probably acetylsalicylic acid (aspirin) which has so many side effects that it would never pass the drug registration process today, or at best end up as a prescription drug for a very limited range of conditions. Most authorities are far on the paranoid side - accepting a drug that has to be pulled later is a political disaster, while rejecting or delaying a perfectly fine drug doesn't cost them a dime. Procedures are usually more lenient for the most deadly diseases like cancer and AIDS, and for rarely occuring diseases (so called "orphan diseases").
Human testing - Phase III
If Phase II went well, the authorities may approve proceeding to Phase III clinical trials - that is wider randomized testing of the drug, on hundreds or even thousands of patients. At this point we have preliminary evidence that the drug is safe and efficient, and the wider trials will provide information on interactions with other drugs or conditions, less common side effects, and give a final confirmation that the drug is indeed safer and more efficient.
After Phase III is completed, the company which developed the drug applies for registration. It would be extremely costly and painful to fail here, fortunately it doesn't happen that often.
Success !
As I said, the first rule of designing new drugs is don't. So when the new drug gets to the market, the research team doesn't get back to designing another drug - very often even more intense research on the newly developed drug starts, sometimes even before the Phase III is over. Extending it to more conditions, improving bioavailability, work on similar molecules, combinations with other drugs, such research can be extremely profitable as it carries much lower risk, nobody was there before, and as it is freshly patented, everything containing the new drug is covered.
It would mean a guaranteed stream of money if not for two issues. First, the patent doesn't last that long, and a few years probably already passed since filling (around Phase I clinical trials usually).
The other issue is the competition. Usually all simple modifications of the molecule are covered by the patent, but the target is not covered by patents (the big pharma tried to cover these too, but courts tend to throw them out). For most targets it's not exactly difficult to find alternative drugs.
A great example are inhibitors of cGMP specific phosphodiesterase type 5 enzyme. The first one sildenafil (Viagra) was patented in 1996 and approved by FDA on March 27, 1998. Depending on the country, the patents will expire somewhere around 2011–2013. Based on patent laws alone, that would be a 15-year monopoly over a huge market. However FDA approved two different erectile dysfunction drugs targetting the same enzyme soon - vardenafil (Levitra) on August 19, 2003, and tadalafil (Cialis) on November 21, 2003. That's just 5 years and a few months.
So before even the drug is registered, a huge marketing campaign is started to ensure its speedy adoption. This adds even more to the overall cost, but without it the very valuable monopoly time would be lost. After generic drugs or other competition enters, the prices can stay high for some more time due to brand recognition and plain inertia, but the profits fall quite fast, so you better hurry.
That's about what you need to start designing new drugs. At least if your rich uncle dies leaving you a few hundred million euro. ;-)
The Pharmaceutical Industry
Unless you're interested in political issues like this one, simply ignore this section.
No discussion of drug development would be complete without at least a mention of the pharmaceutical industry.
During the first few years, the drug is heavily "overpriced" compared to the cost (this is intended as a statement of fact, not a moral judgment). Commonly, the price would fall by over 90% if free competition was allowed. A good example was introduction of generic antiretrovival drugs in India in 2000, which caused the prices to fall from $778 a month to $33 a month (96% decrease) in 2003, what also raised number of people living with HIV receiving anti-retrovival therapy from 22% to 44%, and a huge decrease in number of HIV-related deaths, but the main point is how "overpriced" the drugs are. This only compares prices against marginal costs, that is manufacturing, and basic operational costs, and doesn't include things like research.
We can also compare against total costs, including manufacturing, research, development, marketing, sales, CEO compensation, oportunity cost of capital, and everything else. In 2004 top ten big pharmaceutical companies had $305 billion in revenue, $64 billion in net income, and just $43 billion in research and development spending. Average net income at 21% of revenue is far above almost any other industry, including big oil. More typical values are around 5%.
If some industry has very high profits, normally capital would flow to it from less profitable industries, with loads of new companies joining, competition lowering prices, until average profits are back to the industry standard range. Getting exact numbers requires a bit more work than just pulling them from a chart on Wikipedia, but pharmaceuticals undeniably make a very profitable industry, it's the case for quite some time, and industries can stay very profitable for a long time only due to high barriers to entry. In this case - mostly government-issued drug patents.
Actually the taxpayers fund all medical research - basic research in the academia, and drug development by having government healthcare systems pay any company which successfully developed new drugs. After all, virtually nowhere patients pay directly for new drugs - it's always either public healthcare or private insurance. This is great, because the taxpayers only pay for successful developments, not for the failures.
How much does it cost ? Let's make a simple model - let's say the big pharma loses all patent and other protections, stops doing any research and development at all, their profits are brought to industry average, that is 5% over costs (and let's check 10% too), and all savings go to publically funded research (which already does most of the basic medical research). If $305 billion was revenue, $64 billion net income, and $43 billion R&D, the non-R&D costs are $198 billion, plus 5% net income that's $208 billion. Alternatively with 10% net income it'd be $220 billion. That leaves the tax payers with extra $85 billion to $97 billion to fund drug development. So unless the big pharma is 97% to 125% more efficient than the academia in drug development, taxpayers would benefit from the switch. Universities aren't particularly well-regarded on their abilities of bringing results of the research to the market, so their R&D would probably be less efficient, but would the difference be that high ? The largest part of the expenses is after all clinical testing required by the regulatory authorities.
This back of an envelope computation is far too unrealistic for any serious use, however a bad model is far better than the hand-waving approach commonly used to discuss the big pharma or pretty much any other subject in politics or economy. But it seems the taxpayers should consider subsidies to partially cover clinical trials of publically developed patent-free drugs. This avoids financing most of the failures (the drug got to the clinical trials, so it's not a total flop), encourages practice that leads to successful designs, and it's probably cheaper than paying for the patented drug later.
Monday, June 19, 2006
Docking assembly
Ligand-Receptor docking: Canis lupus familiaris molecule docked into Triticum aestivum bun's binding pocket
What a funny day it was, playing with x86 FPU assembly :-D
The problem was inspired by docking, or molecular force field computations. The thing is - there is a commonly-held belief among bioinformaticians that exponential function is very expensive, so they're going to great lengths to avoid it even when the physics suggests it might be a good idea to use it. Unfortunately x86 FPU provides plenty of evidency for this, as it can only evaluate exponential function at extended (80 bit) precision, even though we'd much rather use single (32 bit) precision. Of course such excessive precision make it very very slow, so nobody uses it.
Did you even know that you can lower precision of some other operations on your FPU ? :-D
#include <fpu_control.h>
void set_single_precision() {
int cw = 0;
_FPU_GETCW(cw);
cw = (cw &~ 0x300) | 0x000;
_FPU_SETCW(cw);
}
void set_double_precision() {
int cw = 0;
_FPU_GETCW(cw);
cw = (cw &~ 0x300) | 0x200;
_FPU_SETCW(cw);
}
void set_extended_precision() {
int cw = 0;
_FPU_GETCW(cw);
cw = (cw &~ 0x300) | 0x300;
_FPU_SETCW(cw);
}
Anyway, it only works for division and square root computation, which get about twice faster in the lowest precision, but pretty much nothing else.
Now we could simply wait for the hardware guys to provide us with faster hardware, or we could become evil and implement fast exponentiation in fast assembly :-D
The way x86 FPU implements normal exp function is:
- split x into integer part and fractional part
- evaluate 2fractional part of x
- multiply the result by 2integer part of x, simply by adding to the floating point exponent
fld %st(0) # Duplicate
frndint # Round
fsubr %st, %st(1) # Subtract
fxch %st(1) # Exchange top two values on the stack
f2xm1 # 2^(fractional part) - 1
fadd %st(3), %st # Add 1, so we get 2(fractional part)
fscale # Multiply by 2(integer part)
fstp %st(1) # Clean-up
The first and the last part are very fast, unfortunately the second one is horribly slow.
So, how about we throw it away and replace by some approximation ?
The only reason we can reasonably do that is because the argument is already guaranteed to be a fractional part, that is -1/2 to +1/2 (surprisingly not 0 to 1, as we're rounding to nearest integer, not down). Anyway, even a very simple 2-term Taylor expansion is pretty effective. Oh and in addition to x86 FPU assembly, let's try interfacing it with gcc by some magic :-D
// The worst relative error is smaller than 1%
inline float fast_exp2_t2(float x)
{
float res;
asm (
"fld %%st(0) \n\t" // x x 0.5
"frndint \n\t" // r(x) x 0.5
"fsubr %%st, %%st(1) \n\t" // r(x) f(x)=y 0.5
"fxch %%st(1) \n\t" // y r(x) 0.5
// Instead of doing f2xm1 ...
"fldln2 \n\t" // ln2 y r(y) 0.5
"fmulp \n\t" // ln2*y r(y) 0.5
"fld %%st(0) \n\t" // ln2*y ln2*y r(y) 0.5
"fmul %%st(3) \n\t" // ln2*y/2 ln2*y r(y) 0.5
"fld1 \n\t" // 1 ln2*y/2 ln2*y r(y) 0.5
"faddp \n\t" // (1+ln2*y/2) ln2*y r(y) 0.5
"fmulp \n\t" // (1+ln2*y/2)*ln2*y r(y) 0.5
"fld1 \n\t"
"faddp \n\t"
"fscale \n\t"
"fstp %%st(1)\n\t"
:"=t"(res)
:"0"(x), "u"(0.5)
);
return res;
}
gcc inlines that, so it's almost as effective as if it actually knew what it's doing. Anyway, the results were really striking, the normal exp function was 160% slower than traditional bioinfo trickery, however with this low-precision exponential the slowdown was only 35% !
Of course it's all pretty much toyish and probably has about zero actual uses. At the same time, it's really cool and evil, isn't it :-D ?

