楼主: 顾什么
2648 2

[问答] 求救!!!for循环跑不出结果 [推广有奖]

  • 0关注
  • 0粉丝

等待验证会员

学前班

40%

还不是VIP/贵宾

-

威望
0
论坛币
10 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
20 点
帖子
1
精华
0
在线时间
0 小时
注册时间
2016-4-18
最后登录
2016-4-18

楼主
顾什么 发表于 2016-4-18 15:54:07 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
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

}


二维码

扫码加我 拉你入群

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

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

关键词:for循环 For CME MEC

沙发
jiangbeilu 学生认证  发表于 2016-4-18 21:26:07
你这个代码太乱了额

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

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

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 15:47