see: https://www.biostars.org/p/170573/