scanMeripBAM {exomePeak2} | R Documentation

## Organize the BAM Files Information of a MeRIP-seq Data Set.

### Description

`scanMeripBAM` check and organize the BAM files in MeRIP-seq data before peak calling using `exomePeakCalling`. The library types of the RNA-seq and the filters such as SAM FLAG score are specified in this function.

### Usage

    scanMeripBAM(
      bam_ip = NULL,
      bam_input = NULL,
      bam_treated_ip = NULL,
      bam_treated_input = NULL,
      paired_end = FALSE,
      library_type = c("unstranded", "1st_strand", "2nd_strand"),
      index_bam = TRUE,
      bam_files = NULL,
      design_ip = NULL,
      design_treatment = NULL,
      mapq = 30L,
      isSecondaryAlignment = FALSE,
      isNotPassingQualityControls = FALSE,
      isDuplicate = FALSE,
      isPaired = NA,
      isProperPair = NA,
      hasUnmappedMate = NA,
      ...
    )

### Arguments

`bam_ip` | a `character` vector for the BAM file directories of the (control) IP samples.
`bam_input` | a `character` vector for the BAM file directories of the (control) input samples.
`bam_treated_ip` | a `character` vector for the BAM file directories of the treated IP samples.
`bam_treated_input` | a `character` vector for the BAM file directories of the treated input samples. If the bam files do not contain treatment group, user should only fill the arguments of `BAM_ip` and `BAM_input`.
`paired_end` | a `logical` of whether the data comes from the Paired-End Library, `TRUE` if the data is Paired-End sequencing; default `= FALSE`.
`library_type` | a `character` specifying the protocal type of the RNA-seq library, can be one in `c("unstranded", "1st_strand", "2nd_strand")`; default `= "unstranded"`. unstranded The randomly primed RNA-seq library type, i.e. both the strands generated during the first and the second strand sythesis are sequenced; example: Standard Illumina. 1st_strand The first strand-specific RNA-seq library, only the strand generated during the first strand sythesis is sequenced; examples: dUTP, NSR, NNSR. 2nd_strand The second strand-specific RNA-seq library, only the strand generated during the second strand sythesis is sequenced; examples: Ligation, Standard SOLiD.
`index_bam` | a `logical` value indicating whether to sort and index BAM files automatically if the bam indexes are not found; default `= TRUE`. The BAM index files will be named by adding ".bai" after the names of the corresponding BAM files.
`bam_files` | optional, a `character` vector for all the BAM file directories, if it is provided, the first 4 arguments above will be ignored.
`design_ip` | optional, a `logical` vector indicating the information of IP/input, `TRUE` represents IP samples.
`design_treatment` | optional, a `logical` vector indicating the design of treatment/control, `TRUE` represents treated samples.
`mapq` | a non-negative integer specifying the minimum reads mapping quality. BAM records with mapping qualities less than `mapq` are discarded; default `= 30L`.
`isPaired, isProperPair, hasUnmappedMate, isSecondaryAlignment, isNotPassingQualityControls, isDuplicate, ...` | arguments specifying the filters on SAM FLAG scores, inherited from `ScanBamParam`.

### Details

`scanMeripBAM` takes the input of the BAM file directories for the MeRIP-seq datasets. It first checks the completeness of the BAM files and the BAM indexes. Then, the design information of IP/input and treated/control are returned as a `MeripBamFileList` object. If the BAM file indexes are missing, the BAM files will be automatically indexed with the package `Rsamtools`.

### Value

a `MeripBamFileList` object.

### See Also

`exomePeakCalling`

### Examples

    ### Define BAM File Directories

    f1 = system.file("extdata", "IP1.bam", package="exomePeak2")
    f2 = system.file("extdata", "IP2.bam", package="exomePeak2")
    f3 = system.file("extdata", "IP3.bam", package="exomePeak2")
    f4 = system.file("extdata", "IP4.bam", package="exomePeak2")
    IP_BAM = c(f1,f2,f3,f4)
    f1 = system.file("extdata", "Input1.bam", package="exomePeak2")
    f2 = system.file("extdata", "Input2.bam", package="exomePeak2")
    f3 = system.file("extdata", "Input3.bam", package="exomePeak2")
    INPUT_BAM = c(f1,f2,f3)

    f1 = system.file("extdata", "treated_IP1.bam", package="exomePeak2")
    TREATED_IP_BAM = c(f1)
    f1 = system.file("extdata", "treated_Input1.bam", package="exomePeak2")
    TREATED_INPUT_BAM = c(f1)

    ### For MeRIP-Seq Experiment Without the Treatment Group

    MeRIP_Seq_Alignment <- scanMeripBAM(
      bam_ip = IP_BAM,
      bam_input = INPUT_BAM,
      paired_end = FALSE
    )

    ### For MeRIP-Seq Experiment With the Treatment Group

    MeRIP_Seq_Alignment <- scanMeripBAM(
    bam_ip = IP_BAM,
    bam_input = INPUT_BAM,
    bam_treated_ip = TREATED_IP_BAM,
    bam_treated_input = TREATED_INPUT_BAM,
    paired_end = FALSE
    )

[Package exomePeak2 version 1.6.1 Index]