mutation.signature_tutorial20190418.r
https://bioconductor.org/packages/release/bioc/html/SomaticSignatures.html
hg19 reference genome
source("https://bioconductor.org/biocLite.R") biocLite("BSgenome.Hsapiens.UCSC.hg19")
library(VariantAnnotation) library(SomaticSignatures) install.packages("data.table") library(data.table) #Load the SNV-VCF file into R #Combine the matrix you should one column for sample name vcf <- VRanges( seqnames = g458$CHROM, # chromosome ranges = IRanges(start = g458$POS,end = g458$POS), # Position ref = g458$REF, # Reference alt=g458$ALT, # Alteration sampleNames =sample(rep(paste0('g',1:10),nrow(g458)),nrow(g458)), # Sample name study=sample(rep(paste0('a',1:3),nrow(g458)),nrow(g458)) # put them same name unless you want to analyze different tissues
study는 넣지말것!
) library(BSgenome.Hsapiens.UCSC.hg19) #hg19 reference genome sca_motifs = mutationContext(vcf, BSgenome.Hsapiens.UCSC.hg19) sca_mm2 = motifMatrix(sca_motifs, normalize = TRUE) plotMutationSpectrum(sca_motifs,'study') # You will see overall mutation spectrum histogram n_sigs = 2:10 # define number of signatures to check gof_nmf = assessNumberSignatures(sca_mm2, n_sigs, nReplicates = 3) # get stability of signature plotNumberSignatures(gof_nmf) n_sigs = 6 # decide optimal number of signature sigs_nmf2 = identifySignatures(sca_mm2, n_sigs, nmfDecomposition) plotSignatures(sigs_nmf2) plotSamples(sigs_nmf2)
'R관련' 카테고리의 다른 글
complexheatmap (0) | 2017.07.04 |
---|---|
CBS, DNAcopy (0) | 2017.06.28 |
character heatmap (0) | 2017.06.27 |
R 색깔 (0) | 2017.06.27 |
Cancersubtype 패키지 (0) | 2017.06.09 |