Parses the sample sheet (SampleSheet.csv) to determine certain values
        important for the creation of the assembly report

def parsesamplesheet(self):
        """Parses the sample sheet (SampleSheet.csv) to determine certain values
        important for the creation of the assembly report"""
        # Open the sample sheet
        with open(self.samplesheet, "r") as samplesheet:
            # Iterate through the sample sheet
            samples, prev, header = False, 0, []
            for count, line in enumerate(samplesheet):
                # Remove new lines, and split on commas
                # line = line.decode('utf-8')  # Turn from bytes to string, since python3 is finicky.
                data = line.rstrip().split(",")
                if any(data):
                    if "[Settings]" in line:
                        samples = False
                    if not line.startswith("[") and not samples and not data == ['']:
                        # Grab an data not in the [Data] Section
                        setattr(self.header, data[0].replace(" ", ""), "".join(data[1:]))
                    elif "[Data]" in line or "[Reads]" in line:
                        samples = True
                    elif samples and "Sample_ID" in line:
                        header.extend([x.replace("_", "").replace(' ', "") for x in data])
                        prev = count
                    elif header:
                        # Try and replicate the Illumina rules to create file names from "Sample_Name"
                        samplename = samplenamer(data)
                        # Create an object for storing nested static variables
                        strainmetadata = MetadataObject()
                        # Set the sample name in the object
                        strainmetadata.name = samplename
                        # Add the header object to strainmetadata
                        # strainmetadata.__setattr__("run", GenObject(dict(self.header)))
                        strainmetadata.run = GenObject(copy.copy(self.header.datastore))
                        # Create the run object, so it will be easier to populate the object (eg run.SampleName = ...
                        # instead of strainmetadata.run.SampleName = ...
                        run = strainmetadata.run
                        # Capture Sample_ID, Sample_Name, I7_Index_ID, index1, I5_Index_ID,	index2, Sample_Project
                        for idx, item in enumerate(data):
                            setattr(run, header[idx], item) if item else setattr(run, header[idx], "NA")
                        # Add the sample number
                        run.SampleNumber = count - prev
                        # Create the 'General' category for strainmetadata
                        strainmetadata.general = GenObject({'outputdirectory': os.path.join(self.path, samplename),
                                                            'pipelinecommit': self.commit})
                        strainmetadata.general.logout = os.path.join(self.path, samplename,
                                                                     '{}_log_out.txt'.format(samplename))
                        strainmetadata.general.logerr = os.path.join(self.path, samplename,
                                                                     '{}_log_err.txt'.format(samplename))
                        # Add the output directory to the general category
                        # Append the strainmetadata object to a list
                        self.samples.append(strainmetadata)
                    elif samples:
                        setattr(self.header, 'forwardlength', data[0]) \
                            if 'forwardlength' not in self.header.datastore else \
                            setattr(self.header, 'reverselength', data[0])
                        self.totalreads += int(data[0])
        self.date = self.header.Date if "Date" in self.header.datastore else self.date
        for sample in self.samples:
            if 'InvestigatorName' not in sample.run.datastore:
                sample.run.InvestigatorName = 'NA'