Original Post
Hello everybody, this isnt really a game related question but since im lurking around these forums for some years now and its about java i thought my question might be at the right place here anyways. Here it comes. I need to readout a rather large txt file containing genomic data, and convert these data into a n*m int matrix. To do so i read the file using a FileReader and a BufferedReader. Then im going to tokenize the file using the StreamTokenizer Example Data:
rs3000004 A/G chr14 19166795 - ncbi_b35 perlegen urn:lsid:perlegen.hapmap.org:Protocol:Genotyping_1.0.0:2 urn:lsid:perlegen.hapmap.org:Assay:25761.5787732:1 urn:lsid:dcc.hapmap.org:Panel:CEPH-30-trios:1 QC+ GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG NN GG GG GG GG GG GG GG NN GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG
rs8013379 C/G chr14 19217196 + ncbi_b35 perlegen urn:lsid:perlegen.hapmap.org:Protocol:Genotyping_1.0.0:2 urn:lsid:perlegen.hapmap.org:Assay:25760.7547817:1 urn:lsid:dcc.hapmap.org:Panel:CEPH-30-trios:1 QC+ CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC NN CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC NN CC CC CC CC CC NN CC CC CC CC CC CC CC CC CC CC CC CC NN CC CC CC CC CC CC CC CC CC CC NN
I basicly just check what kind of nucelotide combination i have found and then set my matrix to the corresponding value (int). However if my file exceeds ~7MB i encounter a java.lang.OutOfMemoryError : Java heap space. What really puzzels me is that i can read files up to 100MB without any problem if i only print them back on screen for example, aswell as manipulating a 200000 * 900 matrix isnt a problem either. Im not creating any references to the Strings returned by StreamTokenizer aswell :/ Your help will be much appreciated! -Kai Kratz p.s. sorry for any grammar/spelling errors i made, bad english mmmh kay ;)