Matlab and IonTorrent?

1 view (last 30 days)
Pandora
Pandora on 22 Mar 2016
Answered: Paola Favaretto on 22 Mar 2016
Hi, I'm trying to analyze a BAM file from IonTorrent in MathLab. This is my syntax:
BAMStruct = bamread('namefile.bam', 'referencegenome.fasta'. [range min range max])
but this is my error:
Warning: Found invalid tag in header type: 'RG'. Ignoring tag
'FO:TACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAG
CTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTA
CGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGT
ACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTAAAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACG
TCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTC
TGAGCATCGA'.
> In saminfo (line 186)
In baminfo (line 74)
In bamread (line 131)
Warning: Found invalid tag in header type: 'RG'. Ignoring tag 'KS:TCAGTTCGTGATTCGAT'.
> In saminfo (line 186)
In baminfo (line 74)
In bamread (line 131)
Warning: Found invalid tag in header type: 'RG'. Ignoring tag 'PG:tmap'.
> In saminfo (line 186)
In baminfo (line 74)
In bamread (line 131)
Warning: Found invalid tag in header type: 'PG'. Ignoring tag 'PN:BaseCaller'.
> In saminfo (line 186)
In baminfo (line 74)
In bamread (line 131)
Error using bamread (line 138)
Reference 'hg19.fasta' not found in file.bam.
So I try to read my bam file structure with the code:
InfoStruct = baminfo('namefile.bam')
but this is my error:
Warning: Found invalid tag in header type: 'RG'. Ignoring tag
'FO:TACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAG
CTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTA
CGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGT
ACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACG
TCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCT
GAGCATCGA'.
> In saminfo (line 186)
In baminfo (line 74)
Warning: Found invalid tag in header type: 'RG'. Ignoring tag 'KS:TCAGTAGGTGGTTCGAT'.
> In saminfo (line 186)
In baminfo (line 74)
Warning: Found invalid tag in header type: 'RG'. Ignoring tag 'PG:tmap'.
> In saminfo (line 186)
In baminfo (line 74)
Warning: Found invalid tag in header type: 'PG'. Ignoring tag 'PN:BaseCaller'.
> In saminfo (line 186)
In baminfo (line 74)
InfoStruct =
Filename: 'name.bam'
FilePath: 'G:\Tirocinio\test_matlab'
FileSize: 152991446
FileModDate: '20-nov-2015 15:56:08'
Header: [1x1 struct]
SequenceDictionary: [1x25 struct]
ReadGroup: [1x1 struct]
Program: [1x2 struct]
Comments: '{"BeadAdapters":{"Adapter_0":"ATCACCGACTGCCCATAGAGAGGCTGAGAC","MasterKey":…'
NumReads: []
ScannedDictionary: {0x1 cell}
ScannedDictionaryCount: [0x1 uint64]
with "NumReads: []" but I'm sure that there're more than 200'000 reads in my file. So I ask you: where is my problem? Why this comand don't work?
Thank you for any answer!

Answers (1)

Paola Favaretto
Paola Favaretto on 22 Mar 2016
Hi,
1) bamread requires that REFERENCE may either be a MATLAB string containing the name of the reference sequence, or a positive integer R, indicating the Rth reference sequence in the BAM format file.
In the example above, you are passing the name of the FASTA file. Instead, you should pass the string that indicates the reference in the BAM file.
2) baminfo(...,'NUMOFREADS',T/F) scans the entire BAM file to determine the number of alignment records stored in the file. The count is returned in the NumReads field. Default is false.
If you want to find out the number of reads, you need to scan the file, so you need to set 'numofreads' to true.
You can find the above information (and much more) in the mhelp lines or in the documentation pages for this functions.
HTH
Paola

Community Treasure Hunt

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

Start Hunting!