Write a SQL query using window functions to calculate a rolling 7-day average and rank patients by mutation frequency within each cohort.