func main() { if len(os.Args) != 2 { fmt.Println("Usage: executable filename\n") return } file, err := os.Open(os.Args[1]) if err != nil { fmt.Println(err) return } defer file.Close() seq, err := fas.Read(file) if err != nil { fmt.Println(err) return } if len(seq) == 0 { fmt.Println("File is empty") return } for i, _ := range seq { seq[i].Seq = gene.Complement(gene.Format(seq[i].Seq, "dna"), "dna") seq[i].Name += "_cpl" } n := strings.LastIndexByte(os.Args[1], '.') if n > 0 { os.Args[1] = os.Args[1][:n] } file, err = os.Create(os.Args[1] + ".rev-cpl.fas") if err != nil { fmt.Println(err) return } defer file.Close() err = fas.Write(file, seq) if err != nil { fmt.Println("Can't create output file\n") return } }
func main() { n := flag.Int("threshold", 0, "最短绘制序列长度阀值") flag.Parse() if flag.NArg() != 1 { flag.PrintDefaults() return } file, err := os.Open(flag.Arg(0)) if err != nil { fmt.Println(err) return } defer file.Close() seq, err := fas.Read(file) if err != nil { fmt.Println(err) return } if len(seq) != 2 { fmt.Println("Only accept two sequences\n") return } DrawSame(strings.Split(flag.Arg(0), ".")[0]+".[matrix].png", seq[0].Seq, seq[1].Seq, *n) }