  We give a method of constructing self-orthogonal codes from equitable
partitions of association schemes. By applying this method we construct
self-orthogonal codes from some distance-regular graphs. Some of the obtained
codes are optimal. Further, we introduce a notion of self-orthogonal subspace
codes. We show that under some conditions equitable partitions of association
schemes yield such self-orthogonal subspace codes and we give some examples
from distance-regular graphs.
