Ubuntu 9.10 WM quirks

September 16, 2009 at 2:17 am (review, software, tips, ubuntu) (, , , )

The quirks of my spanking new Ubuntu install is driving me nuts..

I found solutions online that do not seem to work!

1) I have to alt-tab twice to change windows (the first just shows the popup)

tried

http://ubuntuforums.org/archive/index.php/t-490238.html

http://ubuntuforums.org/archive/index.php/t-570357.html

but it seems that using compositing or adding visual effects solves the problem!

2) Alt_R doesn’t work! its a special mod key but xmodmap doesn’t help!

Any solutions is appreciated!

Permalink Leave a Comment

python script to inventorise your ab1 files with md5sums

November 7, 2008 at 11:35 am (opensource, tips) (, , , , )

The problem that needed solving this time was having a list of filenames of my ab1 files, location( directory path) and a md5sum so i know if duplicate filenames are the same file or just a result of misnaming.

managed to come up with this after copying from two different scripts

one that was used to make an inventory of  a directory of ogg songs and the other a python equivalent of md5sum check in linux.

Have fun!

#!/usr/bin/python
#===============================================================================
#
#         FILE:  inventory-abi.py
#
#        USAGE:  ./inventory-abi.py
#
#  DESCRIPTION:  Lists all the files of extension .ab1 with the directory and its md5sum
#  adapated from code from http://pthree.org/2007/08/09/recursion-in-python/ and
#  used md5sum code from http://code.activestate.com/recipes/266486/
#      OPTIONS:  ---
# REQUIREMENTS:  ---
#         BUGS:  will execute md5 on directory as well
#                current method to get CWD is not OS independent
#        NOTES:  ---
#       AUTHOR:  Kevin ,
#      VERSION:  1.0
#      CREATED:  11/07/2008 07:03:16 PM SGT
#     REVISION:  ---
#===============================================================================

import dircache, os, md5
counter = 0

def sumfile(fobj):
    '''Returns an md5 hash for an object with read() method.'''
    m = md5.new()
    while True:
        d = fobj.read(8096)
        if not d:
            break
        m.update(d)
    return m.hexdigest()

def md5sum(fname):
    '''Returns an md5 hash for file fname, or stdin if fname is "-".'''
    if fname == '-':
        ret = sumfile(sys.stdin)
    else:
        try:
            f = file(fname, 'rb')
        except:
            return 'Failed to open file'
        ret = sumfile(f)
        f.close()
    return ret

def PrintFiles(indent):
    global counter
    thisDir = os.getcwd()

    for file in dircache.listdir(thisDir):
        if (file.endswith('ab1') or os.path.isdir(file)) and not file.startswith('.'):
            if file.endswith('ab1'):
                counter += 1

            currdir = os.popen("pwd") #for output of cwd currently works for linux pending upgrade to OS independent
            md5 = md5sum(file) #calls the md5sum function, md5 lib ships with Python

            ab1File.write('%s%s\t%s\t%s\n' %(indent, file, currdir.readline()[:-1], md5))

            if os.path.isdir(file):
                os.chdir(file)
                PrintFiles(indent + '  ')
                os.chdir('../')

try:
    ab1File = open('ab1files.txt', 'w')
except IOError, e:
    print "Unable to open 'ab1files.txt' for writing: ", e
else:
    PrintFiles('')
    ab1File.write('\nCurrent number of ab1 files: %d\n\n' %(counter))
    ab1File.close()

Permalink 4 Comments

Odds of losing ur Lab notebook vs ur Enotebook

September 5, 2008 at 9:15 am (bioinformatics, review, tips) (, )

interesting cross discussions at Saunder’s blog about archiving your lab notebook here

and another person’s take on it which kinda reflects my own opinions .. my previous notebook was a word document it certainly is more helpful cos I dun have to flip pages but jus do a crtl-F

interestingly they both didn’t talk about the odds of having the information lost due to spilled reagents or gasp ur lab notebook catching fire. I don’t think a dog would wanna eat that dirty notebook though. But i think that in some sense an E-notebook is more liable to have data loss.

of course there are safeguards to have to prevent the data loss due to harddisk failures. But I think along the way from the bench to the computer, its likely that one forgets to insert some data..

hmm incoherent? sorry brain is abit scrambled trying to figure out ensembl annotation pipeline. anyway hope you all have a nice weekend! heh next weekend i be travelling down to Cambridge Hinxton for Ensembl User Meeting .. hopefully I get my answers!

Permalink 1 Comment

nsaunders does a tag cloud on journal feeds

August 25, 2008 at 2:42 am (bioinformatics, genome, tips) (, , )

Always found tag clouds useful when looking for interesting things on a blog.. but never thought of using wordle on journals to get a feel on what’s currently hot in a journal.. Nice one !

check his post here

going to try the same thing on journals i read frequently and update this post

Permalink Leave a Comment

Save Toner when printing from Consed output!

August 22, 2008 at 2:49 am (bioinformatics, consed, software, tips)

finally found the answer here from this helpful site!

166) PRINTING CONSED WINDOWS

There is a free (or nearly free) program called “xv”. One web site is
http://www.trilon.com/xv It is written by one of those dying breed of
UNIX programmers who just *loved* UNIX and programming and sharing it.
His web site is enjoyable because some of his passion comes through.
With xv, you can make a postscript file from a Consed window. Then
you can print the postscript file on a color printer.

However, since some Consed windows are mostly black (Aligned Reads
Window and Traces Window), this uses up a lot of toner and is
difficult to read. So go to the Consed Main Window, pulldown the
‘Options’ menu and release on ‘General Preferences’. Scroll down to
“Make light background in Aligned Reads Window…” and click on “Do it
now”. Dismiss any Aligned Reads Windows or Traces Windows and then
bring them back up. You will notice the light background. A few
other things (traces colors and thickness) are also customized for
making color prints.

Permalink Leave a Comment

Python script to split a text file by even or odd numbers

June 20, 2008 at 11:50 am (opensource, software, tips) (, , , , , , )

written a short script to split a file into even or odd line numbers 🙂

#!/usr/bin/python
## loop do something to each line of input file
## changed to write the even line numbers to a file
## and the odd line numbers to another
## note that even numbers start with line 0 (not 1!)
## usage: sort-even-odd.py inputfile
##  written by kevinl @ kevinl.wordpress.com

import sys

def isodd(n):
    return bool(n%2)

input=open(sys.argv[1], 'r')
L=input.readlines()
evenout=open('evenout', 'w')
oddout=open('oddout','w')

for linecount in range(len(L)):
    if isodd(linecount):
        oddout.write(L[linecount])
    else:
        evenout.write(L[linecount])
    #print "line number is " + str(linecount)

Permalink Leave a Comment

1st to publish with Google apps?

April 8, 2008 at 3:47 pm (bioinformatics, opensource, software, tips) ()

Gosh down with flu yesterday and exciting news broke out

http://code.google.com/appengine/

to read the reviews and comments check out

O’Reilly Radar writeup

http://googleblog.blogspot.com/2008/04/developers-start-your-engines.html

http://nsaunders.wordpress.com/2008/04/08/googles-appengine/

I wonder who will be the first to develop an app host it there and publish a paper in a journal with it..

greasemonkey extensions have already been published. what’s stopping a bioinformatician with a lack of web resources to use google’s?

Permalink Leave a Comment

7 bioinformatics secrets every biologist should know

March 28, 2008 at 5:26 pm (bioinformatics, opensource, review, software, tips)

see this lecture in youtube!

I am already using some of the stuff mentioned in here. I might even add a few more to the list..  but it seems like a cool lecture for biologists.

http://www.mozilla.org/
http://biobar.mozdev.org/
http://www.google.com/intl/en/options/
https://addons.mozilla.org/en-US/firefox/addon/748
http://www.ihop-net.org/UniPub/iHOP/
http://bioinfo.icapture.ubc.ca/iHOPerator/
http://gaggle.systemsbiology.org/docs/
http://apropos.mcw.edu/
http://string.embl.de/

consolidated links list from computational biology blog

Permalink Leave a Comment

Rename Multiple Files Efficiently Using Excel or Google Docs

March 5, 2008 at 8:06 am (software, tips, winxp) (, , , , , )

link

batch renaming is what I picked up perl for in the first place. Then I found interesting software like 14arename (win only). I then also picked up abit of SED and AWK in linux.

I know about the batch rename feature in winxp but it didn’t occur to me I could do it in excel. Basically this page teaches you to use

“use SUBSTITUTE to change specific text in the filenames, use CONCATENATE() with DATE() if you want to add date to the filename, etc.” to create a column of rename commands in DOS. something like

ren  abcd.fa abcd.gbk

very old school i know but hey its a godsend in your colleagues windows box with no admin rights to install anything.

Permalink 1 Comment