uk.ac.sanger.npg.picard
Class IndexDecoder

java.lang.Object
  extended by uk.ac.sanger.npg.picard.IndexDecoder

public class IndexDecoder
extends java.lang.Object

This class was separated from Picard ExtractIlluminaBarcodes class, which originally only decode the reads in qseq files. In Sanger we store barcode reads in BAM file as RT tag. Using this separated class, we can decode BAM file using the same mechanism. For qseq file decoding: Determine the bar code for each read in an Illumina lane. For each tile, a file is written to the basecalls directory of the form s___barcode.txt. An output file contains a line for each read in the tile, aligned with the regular basecall output The output file contains the following tab-separated columns: - read subsequence at bar code position - Y or N indicating if there was a bar code match - matched bar code sequence (empty if read did not match one of the barcodes - number of matches - number of mismatches). For bam file decoding: Each read in BAM file will be marked in its read name and read group, There is an option to output bam file by tag.


Nested Class Summary
static class IndexDecoder.BarcodeMatch
          BarcodeMatch class
static class IndexDecoder.BarcodeMetric
          Metrics produced by the ExtractIlluminaBarcodes program that is used to parse data in the basecalls directory and determine to which barcode each read should be assigned.
static class IndexDecoder.NamedBarcode
          Barcode Class
 
Constructor Summary
IndexDecoder()
          default constructor
IndexDecoder(java.io.File inputBarcodeFile)
          Constructor from a file with bar code list
IndexDecoder(java.util.List<java.lang.String> barcodeStringList)
          constructor from a list of barcodes
 
Method Summary
 IndexDecoder.BarcodeMatch extractBarcode(java.lang.String barcodeRead, boolean isPf)
           
 int getBarcodeLength()
           
 java.util.List<IndexDecoder.NamedBarcode> getNamedBarcodes()
           
 java.util.ArrayList<IndexDecoder.NamedBarcode> parseBarcodeFile(java.util.ArrayList<java.lang.String> messages, java.io.File barcodeFile)
          read and check input bar code file
 java.util.ArrayList<IndexDecoder.NamedBarcode> parseBarcodeString(java.util.ArrayList<java.lang.String> messages, java.util.List<java.lang.String> barcodeStringList)
          check the list of input bar codes.
 void prepareDecode(java.util.ArrayList<java.lang.String> messages)
          check input bar codes and initial bar codes object and metrics list
 void setMaxMismatches(int maxMismatches)
           
 void setMaxNoCalls(int maxNoCalls)
           
 void setMinMismatchDelta(int minMismatchDelta)
           
 void writeMetrics(net.sf.picard.metrics.MetricsFile<IndexDecoder.BarcodeMetric,java.lang.Integer> metrics, java.io.File metricsFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexDecoder

public IndexDecoder()
default constructor


IndexDecoder

public IndexDecoder(java.io.File inputBarcodeFile)
Constructor from a file with bar code list

Parameters:
inputBarcodeFile -

IndexDecoder

public IndexDecoder(java.util.List<java.lang.String> barcodeStringList)
constructor from a list of barcodes

Parameters:
barcodeStringList -
Method Detail

prepareDecode

public void prepareDecode(java.util.ArrayList<java.lang.String> messages)
check input bar codes and initial bar codes object and metrics list

Parameters:
messages -

extractBarcode

public IndexDecoder.BarcodeMatch extractBarcode(java.lang.String barcodeRead,
                                                boolean isPf)
Parameters:
barcodeRead -
isPf -
Returns:

writeMetrics

public void writeMetrics(net.sf.picard.metrics.MetricsFile<IndexDecoder.BarcodeMetric,java.lang.Integer> metrics,
                         java.io.File metricsFile)
Parameters:
metrics -
metricsFile -

parseBarcodeString

public java.util.ArrayList<IndexDecoder.NamedBarcode> parseBarcodeString(java.util.ArrayList<java.lang.String> messages,
                                                                         java.util.List<java.lang.String> barcodeStringList)
check the list of input bar codes.

Parameters:
messages -
barcodeStringList -
Returns:

parseBarcodeFile

public java.util.ArrayList<IndexDecoder.NamedBarcode> parseBarcodeFile(java.util.ArrayList<java.lang.String> messages,
                                                                       java.io.File barcodeFile)
read and check input bar code file

Parameters:
messages -
barcodeFile -
Returns:

setMaxMismatches

public void setMaxMismatches(int maxMismatches)
Parameters:
maxMismatches - the maxMismatches to set

setMinMismatchDelta

public void setMinMismatchDelta(int minMismatchDelta)
Parameters:
minMismatchDelta - the minMismatchDelta to set

setMaxNoCalls

public void setMaxNoCalls(int maxNoCalls)
Parameters:
maxNoCalls - the maxNoCalls to set

getBarcodeLength

public int getBarcodeLength()
Returns:
the barcodeLength

getNamedBarcodes

public java.util.List<IndexDecoder.NamedBarcode> getNamedBarcodes()
Returns:
the namedBarcodes