The invention provides transgenic organisms that include a transgene that codes for a product that can be used to digest foreign nucleic acid. The transgene can code for a targeting nuclease, a guide sequence, or other components of a guided nuclease system. Expression of the transgene causes the organism to express an active targeting nuclease that targets and digests foreign nucleic acid. The targeting nuclease targets the foreign nucleic acid specifically and avoids targeting the organisms native genetic material.