create typeToSamples if it was not provided