Oncoprint: define graphic function error
2
0
Entering edit mode
16 months ago
ngcatung0 ▴ 20

Hi, Im not sure how to overcome this error regarding the oncoprint graphic function error.

Error: You should define graphic function for: missense_variantmissense_variant, missense_variantmissense_variantmissense_variant, stop_gainedstop_gained, missense_variantsplice_region_variant, missense_variantsplice_region_variantmissense_variant, missense_variantframeshift_variant, splice_region_variantframeshift_variant

The code is below:

col <- c("stop_gained" = "blue", "missense_variant" = "red", "inframe_deletion" = "#008000", "splice_region_variant" = "aquamarine", "frameshift_variant" = "burlywood4", "splice_acceptor_variant" = "coral", 
         "NA" = "gray90")
alter_fun <- list(
    background = function(x, y, w, h) {
        grid.rect(x, y, w-unit(0.5, "mm"), h-unit(0.5, "mm"), 
            gp = gpar(fill = "#CCCCCC", col = NA))
    },
    # big blue
    stop_gained = function(x, y, w, h) {
        grid.rect(x, y, w-unit(0.5, "mm"), h-unit(0.5, "mm"), 
            gp = gpar(fill = col["stop gained"], col = NA))
    },
    # bug red
    missense_variant = function(x, y, w, h) {
        grid.rect(x, y, w-unit(0.5, "mm"), h-unit(0.5, "mm"), 
            gp = gpar(fill = col["missense variant"], col = NA))
    },
    # small green
    inframe_deletion = function(x, y, w, h) {
        grid.rect(x, y, w-unit(0.5, "mm"), h*0.33, 
            gp = gpar(fill = col["inframe deletion"], col = NA))
    }
    ,
    # aquamarine
    splice_region_variant = function(x, y, w, h) {
        grid.rect(x, y, w-unit(0.5, "mm"), h*0.33, 
            gp = gpar(fill = col["splice region variant"], col = NA))
    }
    ,
    # burlywood4
    frameshift_variant = function(x, y, w, h) {
        grid.rect(x, y, w-unit(0.5, "mm"), h*0.33, 
            gp = gpar(fill = col["frameshift variant"], col = NA))
    }
    ,
    # coral
    splice_acceptor_variant = function(x, y, w, h) {
        grid.rect(x, y, w-unit(0.5, "mm"), h*0.33, 
            gp = gpar(fill = col["splice acceptor variant"], col = NA))  
    }

)
```

```{r}
column_title = "OncoPrint for P00151 Project"
heatmap_legend_param = list(title = "Alterations", at = c("stop_gained", "missense_variant", "inframe_deletion", "splice_region_variant", "frameshift_variant", "splice_acceptor_variant"), 
        labels = c("Stop Gained", "Missense Variant", "Inframe Deletion", "Splice Region Variant", "Frameshift Variant", "Splice Acceptor Variant"))
oncoPrint(data2,
    alter_fun = alter_fun, col = col, 
    column_title = column_title, heatmap_legend_param = heatmap_legend_param)

Please assist!

R Oncoprint Genomics genome NGS • 1.0k views
ADD COMMENT
0
Entering edit mode

ngcatung0, when you post your question on multiple web forums, can you (at the very least) alert the users of both [forums] of the locations where you have posted? This is to allow us not to duplicate efforts.

ADD REPLY
2
Entering edit mode
16 months ago
dsull ★ 2.1k

I've never played around with oncoPrint in R but here is an idea (based off what I can infer from the error message):

You actually need to define the colors for missense_variantmissense_variant, missense_variantmissense_variantmissense_variant, stop_gainedstop_gained, (and all the other stuff mentioned in the error message) the same way you have for everything else (stop_gained, missense_variant, inframe_deletion, etc.). If you don't, you'll need to remove those names mentioned in your error message from your dataframe: data2.

Why do names like missense_variantmissense_variantmissense_variant appear? I speculate that it's because of one-to-many mapping: The location of a variant is mapping to multiple transcripts. In this case, the location is mapping to three transcripts and for that particular variant, it's a missense variant in all three transcripts.

In the case of missense_variantframeshift_variant, perhaps the location maps to two transcripts, and that particular variant is missense in one transcript but frameshift in the other transcript.

That's my best guess based on the information provided. Hope this helps!

ADD COMMENT
1
Entering edit mode
16 months ago

It implies that you have mutation / variant labels such as missense_variantmissense_variant, missense_variantmissense_variantmissense_variant, stop_gainedstop_gained, missense_variantsplice_region_variant, et cetera, in your data; so, you need to define these in the alter_fun

Perhaps you should explore why these labels exist in your input data.

Kevin

ADD COMMENT
0
Entering edit mode

Ah, Kevin beat me to it! :)

Also, this question was cross-posted: https://stackoverflow.com/questions/60557589/question-oncoprint-define-graphic-function-error-in-r

ADD REPLY
0
Entering edit mode

Yes, sorry, I'm on a Biostars binge in the past couple of days. Thanks for alerting to the cross-post.

ADD REPLY

Login before adding your answer.

Traffic: 1674 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6