The detection of horizontal gene transfer (HGT) events has become an increasingly important issue in recent years. Here we discuss a simple theoretical analysis based on the in silico artificial addition of known foreign genes from different prokaryotic groups into the genome of Escherichia coli K12 MG1655. Using this dataset as a control, we have tested the efficiency of four methodologies commonly employed to detect HGT, which are based on (a) the codon adaptation index, codon usage, and GC percentage (CAI/GC); (b) the distributional profile (DP) approach with a gene search in the closely related phylogenetic genomes; (c) the Bayesian model (BM); and (d) the first-order Markov model (MM). All methods exhibit limitations as shown here, with BM and MM giving better approximations. The MM has a better detection rate when genes from closely related organisms are evaluated. The application of the MM to detect recently transferred genes in the genomes of E. coli strain K12 MG1655 shows that this organism has undergone a rather significant amount of HGT, several of which have well-defined functions that appear to be involved in the direct interaction of the organisms with their environment.