Package: njsd
nJSDnJSD is a python package for calculating distance between two biological networks instantiated with gene-expression profiles using entropy concept. It was designed to measure intratumor heterogeneity from bulk RNA-sequencing data.Transcriptome-based ITH (tITH)of tumor state was calculated by considering both normal state and ideally heterogeneous state.InstallationpipinstallnjsdUsagenJSD supports command-line invocation as below:usage:njsd[-h]-nNETWORK-rREF-qQUERY-oOUTPUT[-tGENESET]Calculatenetwork-basedJensen-ShannonDivergence.

optionalarguments:-h,--helpshowthishelpmessageandexit-nNETWORK,--networkNETWORKPre-definednetwork-rREF,--refREFReferencegeneexpressionprofile-qQUERY,--queryQUERYQuerygeneexpressionprofile-oOUTPUT,--outputOUTPUTOutputfile.-tGENESET,--genesetGENESETGenesetlistNote that-t GENESEToption is optional. If-toption is specified,gene set-specifiednJSD and tITH will be computed. Otherwise,njsdwill computetranscriptome-widenJSD of the two expression profiles and tITH of query gene expression profile.Network file, which should be given with-n/--networkoption must be formatted as below where each line specifies an edge in the network.njsdwill simply ignore the header by skipping a single line, so you may name each column in a human-friendly way:GeneA GeneB               # Header
GeneSymbol1 GeneSymbol2
GeneSymbol1 GeneSymbol3
GeneSymbol1 GeneSymbol4
...Gene expression profile, which should be given with-r/--refor-q/--queryoption must follow the format below. Again, the header doesn't matter. Note thatnjsdwill automatically apply log2-transformation to expression values by taking log2(expression + 1), we recommend givingnjsdunnormalized expression values, such as raw FPKM, RPKM or TPM.GeneSymbol  ExpressionValue       # Header
GeneA 10
GeneB 20
BeneC 30
...Gene set list, which should be given with-t/--genesetoption file must have the format below. Please be warned that this file shouldnothave a header. The first column denotes names of each gene set(or group), and the following columns represent the members of each group.Group1Name  GeneA   GeneB   GeneC   ...
Group2Name  GeneD   GeneE   GeneF   ...
Group3Name  GeneA   GeneG   GeneH   ...
...ExamplesToy data, which represents three different gene expression profiles(Toy.profile1, Toy.profile2, Toy.profile3) which are instantiation of the template network(Toy.network), are given inexampledirectory. Following execution scenarios show how to compute nJSD between the gene expression profiles.The template network is shown:And figures below are three gene expression profiles instantiated on top of the template network:Transcriptome-wide nJSDYou can compute transcriptome-wide nJSD as below:$njsd-nexample/Toy.network-rexample/Toy.profile1-qexample/Toy.profile2-oprofile2_njsd_all.txtOutput file contains nJSD_NT(Normal-to-Tumor nJSD), nJSD_TA(Tumor-to-maximally Ambiguous state), and tITH values. You can think ofNormalasReference, andTumorasQuerygene expression profiles.$catprofile2_njsd_all.txtnJSD_NTnJSD_TAtITH0.0039350207933764320.00682025192287466150.36586899255754446Let's compare nJSDs between profile 1 and 2, and profile 1 and 3.$njsd-nexample/Toy.network-rexample/Toy.profile1-qexample/Toy.profile3-oprofile3_njsd_all.txt$cut-f1profile2_njsd_all.txtprofile3_njsd_all.txtnJSD_NT0.003935020793376432
nJSD_NT0.007758064133920005Indeed, the distance between profile1 and 3 is greater than that of profile 1 and 2.Gene set-specified nJSDYou can compute gene set-specified nJSD by specifying-t/--genesetoption as below:$njsd-nexample/Toy.network-rexample/Toy.profile1-qexample/Toy.profile2-texample/Toy.geneset-ooutput_njsd_gene_set.txtEach line of the output file contains nJSD_NT, nJSD_TA, tITH values for each gene set.$catoutput_njsd_gene_set.txtGene_set_IDnJSD_NTnJSD_TAtITH
1st_pwy0.007821945875293380.009384965942708290.45458162150340947
2nd_pwy0.00.0042612335420455380.0
3rd_pwy0.005214630583528920.007102055903409230.4233793390015275
4th_pwy0.0079085181559204520.0042612335420455380.6498504120870645
5th_pwy0.0062575567002347040.0085224670840910770.42337933900152747CitationY. Park, S. Lim, J. Nam, S. Kim, Measuring intratumor heterogeneity by network entropy using RNA-seq data, Scientific Reports (2016)