Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    Archive for the 'Programming' Category

    Date and time in Python scripts

    7th September 2007

    Here’s an excellent description of various methods to handle date and time in Python scripts.

    Share

    Posted in Links, Notepad, Programming, Python | No Comments »

    Elegantly converting Python list into another list with changed items

    30th August 2007

    I just had a small problem with my Python script:

    1. I have a list of tuples, called records_cache; each tuple looks like this:
    (note: for copy-pasting, click the PLAIN TEXT box headers)

    1. (ensembl_transcript_id, ensembl_gene_id, chrom_start, chrom_end, utr_start, utr_end, sequence, strand)

    2. I need to INSERT only some of those values into MySQL table, using the MySQLdb executemany() method. The values I need are utr_start, utr_end, ensembl_gene_id (in exactly this order).

    To do this, I need to create another list of tuples, but with shorter 3-item tuples. Let us call the new list genes_update.

    Here is the elegant, though probably not the most efficient, solution:
    Read the rest of this entry »

    Share

    Posted in Programming, Python | 1 Comment »

    Is the force with you?

    12th August 2007

    Today, after starting ./configure to make one of the programs, I noticed this in the logs:
    is the Force with you? configure will tell!

    I don’t know what is that intended to mean, but this is definitely funny: configure script, able to detect if the Force is with Skywalker…

    Share

    Posted in Humour, Programming | No Comments »

    Non-Programmer’s Tutorial for Python

    12th August 2007

    Non-Programmer’s Tutorial for Python

    Share

    Posted in Links, Programming, Python | No Comments »

    Python: iterate (and read) all files in a directory (folder)

    12th August 2007

    To iterate through all the files within the specified directory (folder), with ability to use wildcards (*, ?, and [ ]-style ranges), use the following code snippet:
    Read the rest of this entry »

    Share

    Posted in Programming, Python | 39 Comments »

    Geany source installation error: “libc.so: file format not recognized; treating as linker script”

    10th August 2007

    Today I was looking for some simple but convenient source-code editor. I came across this post, and decided to try Geany. I’m using Slackware 11 at the moment, and as there were no packages available, I downloaded Geany source to compile and install.

    However, the ‘configure’ script failed. When trying to compile ‘conftest.c’ with gcc, the following error was produced:

    libc.so: file format not recognized; treating as linker script

    (Note 1: in the error above, I removed all the paths which were prepended to the actual error message.)
    (Note 2: I suspect that this error is the result of incomplete/failed/erroneous update of glibc slackware package I attempted a while ago. Will have to fix that more properly than described below.)

    Here’s the solution which helped me to install Geany successfully:
    Read the rest of this entry »

    Share

    Posted in *nix, Programming, Software | 4 Comments »

    How to convert between utf8 and cp-1251 without iconv or mbstring

    8th July 2007

    This helped me, maybe it will help you: How to convert between utf8 and cp1251 without iconv
    Read the rest of this entry »

    Share

    Posted in Links, PHP, Programming, Web | No Comments »