EOL added to write_mapping_file
removed extra whitespace, added credit
added whitespace to break up logic flow
simplified merging logic

* using dict comprehension for per-row values
* using defaultdict so that only a single insert/update call is used
* decomposed complex conditional checking for conflicting values
simplified merge logic

* headers now tracked in a set
* explicit checks for ordered columns (e.g., SampleID)
* decomposed multi-line join and list comprehension
result instantiated at the end of function
Merge pull request #1230 from wasade/issue1193

Issue1193