public void getSNPFiles(String snp, String chrom, String collection, int index, int numinds, int totNumSNPs) throws IOException{
        String filestem = collection+"."+snp;
        if (!(new File(localDir+File.separator+filestem+".bed").exists() &&
                new File(localDir+File.separator+filestem+".bnt").exists())){
            long prev = System.currentTimeMillis();

            SessionChannelClient session = ssh.openSessionChannel();
            session.startShell();
            
            // variable to pass to the evoker-helper.pl script
            int oxStatus;
            if (oxFormat){
                oxStatus = 1;
            } else {
            	oxStatus = 0;
            }
            
            //Fire off the script on the remote server to get the requested slice of data
            OutputStream out = session.getOutputStream();
            String cmd = "cd "+ remoteDir + "\nperl evoker-helper.pl "+ snp + " " +
                    chrom + " " + collection + " " + index + " " + numinds + " " + totNumSNPs + " " + oxStatus+ " " + this.getOxPlatform() + "\n";
            out.write(cmd.getBytes());


            //monitor the remote server for news that the script has been finished
            //this is pretty slow -- is there a better way?
            InputStream in = session.getInputStream();
            byte buffer[] = new byte[1024];
            int read;
            long start = System.currentTimeMillis();
                       
            while((System.currentTimeMillis() - start)/1000 < 120) {
            	try{
                	read = in.read(buffer);
                	String outstr = new String(buffer, 0, read);
                    if (outstr.contains(snp)){
                        break;
                    } else if (outstr.contains("write_error")) {
                    	throw new IOException("user does not have write privileges");
                    }
                }catch (IOException ioe){
                    ssh.disconnect();
                    throw new IOException("Problem with remote directory permissions:\n"+ioe.getMessage());
                }
                
            }
            
            if ((System.currentTimeMillis() - start)/1000 >= 120) {
            	// if nothing is output from evoker-helper.pl in 2 minutes then die 
            	throw new IOException("evoker-helper.pl is not responsive check the script will run");
            }
            
            session.close();

            
            ftp.get(filestem+".bed");
            ftp.get(filestem+".bnt");
            ftp.rm(filestem+".bed");
            ftp.rm(filestem+".bnt");

            double time = ((double)(System.currentTimeMillis() - prev))/1000;
            Genoplot.ld.log(snp +" for "+ collection +" was fetched in "+ time + "s.");
        }else{
            Genoplot.ld.log(snp +" for "+ collection +" was cached.");
        }

    }