Category Archives: Science

How to do science with a computer: workflow tools and OpenSource philosophy

Spread the love

I have two excellent things on my desk, a Linux Journal article by Andy Wills, and a newly published book by Stefano Allesina and Madlen Wilmes.

They are:

Computing Skills for Biologists: A Toolbox by Stefano Allesina and Madlen Wilmes, Princeton University Press.

Open Science, Open Source, and R, by Andy Wills, Linux Journal

Why OpenSource?

OpenSource science means, among other things, using OpenSource software to do the science. For some aspects of software this is not important. It does not matter too much if a science lab uses Microsoft Word or if they use LibreOffice Write.

However, since it does matter if you use LibreOffice Calc as your spreadsheet, as long as you are eschewing proprietary spreadsheets, you might as well use the OpenSource office package LibreOffice or equivalent, and then use the OpenSource presentation software, word processor, and spreadsheet.

OpenSource programs like Calc, R (a stats package), and OpenSource friendly software development tools like Python and the GPL C Compilers, etc. do matter. Why? Because your science involves calculating things, and software is a magic calculating box. You might be doing actual calculations, or production of graphics, or management of data, or whatever. All of the software that does this stuff is on the surface a black box, and just using it does not give you access to what is happening under the hood.

But, if you use OpenSoucre software, you have both direct and indirect access to the actual technologies that are key to your science project. You can see exactly how the numbers are calculated or the graphic created, if you want to. It might not be easy, but at least you don’t have to worry about the first hurdle in looking under the hood that happens with commercial software: they won’t let you do it.

Direct access to the inner workings of the software you use comes in the form of actually getting involved in the software development and maintenance. For most people, this is not something you are going to do in your scientific endeavor, but you could get involved with some help from a friend or colleague. For example, if you are at a University, there is a good chance that somewhere in your university system there is a computer department that has an involvement in OpenSource software development. See what they are up to, find out what they know about the software you are using. Who knows, maybe you can get a special feature included in your favorite graphics package by helping your new found computer friends cop an internal University grant! You might be surprised as to what is out there, as well as what is in there.

In any event, it is explicitly easy to get involved in OpenSource software projects because they are designed that way. Or, usually are and always should be.

The indirect benefit comes from the simple fact that these projects are OpenSource. Let me give you an example form the non scientific world. (it is a made up example, but it could reflect reality and is highly instructive.)

Say there is an operating system or major piece of software competing in a field of other similar products. Say there is a widely used benchmark standard that compares the applications and ranks them. Some of the different products load up faster than others, and use less RAM. That leaves both time (for you) and RAM (for other applications) that you might value a great deal. All else being equal, pick the software that loads faster in less space, right?

Now imagine a group of trollish deviants meeting in a smoky back room of the evile corporation that makes one of these products. They have discovered that if they leave a dozen key features that all the competitors use out of the loading process, so they load later, they can get a better benchmark. Without those standard components running, the software will load fast and be relatively small. It happens to be the case, however, that once all the features are loaded, this particular product is the slowest of them all, and takes up the most RAM. Also, the process of holding back functionality until it is needed is annoying to the user and sometimes causes memory conflicts, causing crashes.

In one version of this scenario, the concept of selling more of the product by using this performance tilting trick is considered a good idea, and someone might even get a promotion for thinking of it. That would be something that could potentially happen in the world of proprietary software.

In a different version of this scenario the idea gets about as far as the water cooler before it is taken down by a heavy tape dispenser to the head and kicked to death. That would be what would certainly happen in the OpenSource world.

So, go OpenSource! And, read the paper from Linux Journal, which by the way has been producing some great articles lately, on this topic.

The Scientists Workflow and Software

You collect and manage data. You write code to process or analyze data. You use statistical tools to turn data into analytically meaningful numbers. You make graphs and charts. You write stuff and integrate the writing with the pretty pictures, and produce a final product.

The first thing you need to understand if you are developing or enhancing the computer side of your scientific endevour is that you need the basic GNU tools and command line access that comes automatically if you use Linux. You can get the same stuff with a few extra steps if you use Windows. The Apple Mac system is in between with the command line tools already built in, but not quite as in your face available.

You may need to have an understanding of Regular Expressions, and how to use them on the command line (using sed or awk, perhaps) and in programming, perhaps in python.

You will likely want to master the R environment because a) it is cool and powerful and b) a lot of your colleagues use R so you will want to have enough under your belt to share code and data now and then. You will likely want to master Python, which is becoming the default scientific programming language. It is probably true that anything you can do in R you can do in Python using the available tools, but it is also true that the most basic statistical stuff you might be doing is easier in R than Python since R is set up for it. The two systems are relatively easy to use and very powerful, so there is no reason to not have both in your toolbox. If you don’t chose the Python route, you may want to supplement R with gnu plotting tools.

You will need some sort of relational database setup in your lab, some kind of OpenSource SQL lanaguge based system.

You will have to decide on your own if you are into LaTex. If you have no idea what I’m talking about, don’t worry, you don’t need to know. If you do know what I’m talking about, you probably have the need to typeset math inside your publications.

Finally, and of utmost importance, you should be willing to spend the upfront effort making your scientific work flow into scripts. Say you have a machine (or a place on the internet or an email stream if you are working collaboratively) where some raw data spits out. These data need some preliminary messing around with to discard what you don’t want, convert numbers to a proper form, etc. etc. Then, this fixed-up data goes through a series of analyses, possibly several parallel streams of analysis, to produce a set of statistical outputs, tables, graphics, or a new highly transformed data set you send on to someone else.

If this is something you do on a regular basis, and it likely is because your lab or field project is set up to get certain data certain ways, then do certain things to it, then ideally you would set up a script, likely in bash but calling gnu tools like sed or awk, or running Python programs or R programs, and making various intermediate files and final products and stuff. You will want to bother with making the first run of these operations take three times longer to set up, so that all the subsequent runs take one one hundredth of the time to carry out, or can be run unattended.

Nothing, of course, is so simple as I just suggested … you will be changing the scripts and Python programs (and LaTeX specs) frequently, perhaps. Or you might have one big giant complex operation that you only need to run once, but you KNOW it is going to screw up somehow … a value that is entered incorrectly or whatever … so the entire thing you need to do once is actually something you have to do 18 times. So make the whole process a script.

Aside form convenience and efficiency, a script does something else that is vitally important. It documents the process, both for you and others. This alone is probably more important than the convenience part of scripting your science, in many cases.

Being small in a world of largeness

Here is a piece of advice you wont get from anyone else. As you develop your computer working environment, the set of software tools and stuff that you use to run R or Python and all that, you will run into opportunities to install some pretty fancy and sophisticated developments systems that have many cool bells and whistles, but that are really designed for team development of large software projects, and continual maintenance over time of versions of that software as it evolves as a distributed project.

Don’t do that unless you need to. Scientific computing often not that complex or team oriented. Sure, you are working with a team, but probably not a team of a dozen people working on the same set of Python programs. Chances are, much of the code you write is going to be tweaked to be what you need it to be then never change. There are no marketing gurus coming along and asking you to make a different menu system to attract millennials. You are not competing with other products in a market of any sort. You will change your software when your machine breaks and you get a new one, and the new one produces output in a more convenient style than the old one. Or whatever.

In other words, if you are running an enterprise level operation, look into systems like Anaconda. If you are a handful of scientists making and controlling your own workflow, stick with the simple scripts and avoid the snake. The setup and maintenance of an enterprise level system for using R and Python is probably more work before you get your first t-test or histogram than it is worth. This is especially true if you are more or less working on your own.

Culture

Another piece of advice. Some software decisions are based on deeply rooted cultural norms or fetishes that make no sense. I’m an emacs user. This is the most annoying, but also, most powerful, of all text editors. Here is an example of what is annoying about emac. In the late 70s, computer keyboards had a “meta” key (it was actually called that) which is now the alt key. Emacs made use of the metakey. No person has seen or used a metakey since about 1979, but emacs refuses to change its documentation to use the word “alt” for this key. Rather, the documentation says somethin like “here, use the meta key, which on some keyboards is the alt key.” That is a cultural fetish.

Using LaTeX might be a fetish as well. Obliviously. It is possible that for some people, using R is a fetish and they should rethink and switch to using Python for what they are doing. The most dangerous fetish, of course, is using proprietary scientific software because you think only if you pay hundreds of dollars a year to use SPSS or BMD for stats, as opposed to zero dollars a year for R, will your numbers be acceptable. In fact, the reverse is true. Only with an OpenSource stats package can you really be sure how the stats or other values are calculated.

And finally…

And my final piece of advice is to get and use this book: Computing Skills for Biologists: A Toolbox by Allesina and Wilmes.

This book focuses on Python and not R, and covers Latex which, frankly, will not be useful for many. This also means that the regular expression work in the book is not as useful for all applications, as might be the case with a volume like Mastering Regular Expressions. But overall, this volume does a great job of mapping out the landscape of scripting-oriented scientific computing, using excellent examples from biology.

Mastering Regular Expressions can and should be used as a textbook for an advanced high school level course to prep young and upcoming investigators for when they go off and apprentice in labs at the start of their career. It can be used as a textbook in a short seminar in any advanced program to get everyone in a lab on the same page. I suppose it would be treat if Princeton came out with a version for math and physical sciences, or geosciences, but really, this volume can be generalized beyond biology.

Stefano Allesina is a professor in the Department of Ecology and Evolution at the University of Chicago and a deputy editor of PLoS Computational Biology. Madlen Wilmes is a data scientist and web developer.


Spread the love

The Solar System from The Smithsonian

Spread the love

Smithsonian Exploration Station: Solar System by Jon Richards is similar to the previously reviewed Exploration Station: The Human Body. This is part of a new series of STEM learning toys from the Smithsonian, and they are just now available for purchase.

As is the case with the other kits, the Solar System includes a book, a large format big flat thing to which one might attach stickers, stickers, and a unique on-topic object, in this case, those cool stars you can attach to your ceiling or walls, and they glow in the dark. Continue reading The Solar System from The Smithsonian


Spread the love

Neil deGrasse Tyson Accessory to War

Spread the love

Accessory to War: The Unspoken Alliance Between Astrophysics and the Military by Neil deGrasse Tyson and Avis Lang is a good and interesting book, and I recommend it.

This is not a book that fully explores the alliance and overlap between war and makers of war on one hand and science and scientists on the other. Authors Neil deGrasse Tyson and Avis Lang focus on one part of that relationship, the link between astrophysics and related disciplines (really, astronomy at large) and the military.

Even as I recommend Accessory to War: The Unspoken Alliance Between Astrophysics and the Military, which I do, I want to broaden the conversation a little with a couple of thoughts about the relationship, from my own experience. Then, I’ll give you my strident critique of the book (there is One Big Problem), and then, again, tell you to buy it

Back when I was working in or near the Peabody Museum, in Cambridge, the museum’s assistant director, Barbara Isaac, hired me to work with the NAGPRA database. NAGPRA was the North American Graves Protection and Repatriation Act. Ultimately, large swaths of the Peabody Museum’s collection would be turned over, or some other thing done to it, as per the wishes of the various Native American groups associated with that material. Most of the work had already been done. But, Barbara is a meticulous person and wanted to make sure the dotting of each i and crossing of each t was double checked. So, I was one of two people charged with going over the printouts, on that old green and less green striped paper, bound in large blue cardboard books. Each line (or two) was an item or collection of items, with notes, and an indication of what was going to happen to the material. There were just a few options, but the basic idea was this: An item listed was either going to be returned to a tribal group, or not. My job was mainly to look at stuff that was not going to be returned and, given my ongoing scan of what was going to be returned, and my knowledge of North American prehistory, ethnography, and archaeology, to earmark things that said “do not return” but where maybe we should be returning it. So, for example, after noting that a particular South Dakota Lakota tribe would have this, and that, and this other, soapstone tobacco pipe returned to them, when I saw that the ninth pipe on the list, several lines down and all by itself, is labeled to not be returned, I’d earmark that. Nearly 100% of the time, that ninth pipe was just something that nobody wanted, or it didn’t really exist (not all museum databases are exactly accurate). But, it would be earmarked.

Many items on the list had information as to how the item had originally gotten to the museum.

Many, many items, especially items taken from Native Americans living in what was the frontier between about 1840 and 1900, were taken by medical doctors who, as we all know, also stood in for naturalists, or some kind of traveling scientist, on military and quasi military expeditions (Like Darwin).

And many of those items were taken for use as medical specimens.

We initially learned that Native Americans have a particular blood type because, in part, of studies done on blood stains on shirts of slain warriors, collected after various battles with the US Army units accompanied by such scientists. There are a few famous cases of Native American bodily remains, mostly but not all skeletal remains, sitting in the anatomy teaching rooms of this or that college. But a lot more, a lot not noticed by either historians or even the all seeing all knowing Wikipedia, are or were sitting in museums around the world. Collected, by scientists wearing military uniforms, on military ventures, with a scientific twist.

So the science-military link is not exclusive to astronomy and astrophysics.

I wrote elsewhere about the person I met who was taking Pentagon funding to build an object that would help cure cancer. An example of a scientist subverting the military funding process. And so on.

OK, my complaint.

The authors have two long chapters (and references elsewhere) covering the early history of human endeavor in general (not limited to military) and the evolution of astronomy, mainly as it related, over a very long period of time, to navigation. One chapter covers land, the other the sea.

Staring somewhere along the way in each chapter, we get a very nice, well done, and pretty full description of the process of humans learning about the stars, about the earth and how to find one’s way, etc. But prior to that, the authors do what so many authors do and I so much dislike. I’ve written about this before. We get a version of human prehistory, and indeed, current human variation (or at least, ethnographically recent), that is bogus. For example, the authors speak of the first modern humans wandering around in the Rift Valley of Africa. There is no evidence that modern humans evolved there. Using just the archaeology, southern Africa is a more likely origin, and the physical anthropology record is simply incomplete. There are early fossils there, but that is because the rift valley is and was a big hole that made fossils. The entire rest of the continent is big, and the evolution probably happened there, not in the rift.

Similarly, ethnographic variation we see in the present and recent times is stripped out. For example, most rain forest dwelling foragers are not known to have a sky oriented cosmology, or to use the sky for much information about seasonal change in ecology, or navigation. And, there have always been a lot of rain forest dwelling foragers.

Putting that criticism aside, however, Accessory to War: The Unspoken Alliance Between Astrophysics and the Military is a very enjoyable and informative read, and makes all the important points about the sometimes uneasy, sometimes too easy, relationship between science and the military enterprise, with a careful look at politics, government, and powerful industrial interests.

Now we also need a book on the broader issue of military-technology links. And, we need a personal ray gun that zaps out of control robots:


Spread the love

Difference and Disease: Excellent new book on medicine and race in the 18th century British empire

Spread the love

Suman Seth is associate professor in the Department of Science and Technology Studies, at Cornell. He is an historian of science, and studies medicine, race, and colonialism (and dabbles as well in quantum theory). In his new book, Difference and Disease: Medicine, Race, and the Eighteenth-Century British Empire, Seth takes on a fascinating subject that all of us who have worked in tropical regions but with a western (or northern) perspective have thought about, one way or another.

As Europeans, and Seth is concerned mainly with the British, explored and conquered, colonizing and creating the empire on which the sun could never set no matter how hard it tried, they got sick. They also observed other people getting sick. And, they encountered a wide range of physiological or biosocial phenomena that were unfamiliar and often linked (in real or in the head) to disease. A key cultural imperative of British Colonials as to racialize their explanations for things, including disease. The science available through the 18th and 19th century was inadequate to address questions that kept rising. Like, why did a Brit get sick on his first visit to a plantation in Jamaica, but on return a few years later, did not get as sick? If you have a model where people of different races have specific diseases and immunities in their very nature, how do you explain that sort of phenomenon? How might the widely held, or at least somewhat widely held, concept of polygenism, have explained things? This is an early version of the multi-regional hypothesis, but more extreme, in which god created each type of human independently where we find them, and we are all different species. (Agassiz, with his advanced but highly imperfect geological understanding, thought the earth was totally frozen over with each ice age, and repopulated with these polygenetic populations of not just humans, but all the organisms, after each thaw).

Seth weaves together considerations of slavery and abolition, colonialism, race, geography, gender, and illness. This is an academic book, but at the same time, something of a page turner. Anyone interested in disease, colonial history, and race, will want to re-excavate the British colonial world, looking at disease, illness, and racial thinking, with Suman Seth as your guide. I highly recommend this book.


Spread the love

The Skeptics’ Guide to the Universe

Spread the love

I’m about to trash skepticism (as a cult) but before I do, I want to recommend that you get Steve Novella’s excellent new edition of The Skeptics’ Guide to the Universe: How to Know What’s Really Real in a World Increasingly Full of Fake.

I no longer call myself a skeptic. Well, actually, I probably never really did, but now I’m more explicit about that. Why? Two reasons. 1) Global warming and other science deniers call themselves skeptics, and I don’t want any confusion. 2) The actual “skeptics movement” is described as…

…a modern social movement based on the idea of scientific skepticism (also called rational skepticism). Scientific skepticism involves the application of skeptical philosophy, critical-thinking skills, and knowledge of science and its methods to empirical claims, while remaining agnostic or neutral to non-empirical claims (except those that directly impact the practice of science).[1] The movement has the goal of investigating claims made on fringe topics and determining whether they are supported by empirical research and are reproducible, as part of a methodological norm pursuing “the extension of certified knowledge”.[2] The process followed is sometimes referred to[by whom?] as skeptical inquiry.

[source]

That’s all nice and all, but I discovered that the actual skeptics movement is made out of people not quite so cleanly guided by a philosophy, roughly one third of whom are not really skeptics (such as Penn Jilette and James Randi, who allowed their libertarian philosophy to drive “skepticism” of anthropocentric global warming long after the scientific consensus was established), “mens rights activists” (MRAs) who vigorously attacked anyone speaking out in favor of women’s rights, against rape, etc., and #MeToo movement poster boys, who have for years used skeptical conferences as their own private meat markets.

Besides, I’m an actual scientist, so I can be a fan of science without having to be a fanboy, which makes it easier for me.

I started writing publicly, blogging, partly to be an on-line skeptic, to take on politically charged topics, especially as related to evolutionary biology, but other areas of science as well (and more recently, climate change), addressing falsehoods and misconceptions. But I very quickly discovered that there multiple and distinct kinds of “skepticism” make up the larger conversation.

There is a lot of very low level, knee jerk skepticism that is little more than uninformed reactionism, based on, at best, received knowledge. That is about as unskeptical as it gets. The Amazing Randy says Global Warming is nothing other than natural variation. Therefore, I will believe that. Uncritically. Some of this is what I long ago labeled as “hyperskepticism.” This is where potentially valid skepticism about a claim is melded with hyperbole. “There is not a single peer reviewed study that shows the bla bla bla bladiby bla” coming from the mouth of a person who has never once even looked for a peer reviewed study about any thing. They hyperskeptic may create entire categories of things that include claims worthy of debunking, and put all of the thing into the debunked category even if they are not.

A fairly benign example of this relates to CAM medicine. “CAM” refers to “complementary and alternative medicine” like acupuncture, rolfing, and the like. These are mostly forms of treatment that have no basis in science, and probably don’t do anything useful even if they sometimes cost real money. Hypersketpics put all CAM into the same category and light a match to it. But, there is a subset of CAM that is legit … the very fact that I wrote that sentence just there will disqualify me, and my entire post, and everything I ever say — there will be comments below that say “I stopped reading when you said “there is a subset of CAM that is legit”. OK, hold on a second, count to four. One two thee four. Now that all the hyperskeptics have gone off in a huff I can continue … and I can give you an example. There are people who undergo regular, uncomfortable, sometimes painful or sick-making treatments as part of their normal medical routine. Chemotherapy, dialysis, that sort of thing. We know that the quality of an individual’s life can be improved, their stress levels, reduced, and thus, probably, the outcome of their treatments improved or made less complicated, if the environment in which they get the treatments are more comfortable. This is why dentists put ferns and pictures of the ocean in their waiting rooms. There is evidence to suggest that surroundings should be considered in design of treatment rooms, waiting room, etc. (See for example, Brown and Gallant, 2006, “Impating Patient Outcomes Through Design: Acuity Adaptable Care/Universal Rom Design. “Critical Care Nursing Quarterly. 29:4(326-341) and Ulrich, Zimring, and Zhu, 2008, “A Review of the Research Literature on Evidence-Based Healthcare Design. HERD 1(3). They hyperskeptic wants divide the world into evidence based double blind study proven and everything else, with everything else being always wrong in all ways. (Perhaps I exaggerate a little, but only for the irony.) This concept, of considering room and environmental design, now standard, did exist before CAM (those dentists and their ferns) but the study an implementation of stress reducing design as we now know of it comes from the CAM movement. What is needed is not closing down CAM, but making it accountable. It would probably get much smaller if that happened, but what is left of it would be useful.

Having said all that, the skeptical world includes a number of excellent and widely respected actual self-identified skeptics who have science or medical backgrounds, and who occasionally write books that everyone should read. One such individual is Steven Novella, who wrote some time ago a skeptics guide to the universe. Well, that book is out of date (universes evolve) and there is now anew edition: The Skeptics’ Guide to the Universe: How to Know What’s Really Real in a World Increasingly Full of Fake.

Four others contributed to this volume, Bob Novella, Cara Santa Maria, Jay Novella, and Evan Bernstein.

I do not agree with everything in this book. For example, although the discussion of placebo effect is excellent, I have a different take on it. I like to divide the effect up into different categories than I do, and I want to make a more explicit connection between the phenomenon called placebo effect and the role and meaning of a control. But for the most part, every single one of the more than 50 topics covered in this book is well treated, informative, and enjoyable to read. (See what I did there? I was a little skeptical of the book, so now, you know it must be good!)

Do get and read this book, get one for a friend for a holiday gift, and enjoy. But right now, before you even do that, to tho the Amazon page and find the negative reviews. There are only two now (the book just came out) but they are a hoot.


Spread the love

Conflict of Interest in Science

Spread the love

There is a great deal of overlap and integration between government agencies, private corporations including Big Pharm and Big Ag and Big Whatever, university and other research institutions, and the scientist and others who work in these places.

This topic is addressed in the latest episode of the science podcast Ikonokast, which also includes details about a recent minor scandal involving GMO research and squirrels. And maybe bears.

Check it out: Episode 22 – Ethics, Conflict of Interest, and Science


Spread the love

Darwin Quotes, Assembled

Spread the love

From Janet Browne, the author of Charles Darwin: A Biography, Vol. 1 – Voyaging and other works about Charles Dawin, The Quotable Darwin.

Quotes by Charles Darwin are not just the stuff of memes. Even the fake quotes. They can be the center of long arguments, or at least, they can significantly augment the arguments. For example, did you know that while Darwin never used the term “missing link” he did talk about missing links quite a bit, missing links are central to his thinking about evolution, and all those writers of today who claim that we must never speak of missing links are misguided? Continue reading Darwin Quotes, Assembled


Spread the love

Making Sense of Weather and Climate

Spread the love

Read Making Sense of Weather and Climate: The Science Behind the Forecasts, by Mark Denny if you want to … well, do what the title of the book says.

I know a lot of you are interested in global warming/climate change, so you need to know that this book is not mainly about that (but it is covered). Rather, this book is the Rosetta Stone that allows you to connect a general understanding of the planet (it is round, it spins, it has an atmosphere that includes water vapor, and tends to reside between -50 and +50 degrees C, etc.) and the person on the TV talking about air masses going up and down and what is going to happen during “the overnight” and “the overday” and such. Continue reading Making Sense of Weather and Climate


Spread the love

Measurements of the human male kakadodo organ, does it matter and why?

Spread the love

This is a repost of an item I put up in 2013 based on some interesting scientific research. Today, I was told by Google that if I do not take the article down, I will lose my ad sense qualification. Google and companies like Google are giant behemoths that do not have humans to whom one can talk when they do something boneheaded like this. So, I’ll unpublish the original item and post it here with a change in title. Also, words that might be interpreted by an unintelligent robot at Google as violating policy have been changed. Continue reading Measurements of the human male kakadodo organ, does it matter and why?


Spread the love

Is There Evidence of Life On Mars?

Spread the love

At present, the evidence suggests that life may have existed in the past on Mars, or not. However, the scientific consensus is that we assume life never arose on Mars, and will continue to do so until evidence pops out and bites us in the mass spectrometer.

There is no evidence of life on Mars right now. Continue reading Is There Evidence of Life On Mars?


Spread the love

Minnesota March For Science

Spread the love

Just a little video and some pictures from today’s March for Science, Minnesota.

This one from the march route on the way to the capitol. Skip ahead to about 1:12 go get the best chant:

PHOTO_20170422_111658

Another video, this one from The Hedge:

You don’t see this sign at many protests:
PHOTO_20170422_114843

Mammals were welcome at the march:PHOTO_20170422_115032

And, now, Here is my extraordinarily well timed Facebook Live post


Spread the love