public void addFile(String bimFile, String collection, String chromosome,
                        boolean isOx) throws IOException {
        if (collectionIndices.get(collection) == null){
            runningCount++;
            collectionIndices.put(collection,runningCount);
        }
        byte chrom = chromosomeLookup.get(chromosome);
        String currentLine;
        BufferedReader bimReader =  new BufferedReader(new FileReader(bimFile));

        //read through bim file to record marker order so we can quickly index
        //into binary files
        int index = 0;
        String[] bits;
        boolean missingAlleles = false;
        while ((currentLine = bimReader.readLine()) != null){
            bits = currentLine.split("\\s");
            StringBuffer snpid = null;
            char a = 'A',b = 'B';
            // check the size of the bits array 
            if(bits.length >= 5) {
            	snpid = new StringBuffer(bits[1]);
            	if (isOx){
                    a = bits[3].toCharArray()[0];
                    b = bits[4].toCharArray()[0];
                }else{
                    a = bits[4].toCharArray()[0];
                    b = bits[5].toCharArray()[0];
                }
            } else if (bits.length == 1){
            	// if there is just 1 column assume the file contains only a SNP id
            	missingAlleles = true;
            	snpid = new StringBuffer(bits[0]);
            }  
            
            // not sure if these files exist            
//            else if(bits.length == 3) {
//            	// if there are 3 columns assume the file contains name, id and position
//            	missingAlleles = true;
//            	snpid = new StringBuffer(bits[1]);
//            } 
            
            if (markerTable.get(snpid.toString()) ==  null){
                markerTable.put(snpid.toString(), new Marker(numCollections,a,b,chrom));
            }
            //TP: only the first two args are used in addSampleCollection
            markerTable.get(snpid.toString()).addSampleCollection(runningCount,index++,a,b,snpid.toString());
            
//            if(! snpDB.containsKey(collection)) snpDB.put(collection, new HashMap<String, Vector<String>>());
//            if(! snpDB.get(collection).containsKey(chromosome)) snpDB.get(collection).put(chromosome, new Vector<String>());
//            snpDB.get(collection).get(chromosome).add(snpid.toString());
            
        }
        //TP CHANGED THIS
        int snpsSoFar = 0;	
        if (snpsPerCollection.containsKey(collection))
        	snpsSoFar = snpsPerCollection.get(collection);
        
        snpsPerCollection.put(collection,index + snpsSoFar);
        snpsPerCollection.put(collection+chromosome,index);
        
        if (missingAlleles) {
        	Genoplot.ld.log("WARNING: SNP file does not contain allele information");
        }
    }