Biological immune principles provide the perfect protecting schemes for computer immune system. Based on the research on anomaly detection, a gene immune detection algorithm is presented. Innate immune mechanism and adaptive immune mechanism of the biological immune system are considered synthetically. Positive selection and vaccine mechanism are introduced and a strategy of PRI in the detection is adopted by using gene detection. As shown in the simulation experiments, the algorithm improves the variety of the antibodies. It has a rather high detecting efficiency.