Giter Site home page Giter Site logo

acabassi / klic Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 3.0 22.95 MB

R package for KLIC: Kernel Learning Integrative Clustering

Home Page: https://acabassi.github.io/klic/articles/klic-vignette.html

License: Other

R 100.00%
clustering genomics kernel-methods multi-omics integrative-clustering coca cluster-analysis

klic's Introduction

CRAN status Build Status DOI

KLIC - Kernel Learning Integrative Clustering

Installing

In order to install this package, you will need to have Rmosek installed.

Installing Rmosek [Unix]

cd <my-mosek-directory>
tar -xvf mosektoolslinux64x86.tar.bz2
  • Add the following to your ~/.bashrc file:
export PATH=$PATH:<my-mosek-directory>/mosek/8/tools/platform/linux64x86/bin
  • If you are eligible apply for a free personal academic license at https://www.mosek.com/products/academic-licenses/ You will receive it (immediately) via email.
  • Put the license file in <my-mosek-directory>/mosek
  • Proceed with the installation of mosek
export PKG_MOSEKHOME=<my-mosek-directory>/mosek/8/tools/platform/linux64x86
export PKG_MOSEKLIB=mosek64
  • Now that you have mosek installed, you can open R and install the Rmosek package with
install.packages("Rmosek", type="source", INSTALL_opts="--no-multiarch",
                  repos="http://download.mosek.com/R/8")

Installing klic

You can install the latest released version of klic from CRAN with

install.packages("klic")

or the development version from GitHub with

library(devtools)
install_github("acabassi/klic")
library(klic)

klic's People

Contributors

acabassi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

klic's Issues

Possible bug in plotSimilarityMatrix

Hi, I'm testing this tool and I find it very interesting; however, I'm having a little problem (I am not sure if this is a bug or if I am missing something).

I have a similarity matrix that I've calculated by applying the Jaccard similarity to my data. In R this matrix is stored in a data frame, where equal individuals have a similarity of 1, and completely distinct individuals have a similarity of 0. I am using the function plotSimilarityMatrix and It seems to be correct:
imagen

Nonetheless, I tried to recreate the clustering by using hclust. This library needs a dist object, so I did 1 - my similarity matrix so that a similarity of 1 is translated into a distance of 0, and a similarity of 0 is translated into a distance of 1, and I did as.dist(myDistanceMatrix) in order to get a dist object to use with hclust. I used the default parameters for hclust (euclidean distance and complete method), however, the resulting clustering is not as nice as I got before:
imagen

I do not know which cluster is the correct one, but I have checked the code of the function plotSimilarityMatrix and it is using the pheatmap library. If I am not wrong, the similarity matrix received as input by plotSimilarityMatrix is passed to pheatmat. I dived into the pheatmap function and I saw the following code used for calculating the dendrogram:

cluster_mat = function(mat, distance, method){
    if(!(method %in% c("ward.D", "ward.D2", "ward", "single", "complete", "average", "mcquitty", "median", "centroid"))){
        stop("clustering method has to one form the list: 'ward', 'ward.D', 'ward.D2', 'single', 'complete', 'average', 'mcquitty', 'median' or 'centroid'.")
    }
    if(!(distance[1] %in% c("correlation", "euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski")) & class(distance) != "dist"){
        stop("distance has to be a dissimilarity structure as produced by dist or one measure  form the list: 'correlation', 'euclidean', 'maximum', 'manhattan', 'canberra', 'binary', 'minkowski'")
    }
    if(distance[1] == "correlation"){
        d = as.dist(1 - cor(t(mat)))
    }
    else{
        if(class(distance) == "dist"){
            d = distance
        }
        else{
            d = dist(mat, method = distance)
        }
    }
    
    return(hclust(d, method = method))
}

This code checks if the type of the input matrix is a dist object. I think, in this case this would never be a dist object because the function plotSimilarityMatrix is expecting a similarity matrix, not a dissimilarity one. Thus, the above function from pheatmat assumes that the input matrix contains data, not distances, and it calculates a distance matrix through d = dist(mat, method = distance) Then, the clustering appearing in the plot from plotSimilarityMatrix is resulting from calculating the distance among the elements from the input similarity matrix.

Am I correct? I wish I've misunderstood something because I really like the first plot provided by your library, much more than the one I obtained after by applying hclust.

Kind regards,
Francisco Abad.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.