Package bamm :: Module bamMaker :: Class BamMaker
[hide private]
[frames] | no frames]

Class BamMaker

source code

Class that wraps bwa and samtools. Can call shell commands and make BAM and TAM files

Not threaded, use the BamSceduler to start multiple BAM runs in parallel

Instance Methods [hide private]
 
__init__(self, database, alignmentAlgorithm, indexAlgorithm, outFileName, readFile1, readFile2=None, interleaved=False, singleEnded=False, keptFiles=False, keepFiles=False, outputTam=False, numThreads=1, maxMemory=None, forceOverwriting=False, extraArguments='', showCommands=False, quiet=False, silent=False)
Default constructor.
source code
 
makeDatabase(self)
call BWA make index command
source code
 
removeDatabase(self)
'Remove any index files that are no longer needed
source code
 
makeBam(self)
Use BWA ans samtools to make a BAM/TAM file
source code
 
aln(self, readFile, saiFile)
call bwa aln
source code
 
sampe(self)
call bwa sampe
source code
 
samse(self)
call bwa samse
source code
 
sampe_to_sorted_indexed_bam(self)
call bwa sampe and sort + index the result
source code
 
samse_to_sorted_indexed_bam(self)
call bwa samse and sort + index the result
source code
 
mem_single_to_sorted_indexed_bam(self)
call bwa mem mapping with single ended reads and sort + index
source code
 
mem_to_sorted_indexed_bam(self)
call bwa mem mapping with paired reads and sort + index the result
source code
 
bwasw(self)
call bwasw
source code
 
bwasw_to_sorted_indexed_bam(self)
call bwasw and sort and index the result
source code
 
samtoolsIndex(self, sortedBamFile)
call samtools index on a sorted BAM file
source code
 
safeRemove(self, fileName)
Delete a file without raising an exception
source code
 
__str__(self)
Print out the operations and outputs that will be made
source code
Method Details [hide private]

__init__(self, database, alignmentAlgorithm, indexAlgorithm, outFileName, readFile1, readFile2=None, interleaved=False, singleEnded=False, keptFiles=False, keepFiles=False, outputTam=False, numThreads=1, maxMemory=None, forceOverwriting=False, extraArguments='', showCommands=False, quiet=False, silent=False)
(Constructor)

source code 
Default constructor.

Initializes a BamMaker instance with the provided set of properties.

Inputs:
 database - full path to fasta file of contigs (may be gzipped),
 alignmentAlgorithm - one of BWA's alignment algorithms,
 indexAlgorithm - one of BWA's index algorithms,
 outFileName - string, what to name the BAM
 readFile1 - string, full path to 1st read file
 readFile2 - string, full path to 2nd read file or None
 interleaved - == True -> readFile1 is interleaved pairs
 singleEnded - == True -> readFile1 is single ended reads
 keptFiles - == True -> indexes for the db already exist,
 keepFiles - == True -> don't delete indexes at the end,
 outputTam - == True -> you love text files to bits,
 numThreads - int, the maximum number of threads to use
 maxMemory - string, maximum memory program will use (samtools style)
 forceOverwriting - == True -> force overwriting index files,
 extraArguments - string, extra args to pass to BWA
 showCommands - == True -> show all commands being run
 quiet - == True -> suppress output from the mapper
 silent - == True -> suppress all output

Outputs:
 None

makeDatabase(self)

source code 
call BWA make index command

Inputs:
 None

Outputs:
 None

removeDatabase(self)

source code 
'Remove any index files that are no longer needed

Inputs:
 None

Outputs:
 None

makeBam(self)

source code 
Use BWA ans samtools to make a BAM/TAM file

Inputs:
 None

Outputs:
 None

aln(self, readFile, saiFile)

source code 
call bwa aln

Inputs:
 readFile - full path to reads file
 saiFile - full path to corresponding sai file

Outputs:
 None

sampe(self)

source code 
call bwa sampe

Inputs:
 None

Outputs:
 None

samse(self)

source code 
call bwa samse

Inputs:
 None

Outputs:
 None

sampe_to_sorted_indexed_bam(self)

source code 
call bwa sampe and sort + index the result

Inputs:
 None

Outputs:
 None

samse_to_sorted_indexed_bam(self)

source code 
call bwa samse and sort + index the result

Inputs:
 None

Outputs:
 None

mem_single_to_sorted_indexed_bam(self)

source code 
call bwa mem mapping with single ended reads and sort + index

Inputs:
 None

Outputs:
 None

mem_to_sorted_indexed_bam(self)

source code 
call bwa mem mapping with paired reads and sort + index the result

Assume -p for bwa if reads2 is None, otherwise specify reads1 and reads2

Inputs:
 None

Outputs:
 None

bwasw(self)

source code 
call bwasw

Inputs:
 None

Outputs:
 None

bwasw_to_sorted_indexed_bam(self)

source code 
call bwasw and sort and index the result

Inputs:
 None

Outputs:
 None

samtoolsIndex(self, sortedBamFile)

source code 
call samtools index on a sorted BAM file

Inputs:
 sortedBamFile - full path to sorted bam file

Outputs:
 None

safeRemove(self, fileName)

source code 
Delete a file without raising an exception

Inputs:
 fileName - full path to file to be removed

Outputs:
 None

__str__(self)
(Informal representation operator)

source code 
Print out the operations and outputs that will be made

Used when the scheduler is in showCommands mode

Inputs:
 None

Outputs:
 None