Watch the Invention No.4 online guitar lesson by Tony Smotherman from Classical Flatpicking Explorations
The 4th invention is in D minor, the first section borrowing lines straight from the D Aeolian (natural minor) scale. Try and keep your fingers upright (as in a classical position) so that you don't have to worry about a lot of shifting. You should feel as though you can play through a majority of the piece without moving positions much. The key is to give each finger its own fret (as in chromatically).
This tune is at the top of the list for great alternate picking studies. You'll soon see why guitarists of many genres find Bach to be a huge source of inspiration.