# Class LibraryIdGenerator

java.lang.Object
picard.sam.markduplicates.util.LibraryIdGenerator

public class LibraryIdGenerator extends Object
A class to generate library Ids and keep duplication metrics by library IDs.

## Constructor Summary

Constructors
Constructor
Description
`LibraryIdGenerator(htsjdk.samtools.SAMFileHeader header)`
`LibraryIdGenerator(htsjdk.samtools.SAMFileHeader header, boolean flowMetrics)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addMetricsByLibrary(String library, DuplicationMetrics metrics)`
`htsjdk.samtools.util.Histogram<Double>`
`getDuplicateCountHist()`
`short`
`getLibraryId(htsjdk.samtools.SAMRecord rec)`
Get the library ID for the given SAM record.
`Map<String,Short>`
`getLibraryIdsMap()`
`static String`
`getLibraryName(htsjdk.samtools.SAMFileHeader header, htsjdk.samtools.SAMRecord rec)`
Gets the library name from the header for the record.
`DuplicationMetrics`
`getMetricsByLibrary(String library)`
`Map<String, DuplicationMetrics>`
`getMetricsByLibraryMap()`
`htsjdk.samtools.util.Histogram<Double>`
`getNonOpticalDuplicateCountHist()`
`long`
`getNumberOfOpticalDuplicateClusters()`
`htsjdk.samtools.util.Histogram<Double>`
`getOpticalDuplicateCountHist()`
`htsjdk.samtools.util.Histogram<Short>`
`getOpticalDuplicatesByLibraryIdMap()`
`static String`
`getReadGroupLibraryName(htsjdk.samtools.SAMReadGroupRecord readGroup)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LibraryIdGenerator

public LibraryIdGenerator(htsjdk.samtools.SAMFileHeader header)

### LibraryIdGenerator

public LibraryIdGenerator(htsjdk.samtools.SAMFileHeader header, boolean flowMetrics)

## Method Details

### getLibraryIdsMap

public Map<String,Short> getLibraryIdsMap()

### getMetricsByLibraryMap

public Map<String, DuplicationMetrics> getMetricsByLibraryMap()

### getOpticalDuplicatesByLibraryIdMap

public htsjdk.samtools.util.Histogram<Short> getOpticalDuplicatesByLibraryIdMap()

### getDuplicateCountHist

public htsjdk.samtools.util.Histogram<Double> getDuplicateCountHist()

### getNonOpticalDuplicateCountHist

public htsjdk.samtools.util.Histogram<Double> getNonOpticalDuplicateCountHist()

### getOpticalDuplicateCountHist

public htsjdk.samtools.util.Histogram<Double> getOpticalDuplicateCountHist()

### getReadGroupLibraryName

public static String getReadGroupLibraryName(htsjdk.samtools.SAMReadGroupRecord readGroup)

### getLibraryName

public static String getLibraryName(htsjdk.samtools.SAMFileHeader header, htsjdk.samtools.SAMRecord rec)
Gets the library name from the header for the record. If the RG tag is not present on the record, or the library isn't denoted on the read group, a constant string is returned.

### getLibraryId

public short getLibraryId(htsjdk.samtools.SAMRecord rec)
Get the library ID for the given SAM record.

### getMetricsByLibrary

public DuplicationMetrics getMetricsByLibrary(String library)

### addMetricsByLibrary

public void addMetricsByLibrary(String library, DuplicationMetrics metrics)

### getNumberOfOpticalDuplicateClusters

public long getNumberOfOpticalDuplicateClusters()