全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
2605 2
2016-04-18
CMEC<-read.csv("CosmicMutantExportCensus.csv")

CMEC_GRCh<-as.character(CMEC$GRCh)
CMEC_Mutation.genome.position<-as.character(CMEC$Mutation.genome.position)
CMEC_Gene.name<-as.character(CMEC$Gene.name)
CMEC_Accession.Number<-as.character(CMEC$Accession.Number)
CMEC_Mutation.ID<-as.character(CMEC$Mutation.ID)
CMEC_Mutation.CDS<-as.character(CMEC$Mutation.CDS)
CMEC_Mutation.AA<-as.character(CMEC$Mutation.AA)
CMEC_Mutation.Description<-as.character(CMEC$Mutation.Description)
CMEC_FATHMM.prediction<-as.character(CMEC$FATHMM.prediction)


GRCh_Mutation.genome.position<-as.vector(paste(CMEC_GRCh,CMEC_Mutation.genome.position))  #合成突变唯一号

data1<-as.matrix(as.data.frame(table(CMEC_Mutation.genome.position)))

mutation.genome.position<-as.character(data1[,1])
freq<-as.numeric(data1[,2])

#rate<-NULL
#k=1
#for(i in 1:length(freq)){
#rate[k]<-(freq[i]/length(GRCh_Mutation.genome.position))
#k=k+1
#}

#rate #统计每个突变的发生频率


Gene.name<-NULL
Accession.Number<-NULL
Mutation.ID<-NULL
Mutation.CDS<-NULL
Mutation.AA<-NULL
Mutation.Description<-NULL
GRCh<-NULL
Mutation.genome.position<-NULL
FATHMM.prediction<-NULL

h<-1

for(i in 1:length(mutation.genome.position)){

  Gene.name[h]<-CMEC_Gene.name[match(mutation.genome.position[i],CMEC_Mutation.genome.position)]
  Accession.Number[h]<-CMEC_Accession.Number[match(mutation.genome.position[i],CMEC_Mutation.genome.position)]
  Mutation.ID[h]<-CMEC_Mutation.ID[match(mutation.genome.position[i],CMEC_Mutation.genome.position)]
  Mutation.CDS[h]<-CMEC_Mutation.CDS[match(mutation.genome.position[i],CMEC_Mutation.genome.position)]
  Mutation.AA[h]<-CMEC_Mutation.AA[match(mutation.genome.position[i],CMEC_Mutation.genome.position)]
  Mutation.Description[h]<-CMEC_Mutation.Description[match(mutation.genome.position[i],CMEC_Mutation.genome.position)]
  GRCh[h]<-CMEC_GRCh[match(mutation.genome.position[i],CMEC_Mutation.genome.position)]
  Mutation.genome.position[h]<-CMEC_Mutation.genome.position[match(mutation.genome.position[i],CMEC_Mutation.genome.position)]
  FATHMM.prediction[h]<-CMEC_FATHMM.prediction[match(mutation.genome.position[i],CMEC_Mutation.genome.position)]
h<-h+1

}


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2016-4-18 21:26:07
你这个代码太乱了额
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-4-18 21:59:15
同感,建议在read.csv中巴变量stringsAsFactors先设为F。你可以省去好几条as.character.

然后把问题用文字先描述一下。直接看代码真搞不清你想干嘛。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群