My reading of Targaryen inheritance law, post the Great Council of 101 and the decrees of Aegon II, is that a woman cannot rule until all male collateral relations are exhausted. It’s not saying that a woman could never rule – post Blackfyre Rebellion, Daemon II redid the rules so that a woman inherits ahead of a legitimized bastard.
So after Viserys died, Robert became the rightful heir as the closest collateral male relation, but Dany would inherit ahead of Edric Storm if Edric was legitimized.
As to other Houses: the Martells probably have the edge against the Penroses, as the connection to Aegon IV is more proximate than that to Aegon III.
Then it probably goes House Velaryon, given their repeated connections with the Targaryens and their Valyrian blood, then the Hightowers, assuming that one of Garmund’s daughters bred back into the line, then probably the Arryns.