subsetAlterations {PrecisionTrialDrawer} | R Documentation

## Retrieve exactly the the alteration requested in the panel after a getAlterations method

### Description

As soon as all the data are retrieved from local or remote repositories, this method simply subsets the alterations as exactly requested by the panel and put them in a format that is common to all kinds of alterations

### Usage

    subsetAlterations(object , rules)

### Arguments

`object` | a CancerPanel object
`rules` | a data.frame with the same columns as the panel plus tumor_type and in_out. Check newCancerPanel function

### Details

This method will raise an error if no data are available in the slot dataFull. The method is compulsory to draw all plots since it attaches to each alteration all the panel characteristics, like for example druggability and group.

### Value

This method returns the object itself with the slot dataSubset updated. This slot is formed by a list of 4 elements:

`mutations` | a data.frame containing exactly the mutation alterations requested in the panel
`copynumber` | a data.frame containing exactly the copynumber alterations requested in the panel
`expression` | a data.frame containing exactly the expression alterations requested in the panel
`fusions` | a data.frame containing exactly the fusions alterations requested in the panel
`excluded` | a data.frame containing the samples that are resistant to a drug, if rules is set

Each of the first 4 element is a data.frame with the following columns:

`drug` | drug associated with the alteration, if any
`group` | group associated with the alteration, if present
`gene_symbol` | gene associated with the alteration. In case of fusions, a fusion gene in the format gene1__gene2
`tumor_type` | tumor_type in which the alterations were found
`case_id` | sample IDs in which the alterations were found
`alteration_id` | type of alteration with autonumeric identifier. e.g. a specific fusion is fus_1, fus_2 etc.

Please note that the number of alterations per alteration type can have more rows than the original dataFull slot. This is because the same alteration can be a target of multiple drugs or belong to more than one group and is therefore repeated.

### Author(s)

Giorgio Melloni, Alessandro Guida

### References

data origin for mutations, copynumber and expression data

data origin for fusion data

### See Also

`getAlterations` `newCancerPanel`

### Examples

    # Load example CancerPanel object
    data(cpObj)
    # Launch subsetAlterations excluding certain mutations
    # from being considered actionable
    rules <- data.frame(
        drug=c("Erlotinib" , "Erlotinib", "Erlotinib","Erlotinib","Olaparib")
        , gene_symbol=c("EGFR" , "KRAS", "" , "", "")
        , alteration=c("SNV" , "SNV", "" , "", "")
        , exact_alteration=c("amino_acid_variant" , "", "" , "", "")
        , mutation_specification=c("T790M" , "" , "" , "", "")
        , group=c("Driver" , "Driver", "Driver" , "Driver", "Driver")
        , tumor_type=c("luad" , "luad" , "luad" , "coadread","brca")
        , in_out=c("exclude" , "exclude" , "include" , "include" , "include")
        , stringsAsFactors = FALSE)
    cpObj <- subsetAlterations(cpObj , rules = rules)
    # See the updated slot
    str(cpDataSubset(cpObj))

[Package PrecisionTrialDrawer version 1.10.0 Index]