ConvertToPSelf {MACPET} | R Documentation

## Convert GInteraction object to PSelf object

### Description

`ConvertToPSelf` converts a `GInteractions` object to class to `PSelf` object.

### Usage

    ConvertToPSelf(object, ...)

    ## Default S3 method:
    ConvertToPSelf(object, ...)

    ## S3 method for class 'GInteractions'
    ConvertToPSelf(object, S2_BlackList, SA_prefix,
      S2_AnalysisDir, ...)

    ## S4 method for signature 'GInteractions'
    ConvertToPSelf(object, S2_BlackList, SA_prefix,
      S2_AnalysisDir, ...)

### Arguments

`object` | An object of `GInteractions` class.
`...` | not used.
`S2_BlackList` | See `MACPETUlt`.
`SA_prefix` | See `MACPETUlt`.
`S2_AnalysisDir` | The directory in which the object will be saved.

### Details

`MACPETUlt` at State 2 separates the Inter-chromosomal, Intra-chromosomal and Self-ligated PETs by taking the paired-end BAM/SAM file as input. However the user might only have Self-ligated data available and already separated from the Inter/Intra-chromosomal PETs. `ConvertToPSelf` can then be used in the Self-ligated data to convert a `GInteractions` object containing only the Self-ligated PETs to a `PSelf` class for further analysis in Stage 3. The object will be saved in the `S2_AnalysisDir` directory with the name `SA_prefix_pselfData`. Note that if `S2_BlackList==TRUE` then the `GInteractions` object given as input has to include the genome name in the `seqinfo` slot. Also, the sequences lengths are mandatory in the `seqinfo` slot since they are used in stage 3 of the analysis.

### Value

An object of class `PSelf`.

### Author(s)

Ioannis Vardaxis, ioannis.vardaxis@ntnu.no

### References

Vardaxis I, Drabløs F, Rye M and Lindqvist BH (2018). MACPET: Model-based Analysis for ChIA-PET. To be published.

### See Also

`PSelf`

### Examples

    #load Self-ligated data: (class=PSelf)
    load(system.file('extdata', 'MACPET_pselfData.rda', package = 'MACPET'))
    class(MACPET_pselfData)

    object=MACPET_pselfData
    #--remove information and convert to GInteractions:
    S4Vectors::metadata(object)=list(NULL)
    class(object)='GInteractions'
    #----input parameters
    S2_BlackList=TRUE
    SA_prefix='MACPET'
    S2_AnalysisDir=file.path(tempdir(),'MACPETtest')
    if(!dir.exists(S2_AnalysisDir)) dir.create(S2_AnalysisDir)

    ConvertToPSelf(object=object,
                          S2_BlackList=S2_BlackList,
                          SA_prefix=SA_prefix,
                          S2_AnalysisDir=S2_AnalysisDir)
    #load object:
    rm(MACPET_pselfData)#old object
    load(file.path(S2_AnalysisDir,'MACPET_pselfData'))
    class(MACPET_pselfData)
    #-----delete test directory:
    unlink(S2_AnalysisDir,recursive=TRUE)

[Package MACPET version 1.6.0 Index]