RBP AS生信流程(N)RBP與AS相關(guān)性

RBP = read.table("RBPexp.txt", row.names=1 ,header=T,sep="\t",check.names=F) 
AS = read.table("AS.txt", row.names=1 ,header=T,sep="\t",check.names=F)  
rownames(AS)=gsub("\\|","\\-",rownames(AS))
corFilter=0.6             
pvalueFilter=0.05
outTab=data.frame()
for(i in row.names(RBP)){
  if(sd(RBP[i,])>1){
      for(j in row.names(AS)){
         x=as.numeric(RBP[i,])
         y=as.numeric(AS[j,])
         corT=cor.test(x,y)
         cor=corT$estimate
         pvalue=corT$p.value
         if((cor>corFilter) & (pvalue<pvalueFilter)){
             outTab=rbind(outTab,cbind(SF=i,AS=j,cor,pvalue,Regulation="postive"))
         }
         if((cor< -corFilter) & (pvalue<pvalueFilter)){
             outTab=rbind(outTab,cbind(RBP=i,AS=j,cor,pvalue,Regulation="negative"))
         }
      }
    }
}
head(outTab)
write.table(file="corResult.txt",outTab,sep="\t",quote=F,row.names=F)      
library(openxlsx) #讀取xlsx文件
library(tidyr) #separate函數(shù)
#第一步:整理出 基因|ID|剪接類型 
RI <- read.xlsx("RI.xlsx")
head(RI[,21])
RI$splicetype <- paste(RI$geneSymbol,RI$ID,"RI",sep = "|")
head(RI[,24])
RI2 <- RI[,c(21,22,24)]
RI2 <- RI2[,c(3,1,2)]
head(RI2)
RI2 <- separate(RI2,IncLevel1,into = c("HF1","HF2","HF3","HF4","HF5",
"HF6","HF7","HF8","HF9","HF10","HF11", "HF12","HF13","HF14","HF15"),
                sep = ",",
                remove =TRUE)
RI2 <- separate(RI2,IncLevel2,into = c("normal1","normal2","normal3","normal4",
                                       "normal5","normal6","normal7","normal8"),
                sep = ",",remove =TRUE)
head(RI2)
rownames(RI2) <- RI2$splicetype
RI2 <- RI2[,-1]
head(RI2)
SE <- read.xlsx("SE.xlsx")
head(SE[,21])
SE$splicetype <- paste(SE$geneSymbol,SE$ID,"SE",sep = "|")
head(SE[,24])
SE2 <- SE[,c(21,22,24)]
SE2 <- SE2[,c(3,1,2)]
head(SE2)
SE2 <- separate(SE2,IncLevel1,into = c("HF1","HF2","HF3","HF4","HF5",
"HF6","HF7","HF8","HF9","HF10","HF11", "HF12","HF13","HF14","HF15"),
                sep = ",",
                remove =TRUE)
SE2 <- separate(SE2,IncLevel2,into = c("normal1","normal2","normal3","normal4",
                                       "normal5","normal6","normal7","normal8"),
                sep = ",",remove =TRUE)
head(SE2)
rownames(SE2) <- SE2$splicetype
SE2 <- SE2[,-1]
head(SE2)
A3SS <- read.xlsx("A3SS.xlsx")
head(A3SS[,21])
A3SS$splicetype <- paste(A3SS$geneSymbol,A3SS$ID,"A3SS",sep = "|")
head(A3SS[,24])
A3SS2 <- A3SS[,c(21,22,24)]
A3SS2 <- A3SS2[,c(3,1,2)]
head(A3SS2)
A3SS2 <- separate(A3SS2,IncLevel1,into = c("HF1","HF2","HF3","HF4","HF5",
"HF6","HF7","HF8","HF9","HF10","HF11", "HF12","HF13","HF14","HF15"),
                sep = ",",
                remove =TRUE)
A3SS2 <- separate(A3SS2,IncLevel2,into = c("normal1","normal2","normal3","normal4",
                                       "normal5","normal6","normal7","normal8"),
                sep = ",",remove =TRUE)
head(A3SS2)
rownames(A3SS2) <- A3SS2$splicetype
A3SS2 <- A3SS2[,-1]
head(A3SS2)
A5SS <- read.xlsx("A5SS.xlsx")
head(A5SS[,21])
A5SS$splicetype <- paste(A5SS$geneSymbol,A5SS$ID,"A5SS",sep = "|")
head(A5SS[,24])
A5SS2 <- A5SS[,c(21,22,24)]
A5SS2 <- A5SS2[,c(3,1,2)]
head(A5SS2)
A5SS2 <- separate(A5SS2,IncLevel1,into = c("HF1","HF2","HF3","HF4","HF5",
"HF6","HF7","HF8","HF9","HF10","HF11", "HF12","HF13","HF14","HF15"),
                  sep = ",",
                  remove =TRUE)
A5SS2 <- separate(A5SS2,IncLevel2,into = c("normal1","normal2","normal3","normal4",
                                           "normal5","normal6","normal7","normal8"),
                  sep = ",",remove =TRUE)
head(A5SS2)
rownames(A5SS2) <- A5SS2$splicetype
A5SS2 <- A5SS2[,-1]
head(A5SS2)
MXE <- read.xlsx("MXE.xlsx") 
MXE$splicetype <- paste(MXE$geneSymbol,MXE$ID,"MXE",sep = "|")
head(MXE[,26])
MXE2 <- MXE[,c(23,24,26)]
MXE2 <- MXE2[,c(3,1,2)]
head(MXE2)
MXE2 <- separate(MXE2,IncLevel1,into = c("HF1","HF2","HF3","HF4",
"HF5","HF6","HF7","HF8","HF9","HF10","HF11", "HF12","HF13","HF14","HF15"),
                  sep = ",",
                  remove =TRUE)
MXE2 <- separate(MXE2,IncLevel2,into = c("normal1","normal2","normal3","normal4",
                                           "normal5","normal6","normal7","normal8"),
                  sep = ",",remove =TRUE)
head(MXE2)
rownames(MXE2) <- MXE2$splicetype
MXE2 <- MXE2[,-1]
head(MXE2)
allsplice <- rbind(RI2,SE2,A3SS2,A5SS2,MXE2)
#第二步:過濾掉在大于四分之一的樣本中PSI值為缺失值的可變剪接事件
allsplice <- allsplice[apply(allsplice, 
                              1,                            
                              function(x)sum(x!="NA")>17),]  
#第三步:過濾波動太小的可變剪接事件
exp=as.matrix(allsplice)
mat=impute.knn(exp)
data=mat$data
data=data[rowMeans(data)>0.05,]
genes=c()
for(i in row.names(data)){
  if(sd(data[i,])>0.2){       
    genes=c(genes,i)
  }
}  
all=data[genes,]
all <- cbind(id=row.names(all),all)
write.table(all,file="AS.txt",sep="\t",row.names=F,quote=F)
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末狂男,一起剝皮案震驚了整個濱河市综看,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌岖食,老刑警劉巖红碑,帶你破解...
    沈念sama閱讀 206,839評論 6 482
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異,居然都是意外死亡析珊,警方通過查閱死者的電腦和手機羡鸥,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,543評論 2 382
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來忠寻,“玉大人惧浴,你說我怎么就攤上這事∞忍辏” “怎么了衷旅?”我有些...
    開封第一講書人閱讀 153,116評論 0 344
  • 文/不壞的土叔 我叫張陵,是天一觀的道長纵朋。 經(jīng)常有香客問我柿顶,道長,這世上最難降的妖魔是什么操软? 我笑而不...
    開封第一講書人閱讀 55,371評論 1 279
  • 正文 為了忘掉前任九串,我火速辦了婚禮,結(jié)果婚禮上寺鸥,老公的妹妹穿的比我還像新娘猪钮。我一直安慰自己,他們只是感情好胆建,可當我...
    茶點故事閱讀 64,384評論 5 374
  • 文/花漫 我一把揭開白布烤低。 她就那樣靜靜地躺著,像睡著了一般笆载。 火紅的嫁衣襯著肌膚如雪扑馁。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,111評論 1 285
  • 那天凉驻,我揣著相機與錄音腻要,去河邊找鬼。 笑死涝登,一個胖子當著我的面吹牛雄家,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播胀滚,決...
    沈念sama閱讀 38,416評論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼趟济,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了咽笼?” 一聲冷哼從身側(cè)響起顷编,我...
    開封第一講書人閱讀 37,053評論 0 259
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎剑刑,沒想到半個月后媳纬,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 43,558評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,007評論 2 325
  • 正文 我和宋清朗相戀三年钮惠,在試婚紗的時候發(fā)現(xiàn)自己被綠了杨伙。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 38,117評論 1 334
  • 序言:一個原本活蹦亂跳的男人離奇死亡萌腿,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出抖苦,到底是詐尸還是另有隱情毁菱,我是刑警寧澤,帶...
    沈念sama閱讀 33,756評論 4 324
  • 正文 年R本政府宣布锌历,位于F島的核電站贮庞,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏究西。R本人自食惡果不足惜窗慎,卻給世界環(huán)境...
    茶點故事閱讀 39,324評論 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望卤材。 院中可真熱鬧遮斥,春花似錦、人聲如沸扇丛。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,315評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽帆精。三九已至较屿,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間卓练,已是汗流浹背隘蝎。 一陣腳步聲響...
    開封第一講書人閱讀 31,539評論 1 262
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留襟企,地道東北人嘱么。 一個月前我還...
    沈念sama閱讀 45,578評論 2 355
  • 正文 我出身青樓,卻偏偏與公主長得像顽悼,于是被迫代替她去往敵國和親拱撵。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 42,877評論 2 345