Thursday, December 12, 2013

Fun with custom tracks in WashU EpiGenome Browser

In a course of working on a multiscale domains project (see [2]), I came to a point where I wanted to plot domains against the epigenetic tracks and associated 3C data. WashU EpiGenome Browser contains a lot of such data and also supports custom tracks -- perfect! Below I describe how to prepare a custom track for overlapping and non-overlapping domains.

Dixon et al [1] domains

Dixon et al domains are non-overlapping and so I plotted them as a categorical track in WashU EpiGenome Browser.

Initial domain file looks like this:

chr1 760000 1280000
chr1 1280000 1840000
chr1 1840000 2320000
...

First, I added a column at the end to represent a category and alternate between the categories 1 and 2 for every other domain:

chr1    760000  1280000 1
chr1    1280000 1840000 2
chr1    1840000 2320000 1
...

Now, the file looks like a bedGraph format and we can use tabix:

bgzip -c dixon.domains.bedgraph > dixon.domains.bedgraph.gz
tabix -p bed dixon.domains.bedgraph.gz

The first command gzips the bedGraph file, the second one generates an index *.tbi file. Now copy both *.gz and *.tbi to your webserver and you can load the tracks from the EpiGenome Browser using the "CustomTK" menu.

Dixon domains URL: http://www.cs.cmu.edu/~dfilippo/epitracks/dixon.domains.gz
Domains are alternating yellow and orange blocks (each block is a domain), 3C matrix for the same cell line (IMR90, or human fibroblast) is shown in pink:



Multiscale domains [2]

Multiscale domains generated by Armatus change from one gamma setting to another, and so it was important that the track supports overlapping items. Multiscale domains are similar to a collection of genes (if you consider their various isoforms) and are best represented by a bed annotation track.

As before, initial domain file looked like this:

chr20   61640000        62440000
chr20   60760000        61520000
chr20   60600000        60640000

...

Now, since we may have several domains start at the same position, we need to sort domains by the start position, or otherwise tabix will throw an error:

chr20   40000   26280000
chr20   40000   80000

chr20   40000   120000

Next, to fit in with the format of the a bed file, we need to add 3 more fields to every line: a label assigned to this domain (a simply set it to indicate what gamma the domain comes from), a category (in the case of domains I assigned unique categories to individual gamma settings), and an indicator of the forward/reverse strand (we don't really need the forward/reverse information, so it could be replaced with a "."):

chr20   40000   26280000        0.0     1       +
chr20   40000   80000   0.0     1       +
chr20   40000   120000  0.0     1       +

Now that the bed file is ready, I use tabix tools again (same as above):

bgzip -c chr20-all-gamma.bed > chr20-all-gamma.bed.gz
tabix -p bed chr20-all-gamma.bed.gz

Upload the newly created *.gz and *.tbi files to the webserver and they are ready to be used within the WashU Epigenome Browser. Below, Armatus' domains are shown in green and vary between different scales capturing many alternative domains:


The labels on the domains correspond to the length scale at which they were observed (gamma).

My multiscale domains URL: http://www.cs.cmu.edu/~dfilippo/epitracks/chr20-all-gamma.bed.gz (chromosome 20 only).

Referi


[1] Dixon et al. Topological domains in mammalian genomes identified by analysis of chromatin interactions. Nature. 485 (376-380). 2012.
[2] Filippova et al. Multiscale identification of topological domains in chromatin. WABI 2013.
Preparing custom track (WashU Epigenome Browser help)
Making a custom gene track (Epi Browser author writes out some commands to make a gene track)
Browser file formats (UCSC's FAQ on file formats for the UCSC and Epigenome Browsers)


UPD: one more reference custom gene tracks (WashU Epigenome Browser help)

Friday, December 06, 2013

Twinlist: When Simple is Powerful

I do not take pills too often, mostly it's something for a headache once every couple of months or allergy whenever the flowers are in bloom. However, there are people around us that take many medications daily, especially people with chronic conditions and the elderly. Keeping track of medications within an electronic medical record (EMR) for such patients is, not surprisingly, a challenge: the patient may switch to a generic drug, but the EMR lists it under a brand name, the dosage may be off, or instead of orally the patient now takes the drug intravenously. Reconciling what the patient is actually taking and what is recorded in the system is a boring and daunting task: one has to pay attention to details like "4mg" vs "7 mg" and meticulously compare drug names -- not something a busy physician can spend a lot of time on. However, this problem shows up every time the provider's data is out of date. This could be during an emergency visit to the hospital or during a routine visit to a physician or a specialist. Keeping track of the current medications is important when adjusting or prescribing new treatment and as to avoid prescribing drugs and procedures that may be incompatible with current medications.

The Human-Computer Interaction Lab (HCIL) at University of Maryland took on this challenge and produced a simple, yet powerful way to automate medication list reconciliation (a medical term for a problem described above). Computers are good at exact comparisons -- and that's what researchers at HCIL used to find discrepancies in dosage, path of administration, and frequency for the same drugs coming from two different lists. Inexact and ambiguous matches are then presented to the user who can decide how to proceed. Through intuitive highlighting and animation that makes it easier to follow the process they have made reconciliation quick and managed to reduce human error.


What I appreciate the most about this interface is its simplicity (it is a list after all). It is easy to identify the drugs that match and the drugs that differ, drugs that are unique to the hospital and drugs that are unique to a patient. Similar drugs are aligned on the same line visually encoding the relationship. The details that differ between similar drugs are subtly highlighted in yellow as to not crowd the overall picture with too much information. The careful use of animation makes a seemingly boring task more fun. Power users may skip the animation and use the overhead menu instead.

I am very impressed with HCIL's continued success and if I ever find myself having to manage 20 different drugs, I would want my physician to use Twinlist for reconciliation! They took a mundane task that no one likes and turned it into an easy exercise for the eyes improving medical care in the end. Having seen some EMRs and what a tangled mess they are, I believe it is solutions like this -- making mundane data entry/cleaning/updating -- that can significantly improve care and save doctors some precious time.

Code and more details about this award-winning design are available on Twinlist's page.

Monday, November 11, 2013

On war and peace

A while back Google released an Ngram Viewer tool which gives an opportunity to query the texts of many Google Books all at once. One can spend many hours trying out words and their different combinations and seeing how their frequency of use changed over the centuries. It tells you about popular trends and dying ideas. Today, through a series of random steps I found myself on Ngram Viewer quering for "inference", then "war". Here is a plot of occurrences of "war" in the many books since 1800 to the present day: Two bumps around 1920ies and 1940 are the two world wars. No other time points stand out - sorry, Iraq, Afghanistan, Sri-Lanka, East Timor, and many-many others.
Well, are we doing better in terms of promoting peace? Apparently not:

We use "peace" less and less. Sure, we spoke about peace a little more often during the first and second World Wars, but the general decline in its use continues. I wonder if "peace" is simply being replaced by another word, or does it mean that we are all doomed? A quick search through synonyms of "peace" offers a glimpse of hope in "nonviolence":

and "ceasefire":

although neither of these words is being used quite as often as "peace".

Well, be it non-violence or ceasefire, there is still hope that we will survive as a human race!

Thursday, August 15, 2013

Alternative domains highlighted in a review

Spatial proximity between far-away parts of DNA has implications for DNA accessibility, gene expression and regulation. The information about which parts of DNA are physically co-located in the nucleus can be obtained through various Hi-C experiments: 3C (chromatin conformation capture), 4C (circularized 3C), 5C (carbon copy 3C), and some others. Our research group has been working a lot with Hi-C lately, so I made it a habit to scan my Feedly collection of titles from various journals for new relevant Hi-C material. As I was browsing, I saw this article in Nature Reviews talking about Hi-C data. The keypoints section drew my attention because our research group has developed some methods that fit with these outlined research problems almost directly! In particular, I wanted to highlight these two points:
  • Mining increasingly comprehensive chromatin interaction maps for chromosomal domains and complete genomes requires novel computational methods and modeling tools.
  • Statistical analysis of Hi-C data identifies multiple scales of domain organization: larger (1–10 Mb) chromosomal compartments and smaller (less than 1 Mb) topologically associating domains
Topological domains were first mentioned in a paper by Dixon et al. that appeared in Nature last year. Domains are contiguous segments of DNA that self-interact a lot more frequently than they interact with the rest of the chromosome. The original paper proposed an HMM method for finding domains and reported a collection of domains found by their algorithm. The article got cited over a hundred times since then and these domains have appeared in multiple analyses.

However, as the review above suggests, there may be other domains that overlap, nest in, or completely contain domains reported by Dixon et al. One look at the interaction matrix is enough to convince oneself of their existence:
Here I plotted a submatrix of human chromosome 22 (hESC cells) with each cell in the matrix representing 40Kbp of sequence. I highlighted several potential domains in purple, but there are many more just in this one snapshot.

Guided by what we saw in the matrices, we have developed a simple dynamic programming approach that finds alternative domains of various sizes. When applied to the same Hi-C interaction matrices that were used by Dixon et al, we were able to identify domains that are significantly different from Dixon's domains, yet are, in some cases, more enriched for certain chromatin marks. We are working on an extension to this problem that will find other optimal solutions to our formulation and plan on releasing the code soon. Our preprint is already posted on the ArXiv and will appear in this year's WABI, and now there is a review that calls for methods like ours to search for alternative domains. What a boost of confidence!

Sunday, November 18, 2012

Dental health insurance

Going to a dentist is a stressful experience for most of us. However, trying to understand your dental insurance may stress you out even more, especially if your insurance is anything like mine. Here is a piece of paper that claims to "explain" the charges from my recent visit to a dentist to get a filling:

I studied this piece of paper in detail for some time, and, after trudging past the quirky vocabulary, I remain puzzled:
Problem 1: What? Does $200 + $200 + $200 + $200 equal $400?
Problem 2: What is "Allowance"? What determines how much the insurance company will pay for a procedure?
Problem 3: How is "amount paid" determined? Why is the "allowed amount" on line 4 $60, but insurance company decides to pay only $16? How is line 4 different from line 2: same procedure, same charge and allowance, but insurance company made a different call on that. Why?
Problem 4: What are these codes in the "Remarks" section? Aaaah, there they are on the next page. At least an indication of what these codes are would be helpful. Or, you can go crazy and explain them away on this very page in the whitespace below the table!

The company's website, where I went to check what I am covered for, is also... wanting. Here is an example of what one sees when they go to check their coverage:
Looks reasonable, doesn't it? But hold on, let's check out the coverage details for the fillings:
Whoa, how do I navigate through this mess? Where are the fillings?
Problem 1: Is this a list? Is this free text?  Are "Post removal" and "Enamel Microabrasion" the only two procedures (due to the visual cues - the dashes) or is every line a separate procedure?
Problem 2: Are the procedures ordered in any reasonable way, say, alphabetic, making it easier to navigate? How can one search for a specific procedure other than by reading the whole list?
Problem 3: What are these codes in parentheses? I guess these are procedure codes, but how do I know if my dentist is about to install D2391 and not D2394 into my mouth? And since there are codes for everything, why isn't there a code for the "comparable amalgam filling"?
Problem 4: Why wouldn't the text span the whole line?..

I think you get the point: either I'm a high school dropout, or this is really hard to read for a common person. A couple of gentle touches will make the "EOB" better, same goes for coverage - just adding some organization to the text improves its readability dramatically:
(the sad truth is nothing is covered). 
After trying to understand my dental benefits and trying to read  the "explanation" of such, I can only agree with our president: yes, we need a reform in health care. But this reform has to start at the very beginning, with people being able to understand their insurance. Improving the communication and readability of the benefits and coverage is the easiest step to make and, possibly, one of the most important.

Sunday, March 18, 2012

clustering a graph using Python

For those of you who are interested in graph clustering and use Python, here is a Python implementation of a clustering algorithm that finds non-overlapping modules that maximize graph's modularity.

Maximal vs maximum



Here I am again: what do I use in a sentences, "maximal" or "maximum"? After some digging around, I discovered that Wikipedia has a whole page explaining what a maximal element is, but in short:

  • "maximal" - a local maximum,

  • "maximum" - an absolute maximum

Wednesday, December 07, 2011

About a year ago I switched from JabRef to Mendeley and fter this unusually long test run I am quite happy with it:

  • it keeps my references in a cloud, so I can easily sync refs on my laptop and desktop machines;
  • I have sorted my references into folders by their topic and by the project;
  • my colleagues and I have created thematic groups through which we share relevant publications;
  • I can search for papers at mendeley.com -- comes in handy when I am outside of university's network and do not have access to some journals
  • I can add papers to Mendeley through their web importer clicking on a bookmark when I view the paper at the publisher's website

Wednesday, September 07, 2011

Despite all the pluses and minuses that a anonymous peer-review system has, there is one major issue that I have with it: bad reviewers. I'm not talking about reviewers who criticized my work, I mean those who are lazy, incompetent, or simply angry at the world, those who have no idea what my work is yet they talk about it with such authority!
I'd like to meet:

  • reviewer who commented on a great video I submitted along with a paper that had no video

  • reviewer who claimed I had no video - yet the other two reviewers found the video helpful (there was indeed a video)

  • reviewer who claimed that TF-IDF scores were not appropriate for text mining

  • reviewer who claimed "no related work as cited or discussed" for a paper with a page of related work and ~40 references. Given, it was not in a separate section titled "Related work" which, apparently, made it impossible to notice

  • reviewer who noted that my draft needed "some wordsmithing" and continued on with: "I belief...", "no future more section", "in the introduction was stated...", "explore and asses similarity", "an consensus", "requirements were not disused", " identified cores seems to be..." in a broken English. Really?



Is this the best we can be?

Tuesday, August 16, 2011