static public void main(String[] arguments) {

		String msg = null;

		// create the configuration
		Config config = new Config();

		// see:
		// http://www.javaworld.com/javaworld/jw-08-2004/jw-0816-command.html?page=5
		Options opt = new Options(arguments, 2);
		
		// convert fasta: arg1 = fasta files, arg2 = bases files
		// c = comma separated list of chromosomes e.g. "1,3,18,X" 
		opt.addSet("cfset", 2).addOption("cf").addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
		// extract exons: arg1 = reference bases, arg2 = input bases, arg3 = output exon.bases, arg4 = output exon.locations
		// c = comma separated list of chromosomes e.g. "1,3,18,X"
		opt.addSet("eeset", 4).addOption("ee").addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
		// extracts exons from the file provided by RB
		// arg2 = input .fa, arg2 = output exon.bases, arg3 = output exon.locations
		opt.addSet("rbset", 3).addOption("rb").addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE);

		// add -d to all of them
		opt.addOptionAllSets("d", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
		
		OptionSet set = opt.getMatchingSet();
		if (set == null) {
			GLT.showHelp();
			// Print usage hints
			System.exit(1);
		}
		
		// set the directory
		if (set.isSet("d")) {
			String directory = set.getOption("d").getResultValue(0);
			config.setDirectory(directory);
		}

		msg = "Working directory:" + config.getDirectory();
		GLT.logger.info(msg);

		// set the chromosomeIds
		if (set.isSet("c")) {
			String chromosomeIds = set.getOption("c").getResultValue(0);
			List<String> ids = new ArrayList<String>(Arrays.asList(chromosomeIds.split(",")));
			config.setChromosomeIds(ids);
		}

		msg = "Working with chromosomes " + config.getChromosomeIds().toString();
		GLT.logger.info(msg);
		
		int i = 0;

		// Evaluate the different option sets
		if (set.getSetName().equals("cfset")) {
		  
			// set the different file name masks
			config.setInputChromosomeFastaFileName(set.getData().get(i++));
			config.setOutputChromosomeBasesFileName(set.getData().get(i++));

			for (String id : config.getChromosomeIds()) {
				GLT.convertFasta(config, id);
			}
		}
		
		if (set.getSetName().equals("eeset")) {
			
			// set the different file name masks
			config.setReferenceChromosomeBasesFileName(set.getData().get(i++));
			config.setInputChromosomeBasesFileName(set.getData().get(i++));
			config.setOutputExonBasesFileName(set.getData().get(i++));
			config.setOutputExonLocationsFileName(set.getData().get(i++));

			for (String id : config.getChromosomeIds()) {
	
				GLT.compileExons(config, id);
				
				Chromosome chromosome = Chromosome.get(id);
				
				// we may have picked up duplicate ones, so throw those away first,
				// because it is unnecessary to process them twice
				GLT.removeDuplicateExons(config, chromosome);
				
				// find them in the input file
				GLT.locateExons(config, chromosome);
				
				// and throw the duplicated ones away again for good measure
				GLT.removeDuplicateExons(config, chromosome);
				
				GLT.exportExons(config, chromosome);
			}
		}
		
		if (set.getSetName().equals("rbset")) {
			
			// set the different file name masks
			config.setInputChromosomeFastaFileName(set.getData().get(i++));
			config.setOutputExonBasesFileName(set.getData().get(i++));
			config.setOutputExonLocationsFileName(set.getData().get(i++));

			for (String id : config.getChromosomeIds()) {
	
				GLT.exportRBExons(config, id);
			}
		}
	}