We discuss the homological aspects of the connection between quantum string generating function and the formal power series associated to the dimensions of chains and homologies of suitable Lie algebras. Our analysis can be considered as a new straightforward application of the machinery of modular forms and spectral functions (with values in the congruence subgroup of $SL(2,{mathbb Z})$) to the partition functions of Lagrangian branes, refined vertex and open string partition functions, represented by means of formal power series that encode Lie algebra properties. The common feature in our examples lies in the modular properties of the characters of certain representations of the pertinent affine Lie algebras and in the role of Selberg-type spectral functions of an hyperbolic three-geometry associated with $q$-series in the computation of the string amplitudes.