[BioLib-dev] SAMtools: 'samread' support for Perl, Python and Ruby

Pjotr Prins pjotr.public14 at thebird.nl
Sat Aug 7 15:28:28 UTC 2010


I have added samread support to BioLib - so it can be used from Perl,
Python and Ruby.

You can fetch SAM/BAM records from a file. The tests output something
like:

> rec,bytesread=1, 135
> bam.core.tid=0 (chromosome nr)
> bam.core.pos=32 (chromosome pos)
> bam.data_len=107
> bam.m_data=128
>107["read_28833_29006_6945\000\240\000\000\000\022\000\000\000\220\001\000\000\024(\201B\201B\201\"\201\201\202\210D\202\210D\"@\e\e\e\e\e\e\e\e\e\e\e\e\e\e\e\e\e\e\e\e\e\031\e\030\016\v\005\v\021\021\032\032\e\e\eNMC\001RGZL1\000PGZP1\000XTAU"]

bam->data is currently a string type, the name of the short read is
read_28833_29006_6945. Maybe I should use an integer array instead.
Not sure.

Perl example: http://github.com/pjotrp/biolib/blob/samtools/src/mappings/swig/perl/test/test_samtools.pl

Python example: http://github.com/pjotrp/biolib/blob/samtools/src/mappings/swig/python/test/test_samtools.py

Ruby example: http://github.com/pjotrp/biolib/blob/samtools/src/mappings/swig/ruby/test/test_samtools.rb

Progress report is here:

  http://thebird.nl/biolib/Adding_BioLib_BAM_SAM_Support.html

Code is in Samtools branch of Biolib:

  http://github.com/pjotrp/biolib/tree/samtools

Next stop is adding support for 'samwrite'.

Pj.




More information about the BioLib-dev mailing list