def _hmmalign(self, input_path, directions, pipeline,
                  forward_reads_output_path, reverse_reads_output_path):
        '''
        Align reads to the aln_hmm. Receives unaligned sequences and
        aligns them.

        Parameters
        ----------
        input_path : str
            Filename of unaligned hits to be aligned
        directions : dict
            dictionary containing read names as keys, and complement
            as the entry (True=Forward, False=Reverse)
        pipeline: str
            either PIPELINE_AA = "P" or PIPELINE_NT = "D"
        forward_reads_output_fh: str
            Where to write aligned forward reads
        reverse_reads_output_fh: str
            Where to write aligned reverse reads
        Returns
        -------
        Nothing.
        '''
        if pipeline == PIPELINE_AA:
            reverse_direction_reads_present=False
        else:
            reverse_direction_reads_present=False in directions.values()

        with tempfile.NamedTemporaryFile(prefix='for_file', suffix='.fa') as for_file_fh:
            for_file = for_file_fh.name
            with tempfile.NamedTemporaryFile(prefix='rev_file', suffix='.fa') as rev_file_fh:
                rev_file = rev_file_fh.name
                # Align input reads to a specified hmm.
                if reverse_direction_reads_present:  # Any that are in the reverse direction would be True
                    reverse = []
                    forward = []
                    records = list(SeqIO.parse(open(input_path), 'fasta'))

                    # Split the reads into reverse and forward lists
                    for record in records:
                        read_id = record.id

                        if directions[read_id] == True:
                            forward.append(record)
                        elif directions[read_id] == False:
                            reverse.append(record)
                        else:
                            raise Exception(logging.error('Programming error: hmmalign'))
                            exit(1)

                    logging.debug("Found %i forward direction reads" % len(forward))
                    logging.debug("Found %i reverse direction reads" % len(reverse))

                    # Write reverse complement and forward reads to files
                    with open(for_file, 'w') as for_aln:
                        logging.debug("Writing forward direction reads to %s" % for_file)
                        for record in forward:
                            for_aln.write('>' + record.id + '\n')
                            for_aln.write(str(record.seq) + '\n')
                            # HMMalign and convert to fasta format
                    if any(forward):
                        self.hmmalign_sequences(self.aln_hmm, for_file, forward_reads_output_path)
                    else:
                        cmd = 'touch %s' % (forward_reads_output_path)
                        extern.run(cmd)
                    with open(rev_file, 'w') as rev_aln:
                        logging.debug("Writing reverse direction reads to %s" % rev_file)
                        for record in reverse:
                            if record.id and record.seq:
                                rev_aln.write('>' + record.id + '\n')
                                rev_aln.write(str(record.seq.reverse_complement()) + '\n')
                    self.hmmalign_sequences(self.aln_hmm, rev_file, reverse_reads_output_path)
                    conv_files = [forward_reads_output_path, reverse_reads_output_path]
                    return conv_files

                else:
                    # If there are only forward reads, just hmmalign and be done with it.
                    self.hmmalign_sequences(self.aln_hmm, input_path, forward_reads_output_path)
                    conv_files = [forward_reads_output_path]

                    return conv_files
Align reads to the aln_hmm. Receives unaligned sequences and
        aligns them.

        Parameters
        ----------
        input_path : str
            Filename of unaligned hits to be aligned
        directions : dict
            dictionary containing read names as keys, and complement
            as the entry (True=Forward, False=Reverse)
        pipeline: str
            either PIPELINE_AA = "P" or PIPELINE_NT = "D"
        forward_reads_output_fh: str
            Where to write aligned forward reads
        reverse_reads_output_fh: str
            Where to write aligned reverse reads
        Returns
        -------
        Nothing.