The increasing availability of experimental and computational protein structures entices their use for function prediction. We developed a structure-based automated procedure to identify proteins involved in metabolic reactions by evaluating substrate conformations docked to a library of enzyme active sites. By screening AlphaFold-modeled vitamin B6-dependent enzymes, we found that a metric based on catalytically favorable conformations performed best (AUROC score=0.84) in identifying genes related to known enzymatic reactions. Applying this procedure, we identified the mammalian gene encoding hydroxytrimethyllysine aldolase (HTMLA), the second enzyme of carnitine biosynthesis. Experimental validation showed that the top-ranked candidates, serine hydroxymethyl transferase (SHMT) 1 and 2, catalyze the HTMLA reaction. However, a mouse protein (threonine aldolase; Tha1) catalyzes the reaction more efficiently. Tha1 did not rank highest based on the AlphaFold model, but its rank improved to second place using the experimental crystal structure we determined at 2.26 Å resolution. We propose that mouse Tha1 be renamed as Htmla. Our findings suggest that humans have lost a gene involved in carnitine biosynthesis, with HTMLA activity of SHMT partially compensating for its function.