Vad bestämmer fåglarnas kön?

Någon frågade på Facebook ungefär såhär: Fåglarna har andra könskromosomer än vi, ZW istället för XY, och det är honorna som har den lilla konstiga kromosomen (W) och hanarna som har två av samma (Z). Varför kallas ZW-individen hona och inte hane, när XY-däggdjur kallas hanar?

Jo, för att kön (nu i den strikt biologiska bemärkelsen) inte handlar om kromsomer eller ens hur olika delar av kroppen ser ut; det handlar bara om könsceller. Den som gör de stora könscellerna är hona och den som gör de små är hane. Det finns arter som har sexuell reproduktion men där alla producerar lika stora könsceller, men när det gäller arter som har flera storlekar är det oftast två. Den delen av kön är en dikotomi, men sedan blir det intressantare. Han- och honfunktionen kan sitta på olika kroppar eller samma; de kan komma i olika former och könsbestämningen kan vara genetisk, styras av någon miljöfaktor, vara bestämd från konceptionen eller ändras under livets gång. Här är en schyst liten video från Aaron Reedy och TED Ed (och som jag såg först på Melissa Wilson Sayres blogg) om könsbestämning i olika djur. Genetisk könsbestämning med könskromosomer är inte allmängiltig!

Videon innehåller några små konstigheter, som den enkelsträngade dna-molekylen i den haploida myran, men låt oss inte gräva ner oss i det. Och naturligtvis betyder ”pojke” och ”flicka” betydligt mer än sekundära könskaraktäristika. Förresten, hitta Nemo!

Morning coffee: the selfish gene versus the world

kaffe_knä

The distinction between ”gene” in the sense of an allele at some locus and ”gene” in the sense of a dna sequence with a name and some function seems easy enough, but still causes a lot of confusion, both in popular and scientific literature.

This was very clear a few months ago when science journalist David Dobbs published his ”Die selfish gene, die” and a few weeks of debate broke out. In my opinion it’s not a particularly good piece, but I agree with Dobbs that the ”selfish gene” metaphor sometimes invites misunderstandings. The article itself displays a few of them, when it suggests that evolution and genetics as understood before the age of microarrays are somehow at odds with the importance of gene regulation or phenotypic plasticity. I suspect that many of these problems stem from the double meaning of the word gene. Other examples are found in headlines claiming that researchers have found the gene for something or the confusion about the word pleiotropy (Paaby & Rockman 2012).

When Dawkins wrote about the selfish gene, he did not mean the selfish dna sequence encoding a protein; he meant the selfish genetic variant causing differences in fitness between individuals. (Or rather, a set of genetic variants in sufficiently close linkage to seldom be separated by recombination.) The book is not about molecular genes. As anyone who actually read it knows, it deals mostly with behaviour using game theory approaches. This does not mean that Dawkins denied that there are actual molecular genes doing the mechanistic work, but that he analysed the situation mostly on a different level. And had he chosen to write only about known sequence variants with adaptive effects on behaviour it would have been a very short book.

Of course the word ”selfish”, while I agree that it is the proper word in the sense that Dawkins intended, is great for those who want to point to instances where people are horrible to each other and tell you that it’s all because of evolution. But I think that is a bigger issue that will not be solved by tweaking popular science metaphors. By the way, that is completely contrary to Dawkins’ intentions, which were to popularise the evolutionary models that explain why animals are not always horrible to each other, even though their behaviour is shaped by natural selection.

Dagens rekommendation: genetisk kartläggning i naturliga hybrider

Ännu en video från ESEB2013 i somras! Luisa Pallares berättar om genetisk kartläggning, med helgenomsassociation, av skallens form hos naturliga hybrider mellan två underarter av möss. Bara för att möss och bananflugor finns som inavlade labbstammar ska en inte glömma att de har livaktiga genpooler i naturen med intressant variation. Det klassiska sättet, om jag vågar kalla det så, att kartlägga genetiska varianter som skiljer två populationer är att göra experimentella korsningar mellan dem — jag jobbar till exempel på en korsning mellan tamhöns och röda djungelhöns.  Men när de tittar naturliga hybrider får de både den höga upplösningen i en associationsstudie och styrkan i att jämföra två olika populationer.

(Bonus: Hitta min kalufs i publiken. Ledtråd: Jag sitter bredvid min handledare, och om en tar medelvärdet av längden på vårt hår blir det ungefär en pottfrisyr.)

Hönan och ägget

På samma tema som igår, nämligen ofta ställda men lite aviga frågor: vad kom först, hönan eller ägget? Ägget, naturligtvis. Så många av hönans både nära och avlägsna släktingar lägger ägg, vilket betyder att deras gemensamma släktingar med största säkerhet lade ägg och alltså måste ägget vara oerhört, oerhört mycket äldre än hönan som art. Vad kom först, hönan eller hönsägget? Hönsägget, kanske. Det är inte helt enkelt att definiera arter, men om vi föreställer oss att det finns någon punkt där en individer i en population av för-höns ackumulerat tillräckligt många hönslika egenskaper för att vara det vi skulle kalla en höns så började de i alla fall sina liv som ägg. Alltså fanns hönsägg innan det fanns vuxna höns. Eller så är hönor bara en sorts teoretiska efterhandskonstruktioner människor använder för att göra naturens röra hanterbar.

Vi härstammar inte från schimpanser

I have found it difficult, when looking at any two species, to avoid picturing to myself, forms directly intermediate between them. But this is a wholly false view; we should always look for forms intermediate between each species and a common but unknown progenitor; and the progenitor will generally have differed in some respects from all its modified descendants.

– Charles Darwin. ”On the Origin of Species…” Chap. IX. On the Imperfection of the Geological Record. (Citerat här.)

Kreationism eller intelligent design kan inte vara föreställningen att Gud skapade världen — för det finns många olika idéer om hur gudar kan ha skapat världen som inte får folk att vägra vetenskap — utan föreställningen att levande organismer av olika arter inte har ett gemensamt ursprung, fast de är så lika, och inte förändras över tid genom evolution, även om det ser ut som att de gjort det. Eftersom att evolution går att observera i realtid i naturen och i labbet blir de mer eller mindre tvungna att erkänna att evolution finns, bara att den inte kan förklara variationen i naturen. Jag tror inte det finns någon som helst mening med att lägga massor av tid på att debattera mot kreationister, särskilt när svenska kreationister är så sällsynta. Däremot tror jag att det kan vara både roligt och meningsfullt att skriva allmänt hållna saker om evolutionsbiologi som har att göra med sådant kreationister brukar säga.

Om vi frågar oss: Om människan härstammar från apor, varför finns det fortfarande apor? Eller pröva den här, tycker jag, intressantare versionen: Om flercelliga organismer härstammar från encelliga organismer, varför finns det så många bakterier? Kruxet är förstås att vi inte härstammar från nu levande encelliga organismer eller nu levande andra arter av apor. Men vi har ett gemensamt ursprung. Människor och andra apor är hyfsat lika, så vi kan sluta oss till att de sista gemensamma förfäder- och mödrar vi hade måste ha varit något som vi skulle beskriva som apor. Men det var länge sedan och många genetiska varianter har flutit under de metaforiska broarna, både för det släktled som ledde till oss och det som ledde till schimpanserna. Min pappa kom från Skåne och alltså måste jag till hälften härstamma från skåningar. Ändå finns det fortfarande skåningar.

Här är ett släktträd (från Polina Perelman m.fl, 2011, cc:by 3.0) med oss och andra levande apor. Den tekniska termen är fylogenetiskt träd, men släktträd beskriver ganska bra vad det är frågan om. Skillnaden är att det är ett träd över grupper (i det här fallet släkten) och att det saknas bild och namn på de gemensamma förfäder- och -mödrar som är förgreningarna i trädet. Det här trädet är baserat på jämförelser av dna-sekvenser mellan de nu levande arterna. Mycket riktigt ser vi att människor (Homo) har schimpanser (Pan) som närmaste släktingar och med gorillorna på lite längre håll.

journal.pgen.1001342.g001

Using R: common errors in table import

I’ve written before about importing tabular text files into R, and here comes some more. This is because I believe (firmly) that importing data is the major challenge for beginners who want to analyse their data in R. What is the most important thing about using any statistics software? To get your data into it in the first place! Unfortunately, no two datasets are the same and many frustrations await the beginner. Therefore, let me share a few things that I’ve picked up while trying to read data into R.

General tip: keep it as simple as possible. Open your favourite spreadsheet software, remove all the colours and formatting, make sure to have only one header row with short and simple column names (avoid any special characters; R will turn them to full stops), remove empty columns above and to the left of the table and export the sheet in to plain text, tab separated or comma separated. Then use either read.table, read.csv or the Import dataset button in RStudio to read your table, and in case of doubt, begin with the default settings, which are often sensible. If you see any annoying data import errors, below are a few possible causes.

If you don’t get the number of columns you expect

Then it’s often a separator problem. read.table allows you to set the filed separator character (with sep=) and the decimal separator (with dec=). To get a tab character, use ”\t”:

data <- read.table(file="data.txt", sep="\t", dec=",")

In many countries this is not an issue, but the Swedish standard is using a comma as decimal separator, while R uses a decimal point. If you export a comma separated value file on a Swedish computer, you are likely to get a numbers with decimal commas and semicolons as field separators. Then what you want is read.csv2( ), which is a read.csv made for semicolon separated files with decimal commas.

As an additional benefit of using it, RStudio solves those issues for you with the Import dataset button. The dialog box that appears when you click it lets you choose separators, header line (yes/no) and whether there are quotes around fields, and shows a preview of what the table will look like. Then it builds the read.table command for you, so that you can copy it into your script. If you’re not an RStudio user, just look at the actual file in a text editor, and add dec= and sep= instructions to your read.table as needed.

If you see a lot more columns than you expect, usually after the ones you expect, filled with NAs, it’s probably because you’ve happened to enter some character (very likely a whitespace …) somewhere to the right in the spreadsheet. When exported, the software will fill in all the empty cells, which R will interpret as missing values. If this happens, make sure to delete the contents of the spreadsheet after the columns you’re interested in.

Whitespaces can also be a problem if you’ve specified a custom separator, like above. Normally, read.table is very good about skipping over whitespace, should you have happened to put an extra whitespace in before that factor level. That functionality is turned off when you specify a separator, though, so you might need to switch it on again by setting strip.white=T in the function call. So, for instance, ” male” and ”female  ” are interpreted as male/female, which is probably what one wants. This cost me several grey hairs and string operations before I came to my senses and read the data import manual.

If columns are not the type you expect

If something is a character when it should be numeric you might see messages such as ”‘x’ must be numeric ” or ”non-numeric argument to binary operator”. If something is a factor when it should be character, some character operations might fail. Regardless, it could still be a separator problem. If R expects to see decimal points and sees a comma, it will make that column a character vector rather then a numeric column. The principle is that read.table it will try to turn the column into numeric or integer (or complex or logical, but they are rarer). Most often, this means that if you feed it numbers it will make them numeric. But if there is anything else in any of the elements, it will assume character — and by default it will convert character vector into factors.

There are several reasons why you might have text among the numbers, making R not interpret the column as numeric. We’ve mentioned wrong separators, but sometimes if you paste spreadsheets from different sources together you end up with inconsistent field separators. I’ve written a post about a way to deal with that in some cases, but you can also search and replace the file with a text editor, or use a command-line tool like sed. Missing values can be another problem. read.table understands that empty fields are missing, but maybe you or your collaborator has used another character to mean missing, like ”-” or ”?”. This is dealt with by specifying your own na.strings:

data <- read.table("data.txt", na.strings=c("NA", "-", "?"))

R’s default of interpreting characters as factors is sometimes a good choice, but often what you really want is characters that you can work with and then, if needed, turn into factors. In particular, if your column of sample ids is turned into a factor, comparing and matching ids will sometimes hurt you. To avoid that you can specify stringsAsFactors=F. This works when you make data frames with the data.frame function as well.

data <- read.table("data.txt", stringsAsFactors=F)

Diagnosing problems with your data frame

Look at the dimensions of your data frame and the column of the classes. dim gives dimensions; the class function gives the type of a column and the str function will give you a summary of the structure of the object.

dim(data)
lapply(data, class)
str(data)

Happy importing!

Journal club of one: ”Functionally enigmatic genes: a case study of the brain ignorome”

This recent paper, Pandey & al (2014), made me interested because I’m in the business of finding genes for traits, and have spent quite some time looking at lists of gene names and annotation database output. One is tempted to look for the ”outstanding candidates” that ”make biological sense” (quotes intended as scare quotes), but the truth is probably that no-one knows what genes and functions we should expect to be affected by genetic variation in, for instance, behaviour. This paper tries to make the case for the unknown parts of the brain transcriptome; they use data about gene expression, protein domains, paralogs and literature to argue that the unknown genes are unknown for no good reason and that they might be just as important as genes that happen to be well-known.

They found genes that are had a high ratio of expression in brain to average expression in other tissues of C57BL/6J and DBA/2J mice and searched PubMed for these genes in combination with neuroscience-related keywords. Some of them have few citations and these are their selectively expressed but little studied genes. They then make a series of comparisons between these and well-studied genes. It turns out the only major difference is that well-studied genes were discovered (entered into GenBank) earlier.

Comments:

I don’t know to what extent these results are suprising. I was not surprised by their main conclusion, but then again, that maybe my opinion was mostly prejudice. There is a literature on biases in the functional genomics literature, but I don’t know much about it. And apparently neither did the authors, initially, as Robert Williams writes in a comment on the PLOS ONE website:

We did not rediscover the lovely work of Robert Hoffmann (now head of WikiGene) until the paper had been submitted in succession to six higher profile journals … Hoffmann and colleagues showed that social factors account for much of the annotation imbalance for genes.

I love the idea of authors writing an informal comment about the background of the paper like this.

The coexpression network results show some of the little known genes are just as connected as known important genes. This suggest some of the unknown genes might be important too, if we can trust that coexpression hub genes are likely to be important (for various values of ”important”). Maybe this is a scientific opportunity for some neuroscientist. Several people I’ve talked with has imagined future Big Science initiatives to describe the function of unknown genes — ”divide them up between labs and characterise them!” — and some initiatives exist, such as the IMPC. On the other hand, how do we know that we really find the most important and interesting functions of a gene? The skeptic in me thinks that going bottom up, from gene to phenotype, will miss the most interesting surprising phenotypes.

I think ”ignorome” is one of those unnecessary bad omics words, which is why I’ve avoided using it.

Their PubMed query was restricted to mouse, human and rat. I wonder why. Maybe there could be something useful from fruit flies or roundworms?

Overall, a fun paper that I recommend reading over a few cups of coffee!

Literature

Pandey AK, Lu L, Wang X, Homayouni R, Williams RW (2014) Functionally Enigmatic Genes: A Case Study of the Brain Ignorome. PLoS ONE 9(2): e88889. doi:10.1371/journal.pone.0088889

Dagens rekommendation: virus som lever på bakterier som lever på träd

Jag var ju på konferens i somras: ESEB2013, som var helt fantastisk — som en festival av vetenskap. Föredragen spelades in och nu börjar det komma upp fler på konferensens youtube-kanal. Det är förstås fråga om ganska tekniska presentationer riktade till en expertpublik, men många av föredragshållarna är så bra och underhållande att jag tror att det är i allra högsta grad tillgängligt för en lite nördigt intresserad allmänhet: vetenskap som är fullt tjänlig som populär/vetenskap!

Dagens föredrag: Britt Koskella är en evolutionsbiolog som jobbar med interaktioner mellan parasiter och värdorganismer. Här berättar hon om bakteriofager som lever på bakterier som lever på kastanjer, deras interaktioner och deras evolutionära anpassning till sin närmiljö och till varandra, från sessionen om snabb evolution. Inte nog med att en kan flytta bakterier och virus fram och tillbaka för att pröva hur de klarar sig i en ny miljö, dessutom går det att frysa ner och tina dem igen, så att en kan jämföra gamla organismer med nya och se anpassning i realtid!

Using R: correlation heatmap, take 2

Apparently, this turned out to be my most popular post ever.  Of course there are lots of things to say about the heatmap (or quilt, tile, guilt plot etc), but what I wrote was literally just a quick celebratory post to commemorate that I’d finally grasped how to combine reshape2 and ggplot2 to quickly make this colourful picture of a correlation matrix.

However, I realised there is one more thing that is really needed, even if just for the first quick plot one makes for oneself: a better scale. The default scale is not the best for correlations, which range from -1 to 1, because it’s hard to tell where zero is. We use the airquality dataset for illustration as it actually has some negative correlations. In ggplot2, it’s very easy to get a scale that has a midpoint and a different colour in each direction. It’s called scale_colour_gradient2, and we just need to add it. I also set the limits to -1 and 1, which doesn’t change the colour but fills out the legend for completeness. Done!

data <- airquality[,1:4]
library(ggplot2)
library(reshape2)
qplot(x=Var1, y=Var2, data=melt(cor(data, use="p")), fill=value, geom="tile") +
   scale_fill_gradient2(limits=c(-1, 1))

correlation_heatmap2

”Ytterligare en studie vi valde bort att rapportera” är inte en referens

Uppdatering: Åtminstone Sveriges radio har uppdaterat sin krönika med referenser! Hurra!

Att skriva om resultat från vetenskapliga artiklar utan att referera till dem är en fruktansvärt dålig vana, men tyvärr normen bland journalister. Jag förstår inte hur en kan umgås med vetenskapssamhället någon längre tid utan att fatta det här själv, men låt mig tjata lite: Referat utan referens är aldrig okej! Jag har förstått att det är andra regler om texter, originalitet och källor inom journalistiken; svenska journalister gör till exempel ofta vad som närmast är översättningar av artiklar i brittiska tidningar med i bästa fall en bisats som säger ”enligt The Guardian”, men det här är inte en fråga om upphovsrätt, utan om trovärdighet. Som student vid ett universitet blir en utsatt för långa utläggningar om hur referensformatering ska gå till, men det är faktiskt inte så himla viktigt precis hur referensen ser ut; när det gäller texter på internet hade det räckt väldigt bra med en länk i artikeln. Alla vetenskapliga tidskrifter värda namnet har standardiserade Digital object identifier-nummer som bör medfölja pressmeddelandet, i värsta fall kan fås från författaren — och förresten, borde journalisten inte själv läst den vetenskapliga artikeln, antagligen via just den länken? Bara det går att hitta studien och läsa mer.

Därför är det ingen ursäkt att texten ifråga inte är ett referat utan en krönika som resonerar om innehållet. Och därför är det heller ingen ursäkt om det rör sig om en intervju med en av författarna och att journalisten bara citerar och sammanfattar det hen sa om sin vetenskapliga artikel. För att läsaren själv ska kunna bedöma om analysen är trovärdig måste hen kunna spåra vilka artiklar det gäller. Det blir särskilt ironiskt i samband med två krönikor av Ulrika Björkstén och Karin Bojs (bakom betalvägg) som båda handlar om forskningens trovärdighet och kritiserar en forskargrupp för hur de använder statistiska metoder. Utan att nämna forskarna vi namn eller referera till artiklarna de analyserar och beskriver! Om jag skulle hitta på en hypotetisk situation då det är helt oförlåtligt att inte ge en fullständig referens så skulle det vara när en skriver en kritisk teknisk kommentar, vilket är vad de gör om än på populär/vetenskaplig nivå. Tankeexperiment: jag återkommer till Björksténs krönika om fyra år och blir nyfiken. Hur sjutton ska jag då kunna hitta ”[y]tterligare en studie vi valde bort att rapportera”? Ibland är journalisterna nådiga nog att ge i alla fall namnet på en tidskrift eller en av författarnas namn, men inte ens det. I sak tror jag både Björkstén och Bojs har rätt i sin kritik av analysen av Överkalix-studien (Bygren & al (2014) BMC Genetics), och jag skulle vilja skriva ett positivt blogginlägg som hejade på dem. Det är hemskt irriterande att inte ens de, som kanske är bäst i Sverige, kan få referenserna rätt.