All Downloads are FREE. Search and download functionalities are using the official Maven repository.

picard.fastq.IlluminaReadNameEncoder Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
package picard.fastq;

import picard.illumina.parser.ClusterData;

/**
 * A read name encoder following the encoding initially produced by picard fastq writers.
 * 
 * Illumina sequence identifiers
 * almost describes the format used here, except instead of an instrument name, we write the run barcode.
 *
 * @author mccowan
 */
public class IlluminaReadNameEncoder implements ReadNameEncoder {
    final String runBarcode;
    public IlluminaReadNameEncoder(final String runBarcode) {
        this.runBarcode = runBarcode;
    }
    
    @Override
    public String generateReadName(final ClusterData cluster, final Integer pairNumber) {
        return runBarcode + ":" + cluster.getLane() + ":" + cluster.getTile() + ":" + cluster.getX() + ":" + cluster.getY() + generatePairNumberSuffix(pairNumber);
    }
    
    private static String generatePairNumberSuffix(final Integer pairNumber) {
        if (pairNumber == null)
            return ""; 
        else
            return "/" + pairNumber;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy