Is a comma needed before or after "which" and "such as"?
Solution 1:
I agree that the second sentence needs a comma before ‘such’. The first sentence, however, requires careful consideration. To begin with, it might make for easier reading to recast it as:
Ethical clearance which was obtained very early in the research process was essential.
It is the convention not to place the relative clause between commas when the information contained in the relative clause is integral to the larger message. So, the sentence as shown above distinguishes the clearance which was obtained very early in the research process from the implied clearance which was obtained at some other time in the research process. However, if we punctute the sentence as:
Ethical clearance, which was obtained very early in the research process, was essential
then the information contained in the relative clause is supplementary to the larger message. By putting the relative clause between commas, we are saying that ethical clearance was essential, and we happened to obtain it very early in the research process. Of the two, that seems to be the more likely intended meaning.
Solution 2:
You use commas to split a sentence which isn't necessary for the original sentence to work, for example:
1) Imagine I have a brother - only 1 brother. Therefore, whenever I talk about him, you always know which brother it is, as there's only one. Imagine the following:
My brother, who is a programmer, won the competition.
The middle sentence here isn't really necessary for the original sentence to have its meaning and thus you can remove it and still have a perfectly valid sentence:
My brother won the competition.
In this case, the commas are added.
BUT, another case:
2) Imagine that I have many brothers and I say the following:
My brother who is a programmer won the competition.
Here I cannot erase anything from the sentence, because the "who" part further defines which brother I'm talking about for you to fully understand the meaning. In this case, you don't add any commas anywhere.