The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CracTools::SAMReader - An easy to use tool to read files in SAM format.

VERSION

version 1.251

SYNOPSIS

  use CracTools::SAMReader;

  # Creating the reader
  my $sam_reader = CracTools::SAMreader->new($sam,'CRAC');

  # Get an iterator to go through the SAM file in a linear way
  my $it = $sam_reader->iterator();
  
  # Iterate on lines and explore CRAC special fields of SAM
  while(my $line = $it->()) {
    if(defined $line->events('Junction') && $line->isClassified('normal')) {
      my @junctions = @{$line->events('Junction')};
      foreach my $junction (@junctions) {
        print "Foud Junction : [type : $junction->{type}, loc : $junction->{loc}, gap : $junction->{gap}]\n";
      } 
    }
  }

DESCRIPTION

Reader for SAM format, including CRAC special fields.

METHODS

new

  Arg [1] : String - SAM file
  Arg [2] : (Optional) String - SAM type
            - CRAC
            - CRAC_EMT

  Example     : $reader = CracTools::SAMreader->new('file.sam','CRAC');
  Description : Create a new reader object
  ReturnType  : CracTools::SAMreader
  Exceptions  : none

iterator

  Example     : my $it = $sam_reader->iterator();
                while(my $line = $it->()) {
                  print $line->seq,"\n";
                }
  Description : Create an iterator to go throud each lines of the file
  ReturnType  : Iterator on CracTools::SAMline
  Exceptions  : none

iteratorFile

  Arg [1] : (Optional) String - options (IGNORE_HEADERS,..)

  Example     : my $it_f = $sam_reader->iteratorFile();
                while(my ($line,$line_number) = $it->()) {
                  print $line,"\n";
                }
  Description : Create an iterator to go throud each lines of the file
  ReturnType  : Iterator on Array (String,Int) where the <String> is the
                line, and <Int> the line number.
  Exceptions  : none

GETTERS AND SETTERS

  Description : Getter/setter for attribute header
  ReturnType  : none
  Exceptions  : none

refSeqLength

  Description : Return the length of the reference sequence given in argument
  ReturnType  : Integer

allRefSeqLengths

Return a hashref with all reference sequence names and length.

  my $refseq_lengths = $sam_reader->allRefSeqLength();

The return value is :

  { refseq_name => length,
    refseq_name => lenght,
    ...
  }

commandLine

  Description : Return crac command line defined in SAM's header
  ReturnType  : String

getCracArgumentValue

  Description : Retrun the value of the specified argument in crac command line

hasCracOption

  Description : Return true if crac command line has specified a certain option

getCracVersionNumber

  Description : Return CRAC version number

PRIVATE METHODS

init (private)

  Description : Initialization method
  ReturnType  : none
  Exceptions  : none

AUTHORS

  • Nicolas PHILIPPE <nphilippe.research@gmail.com>

  • Jérôme AUDOUX <jaudoux@cpan.org>

  • Sacha BEAUMEUNIER <sacha.beaumeunier@gmail.com>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2017 by IRMB/INSERM (Institute for Regenerative Medecine and Biotherapy / Institut National de la Santé et de la Recherche Médicale) and AxLR/SATT (Lanquedoc Roussilon / Societe d'Acceleration de Transfert de Technologie).

This is free software, licensed under:

  The GNU Affero General Public License, Version 3, November 2007