def parse_map_file(mapFNH):
m = OrderedDict()<EOL>map_header = None<EOL>with file_handle(mapFNH) as mapF:<EOL><INDENT>for line in mapF:<EOL><INDENT>if line.startswith("<STR_LIT>"):<EOL><INDENT>map_header = line.strip().split("<STR_LIT:\t>")<EOL><DEDENT>if line.startswith("<STR_LIT:#>") or not line:<EOL><INDENT>continue<EOL><DEDENT>line = line.strip().split("<STR_LIT:\t>")<EOL>m[line[<NUM_LIT:0>]] = line<EOL><DEDENT><DEDENT>return map_header, m<EOL>
Opens a QIIME mapping file and stores the contents in a dictionary keyed on SampleID
(default) or a user-supplied one. The only required fields are SampleID,
BarcodeSequence, LinkerPrimerSequence (in that order), and Description
(which must be the final field).

:type mapFNH: str
:param mapFNH: Either the full path to the map file or an open file handle

:rtype: tuple, dict
:return: A tuple of header line for mapping file and a map associating each line of
         the mapping file with the appropriate sample ID (each value of the map also
         contains the sample ID). An OrderedDict is used for mapping so the returned
         map is guaranteed to have the same order as the input file.

Example data:
#SampleID BarcodeSequence LinkerPrimerSequence State   Description
11.V13    ACGCTCGACA      GTTTGATCCTGGCTCAG    Disease Rat_Oral