Saturday, September 20, 2008

Grab a set of tile images from an Illumina/Solexa run folder

This script copies a set of images for a single tile in an illumina runfolder and creates another runfolder containing just that image set. It's useful if you want to grab an image set to process it later, or save a representative sample.

#!/bin/bash

SOURCE=$1
LANE=$2
TILE=$3
DESTINATION=$4

echo Source : $SOURCE
echo Lane : $LANE
echo Tile : $TILE
echo Destination: $DESTINATION


mkdir $DESTINATION
mkdir $DESTINATION/Images
mkdir $DESTINATION/Images/L00$LANE

cd $SOURCE/Images/L00$LANE


find . -type d -exec mkdir $DESTINATION/Images/L00$LANE/{} \;

for ((CYCLE=1; CYCLE<=100; CYCLE++))
do
find ./C$CYCLE.1/ -name s_$LANE\_$TILE\_* -exec cp {} $DESTINATION/Images/L00$LANE/{} \;
done



Example:

./grabtile /staging/IL18/outgoing/080910_IL18_1380 4 100 $HOME/1380_4_100

Thursday, September 18, 2008

How do you get subversion to post directly to a blog?

I'm being proactive here.
[09:47] < nobodycares> can you create a hook into svn so that it tracks commits and
publishes the comments somewhere like a blog?
[09:47] < new> yes
[09:47] < new> easy way would be to get the svn to email in to the blog
[09:47] < nobodycares> I'm thinking that instead of a lab notebook you could have a blog of the svn
[09:47] < nobodycares> commit messages
[09:48] < nobodycares> how easy is it?
[09:48] < new> you can publish straight from an email address with, for example, blogspot
[09:48] < new> so you'd just tell the svn hook to mail that address
[09:48] < new> and it should all work
[09:48] < new> setting up a svn hook to send an email is easy
[09:48] < new> you need to have the MTA or whatever on your computer setup correctly mind
[09:49] < new> on the svn server that is
[09:51] < nobodycares> okay
[09:51] < nobodycares> I'm gonna forget about this. And ask you again in six months or so.
[09:52] < new> ok cool
[09:52] < new> so long as I know.


Anybody care to weigh in? The simplest way to me would seem to be to setup an email hook and get it to email your blog directly (I guess it will depend on your blog software), blogspot for example supports sending to a special email address which gets automagically posted to the blog. It's not very secure but it would work.

Sorting by a different comparison method in C++ (STL)

You have a list of numbers in C++ that you want to sort, but you don't want to sort them in simple numerical order. You might, for example, want to sort them by their deviation from 0. Here's how you do it using the STL:

#include <vector>
#include <iostream>

using namespace std;

class compare_deviation
{
public:
compare_deviation(int d) : deviation(d) {
}

bool operator ()(const int p1,const int p2)
{

int v1 = abs(deviation - p1);
int v2 = abs(deviation - p2);
return(v1 < v2);
}

int deviation;
};


int main() {


vector<int> numbers;

numbers.push_back(1);
numbers.push_back(-10);
numbers.push_back(-9);
numbers.push_back(-5);
numbers.push_back(0);
numbers.push_back(5);
numbers.push_back(6);
numbers.push_back(7);
numbers.push_back(10);
numbers.push_back(11);

compare_deviation comp(0);

cout << "Unsorted numbers: ";

for(vector<int>::iterator i=numbers.begin();i != numbers.end();i++) cout << " " << (*i);
sort(numbers.begin(),numbers.end(),comp);
cout << endl;

cout << "Sorted numbers: ";
for(vector<int>::iterator i=numbers.begin();i != numbers.end();i++) cout << " " << (*i);
cout << endl;

return 1;
}



Bang On!

Thursday, September 11, 2008

Urxvt and other terminal fun

Here's my .Xdefaults for urxvt, it's very simple:

! urxvt*font: xft:Terminus:pixelsize=12
! urxvt*boldFont: xft:Terminus:pixelsize=12
urxvt*font: -*-profont-*-*-*-*-11-*-*-*-*-*-iso8859-*
urxvt*boldFont: -*-profont-*-*-*-*-11-*-*-*-*-*-iso8859-*


URxvt.keysym.M-y: perl:mark-and-yank:activate_mark_mode
URxvt.keysym.M-u: perl:mark-and-yank:activate_mark_url_mode
URxvt.perl-lib: /home/new/.urxvt/
URxvt.perl-ext-common: tabbed,mark-and-yank
URxvt.urlLauncher: firefox

urxvt*borderLess: false
urxvt*externalBorder: 0
urxvt*internalBorder: 2
urxvt*scrollBar: false
urxvt*depth: 32
urxvt*background: rgba:0000/0000/0000/0000
urxvt*foreground: #ffffff
urxvt*cursorColor: #ffff00
urxvt*cursorColor2: #00ffff
urxvt*cursorBlink: true
urxvt*inheritPixmap: false
urxvt*termName: rxvt-unicode
urxvt*saveLines: 65535
urxvt*scrollTtyOutput: true
urxvt*scrollTtyKeypress: true
urxvt*mouseWheelScrollPage: true
urxvt*cutchars: `'",;@&*=|?()<>[]{}
URxvt.urlLauncher: firefox



I've also added an alias to clear my scrollback, it's useful in .bashrc:

alias cls='tput reset'



BBC Micro FTW!