AbstractMutational signature analysis is an essential part of the cancer genome analysis toolkit. Conventionally, mutational signature analysis extracts patterns of different mutation types across many cancer genomes. Here we present TensorSignatures, an algorithm to learn mutational signatures jointly across all variant categories and their genomic context. The analysis of 2,778 primary and 3,824 metastatic cancer genomes of the PCAWG consortium and the HMF cohort shows that practically all signatures operate dynamically in response to various genomic and epigenomic states. The analysis pins differential spectra of UV mutagenesis found in active and inactive chromatin to global genome nucleotide excision repair. TensorSignatures accurately characterises transcription-associated mutagenesis, which is detected in 7 different cancer types. The analysis also unmasks replication- and double strand break repair-driven APOBEC mutagenesis, which manifests with differential numbers and length of mutation clusters indicating a differential processivity of the two triggers. As a fourth example, TensorSignatures detects a signature of somatic hypermutation generating highly clustered variants around the transcription start sites of active genes in lymphoid leukaemia, distinct from a more general and less clustered signature of Polη-driven translesion synthesis found in a broad range of cancer types.Key findingsSimultaneous inference of mutational signatures across mutation types and genomic features refines signature spectra and defines their genomic determinants.Analysis of 6,602 cancer genomes reveals pervasive intra-genomic variation of mutational processes.Distinct mutational signatures found in quiescent and active regions of the genome reveal differential repair and mutagenicity of UV- and tobacco-induced DNA damage.APOBEC mutagenesis produces two signatures reflecting highly clustered, double strand break repair-initiated and lowly clustered replication-driven mutagenesis, respectively.Somatic hypermutation in lymphoid cancers produces a strongly clustered mutational signature localised to transcription start sites, which is distinct from a weakly clustered translesion synthesis signature found in multiple tumour types.