Git Product home page Git Product logo

slnmf's Introduction

SLNMF

Overview:

This is code to do structural learning non-negative matrix factorization clustering of single-cell RNA-seq data given in the "experiment" section of the paper:

Wenming Wu, Xiaoke Ma*. "SLNMF: a network-based algorithm for the identification of cell types and trajectory from single-cell RNA-seq data."

The coding here is a generalization of the algorithm given in the paper. SLNMF is written in the MATLAB programming language. To use, please download the SLNMF folder and follow the instructions provided in the README.doc.

Files:

slnmf.m - The main function.

main_slnmf.m - A script with a real scRNA-seq data to show how to run the code.

Biase_data.mat - A real scRNA-seq data used in the cell type clustering example. We retain the genes that are expressed in at least 10% cells for the dataset. The Biase dataset contains 49 mouse fetal brain cells sequenced using SMAR T-Seq platform, which consists of three cell types, zygote cells, Two-cell cells and Four-cell cells.

constructW.m - Compute adjacent matrix W.

PMI.m - Cell-cell network construction.

bestMap.m - permute labels of L2 to match L1 as good as possible.

ARI.m - Program for calculating the Adjusted Rand Index ( Hubert & Arabie) between two clusterings.

hungarian.m - Solve the Assignment problem using the Hungarian method.

data$Biase.expr.csv - Biase dataset original expression data.

data$Biase.celltype.csv - The cell type of Biase dataset.

Example:

Follow the steps below to run SLNMF(also contained in the " main_slnmf.m" file). Here use a real scRNA-seq data (Biase_data) set as an example.

clear all;

clc;

load('Biase_data.mat')%Loading data

X=Data;%%%%%%%Rows are genes, columns are cell sample

%==============Constructing a weight matrix==============

%Preset value before constructing weight matrix

options = [];

option.Metric = 'Cosine';

options.NeighborMode = 'KNN';%KNN

options.k =5;%5 nearest neighbors

options.WeightMode = 'Cosine';%Weights are 0 or 1, it can eplace with 'HeatKernel', 'Euclidean'

W = constructW(X',options);

M=PMI(W,1);%%%%Cell-cell network construction

k=3;lambda=10;iter=150;

[B,F,nn,error]=slnmf(k,lambda,iter,M); %% Call the main function to solve the variables

%%%%%%%%%%% Clustering cell type label

for e=1:size(B,1)

v=B(e,:);

ma=max(v);

[s,t]=find(v==ma);

l(e)=t(1);

end

[newl] = bestMap(real_label,l);%%% the label originally identified by the authors

ari = ARI(real_label,max(real_label),newl,max(newl))%% Calculating the Adjusted Rand Index (ARI)

pre_label =newl;

if ~isempty(real_label)

exact = find(pre_label == real_label);

accuracy = length(exact)/length(newl) %% Calculating the accuracy

else

accuracy = []

end

Contact:

Please send any questions or found bugs to Xiaoke Ma [email protected]

slnmf's People

Contributors

xkmaxidian avatar

Watchers

 avatar

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.