Package bamm :: Module bamParser :: Class BamParser
[hide private]
[frames] | no frames]

Class BamParser

source code

class for generating coverage profiles and linking read information from several BAM files

Uses python multiprocessing to parallelize processing

Instance Methods [hide private]
 
__init__(self, coverageType, minLength=0, baseQuality=0, mappingQuality=0, useSuppAlignments=False, useSecondaryAlignments=False, maxMisMatches=1000)
Default constructor.
source code
 
parseBams(self, bamFiles, doLinks=False, doCovs=False, types=None, threads=1, verbose=False)
Parse bam files to get coverage and linking reads.
source code
 
_parseOneBam(self, bid)
Parse a single BAM file and append the result to the internal mapping results list
source code
 
collapseBFIs(self, BFI_list)
Collapse multiple BFI objects into one and set it as member variable BFI
source code
 
printBamTypes(self, fileName='')
Print template size and orientation information to a file or to stdout.
source code
 
printCoverages(self, fileName='')
Print coverage profile information to a file or to stdout
source code
 
printLinks(self, fileName='')
Print paired links information to a file or to stdout
source code
Method Details [hide private]

__init__(self, coverageType, minLength=0, baseQuality=0, mappingQuality=0, useSuppAlignments=False, useSecondaryAlignments=False, maxMisMatches=1000)
(Constructor)

source code 

Default constructor.

Set quality thresholds used in later parsing

Inputs:
 coverageType - BM_coverageType, stores type of coverage to calculate
 minLength - int, ignore contigs shorter than this length
 mappingQuality - int, ignore positions with a lower base quality score
 mappingQuality - int, skip all reads with a lower mapping quality score
 useSuppAlignments - == True -> DON'T skip supplementary alignments
 useSecondaryAlignments - == True -> DON'T skip secondary alignments
 maxMisMatches - int, skip all reads with more mismatches (NM aux files)

Outputs:
 None

parseBams(self, bamFiles, doLinks=False, doCovs=False, types=None, threads=1, verbose=False)

source code 
Parse bam files to get coverage and linking reads.

Manages threading
Stores results in internal mapping results list

Inputs:
 bamFiles - [string], full paths to BAMs
 doLinks - == True -> find linking pairs
 doCovs - == True -> calculate coverage profiles
 types - [int] or None, number of insert types per bamfile
 threads - int, max number of threads to use
 verbose - == True -> be verbose

Outputs:
 0 if the parsing worked, 1 otherwise

_parseOneBam(self, bid)

source code 
Parse a single BAM file and append the result
to the internal mapping results list

Called from the ExternalParseWrapper

Inputs:
 bid - unique identifier of the BAM to parse

Outputs:
 A populated BM_FileInfo_C  struct containing the parsing results

collapseBFIs(self, BFI_list)

source code 
Collapse multiple BFI objects into one and
set it as member variable BFI

Only one of the threads will bother to parse contig names. Find it's
BFI and then merge all the other BFIs (from other threads) into it

Inputs:
 BFI_list - Manager.List, list of all BFIs created during parsing

Outputs:
 None

printBamTypes(self, fileName='')

source code 
Print template size and orientation information
to a file or to stdout.

Inputs:
 fileName - string, full path to output file or ""

Outputs:
 None

printCoverages(self, fileName='')

source code 
Print coverage profile information to a file or to stdout

Inputs:
 fileName - string, full path to output file or ""

Outputs:
 None

printLinks(self, fileName='')

source code 
Print paired links information to a file or to stdout

Inputs:
 fileName - string, full path to output file or ""

Outputs:
 None