Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Bio::DB::Map::SQL::MapAdaptor
DESCRIPTION of Object

Bio::DB::Map::SQL::MapAdaptor - DESCRIPTION of Object


NAME

Bio::DB::Map::SQL::MapAdaptor - DESCRIPTION of Object


SYNOPSIS

Give standard usage here


DESCRIPTION

Describe the object here


FEEDBACK

Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.


  bioperl-l@bioperl.org             - General discussion

  http://bioperl.org/MailList.shtml - About the mailing lists

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via email or the web:


  bioperl-bugs@bioperl.org

  http://bioperl.org/bioperl-bugs/


AUTHOR - Jason Stajich

Email jason@chg.mc.duke.edu

Describe contact details here


APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

get


 Title   : get

 Usage   : my $map = $adaptor->get(-id => $mapid); OR

           my $map = $adaptor->get(-name => $name); 

 Function: finds the map based on a criteria

 Returns : Bio::DB::Map::MapI object

 Args    : -id => mapid OR

           -name => mapname

write


 Title   : write

 Usage   : $mapadaptor->write($map);

 Function: adds a new map to the database

 Returns : Bio::DB::Map::MapI object

 Args    : Bio::DB::Map::MapI object

get_mapids_hash


 Title   : get_mapids_hash

 Usage   : my %mapnames = $adaptor->get_mapids_hash();

 Function: returns a hash of mapnames => mapids and mapids => mapnames

 Returns : hash which 

 Args    : none

get_markers_for_region


 Title   : get_markers_for_region

 Usage   : my @markers = $map->get_markers_for_region('-start' => $start,

                                                      '-end'   => $end);

 Function: returns a list of markers for this map that fall between

           start and end in this map\'s units.  Omitting 'start' will

           default to the beginning of the map, omitting 'end' will

           default to the end of map.

 Returns : List of Bio::DB::Map::MarkerI objects

 Args    : -start => starting point or region (in units of this map)

           -end   => ending point of region (in units of this map)

           -chrom => chromosome [1,22,X,Y]

           -id    => map id

=cut

sub get_markers_for_region{ my ($self,@args) = @_;




   my ( $start, $end,$chrom,$id ) = $self->_rearrange([qw(START END 

                                                          CHROM ID)], 

                                                      @args);

   $start = 0 unless defined $start;

   if( !defined $end ) {

       $end = $self->map_length();

   }

   

   my $SQL =q(SELECT m.markerid from marker m, map_position p 

              WHERE m.chrom = ? AND p.map_id = ?

              AND m.markerid = p.markerid AND

              p.position >= ? AND p.position <= ?

              );

                

   my @m;   

   eval { 

       my $sth = $self->prepare($SQL);

       $sth->execute($chrom,$id,$start,$end);       

       while( my ($markerid) = $sth->fetchrow_array) {

           push @m, $markerid;

       }

   };

   if( $@ ) {  $self->warn($@); }

   if( @m ) {

       my $marker_adaptor = new Bio::DB::Map::SQL::MarkerAdaptor($self);

       my @markers = $marker_adaptor->get('-ids' => \@m);   

       return @markers;

   }   

}

get_next_marker


 Title   : get_next_marker

 Usage   : my $marker = $map->get_next_marker(-marker => $marker,

                                              -direction => 1);

 Function: returns the next marker(s) (by markerid) in the map based on the given marker

           and either a positive or negative direction

 Returns : Array of markerid or empty array if error or none found 

 Args    : -mapid     => mapid

           -markerid  => markerid

           -direction => [1,-1] (default 1)          

           -number    => number of markers to get (default 1)

=cut

sub get_next_marker{ my ($self,@args) = @_; my ($mapid, $markerid, $direction, $number) = $self->_rearrange([qw(MAPID MARKERID DIRECTION NUMBER )], @args);




   $number = 1 unless $number;

   $direction = 1 unless $direction;

   if( !defined $mapid ) {

       $self->warn("Did not specify a mapid to anchor the search");

       return ();

   } elsif( !defined $markerid ) {

       $self->warn("Did not specify a marker to anchor the search");

       return ();

   } 

   

   my (@markerids,@markers);

   

   my $SQL = q(SELECT query.markerid 

               FROM map_position start, map_position query 

               WHERE start.markerid = ? AND start.map_id = ?

               AND start.map_id = query.map_id 

               );

   if( $direction > 0 ) { $SQL .= ' AND query.position > start.position'; }

   else { $SQL .= ' AND query.position < start.position'; }

   

   $SQL .= " ORDER BY query.position LIMIT $number";

   eval { 

       my $sth = $self->prepare($SQL);

       $sth->execute($markerid, $mapid);

       while( my ($row) = $sth->fetchrow_array ) {

           push @markerids, $row;

       }

   };

   if( $@ ) {

       $self->warn($@);

   }

   if( @markerids ) {

       my $marker_adaptor = new Bio::DB::Map::SQL::MarkerAdaptor($self);

       @markers = $marker_adaptor->get('-ids' => \@markerids);   

   }   

   return @markers;

}

get_Chrom_length


 Title   : get_Chrom_length

 Usage   : my $len = $map->get_Chrom_Length()

 Function: Returns the length of a chromosome for a Map in the map\'s units

 Returns : float

 Args    : map id, chromsome

get_all_markerids_for_map


 Title   : get_all_markerids_for_map

 Usage   : my @markerids = $mapadaptor->get_all_markerid_for_map($mapid);

 Function: returns a list of marker ids which are associated with a map

 Returns : list of markerids

 Args    : $mapid

create_ePCR_DB


 Title   : create_ePCRDB

 Usage   : $mapadaptor->create_ePCR_DB ( $mapid, $fh );

 Function: writes an ePCR format database to $fh based on a mapid

 Returns : boolean on success

 Args    : mapid to build db on

           filehandle to write to

                      someday will add option to write each chrom

                      to different file



# Later on maps may become a bit more dynamic, ie collections of # markers, so perhaps we'll want to do this based on a mapobj

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy