With all the different ways to get bonuses you actually might need to do some math to find your answer. The adjacency bonuses kinda throws out the idea of having a build order. It really depends on the layout of the planet in question if you are looking for optimal output.
Generally build factories first, then research.
Farms are only needed when you are about to max your pop. If your pop cap is 5 and currenly have 4.5 population and have growth rate of .1 you optimally will build your farm 5 turns prior to capping your pop. However, it will not hurt you if you prebuild your farms. Although, putting farms around a hospital will boost your growth rate. If you don't mind the micro I would focus on a few planets as population farms and have colony ships (early) or transports (later) shuttle population.
For factories (or research) and buildings that boost the adjacency you will want to compare numbers.
The solar farm can usually be built right away then the factories after it early on. Later you might want to build a couple factories then the solar farm. I try to build the solar farm surrounded by 3 factories. If I have 5 or 6 factories around a tile I make it my manufacturing captial.
This system can get pretty complex and turns each planet into a new puzzle. Specialize planets that have a layout that allows you to put multiple buildings next to each other. Generalize planets that have many different bonuses.
Specialty planets should also have enough farms to grow a huge population to support your factories. I wouldn't specialize a planet that has lower planet class then 10 that pop. Although I prefer class 15 planets. However, an exception would be if you have a smaller planet with a large ring around a single hex. Remember your terraforming possibilites too. You can terraform any "land" tile. Another reason to make specialty planets is when they have a bonus such as Bread Basket. If possible you want to make these planet growing planets.
Influence planets are best near enemy planets that you want to flip.
Lastly, don't forget Approval improvements. Approval helps your planets resist being flipped (through influence or invasion) and improves their growth rate.