Biogen is to acquire RayThera, a biotechnology company specialising in small-molecule therapies for immunology, for up to $1bn.