gt: 			for(String s : list){
context: package align2;
  
  import java.io.File;
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.LinkedHashMap;
  import java.util.LinkedHashSet;
  import java.util.Locale;
  
  import dna.Data;
  import fileIO.FileFormat;
  import fileIO.ReadWrite;
  import fileIO.TextFile;
  import fileIO.TextStreamWriter;
  import shared.PreParser;
  import shared.ReadStats;
  import shared.Shared;
  import shared.Timer;
  import shared.Tools;
  import stream.ConcurrentReadOutputStream;
  import stream.Read;
  import stream.SiteScore;
  
  /**
   * @author Brian Bushnell
   * @date Mar 19, 2013
   *
   */
  public class BBSplitter {
  	
  	public static void main(String[] args){
  		if(Shared.COMMAND_LINE==null){
  			Shared.COMMAND_LINE=(args==null ? null : args.clone());
  			Shared.BBMAP_CLASS="BBSplitter";
  		}
  		Timer t=new Timer();
  		String[] margs=processArgs(args);
  		ReadWrite.waitForWritingToFinish();
  		t.stop();
  		Data.sysout.println("Ref merge time:     \t"+t);
  		Data.scaffoldPrefixes=true;
  		if(MAP_MODE==MAP_NORMAL){
  			BBMap.main(margs);
  		}else if(MAP_MODE==MAP_ACC){
  			BBMapAcc.main(margs);
  		}else if(MAP_MODE==MAP_PACBIO){
  			BBMapPacBio.main(margs);
  		}else if(MAP_MODE==MAP_PACBIOSKIMMER){
  			BBMapPacBioSkimmer.main(margs);
  		}else{
  			throw new RuntimeException();
  		}
  //		Data.sysout.println("\nTotal time:     \t"+t);
  		
  		clearStatics();
  	}
  	
  	public static String[] processArgs(String[] args){
  		{//Preparse block for help, config files, and outstream
  			PreParser pp=new PreParser(args, new Object() { }.getClass().getEnclosingClass(), false);
  			args=pp.args;
  			//outstream=pp.outstream;
  		}
  		
  //		if(ReadWrite.ZIPLEVEL<2){ReadWrite.ZIPLEVEL=2;} //Should be fine for a realistic number of threads, except in perfect mode with lots of sites and a small index.
  		String[] oldargs=args;
  		args=remakeArgs(args);
  		if(args!=oldargs){
  			Data.sysout.println("Converted arguments to "+Arrays.toString(args));
  		}
  		
  		AbstractMapper.DEFAULT_OUTPUT_FORMAT=FileFormat.FASTQ;
  		ReadWrite.ZIPLEVEL=2;
  		
  		Timer t=new Timer();
  		
  		
  		int ziplevel=-1;
  		int build=1;
  		
  		LinkedHashSet<String> nameSet=new LinkedHashSet<String>();
  		HashMap<String, LinkedHashSet<String>> table=new HashMap<String, LinkedHashSet<String>>();
  		
  		ArrayList<String> unparsed=new ArrayList<String>();
  		
  		String basename=null;
  		
  		for(int i=0; i<args.length; i++){
  			final String arg=args[i];
  			final String[] split=arg.split("=");
  			String a0=split[0];
  			String a=a0.toLowerCase();
  			String b=split.length>1 ? split[1] : null;
  			if(b!=null && b.equalsIgnoreCase("null")){b=null;}
  
  			if(a.equals("blacklist") || a.equals("ref_blacklist")){a="ref_blacklist";}
  			if(a.equals("whitelist") || a.equals("ref_whitelist")){a="ref_whitelist";}
  			if(a.equals("ref") || a.equals("reference")){a="ref_ref";}
  
  			if(b!=null && (a.startsWith("ref_"))){
  				String setName=a0.substring(4);
  				if(setName.indexOf(',')>=0){setName=setName.replace(',', '_');}
  				if(setName.indexOf('$')>=0){setName=setName.replace('$', '_');}
  				nameSet.add(setName);
  				if(!table.containsKey(setName)){table.put(setName, new LinkedHashSet<String>());}
  				LinkedHashSet<String> set=table.get(setName);
  				
  				File f;
  				if((f=new File(b)).exists()){
  					try {
  						String s=f.getCanonicalPath();
  						set.add(s);
  					} catch (IOException e) {
  						// TODO Auto-generated catch block
  						e.printStackTrace();
  					}
  				}else{
  					for(String x : b.split(",")){
  						f=new File(x);
  						if(f.exists()){
  							try {
  								set.add(f.getCanonicalPath());
  							} catch (IOException e) {
  								// TODO Auto-generated catch block
  								e.printStackTrace();
  							}
  						}else{
  							assert(x.startsWith("stdin")) : "Can't find file "+x;
  							set.add(x);
  						}
  					}
  				}
  //				assert(false) : a+", "+b+", "+arg+", "+setName;
  			}else{
  				if(a.startsWith("-xmx") || a.startsWith("-xms")){
  					//jvm argument; do nothing
  				}else if(a.equals("path") || a.equals("root")){
  					Data.setPath(b);
  				}else if(a.equals("ziplevel") || a.equals("zl")){
  					ReadWrite.ZIPLEVEL=Integer.parseInt(b);
  					unparsed.add(args[i]);
  				}else if(a.equals("build")){
  					build=Integer.parseInt(b);
  					unparsed.add(args[i]);
  				}else if(a.equals("basename") || a.equals("pattern")){
  					basename=b;
  					assert(b==null || (b.indexOf('%')>=0 && (b.indexOf('%')<b.lastIndexOf('.')))) :
  						"basename must contain a '%' symbol prior to file extension.";
  				}else if(a.equals("append") || a.equals("app")){
  					append=ReadStats.append=Tools.parseBoolean(b);
  //					sysout.println("Set append to "+append);
  					unparsed.add(args[i]);
  				}else if(a.equals("overwrite") || a.equals("ow")){
  					overwrite=Tools.parseBoolean(b);
  //					Data.sysout.println("Set overwrite to "+overwrite);
  					unparsed.add(args[i]);
  				}else if(a.equals("verbose")){
  					verbose=Tools.parseBoolean(b);
  					unparsed.add(args[i]);
  				}else if(a.equals("rebuild")){
  					forceRebuild=Tools.parseBoolean(b);
  					unparsed.add(args[i]);
  				}else if(a.equals("fastawrap")){
  					Shared.FASTA_WRAP=Integer.parseInt(b);
  				}else{
  					unparsed.add(args[i]);
  				}
  			}
  		}
  		
  		String refname=mergeReferences(nameSet, table, build);
  		ArrayList<String> outnames=gatherLists(nameSet, basename);
  //		unparsed.add("scaffoldprefixes=true");
  		unparsed.add("ref="+refname);
  		
  		String[] margs=new String[unparsed.size()+(outnames==null ? 0 : outnames.size())];
  		int idx=0;
  		for(int i=0; i<unparsed.size(); i++){
  			margs[idx]=unparsed.get(i);
  			idx++;
  		}
  		if(outnames!=null){
  			for(int i=0; i<outnames.size(); i++){
  				margs[idx]=outnames.get(i);
  				idx++;
  			}
  		}
  		
  		return margs;
  	}
  	
  	
  	public static String[] remakeArgs(String[] args){
  		
  		LinkedHashSet<String> set=new LinkedHashSet<String>();
  		HashMap<String,LinkedHashSet<String>> map=new HashMap<String,LinkedHashSet<String>>();
  		int removed=0;
  		
  		for(int i=0; i<args.length; i++){
  			final String arg=args[i];
  			final String[] split=arg.split("=");
  			String a=split[0].toLowerCase();
  			String b=split.length>1 ? split[1] : null;
  			
  			if(a.equals("mapmode") && b!=null){
  				args[i]=null;
  				removed++;
  				if(b.equalsIgnoreCase("normal")){MAP_MODE=MAP_NORMAL;}
  				else if(b.equalsIgnoreCase("accurate") || b.equalsIgnoreCase("acc")){MAP_MODE=MAP_ACC;}
  				else if(b.equalsIgnoreCase("pacbio") || b.equalsIgnoreCase("pb") || b.equalsIgnoreCase("bp")){MAP_MODE=MAP_PACBIO;}
  				else if(b.equalsIgnoreCase("pacbioskimmer") || b.equalsIgnoreCase("pbs") || b.equalsIgnoreCase("bps")){MAP_MODE=MAP_PACBIOSKIMMER;}
  				else{throw new RuntimeException("Unknown mode: "+b);}
  			}else if(a.equals("ref") && b!=null){
  				args[i]=null;
  				removed++;
  				processRef(b, set, map);
  			}
  		}
  		if(set.isEmpty() && removed==0){return args;}
  		if(MAP_MODE==MAP_ACC){removed--;}
  		String[] args2=new String[args.length+set.size()-removed];
  		
  		int i=0, j=0;
  		if(MAP_MODE==MAP_ACC){
  			args2[j]="minratio=0.4"; //Increase sensitivity in accurate mode
  			j++;
  		}
  		for(; i<args.length; i++){
  			if(args[i]!=null){
  				args2[j]=args[i];
  				j++;
  			}
  		}
  		for(String key : set){
  			LinkedHashSet<String> list=map.get(key);
  			StringBuilder sb=new StringBuilder(200);
  			sb.append("ref_"+key+"=");
  			String comma="";
  