How to open a BAM file?

조회 수: 9 (최근 30일)
Razvan
Razvan 2012년 11월 10일
Hi, I have a problem opening a BAM file (the one from here: http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM754388 the link is at the bottom of the page)
Usually I open BAM files like this:
bamFilename = 'GSM754388_P2_5_20110519_7.bam';
info = baminfo(bamFilename,'ScanDictionary',true);
bm = BioMap(bamFilename, 'SelectReference', info.ScannedDictionary{1});
but this time it doesn't work, and some error pops up...
I tried also to open it with bamread but with no success:
bamFilename = 'GSM754388_P2_5_20110519_7.bam';
info = baminfo(bamFilename);
RefSeq = info.SequenceDictionary;
data = bamread(bamFilename, RefSeq(1).SequenceName, [1, RefSeq(1).SequenceLength]);
Is there any other way to access this BAM file in MATLAB?
Thanks,
Razvan

채택된 답변

Lucio Cetto
Lucio Cetto 2012년 11월 14일
It may be possible that the BAM file is not ordered. The Bioinfomatics Toolbox (12b) automatically indexes the BAM file, but for this it must be ordered. You can order the BAM file using SAMTOOLS or by using the following undocummented option in MATLAB:
bioinfoprivate.bamaccessmex('bamsort', 'unorderedname.bam', 'orderedname')
  댓글 수: 1
Razvan
Razvan 2012년 11월 14일
Thanks a lot! That solved my problem.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Genomics and Next Generation Sequencing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by