初级会员
  • 第 10374 位会员
  • hitcat
  • 2017-07-26 15:01:10
  • Offline
  • 20 8

最近发布的文章

    暂无

最近分享的资源

    暂无

最近发布的项目

    暂无

最近的评论

  • 基本上实现了...原来··可以的,小白伤不起啊...,话说就调用一个系统命令要这么多行... ```go package main import ( "fmt" "io/ioutil" "os/exec" ) func main() { var maflist string = "~/softtest/advance/script/maf/RSS2.somatic.snvindel.maf ~/softtest/advance/script/maf/RSS4.somatic.snvindel.maf ~/softtest/advance/script/maf/RSS1.somatic.snvindel.maf ~/softtest/advance/script/maf/RSS3.somatic.snvindel.maf ~/softtest/advance/script/maf/RSS5.somatic.snvindel.maf" var a string =`awk -F"\t" NR>1{var["Missense_Mutation"]="Missense_Mutation";var["Nonsense_Mutation"]="Nonsense_Mutation";var["Nonstop_Mutation"]="Nonstop_Mutation";var["Splice_Site"]="Splice_Site";var["In_Frame_Del"]="In_Frame_Del";var["Frame_Shift_Del"]="Frame_Shift_Del";var["In_Frame_Ins"]="In_Frame_Ins";var["Frame_Shift_Ins"]="Frame_Shift_Ins";if($9 in var){print $0;}}' `+ maflist +` |awk -F"\t" '{if($5!="MT" && $5!="X" && $5!="Y" && $1!="Hugo_Symbol" && $10=="SNP"){print $1":"$5":"$6}}' |sort -ru` cmd := exec.Command("/bin/sh", "-c",a) stdout, err:= cmd.StdoutPipe() if err != nil { fmt.Println("StdoutPipe: " + err.Error()) return } stderr, err := cmd.StderrPipe() if err != nil { fmt.Println("StderrPipe: ", err.Error()) return } if err := cmd.Start(); err != nil { fmt.Println("Start: ", err.Error()) return } bytesErr, err := ioutil.ReadAll(stderr) if err != nil { fmt.Println("ReadAll stderr: ", err.Error()) return } if len(bytesErr) != 0 { fmt.Printf("stderr is not nil: %s", bytesErr) return } bytes, err := ioutil.ReadAll(stdout) if err != nil { fmt.Println("ReadAll stdout: ", err.Error()) return } if err := cmd.Wait(); err != nil { fmt.Println("Wait: ", err.Error()) return } fmt.Printf("stdout: %s", bytes) } ```