Identification and transfer of spatial transcriptomics signatures for cancer diagnosis