// Path: src/main/java/org/seqdoop/hadoop_bam/FormatConstants.java
// public enum BaseQualityEncoding { Illumina, Sanger };
// 
// Path: src/main/java/org/seqdoop/hadoop_bam/util/ConfHelper.java
// public class ConfHelper
// {
// 	/**
// 	 * Convert a string to a boolean.
// 	 *
// 	 * Accepted values: "yes", "true", "t", "y", "1"
// 	 *                  "no", "false", "f", "n", "0" 
// 	 * All comparisons are case insensitive.
// 	 *
// 	 * If the value provided is null, defaultValue is returned.
// 	 *
// 	 * @exception IllegalArgumentException Thrown if value is not
// 	 * null and doesn't match any of the accepted strings.
// 	 */
// 	public static boolean parseBoolean(String value, boolean defaultValue)
// 	{
// 		if (value == null)
// 			return defaultValue;
// 
// 		value = value.trim();
// 
// 		// any of the following will 
// 		final String[] acceptedTrue = new String[]{ "yes", "true", "t", "y", "1" };
// 		final String[] acceptedFalse = new String[]{ "no", "false", "f", "n", "0" };
// 
// 		for (String possible: acceptedTrue)
// 		{
// 			if (possible.equalsIgnoreCase(value))
// 				return true;
// 		}
// 		for (String possible: acceptedFalse)
// 		{
// 			if (possible.equalsIgnoreCase(value))
// 				return false;
// 		}
// 
// 		throw new IllegalArgumentException("Unrecognized boolean value '" + value + "'");
// 	}
// 
// 	public static boolean parseBoolean(Configuration conf, String propertyName, boolean defaultValue)
// 	{
// 		return parseBoolean(conf.get(propertyName), defaultValue);
// 	}
// }


import org.apache.hadoop.mapreduce.lib.input.FileSplit;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import java.io.InputStream;
import java.io.IOException;
import java.io.EOFException;
import java.util.regex.*;
import org.seqdoop.hadoop_bam.FormatConstants.BaseQualityEncoding;
import org.seqdoop.hadoop_bam.util.ConfHelper;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.compress.*;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
			{
				positionAtFirstRecord(fileIn);
				inputStream = fileIn;
			}
			else
			{ // compressed file
				if (start != 0)
					throw new RuntimeException("Start position for compressed file is not 0! (found " + start + ")");

				inputStream = codec.createInputStream(fileIn);
				end = Long.MAX_VALUE; // read until the end of the file
			}

			lineReader = new LineReader(inputStream);
		}

		protected void setConf(Configuration conf)
		{
			String encoding =
			  conf.get(FastqInputFormat.CONF_BASE_QUALITY_ENCODING,
			    conf.get(FormatConstants.CONF_INPUT_BASE_QUALITY_ENCODING,
			      FastqInputFormat.CONF_BASE_QUALITY_ENCODING_DEFAULT));

			if ("illumina".equals(encoding))
				qualityEncoding = BaseQualityEncoding.Illumina;
			else if ("sanger".equals(encoding))
				qualityEncoding = BaseQualityEncoding.Sanger;
			else
				throw new RuntimeException("Unknown input base quality encoding value " + encoding);

// Path: src/main/java/org/seqdoop/hadoop_bam/FormatConstants.java
// public enum BaseQualityEncoding { Illumina, Sanger };
// 
// Path: src/main/java/org/seqdoop/hadoop_bam/util/ConfHelper.java
// public class ConfHelper
// {
// 	/**
// 	 * Convert a string to a boolean.
// 	 *
// 	 * Accepted values: "yes", "true", "t", "y", "1"
// 	 *                  "no", "false", "f", "n", "0" 
// 	 * All comparisons are case insensitive.
// 	 *
// 	 * If the value provided is null, defaultValue is returned.
// 	 *
// 	 * @exception IllegalArgumentException Thrown if value is not
// 	 * null and doesn't match any of the accepted strings.
// 	 */
// 	public static boolean parseBoolean(String value, boolean defaultValue)
// 	{
// 		if (value == null)
// 			return defaultValue;
// 
// 		value = value.trim();
// 
// 		// any of the following will 
// 		final String[] acceptedTrue = new String[]{ "yes", "true", "t", "y", "1" };
// 		final String[] acceptedFalse = new String[]{ "no", "false", "f", "n", "0" };
// 
// 		for (String possible: acceptedTrue)
// 		{
// 			if (possible.equalsIgnoreCase(value))
// 				return true;
// 		}
// 		for (String possible: acceptedFalse)
// 		{
// 			if (possible.equalsIgnoreCase(value))
// 				return false;
// 		}
// 
// 		throw new IllegalArgumentException("Unrecognized boolean value '" + value + "'");
// 	}
// 
// 	public static boolean parseBoolean(Configuration conf, String propertyName, boolean defaultValue)
// 	{
// 		return parseBoolean(conf.get(propertyName), defaultValue);
// 	}
// }


// Path: src/main/java/org/seqdoop/hadoop_bam/FastqInputFormat.java
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import java.io.InputStream;
import java.io.IOException;
import java.io.EOFException;
import java.util.regex.*;
import org.seqdoop.hadoop_bam.FormatConstants.BaseQualityEncoding;
import org.seqdoop.hadoop_bam.util.ConfHelper;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.compress.*;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

			{
				positionAtFirstRecord(fileIn);
				inputStream = fileIn;
			}
			else
			{ // compressed file
				if (start != 0)
					throw new RuntimeException("Start position for compressed file is not 0! (found " + start + ")");

				inputStream = codec.createInputStream(fileIn);
				end = Long.MAX_VALUE; // read until the end of the file
			}

			lineReader = new LineReader(inputStream);
		}

		protected void setConf(Configuration conf)
		{
			String encoding =
			  conf.get(FastqInputFormat.CONF_BASE_QUALITY_ENCODING,
			    conf.get(FormatConstants.CONF_INPUT_BASE_QUALITY_ENCODING,
			      FastqInputFormat.CONF_BASE_QUALITY_ENCODING_DEFAULT));

			if ("illumina".equals(encoding))
				qualityEncoding = BaseQualityEncoding.Illumina;
			else if ("sanger".equals(encoding))
				qualityEncoding = BaseQualityEncoding.Sanger;
			else
				throw new RuntimeException("Unknown input base quality encoding value " + encoding);

			filterFailedQC = ConfHelper.parseBoolean(