Difference between pages "Publications" and "Tutorial"

From BeerLab
(Difference between pages)
Jump to navigation Jump to search
>Dlee
 
>Admin
 
Line 1: Line 1:
* '''Identification of predictive cis-regulatory elements using a discriminative objective function and dynamic search spaces.''' Karnik, R, and Beer MA. 2012 (submitted)
+
gkmSVM-R Tutorial notes
  
* '''kmer-SVM: a Web-based Toolkit for the Computational Identification of Predictive Regulatory Sequence Features in Genomic Datasets.''' Fletez-Brant C*, Lee D*, McCallion AS and Beer MA. 2012. (submitted)
+
INSTALLATION for linux or mac (R 3.5 or later)
  
* '''[http://genome.cshlp.org/content/early/2012/09/26/gr.139360.112 Integration of ChIP-seq and Machine Learning Reveals Enhancers and a Predictive Regulatory Sequence Vocabulary in Melanocytes.]''' Gorkin DU, Lee D, Reed X, Fletez-Brant C, Blessling SL, Loftus SK, Beer MA, Pavan WJ, and McCallion AS. 2012. Genome Research (published in advance September 27, 2012)
+
$ R <br/>
 +
> if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") <br/>
 +
> BiocManager::install() <br/>
 +
> BiocManager::install(c('GenomicRanges','rtracklayer','BSgenome', 'BSgenome.Hsapiens.UCSC.hg19.masked', 'BSgenome.Hsapiens.UCSC.hg18.masked')) <br/>
 +
> install.packages('ROCR','kernlab','seqinr') <br/>
  
* '''[http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0038695 Group Normalization for Genomic Data.]''' Ghandi M, and Beer MA. 2012. PLoS ONE 7:e38695.
+
$ git clone https://github.com/mghandi/gkmSVM.git <br/>
 +
$ R CMD INSTALL gkmSVM <br/>
  
* '''[http://www.ncbi.nlm.nih.gov/pubmed/21875935 Discriminative prediction of mammalian enhancers from DNA sequence.]''' Lee D, Karchin R, and Beer MA. 2011. Genome Research 21:2167 –2180.
+
--or--
  
* '''[http://www.ncbi.nlm.nih.gov/pubmed/19253296 Identification of miR-21 targets in breast cancer cells using a quantitative proteomic approach.]''' Yang Y, Chaerkady R, Beer MA, Mendell JT, and Pandey A. 2009. Proteomics 9:1374–1384.
+
> install.packages('gkmSVM') <br/>
  
* '''[http://www.ncbi.nlm.nih.gov/pubmed/19211792 Lin-28B transactivation is necessary for Myc-mediated let-7 repression and proliferation.]''' Chang T-C, Zeitels LR, Hwang H-W, Chivukula RR, Wentzel EA, Dews M, Jung J, Gao P, Dang CV, Beer MA, et al. 2009. PNAS 106:3384–3389.
+
INSTALLATION for linux or mac (R 3.4 or earlier)
  
* '''[http://www.ncbi.nlm.nih.gov/pubmed/18071029  Metrics of sequence constraint overlook regulatory sequences in an exhaustive analysis at phox2b.]''' McGaughey DM, Vinton RM, Huynh J, Al-Saif A, Beer MA, and McCallion AS. 2008. Genome Research 18:252 –260.
+
$ R <br/>
 +
> source("https://bioconductor.org/biocLite.R") <br/>
 +
> biocLite('GenomicRanges') <br/>
 +
> biocLite('rtracklayer') <br/>
 +
> biocLite('BSgenome') <br/>
 +
> biocLite('BSgenome.Hsapiens.UCSC.hg19.masked')    (or other genomes) <br/>
 +
> biocLite('BSgenome.Hsapiens.UCSC.hg18.masked') <br/>
 +
> install.packages('ROCR') <br/>
 +
> install.packages('kernlab') <br/>
 +
> install.packages('seqinr') <br/>
 +
> quit() <br/>
  
* '''[http://www.ncbi.nlm.nih.gov/pubmed/17540599 Transactivation of miR-34a by p53 Broadly Influences Gene Expression and Promotes Apoptosis.]''' Chang T-C, Wentzel EA, Kent OA, Ramachandran K, Mullendore M, Lee KH, Feldmann G, Yamakuchi M, Ferlito M, Lowenstein CJ, et al. 2007. Molecular Cell 26: 745–752.
+
$ git clone https://github.com/mghandi/gkmSVM.git <br/>
* '''[http://www.ncbi.nlm.nih.gov/pubmed/15870260 Functional Characterization of a Novel Ku70/80 Pause Site at the H19/Igf2 Imprinting Control Region.]''' Katz DJ, Beer MA, Levorse JM, and Tilghman SM. 2005. Mol Cell Biol 25:3855–3863.
+
$ R CMD INSTALL gkmSVM <br/>
  
* '''[http://www.ncbi.nlm.nih.gov/pubmed/14672978 Whole-Genome Discovery of Transcription Factor Binding Sites by Network-Level Conservation.]''' Pritsker M, Liu Y-C, Beer MA, and Tavazoie S. 2004. Genome Research 14:99–108.  
+
--or--
* '''[http://www.ncbi.nlm.nih.gov/pubmed/15084257 Predicting Gene Expression from Sequence.]''' Beer MA, Tavazoie S. 2004. Cell 117:185–198.
+
 
 +
> install.packages('gkmSVM') <br/>
 +
 
 +
 
 +
Now to run gkmSVM-R on the ctcf test set from Ghandi Lee, Mohammad-Noori, Beer, PLOS CompBio 2014:
 +
 
 +
Input files: [http://www.beerlab.org/gkmsvm/ctcfpos.bed ctcfpos.bed], [http://www.beerlab.org/gkmsvm/nr10mers.fa nr10mers.fa], [http://www.beerlab.org/gkmsvm/ref.fa ref.fa], [http://www.beerlab.org/gkmsvm/alt.fa alt.fa] from [http://www.beerlab.org/gkmsvm www.beerlab.org/gkmsvm]
 +
 
 +
1. generate GC, length, and repeat matched negative set and extract fasta sequence files for ctcfpos.fa and ctcfneg_1x.fa:  (Larger negative sets can be generated by increasing xfold, and running time can be decreased by reducing nMaxTrials, at the cost of not matching difficult sequences.  In general training on larger sequence sets will produce more accurate and robust models.)
 +
 
 +
$ R <br/>
 +
> library(gkmSVM) <br/>
 +
> genNullSeqs('ctcfpos.bed',nMaxTrials=10,xfold=1,genomeVersion='hg18',  outputPosFastaFN='ctcfpos.fa', outputBedFN='ctcfneg_1x.bed', outputNegFastaFN='ctcfneg_1x.fa') <br/>
 +
 
 +
2. calculate kernel matrix:
 +
 
 +
> gkmsvm_kernel('ctcfpos.fa','ctcfneg_1x.fa', 'ctcf_1x_kernel.out')
 +
 
 +
3. perform SVM training with cross-validation:
 +
 
 +
> gkmsvm_trainCV('ctcf_1x_kernel.out','ctcfpos.fa','ctcfneg_1x.fa',svmfnprfx='ctcf_1x', outputCVpredfn='ctcf_1x_cvpred.out', outputROCfn='ctcf_1x_roc.out')
 +
 
 +
4. generate 10-mer weights:
 +
 
 +
> gkmsvm_classify('nr10mers.fa',svmfnprfx='ctcf_1x', 'ctcf_1x_weights.out')
 +
 
 +
This should get AUROC=.955 and AUPRC=.954 with some small variation arising from the randomly sampled negative sets. You can then select the top weights with:                  
 +
 +
$ sort –grk  2 ctcf_1x_weights.out | head -12
 +
 
 +
which should give weights very similar to:
 +
 
 +
<span style="font-family:Courier;">
 +
CACCTGGTGG      5.133463 <br/>
 +
CACCAGGTGG      5.090566 <br/>
 +
CACCAGGGGG      5.038873 <br/>
 +
CCACTAGGGG      4.833398 <br/>
 +
CCACCAGGGG      4.832404 <br/>
 +
CACCTAGTGG      4.782613 <br/>
 +
CACCAGAGGG      4.707206 <br/>
 +
CACTAGGGGG      4.663015 <br/>
 +
CACTAGAGGG      4.610800 <br/>
 +
CACTAGGTGG      4.580834 <br/>
 +
CCACTAGAGG      4.529869 <br/>
 +
CAGCAGAGGG      4.335304 <br/>
 +
</span>
 +
 
 +
5. To calculate the impact of a variant, in this case on CTCF binding, we use gkmsvm_classify to find the
 +
score difference between two alleles given in FASTA format in ‘ref.fa’ and ‘alt.fa’. This is only different
 +
by a scale factor from deltaSVM calculated directly from SVM weights, as described in (Lee, Gorkin,
 +
Baker, Strober, Aasoni, McCallion, Beer, Nature Genetics 2015).
 +
 
 +
> gkmsvm_delta('ref.fa','alt.fa',svmfnprfx='ctcf_1x', 'dsvm_ctcf_1x.out')
 +
 
 +
 
 +
If you find this tool useful, please cite:
 +
 
 +
Ghandi, Mohammad-Noori, Ghareghani, Lee, Garraway, and Beer, Bioinformatics (2016); and <br/>
 +
Ghandi, Lee, Mohammad-Noori, and Beer, PLOS Computational Biology (2014).

Revision as of 19:10, 5 August 2019

gkmSVM-R Tutorial notes

INSTALLATION for linux or mac (R 3.5 or later)

$ R
> if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager")
> BiocManager::install()
> BiocManager::install(c('GenomicRanges','rtracklayer','BSgenome', 'BSgenome.Hsapiens.UCSC.hg19.masked', 'BSgenome.Hsapiens.UCSC.hg18.masked'))
> install.packages('ROCR','kernlab','seqinr')

$ git clone https://github.com/mghandi/gkmSVM.git
$ R CMD INSTALL gkmSVM

--or--

> install.packages('gkmSVM')

INSTALLATION for linux or mac (R 3.4 or earlier)

$ R
> source("https://bioconductor.org/biocLite.R")
> biocLite('GenomicRanges')
> biocLite('rtracklayer')
> biocLite('BSgenome')
> biocLite('BSgenome.Hsapiens.UCSC.hg19.masked') (or other genomes)
> biocLite('BSgenome.Hsapiens.UCSC.hg18.masked')
> install.packages('ROCR')
> install.packages('kernlab')
> install.packages('seqinr')
> quit()

$ git clone https://github.com/mghandi/gkmSVM.git
$ R CMD INSTALL gkmSVM

--or--

> install.packages('gkmSVM')


Now to run gkmSVM-R on the ctcf test set from Ghandi Lee, Mohammad-Noori, Beer, PLOS CompBio 2014:

Input files: ctcfpos.bed, nr10mers.fa, ref.fa, alt.fa from www.beerlab.org/gkmsvm

1. generate GC, length, and repeat matched negative set and extract fasta sequence files for ctcfpos.fa and ctcfneg_1x.fa: (Larger negative sets can be generated by increasing xfold, and running time can be decreased by reducing nMaxTrials, at the cost of not matching difficult sequences. In general training on larger sequence sets will produce more accurate and robust models.)

$ R
> library(gkmSVM)
> genNullSeqs('ctcfpos.bed',nMaxTrials=10,xfold=1,genomeVersion='hg18', outputPosFastaFN='ctcfpos.fa', outputBedFN='ctcfneg_1x.bed', outputNegFastaFN='ctcfneg_1x.fa')

2. calculate kernel matrix:

> gkmsvm_kernel('ctcfpos.fa','ctcfneg_1x.fa', 'ctcf_1x_kernel.out')

3. perform SVM training with cross-validation:

> gkmsvm_trainCV('ctcf_1x_kernel.out','ctcfpos.fa','ctcfneg_1x.fa',svmfnprfx='ctcf_1x', outputCVpredfn='ctcf_1x_cvpred.out', outputROCfn='ctcf_1x_roc.out')

4. generate 10-mer weights:

> gkmsvm_classify('nr10mers.fa',svmfnprfx='ctcf_1x', 'ctcf_1x_weights.out')

This should get AUROC=.955 and AUPRC=.954 with some small variation arising from the randomly sampled negative sets. You can then select the top weights with:

$ sort –grk 2 ctcf_1x_weights.out | head -12

which should give weights very similar to:

CACCTGGTGG 5.133463
CACCAGGTGG 5.090566
CACCAGGGGG 5.038873
CCACTAGGGG 4.833398
CCACCAGGGG 4.832404
CACCTAGTGG 4.782613
CACCAGAGGG 4.707206
CACTAGGGGG 4.663015
CACTAGAGGG 4.610800
CACTAGGTGG 4.580834
CCACTAGAGG 4.529869
CAGCAGAGGG 4.335304

5. To calculate the impact of a variant, in this case on CTCF binding, we use gkmsvm_classify to find the score difference between two alleles given in FASTA format in ‘ref.fa’ and ‘alt.fa’. This is only different by a scale factor from deltaSVM calculated directly from SVM weights, as described in (Lee, Gorkin, Baker, Strober, Aasoni, McCallion, Beer, Nature Genetics 2015).

> gkmsvm_delta('ref.fa','alt.fa',svmfnprfx='ctcf_1x', 'dsvm_ctcf_1x.out')


If you find this tool useful, please cite:

Ghandi, Mohammad-Noori, Ghareghani, Lee, Garraway, and Beer, Bioinformatics (2016); and
Ghandi, Lee, Mohammad-Noori, and Beer, PLOS Computational Biology (2014).