www.gusucode.com > bioinfo 案例源码程序 matlab代码 > bioinfo/RetrieveInfoAboutBAMFileExample.m

    %% Retrieve information about a BAM file
% This example shows how to retrieve information about the ex1.bam file included
% with the Bioinformatics Toolbox(TM).

% Copyright 2015 The MathWorks, Inc.

info = baminfo('ex1.bam','ScanDictionary',true,'numofreads',true) 

%%
% List the number of references found in the BAM file.
numel(info.ScannedDictionary) 
%%
% Alternatively, you can use the available header information from a BAM
% file to find out the number of references, thus avoiding the whole
% traversal of the source file.
info = baminfo('ex1.bam'); 
NRefs = numel(info.SequenceDictionary)