gerstung-lab / MutationTimeR

An R package to time somatic mutations
59 stars 24 forks source link

Example input structural variants #14

Open iS4i4S opened 3 years ago

iS4i4S commented 3 years ago

Hello, Thanks for the package it is very useful and i was able to use it correctly but I haven’t included the use of structural variants (for plotting, since it is not used for calculations). Could you provide and example of this input ? Thanks in advance

FreyaVan commented 3 years ago

Have you figured out this? I have the same question

iS4i4S commented 3 years ago

@FreyaVan Yes, I checked the code to see the proper formating of this input. You need the output of structural variants similar to these:

head(snv_tmp)
       X.gene1                                     gene2 breakpoint1 breakpoint2                  type split_reads1 split_reads2
1       RNF213                                     ENDOV 17:80398047 17:80422206 deletion/read-through          119           87
2     DYNC1LI2                               CTC-591M7.1 16:66749197 16:22808270              deletion           11            4
3 RP11-345J4.8                               CTC-591M7.1 16:29561515 16:22810637              deletion            3            3
4       R3HDM2                                    CCDC91 12:57289009 12:28450161             inversion            4            2
7       CCDC91 RP11-314D7.2(428273),RP11-166B14.1(12076) 12:28391411 12:73636590             inversion            2            2
8         UBN1                                     NLRC5  16:4861102 16:57041485              deletion            1            2
  discordant_mates confidence CHROM      POS MATECHROM  MATEPOS SVCLASS
1               18       high    17 80398047        17 80422206     DEL
2                0       high    16 66749197        16 22808270     DEL
3                0       high    16 29561515        16 22810637     DEL
4                0       high    12 57289009        12 28450161  h2hINV
7                0       high    12 28391411        12 73636590  h2hINV
8                1       high    16  4861102        16 57041485     DEL
#Convert to vcf
snv_tmp2<-VCF(rowRanges = toGRanges(snv_tmp[,c("CHROM", "POS")]),info = DataFrame(snv_tmp[,c("MATECHROM","MATEPOS","SVCLASS")]))

##Then you can use "snv_tmp2" as input for plotting 
MutationTimeR::plotSample(tmp2,bb_cnv,title = paste0(unique(tmp_cnv$Sample)),regions = refLengths_test,sv =snv_tmp2)

legend("topright", pch=19, col=RColorBrewer::brewer.pal(9, "Set1")[c(3,4,2,1,9)], legend=paste(as.numeric(table(cls)), levels(cls)), bg='white',inset = -.12,bty = "n",x.intersp = 0.2,pt.cex=1/3)

#Legend CNV plot
legend("right", c("Major CN","Minor CN","DEL","DUP","INV","TRANS"), fill=c("gray47","gray84","#E41A1C44", "#377EB844", "#4DAF4A44", "#FF7F0044"), bg='white',inset = -.1,bty = "n",x.intersp = 0.12,pt.cex=1/3)

#Legend timing
legend("bottomright", levels(time[,"type"]), fill=paste0(RColorBrewer::brewer.pal(5,"Set2")[c(3:5)],"88"), bg="white",inset = -.125,bty = "n",x.intersp = 0.12,pt.cex=1/3)

Hope it helps you

Best regards

FreyaVan commented 3 years ago

Thanks a lot. It's very helpful.