This method does most of the work for this class. It generates an
        individual report for the instance.

def generate_report(self):
        """This method does most of the work for this class. It generates an
        individual report for the instance.
        """

        print("making plot for {}".format(self.outname))
        # make the markdown file to log to while doing analyses
        logfile_filepath = os.path.join(
            self.reportDir,
            "{0}_report.md".format(self.outname))

        #check if seld.reportDir exists
        # if not, make it
        if not os.path.exists(self.reportDir):
            print("making the directory: {}".format(self.reportDir))
            os.makedirs(self.reportDir)

        logfile = open(logfile_filepath, 'w')

        # make a title in the markdown file
        print("# {0}".format(self.outname), file=logfile)
        print("## Meraculous assembly QC analysis", file=logfile)

        # 0. Run params
        print("### 0. Run params", file=logfile)
        print("", file=logfile)
        print("- mer_size: `{}`".format(self.mer_size), file=logfile)
        print("- diploid_mode: `{}`".format(self.diploid_mode), file=logfile)
        print("- genome_size: `{}`".format(self.genome_size), file=logfile)
        print("- min_depth_cutoff: `{}`".format(self.min_depth_cutoff), file=logfile)
        print("", file=logfile)

        # 1. get the mercount and kha plot
        print("### 1. `meraculous_mercount` output", file = logfile)
        print("", file=logfile)
        print("#### `mercount.png`", file = logfile)
        print("", file=logfile)
        mercountFromPath = os.path.join(self.homeBasename, "meraculous_mercount/mercount.png")
        mercountToPath = os.path.join(self.reportDir, "mercount.png")
        mercountHTML = os.path.join(
            os.path.basename(os.path.split(mercountToPath)[0]),
            os.path.basename(mercountToPath))
        shutil.copyfile(mercountFromPath, mercountToPath)
        print("![mercount]({0})".format(mercountHTML),
            file=logfile)
        print("", file=logfile)
        print("#### `kha.png`", file = logfile)
        print("", file=logfile)
        khaFromPath = os.path.join(self.homeBasename, "meraculous_mercount/kha.png")
        khaToPath = os.path.join(self.reportDir, "kha.png")
        khaHTML = os.path.join(
            os.path.basename(os.path.split(khaToPath)[0]),
            os.path.basename(khaToPath))
        shutil.copyfile(khaFromPath, khaToPath)
        print("![kha]({0})".format(khaHTML),
            file=logfile)
        print("", file=logfile)

        # 2. run fasta_stats on UUtig.fa
        # this is the result of the first contigs produced by meraculous_contigs
        print("### 2. `fasta_stats UUtigs.fa`", file=logfile)
        print("", file=logfile)
        print("""This is the output of `meraculous_contigs`. In a diploid genome,
              the total length of all contigs at this stage should be
              larger than the expected genome size because of the
              presence of haplotype variant UUtigs. (Meraculous
              manual)""", file=logfile)
        print("",file=logfile)
        print("```", file=logfile)
        callString="fasta_stats {0}".format(
            "{}/meraculous_contigs/UUtigs.fa".format(self.home))
        self.call_sys(callString, logfile)
        print("```", file=logfile)
        print("",file=logfile)

        if int(self.diploid_mode) == 1:
            #2.5. Check out the output of meraculous_bubble
            print("### 2.5. Diploid mode plot", file=logfile)
            print("", file=logfile)
            print("""- If there are two peaks, and the "half-depth" peak is much larger
                  than the one at full depth, that's a scenario that's
                  best handled by diploid_mode 2.  If it's the
                  opposite, make sure the parameter
                  'bubble_depth_threshold' is being set correctly (if
                  auto-detected, the result is written into
                  `meraculous_bubble/haplotigs.dmin.err`) - E. Goltsman.""",
                  file=logfile)
            print("""- For diploid assemblies, you should examine the file
                  haplotigs.depth.hist.png and verify that there are
                  two distinct peaks, one at roughly half depth of the
                  other. At this point you may want to check your
                  bubble_depth_threshold parameter and adjust it to a
                  value corresponding to the local minimum between the
                  two peaks (_ if you had originally set it to 0
                  Meraculous auto-detects this threshold_). - Meraculous Manual""",
                  file=logfile)
            print("", file=logfile)
            bblFromPath = os.path.join(self.homeBasename,
                                       "meraculous_bubble/haplotigs.depth.hist.png")
            bblToPath = os.path.join(self.reportDir, "haplotigs.depth.hist.png")
            bblHTML = os.path.join(
                os.path.basename(os.path.split(bblToPath)[0]),
                os.path.basename(bblToPath))
            shutil.copyfile(bblFromPath, bblToPath)
            print("![bbl]({0})".format(bblHTML),
                   file=logfile)
            print("", file=logfile)
            bbl_detect=os.path.join(self.home, "meraculous_bubble/haplotigs.dmin.err")
            if os.path.exists(bbl_detect):
                #in a later version, just look at the meraculous log file
                print("", file=logfile)
                print("#### `bubble_depth_threshold` auto-detected", file=logfile)
                print("", file=logfile)
                print("```", file=logfile)
                callString="cat {0}".format(bbl_detect)
                self.call_sys(callString, logfile)
                print("```", file=logfile)
                print("", file=logfile)
            else:
                print("", file=logfile)
                print("#### `bubble_depth_threshold` was user-input", file=logfile)
                print("", file=logfile)
            print("#### `fasta_stats meraculous_bubble/haplotigs.fa", file=logfile)
            print("", file=logfile)
            print("""- These are the assembly stats after running
                  `meraculous_bubble`.""", file=logfile)
            print("", file=logfile)
            print("```", file=logfile)
            callString="fasta_stats {0}".format(
            os.path.join(self.home, "meraculous_bubble/haplotigs.fa"))
            self.call_sys(callString, logfile)
            print("```", file=logfile)
            print("", file=logfile)

        if int(self.diploid_mode) == 1:
            print("### 2.6. Note on `meraculous_ono` with `diploid_mode=1`", file=logfile)
            print("", file=logfile)
            print("""- [ Note: If running in diploid_mode 1, the scaffolding is initially
                performed using combined linkage info from alternative
                variant diplotigs, i.e., both variants contribute read
                pairs to the same link as if they were one and the
                same contig. Then, using haplotype-specific read
                mapping info, phased variant paths are determined and
                the scaffold content is corrected in a haplotype
                consistent manner. As a result, one variant path
                (typically one with the higher overall depth) will be
                preserved in a multi-contig scaffold while the
                individual alternative variants are represented as
                unlinked, singleton scaffolds. A list of these
                singleton alternative variant scaffolds is also
                saved. For more on diploid-aware assembly, see section
                ‘Diploid assembly’. ] - _Meraculous manual_""", file=logfile)

        print("### 3. `meraculous_gap_closure`", file=logfile)
        print("", file=logfile)
        print("#### 3.1 `final.scaffolds.fa`", file=logfile)
        print("", file=logfile)
        print("```", file=logfile)
        callString="fasta_stats {0}".format(
            os.path.join(self.home, "meraculous_gap_closure/final.scaffolds.fa"))
        self.call_sys(callString, logfile)
        print("```", file=logfile)
        print("", file=logfile)

        if int(self.diploid_mode) == 1:
            print("#### 3.1. Note on haplotype final scaffolds", file=logfile)
            print("", file=logfile)
            print("""- [Note: when running in diploid_mode 1, if a gap
            represents a polymorphic region that had been actively
            removed earlier (i.e., a half-depth isotig), Meraculous
            will attempt to walk across it using reads from the more
            abundant allele]. - _Meraculous manual_""", file=logfile)
            print("""- When running in diploid_mode 1, a “single-haplotype” sequence
            file (final.scaffolds.single-haplotype.fa) where the
            alternative variant scaffolds have been removed is also
            created. - _Meraculous manual_""", file=logfile)
            print("", file=logfile)
            print("```", file=logfile)
            callString="fasta_stats {0}".format(
                os.path.join(self.home, "meraculous_gap_closure/final.scaffolds.single-haplotype.fa"))
            self.call_sys(callString, logfile)
            print("```", file=logfile)
            print("", file=logfile)

        print("### 4. `meraculous_final_results`", file=logfile)
        print("""- The final output of meraculous""", file=logfile)
        print("", file=logfile)
        print("```", file=logfile)
        callString="fasta_stats {0}".format(
            os.path.join(self.home, "meraculous_final_results/final.scaffolds.fa"))
        self.call_sys(callString, logfile)
        print("```", file=logfile)
        print("", file=logfile)

        # this block handles the printing the meraculous log to the new output
        # directory
        print("### 5. `meraculous_log`", file=logfile)
        print("""- The final output of meraculous""", file=logfile)
        print("", file=logfile)
        print("```", file=logfile)
        callString="cat {0}".format(
            os.path.join(self.home, "log/meraculous.log"))
        output, err = self.call_sys(callString, logfile)
        print("```", file=logfile)
        print("", file=logfile)
        new_mer_log_path = os.path.join(self.reportDir, "meraculous.log")
        with open (new_mer_log_path, "w") as f:
            print(output, file=f)

        logfile.close()
        self.make_HTML(logfile_filepath)