/*
Input is pathway data from OrganismFilteredPathways or GetTotalPathways (if Genbank/Uniprot are complete in allbase)
and the pathway depth (levels) you want
Returns a map:
key = compound path, e.g. "XMP->guanine", which ignores the intermediary steps
value = list of DNA structs, which contains info about the DNA sequences you need
to add to an organism for it to do this chemical reaction. An individual DNA struct has Rhea reaction ID,
gene sequence, gene seqhash, and the genbank ID of the organism from which the gene comes.
*/
Input is pathway data from OrganismFilteredPathways or GetTotalPathways (if Genbank/Uniprot are complete in allbase)
and the pathway depth (levels) you want
Returns a map:
key = compound path, e.g. "XMP->guanine", which ignores the intermediary steps
value = list of DNA structs, which contains info about the DNA sequences you need
to add to an organism for it to do this chemical reaction. An individual DNA struct has Rhea reaction ID,
gene sequence, gene seqhash, and the genbank ID of the organism from which the gene comes.
/ * Input is pathway data from OrganismFilteredPathways or GetTotalPathways ( if Genbank / Uniprot are complete in allbase ) and the pathway depth ( levels ) you want Returns a map : key = compound path e . g . " XMP - > guanine " which ignores the intermediary steps value = list of DNA structs which contains info about the DNA sequences you need to add to an organism for it to do this chemical reaction . An individual DNA struct has Rhea reaction ID gene sequence gene seqhash and the genbank ID of the organism from which the gene comes . * /
func GetDNA(pathways []pathdata, levels int) (map[string][]DNA, error) {
	RawQuery, err := LoadSQLFile("./queries/DNA_Gen.sql")
	if err != nil {
		return nil, err
	}
	db, err := ConnectDB()
	if err != nil {
		return nil, err
	}
	PathwayToDNA := make(map[string][]DNA)
	for _, pathway := range pathways {
		if pathway.Lvl == levels {
			IdList := strings.Split(pathway.Id_path, ",")
			query, args, err := sqlx.In(RawQuery, IdList)
			if err != nil {
				return PathwayToDNA, err
			}
			result := []DNA{}
			query = db.Rebind(query)
			err = db.Select(&result, query, args...)
			if err != nil {
				return PathwayToDNA, err
			}
			compounds := strings.Split(pathway.Name_path, ",")
			newString := compounds[0] + "->" + compounds[len(compounds)-1]
			PathwayToDNA[newString] = result
		}
	}
	return PathwayToDNA, err
}
func GetDNA ( pathways [ ] pathdata , levels int ) ( map [ string ] [ ] DNA , error ) { RawQuery , err := LoadSQLFile ( " " ) if err != nil { return nil , err } db , err := ConnectDB ( ) if err != nil { return nil , err } PathwayToDNA := make ( map [ string ] [ ] DNA ) for _ , pathway := range pathways { if pathway . Lvl == levels { IdList := strings . Split ( pathway . Id_path , " " ) query , args , err := sqlx . In ( RawQuery , IdList ) if err != nil { return PathwayToDNA , err } result := [ ] DNA { } query = db . Rebind ( query ) err = db . Select ( & result , query , args ... ) if err != nil { return PathwayToDNA , err } compounds := strings . Split ( pathway . Name_path , " " ) newString := compounds [ 0 ] + " " + compounds [ len ( compounds ) - 1 ] PathwayToDNA [ newString ] = result } } return PathwayToDNA , err }
Input is pathway data from OrganismFilteredPathways or GetTotalPathways (if Genbank/Uniprot are complete in allbase)
and the pathway depth (levels) you want
Returns a map:
key = compound path, e.g.
Input is pathway data from OrganismFilteredPathways or GetTotalPathways ( if Genbank / Uniprot are complete in allbase ) and the pathway depth ( levels ) you want Returns a map : key = compound path e . g .