Formation of methylation patterns in the mammalian genome