Monthly Archives: March 2016

I wrote a similar post for downloading sequences of yeast genes.

Basically I needed to do some analysis on the upstream promoter region of about 1200 human genes.

I wasn’t gonna download them one-by-one, and I didn’t want to get a database dump of the whole genome.

Luckily, there’s UCSC’s hgTable! (I love you guys)

Screen Shot 2016-03-31 at 11.39.02 AM

So it hit up.

Screen Shot 2016-03-31 at 11.39.31 AM

Paste in your list of genes.

Note: No commas at the end of lines

Screen Shot 2016-03-31 at 11.45.14 AM

Submit to get your sequences!

You can even toggle between many options, like genomic DNA or protein sequence, or a certain number of bases upstream and downstream of the gene.

Screen Shot 2016-03-31 at 11.46.18 AM

The output will be in one giant FASTA file so if you’re getting the sequences of a lot of genes, you better download the gzip, ’cause it’ll take forever to load it in your browser (it’s on the order of 100MB).

Another note: you might get more than one sequence per gene, depending on what tables, groups, and tracks you select.

Have fun!

So I use Vagrant/virtual machines in my daily development and with that comes annoyances that my host-machine-only friends don’t experience.

I have my Flask app set up to detect changes and reload whenever static files change.

However, Werkzeug updated and my Flask’s auto reload stopped working.

Turns out it was using inotify and since I’m on a virtual machine, (using the /vagrant/ directory), inotify can’t detect changes on a mounted filesystem.

The solution was to use stat.

from flask import Flask
app = Flask(__name__)

def hello():
    return "Hello World!"

if __name__ == "__main__":, reloader_type='stat')

Of course, there’s some disadvantages to stat, it might technically be a watchdog issue, and Werkzeug technically updated a long time ago.

Anyhoo, here’s my quick and dirty solution. I’m posting it ’cause it was hard to search for.

I want to re-compile static assets (SASS to CSS and Coffeescript to JS) whenever there’s change in my Flask app.

I also want to optionally set a flag to toggle whether that compilation happens or not.

I’m using Flask-Assets, and it only seems to trigger the compilation whenever the jinja template with the corresponding assets extension is loaded.

For example, js_all.js will only be created whenever the jinja template with the following is loaded.

{% assets "js_all" %}
    <script type="text/javascript" src="{{ ASSET_URL }}"></script>
{% endassets %}

Bizarrely, triggering the build manually was rather hard to search for.

Here’s my solution.

You can use instead of asserts[‘js_all’].urls()

if reload_flag:
  assets = Environment(app)

  # Don't cache otherwise it won't build every time
  assets.cache = False
  assets.manifest = False

  js = Bundle('jquery.js', 'base.js', 'widgets.js',
              filters='jsmin', output='gen/packed.js')
  assets.register('js_all', js)


You can build bundles manually with .urls().

if reload_flag:
  assets = Environment(app)

  js = Bundle('jquery.js', 'base.js', 'widgets.js',
              filters='jsmin', output='gen/packed.js')
  assets.register('js_all', js)


In the template:

<script type="text/javascript" src="/static/gen/js_all.js"></script>

It’s a lot less robust than using assets to automatically inject the resource url, but for me, I don’t want compilation to happen on production (I don’t even want the compilation tools on the production machines).

Hope this helps folks.
Let me know if there’s a better answer.

My Ergodox Ez came today!


It’s my first mechanical keyboard and I love it! I’m especially tickled by the red light when you go into code mode.

It’s open hardware and open firmware, and feels well made in general.

I’ve been meaning to get a mechanical keyboard for ages, and finally pulled the trigger when a friend gotten one.

Check it out if you’re in the market for a mechanical keyboard.

The Saccharomyces Genome Database is a really nice tool to get yeast gene info. I used it for the first time this past week.

I had to retrieve the sequence of 50+ yeast genes and individually downloading 50+ fasta files seemed really tedious.

Eventually I figured out you could retrieve multiple genomic sequences using YeastMine.

The YeastMine template query feature accepts comma separated genes.

Screen Shot 2016-03-17 at 9.53.27 PM

The resulting genomic DNA sequences can then be exported to CSVs.

Screen Shot 2016-03-17 at 9.54.59 PM

Seasoned SGD users probably already knew about this feature, but it took me a while to figure out (I did not have any luck searching for this topic).

Hopefully this post will save someone some time!

Here’s some highlights from the rest of CES / my Vegas trip:


There was congee at the hotel’s breakfast buffet! SO GOOD!


First time playing craps, I won $10 and then immediately took my winnings and ran.


Harry and I imagined having fish for dinner.

Overall, fun trip. Got to talk to a lot of people about 3D printing. Got to see some friends (great surprises).

No Elvis though.