Changes

From Genome Analysis Wiki
Jump to navigationJump to search
2,259 bytes added ,  17:42, 14 June 2010
no edit summary
Line 10: Line 10:  
* [[C++ Executable: bam#Read a SAM/BAM file and write as a SAM/BAM file|Read a SAM/BAM file and write as a SAM/BAM file]]
 
* [[C++ Executable: bam#Read a SAM/BAM file and write as a SAM/BAM file|Read a SAM/BAM file and write as a SAM/BAM file]]
 
* [[C++ Executable: bam#Print SAM/BAM header|Print SAM/BAM header]]
 
* [[C++ Executable: bam#Print SAM/BAM header|Print SAM/BAM header]]
 +
* [[C++ Executable: bam#Split BAM by Chromosome|Split BAM by Chromosome]]
 
* [[C++ Executable: bam#Dump a BAM index file|Dump a BAM index file into an easy to read text version]]
 
* [[C++ Executable: bam#Dump a BAM index file|Dump a BAM index file into an easy to read text version]]
 
* [[C++ Executable: bam#Read & Write indexed BAM file|Read an indexed BAM file reference by reference id -1 to 22 and write it out as a SAM/BAM file]]
 
* [[C++ Executable: bam#Read & Write indexed BAM file|Read an indexed BAM file reference by reference id -1 to 22 and write it out as a SAM/BAM file]]
Line 114: Line 115:  
@SQ SN:2 LN:242951149
 
@SQ SN:2 LN:242951149
 
@SQ SN:3 LN:199501827
 
@SQ SN:3 LN:199501827
 +
</pre>
 +
 +
 +
== Split BAM by Chromosome ==
 +
 +
The <code>splitChromosome</code> option on the bam executable splits an indexed BAM file into multiple files based on the Chromosome (Reference Name). 
 +
 +
The files all have the same base name, but with an _# where # corresponds with the associated reference id from the BAM file.
 +
 +
=== Parameters ===
 +
<pre>
 +
    Required Parameters:
 +
--in      : the SAM/BAM file to be split
 +
--out      : the base filename for the SAM/BAM files to write into.  Does not include the extension.
 +
            _N will be appended to the basename where N indicates the Chromosome.
 +
    Optional Parameters:
 +
--noeof  : do not expect an EOF block on a bam file.
 +
--bamIndex : the path/name of the bam index file
 +
            (if not specified, uses the --in value + ".bai")
 +
--bamout : write the output files in BAM format (default).
 +
--samout : write the output files in SAM format.
 +
</pre>
 +
 +
=== Usage ===
 +
 +
./bam splitChromosome --in <inputFilename>  --out <outputFileBaseName> [--bamIndex <bamIndexFile>] [--noeof] [--bamout|--samout]
 +
 +
 +
=== Return Value ===
 +
*    0: all records are successfully read and written.
 +
* non-0: at least one record was not successfully read or written.
 +
 +
=== Example Output ===
 +
<pre>
 +
The following parameters are in effect:
 +
 +
Input Parameters
 +
--in [test/testFiles/sortedBam.bam], --out [chromosome], --bamIndex [],
 +
                --noeof
 +
  Output Type : --bamout [ON], --samout
 +
 +
Reference ID -1 has 2 records
 +
Reference ID 0 has 5 records
 +
Reference ID 1 has 2 records
 +
Reference ID 2 has 1 records
 +
Reference ID 3 has 0 records
 +
Reference ID 4 has 0 records
 +
Reference ID 5 has 0 records
 +
Reference ID 6 has 0 records
 +
Reference ID 7 has 0 records
 +
Reference ID 8 has 0 records
 +
Reference ID 9 has 0 records
 +
Reference ID 10 has 0 records
 +
Reference ID 11 has 0 records
 +
Reference ID 12 has 0 records
 +
Reference ID 13 has 0 records
 +
Reference ID 14 has 0 records
 +
Reference ID 15 has 0 records
 +
Reference ID 16 has 0 records
 +
Reference ID 17 has 0 records
 +
Reference ID 18 has 0 records
 +
Reference ID 19 has 0 records
 +
Reference ID 20 has 0 records
 +
Reference ID 21 has 0 records
 +
Reference ID 22 has 0 records
 +
Number of records = 10
 +
Returning: 0 (SUCCESS)
 
</pre>
 
</pre>
  

Navigation menu