Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Bio::DB::Sam 1.33

    Download button

    No screenshots available
    Downloads: 663  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Lincoln D. Stein | More programs
    GPL / FREE
    January 25th, 2012, 08:34 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Bio::DB::Sam description

    Read SAM/BAM database files

    Bio::DB::Sam is a module that provides a Perl interface to the libbam library for indexed and unindexed SAM/BAM sequence alignment databases. It provides support for retrieving information on individual alignments, read pairs, and alignment coverage information across large regions. It also provides callback functionality for calling SNPs and performing other base-by-base functions. Most operations are compatible with the BioPerl Bio::SeqFeatureI interface, allowing BAM files to be used as a backend to the GBrowse genome browser application.

    SYNOPSIS

     use Bio::DB::Sam;

     # high level API
     my $sam = Bio::DB::Sam->new(-bam =>"data/ex1.bam",
     -fasta=>"data/ex1.fa",
     );

     my @targets = $sam->seq_ids;
     my @alignments = $sam->get_features_by_location(-seq_id => 'seq2',
     -start => 500,
     -end => 800);
     for my $a (@alignments) {
     my $seqid = $a->seq_id;
     my $start = $a->start;
     my $end = $a->end;
     my $strand = $a->strand;
     my $cigar = $a->cigar_str;
     my $paired = $a->get_tag_values('PAIRED');
     my $ref_dna = $a->dna; # reference sequence
     my $query_dna = $a->query->dna; # query sequence
     my @scores = $a->qscore; # per-base quality scores
     my $match_qual= $a->qual; # quality of the match
     }

     my @pairs = $sam->get_features_by_location(-type => 'read_pair',
     -seq_id => 'seq2',
     -start => 500,
     -end => 800);

     for my $pair (@pairs) {
     my $length = $pair->length; # insert length
     my ($first_mate,$second_mate) = $pair->get_SeqFeatures;
     my $f_start = $first_mate->start;
     my $s_start = $second_mate->start;
     }

     # low level API
     my $bam = Bio::DB::Bam->open('/path/to/bamfile');
     my $header = $bam->header;
     my $target_count = $header->n_targets;
     my $target_names = $header->target_name;
     while (my $align = $bam->read1) {
     my $seqid = $target_names->[$align->tid];
     my $start = $align->pos+1;
     my $end = $align->calend;
     my $cigar = $align->cigar_str;
     }

     my $index = Bio::DB::Bam->index_open('/path/to/bamfile');
     my $callback = sub {
     my $alignment = shift;
     my $start = $alignment->start;
     my $end = $alignment->end;
     my $seqid = $target_names->[$alignment->tid];
     print $alignment->qname," aligns to $seqid:$start..$end
    ";
     }
     my $header = $index->header;
     $index->fetch($bam,$header->parse_region('seq2'),$callback);



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    SAM database reader | BAM database reader | Perl module | SAM | BAM | database

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM