Considering that all 4 players ahead of Federer participated in the tournament, Roger should not have been the number 5?
Unlike the other Grand Slams, Wimblendon's seeds have more elements into consideration together with the ranking.
This is explained in Wimbledon's Seeds page:
Gentlemen's Seeding Formula
The seeds are the top 32 players on the ATP Ranking list, BUT then rearranged on a surface-based system. Since 2002 a seeding committee has not been required for the Gentlemen’s Singles following an agreement made with the ATP. The seeding order is determined using an objective and transparent system to reflect more accurately an individual player’s grass court achievements. It is based on giving additional credit for grass court performance in the two year period immediately before the date used for seeding for The Championships. The formula is:
- Take the ATP Ranking points at 26 June 2017
- Add 100% of the points earned for all grass court tournaments in the immediate past 12 months period prior to 26 June 2017.
- Add 75% of the points earned for the best grass court tournament in the 12 months prior to that
For this specific year 2017 we read in Wimbledon 2017 seeds revealed in full as Andy Murray secures top spot for the first time:
Federer is ranked fifth but his ninth title in Halle last week was enough to earn him the number three seeding ahead of world number two Nadal, who has struggled on grass in recent years.
Related news: The Wimbledon seedings system explained: Novak Djokovic poised to be seeded 1st, Andy Murray 3rd (from 2014)