def create_hotspot_file(self, hotspot_dir): hotspot_input = "%s/hotspot_orig.vcf" % hotspot_dir final_hotspot = hotspot_input.split(".vcf")[0]+'_prepped.vcf' if os.path.isfile(final_hotspot): self.__log_hotspot_already_exists() else: with open(hotspot_input, "w") as out_file: vcf_header = "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tsample\n" out_file.write(vcf_header) hotspots = hotspot_mongo.get_valid_hotspot_vars() self.__process_hotspot_vars(hotspots, out_file) ref_fasta = self.project_config['ref_fasta'] final_hotspot = hotspot_input.split(".vcf")[0]+'_prepped.vcf' self.__log_preparing_hotpot() hotspot_bash.prep_hotspot(hotspot_input, final_hotspot, ref_fasta) self.reconcile_hotspot_and_database(final_hotspot)
def create_annovar_input(self, hotspot_dir): annovar_input = "%s/annov_in.vcf" % hotspot_dir final_annovar_input = annovar_input.split(".vcf")[0]+'_prepped.vcf' if os.path.isfile(final_annovar_input): self.__log_hotspot_already_exists() else: with open(annovar_input, "w") as out_file: vcf_header = "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tsample\n" out_file.write(vcf_header) hotspots = hotspot_mongo.get_valid_hotspot_vars() self.__get_unannotated_hotspots(hotspots, out_file) ref_fasta = self.project_config['ref_fasta'] final_annovar_input = annovar_input.split(".vcf")[0]+'_prepped.vcf' self.__log_preparing_hotpot() hotspot_bash.prep_hotspot(annovar_input, final_annovar_input, ref_fasta) return final_annovar_input