count matrix to header, default domain and protain to array