Example #1
0
func phaseInferCommand(c *cli.Context) {

	if len(c.String("links")) == 0 {
		glog.Errorf("error: must provide a path to a links file with --links.")
		return
	}

	if _, err := os.Stat(c.String("links")); os.IsNotExist(err) {
		glog.Errorf("error: the specified links file does not exist: %s\n", c.String("links"))
		return
	}

	links, e2 := util.LoadLinks(c.String("links"))
	if e2 != nil {
		glog.Errorf("Error loading links: %s\n", e2)
	}

	Phase(&links)

}
Example #2
0
func scaffoldInferCommand(c *cli.Context) {

	if len(c.String("links")) == 0 {
		fmt.Printf("error: must provide a path to a links file with --links\n")
		return
	}

	if _, err := os.Stat(c.String("links")); os.IsNotExist(err) {
		fmt.Printf("error: the specified links file does not exist: %s\n", c.String("links"))
		return
	}

	/*

		if (len(c.String("assembly")) == 0) {
			fmt.Printf("error: must provide a path to a assembly file with --assembly\n")
			return
		}

		if _, err := os.Stat(c.String("assembly")); os.IsNotExist(err) {
			fmt.Printf("error: the specified assembly file does not exist: %s\n", c.String("assembly"))
			return
		}*/

	links, _ := util.LoadLinks(c.String("links"))
	//fmt.Println(links)
	if len(c.String("subset")) > 0 {
		links.Subset(c.String("subset"))
	}

	//fmt.Println(links.IntIDs())
	//fmt.Println(links.StringIDs())
	//fmt.Println(links.Decode(links.IntIDs()))

	scaffolding := Scaffold(&links, c.String("output"))

	/*scaffolding := ScaffoldNew(&links)
	scaffolding, _ := links.Decode(scaffolding)
	err := WriteScaffolding(scaffolding, c.String("output"))
	if err != nil {
		fmt.Printf("Error writing scaffolding: ", err)
	}*/

	//fmt.Println(scaffolding)
	//fmt.Println(scaffDecoded)

	if len(c.String("key")) > 0 {
		key := ReadScaffolding(c.String("key"))
		//fmt.Println(key)
		score, nscore, _ := EvalScaffolding(scaffolding, key)
		fmt.Printf("Evaluated scaffolding with score %f and neighbor score %f\n", score, nscore)
		if len(c.String("viz")) > 0 {
			VisualizeScaffolding(c.String("output"), c.String("key"), c.String("viz"))
		}
	}

	/*if len(c.String("key")) > 0 {
		key := ReadScaffolding(c.String("key"))
		//fmt.Println(key)
		score, nscore, _ := EvalScaffolding(scaffolding, key)
		fmt.Printf("Evaluated scaffolding with score %f and neighbor score %f\n", score, nscore)
		if len(c.String("viz")) > 0 {
			VisualizeScaffolding(c.String("output"), c.String("key"), c.String("viz"))
		}
	}*/

}