Package picard.sam

## Class SamToFastqWithTags

- java.lang.Object
- - picard.cmdline.CommandLineProgram
  - - picard.sam.SamToFastq
    - - picard.sam.SamToFastqWithTags

-     public class SamToFastqWithTags
      extends SamToFastq

  Extracts read sequences and qualities from the input SAM/BAM file and SAM/BAM tags and writes them into output files in Sanger FASTQ format. See MAQ FASTQ specification for details.

  #### Usage example:

       java -jar picard.jar SamToFastqWithTags
           I=input.bam
           FASTQ=output.fastq
           SEQUENCE_TAG_GROUP="CR"
           QUALITY_TAG_GROUP="CY"
           SEQUENCE_TAG_GROUP="CB,UR"
           QUALITY_TAG_GROUP="CY,UY"

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `Boolean` | `COMPRESS_OUTPUTS_PER_TAG_GROUP` |
    `List<String>` | `QUALITY_TAG_GROUP` |
    `List<String>` | `SEQUENCE_TAG_GROUP` |
    `List<String>` | `TAG_GROUP_SEPERATOR` |

    - ### Fields inherited from class picard.sam.SamToFastq

      `CLIPPING_ACTION, CLIPPING_ATTRIBUTE, CLIPPING_MIN_LENGTH, COMPRESS_OUTPUTS_PER_RG, FASTQ, INCLUDE_NON_PF_READS, INCLUDE_NON_PRIMARY_ALIGNMENTS, INPUT, INTERLEAVE, OUTPUT_DIR, OUTPUT_PER_RG, QUALITY, RE_REVERSE, READ1_MAX_BASES_TO_WRITE, READ1_TRIM, READ2_MAX_BASES_TO_WRITE, READ2_TRIM, RG_TAG, SECOND_END_FASTQ, UNPAIRED_FASTQ`

    - ### Fields inherited from class picard.cmdline.CommandLineProgram

      `COMPRESSION_LEVEL, CREATE_INDEX, CREATE_MD5_FILE, GA4GH_CLIENT_SECRETS, MAX_ALLOWABLE_ONE_LINE_SUMMARY_LENGTH, MAX_RECORDS_IN_RAM, QUIET, REFERENCE_SEQUENCE, referenceSequence, specialArgumentsCollection, TMP_DIR, USE_JDK_DEFLATER, USE_JDK_INFLATER, VALIDATION_STRINGENCY, VERBOSITY`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SamToFastqWithTags()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected String[]` | `customCommandLineValidation()` | Put any custom command-line validation in an override of this method.
    `protected Map<htsjdk.samtools.SAMReadGroupRecord,​List<htsjdk.samtools.fastq.FastqWriter>>` | `generateAdditionalWriters​(List<htsjdk.samtools.SAMReadGroupRecord> readGroups, htsjdk.samtools.fastq.FastqWriterFactory factory)` |
    `protected void` | `handleAdditionalRecords​(htsjdk.samtools.SAMRecord currentRecord, Map<htsjdk.samtools.SAMReadGroupRecord,​List<htsjdk.samtools.fastq.FastqWriter>> tagWriters, htsjdk.samtools.SAMRecord read1, htsjdk.samtools.SAMRecord read2)` |
    `protected void` | `initializeAdditionalWriters()` |

    - ### Methods inherited from class picard.sam.SamToFastq

      `assertPairedMates, doWork`

    - ### Methods inherited from class picard.cmdline.CommandLineProgram

      `checkRInstallation, getCommandLine, getCommandLineParser, getCommandLineParserForArgs, getDefaultHeaders, getFaqLink, getMetricsFile, getPGRecord, getStandardUsagePreamble, getStandardUsagePreamble, getVersion, hasWebDocumentation, instanceMain, instanceMainWithExit, makeReferenceArgumentCollection, parseArgs, requiresReference, setDefaultHeaders, useLegacyParser`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### SEQUENCE_TAG_GROUP

          @Argument(shortName="STG",
                    doc="List of comma separated tag values to extract from Input SAM/BAM to be used as read sequence",
                    minElements=1)
          public List<String> SEQUENCE_TAG_GROUP

    - #### QUALITY_TAG_GROUP

          @Argument(shortName="QTG",
                    doc="List of comma separated tag values to extract from Input SAM/BAM to be used as read qualities",
                    optional=true)
          public List<String> QUALITY_TAG_GROUP

    - #### TAG_GROUP_SEPERATOR

          @Argument(shortName="SEP",
                    doc="List of any sequences (e.g. \'AACCTG`) to put in between each comma separated list of sequence tags in each SEQUENCE_TAG_GROUP (STG)",
                    optional=true)
          public List<String> TAG_GROUP_SEPERATOR

    - #### COMPRESS_OUTPUTS_PER_TAG_GROUP

          @Argument(shortName="GZOPTG",
                    doc="Compress output FASTQ files per Tag grouping using gzip and append a .gz extension to the file names.")
          public Boolean COMPRESS_OUTPUTS_PER_TAG_GROUP

  - ### Constructor Detail

    - #### SamToFastqWithTags

          public SamToFastqWithTags()

  - ### Method Detail

    - #### initializeAdditionalWriters

          protected void initializeAdditionalWriters()

      Overrides:
        `initializeAdditionalWriters` in class `SamToFastq`

    - #### handleAdditionalRecords

          protected void handleAdditionalRecords​(htsjdk.samtools.SAMRecord currentRecord,
                                                 Map<htsjdk.samtools.SAMReadGroupRecord,​List<htsjdk.samtools.fastq.FastqWriter>> tagWriters,
                                                 htsjdk.samtools.SAMRecord read1,
                                                 htsjdk.samtools.SAMRecord read2)

      Overrides:
        `handleAdditionalRecords` in class `SamToFastq`

    - #### generateAdditionalWriters

          protected Map<htsjdk.samtools.SAMReadGroupRecord,​List<htsjdk.samtools.fastq.FastqWriter>> generateAdditionalWriters​(List<htsjdk.samtools.SAMReadGroupRecord> readGroups,
                                                                                                                                    htsjdk.samtools.fastq.FastqWriterFactory factory)

      Overrides:
        `generateAdditionalWriters` in class `SamToFastq`

    - #### customCommandLineValidation

          protected String[] customCommandLineValidation()

      Description copied from class: `SamToFastq`
      Put any custom command-line validation in an override of this method. clp is initialized at this point and can be used to print usage and access argv. Any options set by command-line parser can be validated.
      Overrides:
        `customCommandLineValidation` in class `SamToFastq`
      Returns:
        null if command line is valid. If command line is invalid, returns an array of error messages to be written to the appropriate place.