www.gusucode.com > bioinfo 案例源码程序 matlab代码 > bioinfo/RetrieveAlignmentRecordsThatAlignToTwoRefSeqExample.m
%% Retrieve alignment records that align to reference sequences % %% % Read multiple alignment records from the ex1.bam file that align to two % different reference sequences. % Copyright 2015 The MathWorks, Inc. data1 = bamread('ex1.bam', 'seq1', [100 200]) data2 = bamread('ex1.bam', 'seq2', [100 200]) %% % Read alignments from the ex1.bam file that are fully contained in the 100 % to 200 bp range of the seq1 reference sequence. data3 = bamread('ex1.bam', 'seq1', [100 200], 'full', true) %% % Read alignments from the ex1.bam file that align to the 100 to 300 bp % range of the seq1 reference sequence. Read the same alignments using % zero-based indexing. Compare the position of the 27th record in the two % outputs. data_one = bamread('ex1.bam','seq1', [100 300]); data_zero = bamread('ex1.bam','seq1', [100 300], 'zerobased', true); data_one(27).Position %% % data_zero(27).Position