Comparing miRanda/mirSVR with negative correlations

14 May 2011, 17h11

miRanda/mirSVR

mirandaSCTab=Import["/Users/grobertson/GENEREG/Data/miRNA/microRNA.org/miRanda.hg19_predictions_S_C_aug2010.SFRP.txt","TSV"];
mirandaSCData=Drop[mirandaSCTab,1];
Dimensions[mirandaSCData]
mirandaSCTab[[1;;5]]//TableForm

mirandaS0Tab=Import["/Users/grobertson/GENEREG/Data/miRNA/microRNA.org/miRanda.hg19_predictions_S_0_aug2010.SFRP.txt","TSV"];
mirandaS0Data=Drop[mirandaS0Tab,1];
Dimensions[mirandaS0Data]
mirandaS0Tab[[1;;5]]//TableForm

sfrps=Union[mirandaSCData[[All,4]]]
Tally[mirandaSCData[[All,4]]]//TableForm

Compare the MIMAT IDs

Reverse[SortBy[Tally[mirandaSCData[[All,1]]],Last]]
Reverse[SortBy[Tally[mirandaSCData[[All,2]]],Last]]

Select[mirandaSCData,(StringMatchQ["MIMAT0000264",#[[1]]]==True)&]//TableForm

mimatMirandaSC=Union[mirandaSCData[[All,1]]];
{"SC",nbrMimatMirandaSC=Length[mimatMirandaSC]}
mimatMirandaSC[[1;;5]]

mimatMirandaS0=Union[mirandaS0Data[[All,1]]];
{"S0",nbrMimatMirandaS0=Length[mimatMirandaS0]}
mimatMirandaS0[[1;;5]]

Length[Intersection[mimatMirandaSC,mimatMirandaS0]]

Reverse[SortBy[Tally[mirandaS0Data[[All,1]]],Last]]
Reverse[SortBy[Tally[mirandaS0Data[[All,2]]],Last]]

Compare the miRNA names

miRnasMirandaSC=Union[mirandaSCData[[All,2]]]
{"SC",Length[miRnasMirandaSC]}
miRnasMirandaSC[[1;;5]]

miRnasMirandaS0=Union[mirandaS0Data[[All,2]]]
{"S0",Length[miRnasMirandaS0]}
miRnasMirandaS0[[1;;5]]

Length[Intersection[miRnasMirandaSC,miRnasMirandaS0]]

Negative correlations for a cluster

cluster=3
corrDir=StringJoin["/Users/grobertson/GENEREG/ChIP/CHIP_SEQ/SOLEXA/TCGA/COAD-READ/data/miRNA-Seq/20110505/correlations_k7/",ToString[3]]
Export[ToFileName[corrDir,"test.txt"],{1,2,3}]

negRecs=Import[ToFileName[corrDir,"Wnt.pathway.grep-SFRP.mir_gene.maturestar.c3.txt.filtered.txt.no0slope.25r.pt.mfilter.neg.rsort.txt"],"CSV"];
Dimensions[negRecs]
negRecs[[1;;4]]//TableForm
nbrNegRecs=Length[negRecs];

Tally[negRecs[[All,2]]]//TableForm

StringSplit["hsa-mir-582.MIMAT0004797_-1",{".","_"}]

newNegRecs=Table[
Flatten[{
negRecs[[i,1]],
StringSplit[negRecs[[i,1]],{".","_"}],
First[StringSplit[negRecs[[i,2]],{"|"}]],
negRecs[[i,3;;All]]
}],{i,Length[negRecs]}];
newNegRecs[[1;;5]]//TableForm

mimatNegRecs=Union[newNegRecs[[All,3]]]
nbrMimatNegRecs=Length[mimatNegRecs]

Compare MIMAT overlap between neg correlations and miRanda/mirSVR

{"cluster>",cluster}
myGene="SFRP4"
{"using>",type="MIMAT"}
(*type="miRNA"*)
negRecsCol=If[type=="MIMAT",3,2];
miRandaCol=If[type=="MIMAT",1,2];

myGeneNegRecsFn[myG_]:=(Select[newNegRecs,(StringMatchQ[myG,#[[5]]]==True)&])
myGeneNegRecsCanonicalFn[myG_]:=(Select[newNegRecs,(StringMatchQ[myG,#[[5]]]==True&&#[[4]]=="0")&])

Clear[myGeneNegRecs]
myGeneNegRecs=myGeneNegRecsFn[myGene];
{Length[myGeneNegRecs],"records, considering all 5' isomiRs"}
myGeneNegRecs[[1;;5]]//TableForm

mimatsMyGeneNegRecs=Union[myGeneNegRecs[[All,negRecsCol]]]
nbrMimatsMyGeneNegRecs=Length[mimatsMyGeneNegRecs]

myGeneNegRecsCanonical=myGeneNegRecsCanonicalFn[myGene];
{Length[myGeneNegRecsCanonical],"records, considering only canonical 5'-starts"}
myGeneNegRecsCanonical//TableForm

myGeneMirandaSCFn[myG_]:=(Select[mirandaSCData,(StringMatchQ[myG,#[[4]]]==True)&])

myGeneMirandaSC=myGeneMirandaSCFn[myGene];
Dimensions[myGeneMirandaSC]
myGeneMirandaSC[[1;;5]]//TableForm

mimatsMyGeneMirandaSC=Union[myGeneMirandaSC[[All,miRandaCol]]]
nMimatsMyGeneMirandaSC=Length[mimatsMyGeneMirandaSC]

{myGene,"MIMAT overlap (negCorrs<->miRanda SC)>",nIntersectionMyGeneNegRecsMirandaSC=Length[Intersection[mimatsMyGeneNegRecs,mimatsMyGeneMirandaSC]]}
iSC=Intersection[mimatsMyGeneNegRecs,mimatsMyGeneMirandaSC]

Show the correlation records that share MIMATs with miRanda SC predictions

Select[myGeneNegRecs,(MemberQ[iSC,#[[3]]]==True)&]//TableForm

PieChart[{n1=nMimatsMyGeneMirandaSC-nIntersectionMyGeneNegRecsMirandaSC,nIntersectionMyGeneNegRecsMirandaSC},
ChartLabels->{
StringJoin["pred_S_C\n",ToString[n1]],
StringJoin["pred/negCorr\n",ToString[nIntersectionMyGeneNegRecsMirandaSC]]
},
ChartStyle->{Lighter[Lighter[Gray]],Lighter[Lighter[Green]]},
ImageSize->180,BaseStyle->Directive[14,(FontFamily->"Helvetica")]]

myGeneMirandaS0Fn[myG_]:=(Select[mirandaS0Data,(StringMatchQ[myG,#[[4]]]==True)&])

myGeneMirandaS0=myGeneMirandaS0Fn[myGene];
Dimensions[myGeneMirandaS0]
myGeneMirandaS0[[1;;5]]//TableForm

mimatsMyGeneMirandaS0=Union[myGeneMirandaS0[[All,miRandaCol]]]
nMimatsMyGeneMirandaS0=Length[mimatsMyGeneMirandaS0]

{myGene,"MIMAT overlap, miRanda S0>",nIntersectionMyGeneNegRecsMirandaS0=Length[Intersection[mimatsMyGeneNegRecs,mimatsMyGeneMirandaS0]]}
iS0=Intersection[mimatsMyGeneNegRecs,mimatsMyGeneMirandaS0]

myGeneNegRecs[[1;;5]]//TableForm

Show the correlation records that share MIMATs with miRanda S0 predictions

Select[myGeneNegRecs,(MemberQ[iS0,#[[3]]]==True)&]//TableForm

{nMimatsMyGeneMirandaS0,nMimatsMyGeneMirandaS0-nIntersectionMyGeneNegRecsMirandaS0,nIntersectionMyGeneNegRecsMirandaS0}

PieChart[{nMimatsMyGeneMirandaS0-nIntersectionMyGeneNegRecsMirandaS0,nIntersectionMyGeneNegRecsMirandaS0},
ChartLabels->{
StringJoin["pred_S_0\n",ToString[nMimatsMyGeneMirandaS0-nIntersectionMyGeneNegRecsMirandaS0]],
StringJoin["pred/negCorr\n",ToString[nIntersectionMyGeneNegRecsMirandaS0]]
},
ChartStyle->{Lighter[Lighter[Gray]],Lighter[Lighter[Green]]},
ImageSize->180,BaseStyle->Directive[14,(FontFamily->"Helvetica")]]