Bio::Das::ProServer::SourceAdaptor::Transport::bed12 - DBI-like access to a BED file


Bio-Das-ProServer documentation Contained in the Bio-Das-ProServer distribution.

Index


Code Index:

NAME

Top

Bio::Das::ProServer::SourceAdaptor::Transport::bed12 - DBI-like access to a BED file

VERSION

Top

$Revision: 548 $

SYNOPSIS

Top

  my $rows = $oTransport->query('select * from example.bed where chrom = chr1');

DESCRIPTION

Top

Transport helper class for BED file access, implemented as an extension to Bio::Das::ProServer::SourceAdaptor::Transport::csv.

This transport is used by the Bio::Das::ProServer::SourceAdaptor::bed12 adaptor.

SUBROUTINES/METHODS

Top

init - Initialises the CSV file with BED-specific functions

  1. Sets the appropriate BED column names.
  2. Sets the number of header lines to be skipped.

  $bedtransport->init();

DIAGNOSTICS

Top

Run ProServer with the -debug flag.

CONFIGURATION AND ENVIRONMENT

Top

  [mysource]
  state      = on
  transport  = bed12
  path       = /data/
  filename   = example.bed

DEPENDENCIES

Top

Bio::Das::ProServer::SourceAdaptor::Transport::csv
DBI
Carp

INCOMPATIBILITIES

Top

None reported.

BUGS AND LIMITATIONS

Top

BED is mapped to DAS in the following manner:

1. The BED format allows for "blocks" within each line. Where these are present it is assumed that the line represents a group of features, with each block representing a single feature within the group. Lines without blocks are treated as if they contain a single full-length block.

2. DAS fields are mapped from BED fields as follows:

   segment    = <chrom> (minus the "chr" prefix)
   start      = <chromStart> + 1
   end        = <chromEnd>
   ori        = <strand>
   score      = <score>
   group_id   = <name>
   feature_id = <name>:blocknum
   type       = <name>
   method     = string "BED conversion"

3. Browser and track configurations are not parsed because DAS has different ways of defining many of these attributes - namely coordinate systems and stylesheets. If you wish to define a stylesheet, set the 'stylesheetfile' INI property to the path of a suitable DAS stylesheet XML document.

SEE ALSO

Top

Bio::Das::ProServer::SourceAdaptor::bed12
http://genome.ucsc.edu/goldenPath/help/customTrack.html#BED BED format

AUTHOR

Top

Andy Jenkinson <andy.jenkinson@ebi.ac.uk>

LICENSE AND COPYRIGHT

Top


Bio-Das-ProServer documentation Contained in the Bio-Das-ProServer distribution.

########
# Author:        Andy Jenkinson
# Maintainer:    $Author: zerojinx $
# Created:       2008-09-19
# Last Modified: $Date: 2008-12-03 23:14:25 +0000 (Wed, 03 Dec 2008) $
# $Id: bed12.pm 548 2008-12-03 23:14:25Z zerojinx $
# $HeadURL: https://proserver.svn.sf.net/svnroot/proserver/trunk/lib/Bio/Das/ProServer/SourceAdaptor/Transport/bed12.pm $
#
package Bio::Das::ProServer::SourceAdaptor::Transport::bed12;

use strict;
use warnings;
use Carp;
use base qw(Bio::Das::ProServer::SourceAdaptor::Transport::csv);

our $VERSION = do { my ($v) = (q$Revision: 548 $ =~ /\d+/mxg); $v; };

sub init {
  my $self = shift;

  $self->config()->{col_names} ||= join q[:], qw(chrom chromStart chromEnd
                                                 name score strand
                                                 thickStart thickEnd itemRgb
                                                 blockCount blockSizes blockStarts);

  # Now work out how many header lines are in the file (we need to skip these)
  my ($fh, $headerlines);
  open $fh, q[<], $self->filename or croak 'Unable to open '.$self->filename;
  while ( <$fh> =~ m/^(\#|browser|track)/mx ) {
    $headerlines++;
  }
  close $fh or carp 'Unable to close '.$self->filename;

  $self->{'debug'} && carp "Found $headerlines header lines to skip";
  $self->config()->{'skip_rows'} ||= $headerlines;

  return;
}

1;
__END__