示例#1
0
文件: main.go 项目: BurntSushi/bcbgo
func main() {
	dbPath := util.Arg(0)
	fragLibDir := util.Arg(1)
	pdbFiles := flag.Args()[2:]

	util.Assert(createBowDb(dbPath, fragLibDir, pdbFiles))

	db, err := bow.OpenDB(dbPath)
	util.Assert(err)

	bowOpts := bow.SearchDefault
	bowOpts.Limit = 200
	mattOpts := matt.DefaultConfig
	mattOpts.Verbose = false

	chains := createChains(pdbFiles)
	mattArgs := createMattArgs(chains)

	tabw := tabwriter.NewWriter(os.Stdout, 0, 4, 4, ' ', 0)
	header := []byte(
		"BOW entry\t" +
			"BOW chain\t" +
			"BOW dist\t" +
			"Matt entry\t" +
			"Matt chain\t" +
			"Matt dist\n")
	for i, chain := range chains {
		marg := mattArgs[i]

		bowOrdered := getBowOrdering(db, bowOpts, chain)
		mattOrdered := getMattOrdering(mattOpts, marg, mattArgs)

		fmt.Printf("Ordering for %s (chain %c)\n",
			chain.Entry.IdCode, chain.Ident)

		compared := comparison([2]ordering{bowOrdered, mattOrdered})
		tabw.Write(header)
		tabw.Write([]byte(compared.String()))
		tabw.Flush()
		fmt.Println("\n")
	}

	util.Assert(db.Close())
}
示例#2
0
文件: main.go 项目: BurntSushi/bcbgo
func main() {
	db := util.OpenBOWDB(util.Arg(0))

	// Set our search options.
	bowOpts := bow.SearchDefault
	bowOpts.Limit = -1

	fmt.Println("QueryID\tResultID\tCosine\tEuclid")
	for _, entry := range db.Entries {
		results := db.SearchEntry(bowOpts, entry)

		for _, result := range results {
			fmt.Printf("%s\t%c\t%s\t%c\t%0.4f\t%0.4f\n",
				entry.Id, result.Entry.Id, result.Cosine, result.Euclid)
		}
		fmt.Println("")
	}

	util.Assert(db.Close())
}