Extracts amplicon sequence from contig file
        :param sample: sample metadata object
        :param contig: name of the contig hit by primers
        :param amplicon_range: type LIST: range of the amplicon within the contig
        :param primer_set: type STR: Name of primer set from the ePCR-formatted primer file used in the analyses

def ampliconfile(self, sample, contig, amplicon_range, primer_set):
        """
        Extracts amplicon sequence from contig file
        :param sample: sample metadata object
        :param contig: name of the contig hit by primers
        :param amplicon_range: type LIST: range of the amplicon within the contig
        :param primer_set: type STR: Name of primer set from the ePCR-formatted primer file used in the analyses
        """
        # Open the file
        sample[self.analysistype].ampliconfile = os.path.join(self.reportpath, '{sn}_amplicons.fa'
                                                              .format(sn=sample.name))
        with open(sample[self.analysistype].ampliconfile, 'a') as ampliconfile:
            # Load the records from the assembly into the dictionary
            for record in SeqIO.parse(sample.general.bestassemblyfile, 'fasta'):
                if record.id == contig:
                    try:
                        # Extract the start and end positions of the supplied range
                        start, end = amplicon_range
                        # Slice the gene sequence from the sequence record - remember to subtract one to
                        # allow for zero-based indexing
                        genesequence = str(record.seq)[int(start) - 1:int(end)]
                        # Set the record.id to be the sample name, the contig name,
                        # the range, and the primers
                        record.id = '{sn}_{contig}_{genomepos}_{primer_set}' \
                            .format(sn=sample.name,
                                    contig=contig,
                                    genomepos='_'.join(amplicon_range),
                                    primer_set=primer_set)
                        # Clear the record.description
                        record.description = ''
                        # Create a seq record from the sliced genome sequence
                        record.seq = Seq.Seq(genesequence)
                        # Write the amplicon to file
                        SeqIO.write(record, ampliconfile, 'fasta')
                    except AttributeError:
                        pass