There is nothing wrong with raising pigs and rats to carry out scientific experiments on them, so long as you do not touch the pig except with a barrier, such as gloves, or you wash your hands after touching it.
See also the answer to questions no. 8509 and 20843
And Allah knows best.
Reproduced from Islam QA