def build_fastas_call(sample):
     os.chdir(join(mglobals.original_path, sample))
     log.info("Beginning to build alternate fasta for: " + sample)
     fixed_vcf = sample + "_fix.vcf"
     log.info("Removing duplicated annotations (per transcript annotations)")
     helpers.remove_dups(input_f=(sample + in_file_extension), output_f=(sample + ".temp"))
     log.info("Removing duplicate alleles and adding header")
     # The fact that the original vcf was named sample.vcf is hardcoded
     # here. Be careful.
     helpers.vcf_fix(template_f=(sample + ".vcf"), input_f=(sample + ".temp"), output_f=fixed_vcf)
     # Delete temporary file
     os.remove(sample + ".temp")
     log.info("Creating alternate fasta")
     new_fasta = sample + "_unfixed.fa"
     helpers.sub_call(
         [
             "nice",
             "-n",
             "5",
             "java",
             "-Xmx2g",
             "-jar",
             mglobals.gatk_path,
             "-R",
             "genome.fa",
             "-T",
             "FastaAlternateReferenceMaker",
             "-o",
             new_fasta,
             "--variant",
             fixed_vcf,
         ]
     )
     # Fix the fasta
     log.info("Fixing gatk fasta")
     # If you change this name, you need to change the alternate fastas list as well.
     final_fasta = sample + ".fa"
     helpers.fasta_fix(input_f=new_fasta, output_f=final_fasta)
     # Delete the unfixed version
     os.remove(new_fasta)
     log.info("Moving new fasta to: " + join(mglobals.alternate_path, sample))
     shutil.move(final_fasta, join(mglobals.alternate_path, sample))
     log.info("Indexing new fasta")
     os.chdir(join(mglobals.alternate_path, sample))
     helpers.sub_call(["bowtie2-build", "-f", final_fasta, sample])
 def build_fastas_call(sample):
     os.chdir(join(mglobals.original_path, sample))
     log.info('Beginning to build alternate fasta for: ' + sample)
     fixed_vcf = sample + '_fix.vcf'
     log.info('Removing duplicated annotations (per transcript annotations)')
     helpers.remove_dups(input_f=(sample + in_file_extension),
                         output_f=(sample + '.temp'))
     log.info('Removing duplicate alleles and adding header')
     # The fact that the original vcf was named sample.vcf is hardcoded
     # here. Be careful.
     helpers.vcf_fix(template_f=(sample + '.vcf'),
                     input_f=(sample + '.temp'),
                     output_f=fixed_vcf)
     # Delete temporary file
     os.remove(sample + '.temp')
     log.info('Creating alternate fasta')
     new_fasta = sample + '_unfixed.fa'
     helpers.sub_call(['nice', '-n', '5',
                       'java', '-Xmx2g', '-jar',
                       mglobals.gatk_path,
                       '-R', 'genome.fa',
                       '-T', 'FastaAlternateReferenceMaker',
                       '-o', new_fasta,
                       '--variant', fixed_vcf])
     # Fix the fasta
     log.info('Fixing gatk fasta')
     # If you change this name, you need to change the alternate fastas list as well.
     final_fasta = sample + '.fa'
     helpers.fasta_fix(input_f=new_fasta, output_f=final_fasta)
     # Delete the unfixed version
     os.remove(new_fasta)
     log.info('Moving new fasta to: ' + join(mglobals.alternate_path, sample))
     shutil.move(final_fasta, join(mglobals.alternate_path, sample))
     log.info('Indexing new fasta')
     os.chdir(join(mglobals.alternate_path, sample))
     helpers.sub_call(['bowtie2-build',
                       '-f', final_fasta,
                       sample])
 def build_fastas_call(sample):
     os.chdir(join(mglobals.original_path, sample))
     log.info('Beginning to build alternate fasta for: ' + sample)
     fixed_vcf = sample + '_fix.vcf'
     log.info('Removing duplicated annotations (per transcript annotations)')
     helpers.remove_dups(input_f=(sample + in_file_extension),
                         output_f=(sample + '.temp'))
     log.info('Removing duplicate alleles and adding header')
     # The fact that the original vcf was named sample.vcf is hardcoded
     # here. Be careful.
     helpers.vcf_fix(template_f=(sample + '.vcf'),
                     input_f=(sample + '.temp'),
                     output_f=fixed_vcf)
     # Delete temporary file
     os.remove(sample + '.temp')
     log.info('Creating alternate fasta')
     new_fasta = sample + '_unfixed.fa'
     helpers.sub_call(['nice', '-n', '5',
                       'java', '-Xmx2g', '-jar',
                       mglobals.gatk_path,
                       '-R', 'genome.fa',
                       '-T', 'FastaAlternateReferenceMaker',
                       '-o', new_fasta,
                       '--variant', fixed_vcf])
     # Fix the fasta
     log.info('Fixing gatk fasta')
     # If you change this name, you need to change the alternate fastas list as well.
     final_fasta = sample + '.fa'
     helpers.fasta_fix(input_f=new_fasta, output_f=final_fasta)
     # Delete the unfixed version
     os.remove(new_fasta)
     log.info('Moving new fasta to: ' + join(mglobals.alternate_path, sample))
     shutil.move(final_fasta, join(mglobals.alternate_path, sample))
     log.info('Indexing new fasta')
     os.chdir(join(mglobals.alternate_path, sample))
     helpers.sub_call(['bowtie2-build',
                       '-f', final_fasta,
                       sample])