def run(self):
        '''It runs the analysis.'''
        self._log({'analysis_started':True})
        settings = self._project_settings
        project_path = settings['General_settings']['project_path']
        tmp_dir      = settings['General_settings']['tmpdir']

        inputs = self._get_input_fpaths()
        bam_path = inputs['bam']
        bam_fpath = bam_path.last_version
        reference_path = inputs['reference']

        #memory for the java programs
        osettings   = settings['Other_settings']
        java_mem    = osettings['java_memory']
        picard_path = osettings['picard_path']
        gatk_path = osettings['gatk_path']

        #we need a temporary path
        temp_bam = NamedTemporaryFile(suffix='.bam')
        temp_bam_fpath = temp_bam.name
        temp_bam.close()

        #do the realigment
        realign_bam(bam_fpath=bam_fpath,
                    reference_fpath=reference_path.last_version,
                    out_bam_fpath=temp_bam_fpath,
                    java_conf={'java_memory':java_mem,
                               'picard_path':picard_path,
                               'gatk_path':gatk_path},
                    threads=self.threads,
                    tmp_dir=tmp_dir)
        #a new version for the original bam
        out_bam_fpath = bam_path.next_version
        shutil.move(temp_bam_fpath, out_bam_fpath)
        self._log({'analysis_finished':True})