Dwarf Therapist shows different symbols for homo- bi- and hetero-sexual creatures. Asexual (which also includes marriage commitment issues) are shown as the base gender grayed out (sexual creatures are shown in pink and blue, respectively).
Generally, I bring 3 of each gender on embark to almost ensure I get breeding going. When I went for 2 of each I had a fair number of cases where at least all of one gender were reproductive duds.
There is also a DFHack command called "gaydar" which is supposed to be somewhat buggy. It has no documentation, but you select the creature to examine in DF and type the command in the DFHack console (I haven't tried it with animals myself, as I usually use DT).
Finally, I usually bring birds on embark rather than pigs, since birds produce eggs as well.
Note that you can butcher the problematic one and buy a new partner from the dwarven caravan. If the caravan doesn't bring any, you can request the next one to bring some via the trad liaison. If I understand it correctly, each tick of increased payment guarantees one unit of the desired goods on the next caravan. Since caravan creatures can be dud as well, I'd order 3 (i.e. increase payment 3 steps) of each failed gender. I don't think there is an easy way to find out whether caravan creatures are reproductive before you buy them, but money means nothing in DF.
Also, immigrants can bring animals with them, so you may luck out and get a partner for your functional porker that way.