Nucleotide count in Scala
Encapsulation and information hiding

The parameterless nucleotideCounts method exposes the map of counts.
If later you wanted to change the way you store the counts,
for example you wanted to store in a database instead of a map in memory,
you won't be able to do that,
because you did not hide this information.

Exposing the map is especially suspicious since the map is mutable.
Users of this class could circumvent the validation logic,
for example delete nucleotides or add invalid nucleotides.

In any case, it would be better to declare the count map private.

Unnecessary getOrElse

Thanks to the validate method,
and if we assume that users of the parameterless nucleotideCounts method will not abuse the class and delete nucleotides,
it's guaranteed that count.get(c).get will always find a value,
so you can replace all occurrences of count.get(c).getOrElse(0).

Mutable or not

It's not clear why you use a mutable map.
Your current implementation and tests would work with an immutable map too.

If you really want to use a mutable map, then you can replace this:


count = count.updated(i, count.get(i).getOrElse(0) + 1)



with:

count.update(c, count.get(c).get + 1)


Naming

count is a not a great name for a collection type.
For example the plural counts would be a more fitting name,
which would also match the naming of your parameterless nucleotideCounts method.

You used multiple names for a character in a DNA string: i, chr, nucleotide. It would be easier to read the code if you used a consistent name. i is especially a bad name, as it's typically used in counting loops.