NAME
CracTools::SAMReader::SAMline - The object for manipulation a SAM line.
SYNOPSIS
Usage:
use CracTools::SAMReader::SAMline;
$sam_line = CracTools::SAMReader::SAMline->new($line);
DESCRIPTION
An object for easy acces to SAM line fields. See SAM Specifications for more informations :
http://samtools.sourceforge.net/SAM1.pdf
Variables
%flags
SAM flags :
MULTIPLE_SEGMENTS => 1
PROPERLY_ALIGNED => 2
UNMAPPED => 4,
NEXT_UNMAPPED => 8,
REVERSE_COMPLEMENTED => 16,
NEXT_REVERSE_COMPLEMENTED => 32,
FIRST_SEGMENT => 64,
LAST_SEGMENT => 128,
SECONDARY_ALIGNEMENT => 256,
QUALITY_CONTROLS_FAILED => 512,
PCR_DUPLICATED => 1024,
STATIC PARSING METHODS
These methods can be used without creating an CracTools::SAMReader::SAMline object. They are designed to provided efficient performance when parsing huge SAM files, because creating object in Perl can be long and useless for some purposes.
hasEvent
Arg [1] : String - SAM line
Arg [2] : eventType
Methods
new
Arg [1] : String - SAM line in TAB-separated format.
Example : $sam_line = CracTools::SAMline->new$($line);
Description : Create a new CracTools::SAMline obect.
ReturnType : CracTools::SAMline
Exceptions : none
isFlagged
Arg [1] : Integer - The flag to test (1,2,4,8, ... ,1024)
Example : if($SAMline->isFlagged($fags{unmapped}) {
DO_SOMETHING...
};
Description : Test if the line has the flag in parameter setted.
ReturnType : Boolean
Exceptions : none
getStrand
Example : $strand = $SAMline->getStrand();
Description : Return the strand of the SAMline :
- "1" if forward strand
- "-1" if reverse strand
ReturnType : 1 or -1
Exceptions : none
getOriginalSeq
Descrition : Return the original sequence as it was in the FASTQ file.
In fact we reverse complemente the sequence if flag 16 is raised.
getLocAsCracFormat
Example : $loc = $SAMline->getLocAsCracFormat();
Description : Return the location of the sequence using CRAC format : "chr|strand,position".
For example : X|-1,2154520
ReturnType : String
Exceptions : none
getPatch
Description : If the SAMline has been modified, this method will generate
a patch in UnifiedDiff format that represent the changes.
ReturnType : String (patch) if line has changed, False (0) either.
Exceptions : none
GETTERS AND SETTERS
line
Description : Getterr for the whole SAMline as a string.
ReturnType : String
Exceptions : none
updatedLine
Description : Getter/Setter for the updated line.
If there is not updated line, this method return
the original SAM line.
RetrunType : String
qname
Description : Getter/Setter for attribute qname
ReturnType : String
Exceptions : none
flag
Description : Getter/Setter for attribute flag
ReturnType : String
Exceptions : none
rname
Description : Getter/Setter for attribute rname (chromosome for eucaryotes)
ReturnType : String
Exceptions : none
chr
Description : Getter/Setter for attribute rname (Alias)
ReturnType : String
Exceptions : none
pos
Description : Getter/Setter for attribute pos (position of the sequence)
ReturnType : String
Exceptions : none
mapq
Description : Getter/Setter for attribute mapq (mapping quality)
ReturnType : String
Exceptions : none
cigar
Description : Getter/Setter for attribute cigar (see SAM doc)
ReturnType : String
Exceptions : none
rnext
Description : Getter/Setter for attribute rnext (see SAM doc)
ReturnType : String
Exceptions : none
pnext
Description : Getter/Setter for attribute pnext (see SAM doc)
ReturnType : Integer
Exceptions : none
tlen
Description : Getter/Setter for attribute tlen (sequence length)
ReturnType : Integer
Exceptions : none
seq
Description : Getter/Setter for attribute seq (the sequence)
ReturnType : String
Exceptions : none
qual
Description : Getter/Setter for attribute qual (sequence quality)
ReturnType : String
Exceptions : none
genericInfo
[1] : Key of the generic info
[2] : (Optional) Value of the generic info
Description : Getter/Setter enable to store additional (generic) information
about the SAMline as a Key/Value.
Example : # Set a generic info
$read->genericInfo("foo","bar")
# Get a generic info
print $read->genericInfo("foo"); # this will print "bar"
ReturnType : ?
Exceptions : none
isClassified
Arg [1] : String - The class to test :
- "unique"
- "duplicated"
- "multiple"
- "normal"
- "almostNormal"
Example : if($sam_line->isClassified('normal')) {
DO_SOMETHING;
}
Description : Test if the line is classified according to the parameter value.
ReturnType : Boolean
Exceptions : none
events
Arg [1] : String - The event type to return :
- Junction
- Ins
- Del
- SNP
- Error
- Chimera
- Undetermined
- BioUndetermined
- ... (see CRAC SAM format specifications for more informations).
Example : my @junctions = @{$line->events('Junction')};
foreach my $junction (@junctions) {
print "Foud Junction : [type : $junction->{type}, loc : $junction->{loc}, gap : $junction->{gap}]\n";
}
Description : Return all events of the type specified in parameter
ReturnType : Array reference
Exceptions : none
PRIVATE METHODS
loadClassification
Example : $sam_line->loadClassification();
Description : Loading of classification attributes
ReturnType : none
Exceptions : none
loadEvents
Example : $sam_line->loadEvents();
Description : Loading of events attributes
ReturnType : none
Exceptions : none
addEvent
Arg [1] : String - The event type
Arg [2] : Hash reference - The event object
Example : $line->addEvent($event_type,\%event);
Description : Return all events of the type specified in parameter
ReturnType : none
Exceptions : none
removeEvent
Arg [1] : Hash reference - The event object
Description : Remove the event from the event hash and from the line.
updateEvent
loadSamDetailed
Example : $sam_line->loadSamDetailed();
Description : Loading of sam detaileds attributes
ReturnType : none
Exceptions : none
AUTHORS
Jerome AUDOUX <jerome.audoux@etud.univ-montp2.fr>.
COPYRIGHT AND LICENSE
Copyright (C) 2012-2013 -- IRB/INSERM (Institut de Recherche en Biothérapie / Institut National de la Santé et de la Recherche Médicale) LIRMM/UM2 (Laboratoire d'Informatique, de Robotique et de Microélectronique de Montpellier / Université de Montpellier 2)
FRENCH
Ce fichier fait partie du Pipeline de traitement de données NGS de la plateforme ATGC labélisée par le GiS IBiSA.
Ce logiciel est régi par la licence CeCILL soumise au droit français et respectant les principes de diffusion des logiciels libres. Vous pouvez utiliser, modifier et/ou redistribuer ce programme sous les conditions de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA sur le site "http://www.cecill.info".
ENGLISH
This File is part of the NGS data processing Pipeline of the ATGC accredited by the IBiSA GiS.
This software is governed by the CeCILL license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 973:
Non-ASCII character seen before =encoding in 'Biothérapie'. Assuming UTF-8