Involved in the production of glycogen and alpha-glucan via the TreS-Pep2 branch involved in the biosynthesis of maltose-1-phosphate (M1P), and probably in the osmoprotection via the biosynthesis of trehalose (Ref.4, PubMed:27513637). Catalyzes the transfer of glucose from UDP-glucose (UDP-Glc) to glucose-6-phosphate (Glc-6-P) to form trehalose-6-phosphate (Ref.4). ADP-Glc, CDP-Glc, GDP-Glc and TDP-Glc are also glucosyl donors, however, when the pyrimidine sugar nucleotides (CDP-Glc, TDP-Glc and UDP-Glc) are used as substrates, there is an absolute requirement for a high molecular weight polyanion for activity (Ref.4). ADP-alpha-D-glucose + D-glucose 6-phosphate = ADP + alpha,alpha-trehalose 6-phosphate + H(+) CDP-alpha-D-glucose + D-glucose 6-phosphate = alpha,alpha-trehalose 6-phosphate + CDP + H(+) D-glucose 6-phosphate + GDP-alpha-D-glucose = alpha,alpha-trehalose 6-phosphate + GDP + H(+) D-glucose 6-phosphate + TDP-alpha-D-glucose = alpha,alpha-trehalose 6-phosphate + H(+) + TDP D-glucose 6-phosphate + UDP-alpha-D-glucose = alpha,alpha-trehalose 6-phosphate + H(+) + UDP Stimulated by the polynucleotide FII (physiological activator), and by chondroitin sulfate (CS) and heparin. Activation by the polyanion is inhibited by high salt concentration as well as by high concentrations of mononucleoside phosphates. Optimum pH is 7. About 60% of the activity is lost in the absence of FII after 10 minutes at 40 degrees Celsius, but only 35% in the presence of FII. Glycan biosynthesis; trehalose biosynthesis. Homotetramer. Cells lacking this gene do not accumulate ADP-glucose, however combined inactivation of both glgM and ostA accumulates ADP-glucose. Belongs to the glycosyltransferase 20 family.