PCAP::Bwa::Meta(3)

NAME
PCAP::Bwa::Meta - Object to contain information about input files for mapping.

  Synopsis
Please use the following to generate these objects:

  PCAP::Bwa::Meta::files_to_meta($tmp, \@files)

This accepts bam, paired fastq and interleaved fastq. Fastq files can be gzip compressed. The calling program should decide which type of files it is able to process.

  Constructor

new Generates the object when called with hashref of options, please use files_to_meta to generate the objects.

files_to_meta
    Generates a set of PCAP::Bwa::Meta objects based on the input files.

      my $meta_set = PCAP::Bwa::Meta::files_to_meta($tmpdir, \@files);

    Returns a array reference of checked and pre-processed information.

  Object Methods

in  Can store BAM, FASTQ or INTERLEAVED FASTQ

    Retrieve the original file path. In the case of a paired FASTQ file this will be truncated back to the common part of the filename so that both elements are represented by one object.

      FASTQ 1: /somepath/xxx_1.fq.gz
      FASTQ 2: /somepath/xxx_2.fq.gz

      in = /somepath/xxx

tstub
    A path for files generated from the input file represented here. The path is constructed from 'temp' and the rg_id.

fastq
    Extension type of fastq file, see parser_fastq_filename.

paired_fq
    Flag to indicate that content of in() is a stub for paired fastq rather than an interleaved fastq, see parser_fastq_filename.

    Added for future compatibility with files that can be used with 'BWA mem'.

fastq
    When input is some form of fastq this returns the extension, otherwise undef.

paired_fq
    When input is a paired fastq file this returns true.

rg  Returns the RG_ID that has been applied to this input.

rg_header
    Call this with a hash of RG header tags to generate and retrieve the header, e.g.

      $meta->rg_header(q{\t}, -SN => 'some_sample_name', -LB => 'library_name');

    After generation you can retrieve with the required separator ('\t' for passing string to bwa on command line, "\t" for direct use):

      print $meta->rg_header(qq{\t})."\n";

      $to_pass_to_command = $meta->rg_header(q{\t});

    SN is the only required element at present. See the Samtools specification <http://samtools.sourceforge.net/SAMv1.pdf> for details.

  Utility Methods

set_rg_index
      PCAP::Bwa::Meta::set_rg_index($int);

    Initialise the RG ID value to start at this INTEGER.

reset_rg_index
      PCAP::Bwa::Meta::next_rg_index();
        # or
      &PCAP::Bwa::Meta::next_rg_index;

    Reset the RG ID value to 1.

is_fastq_ext
    Determines if the file is some form of fastq file. If not fastq original filename is returned. When fastq the file extension is removed from the end of the filename and returned as the second argument.

      my ($new_name, $ext) = PCAP::Bwa::Meta::is_fastq_ext('1_1.fq');
        # $new_name = 1_1
        # $ext = 'fq'

      my ($new_name, $ext) = PCAP::Bwa::Meta::is_fastq_ext('1_1.bam');
        # $new_name = 1_1.bam
        # $ext = undef

    Understands the following as fastq files:

      fastq
      fastq.gz
      fq
      fq.gz

parse_fastq_filename
    Takes a fastq filename after removal of the extension (see "PCAP::Bwa::Meta/is_fastq_ext" in is_fastq_ext() and determines if file is read1, read2 or interleaved fastq.

    Expects file to end '_1' or '_2' for paired, assumed interleaved otherwise.

POD ERRORS
Hey! The above document had some coding errors, which are explained below:

Around line 306:
    You forgot a '=back' before '=head2'