Exemplo n.º 1
0
 def export(self):
     sampledatas_2d_array = [i for i in self._queue if i[0] in self._no_coverages_df["sample_name"].values.tolist()]
     if len(sampledatas_2d_array) == 0:
         print("All files have correct number of lines. No files to process")
     else:
         os.makedirs(os.path.dirname(mainInitializer.output), exist_ok=True)
         Utilities.dump_2d_array(sampledatas_2d_array, file=mainInitializer.output)
         print("Files to process: {}\nDumped sample data: '{}'".format(len(self._no_coverages_df), mainInitializer.output))
     if mainInitializer.debugging_bool:
         debug_table = "{}_debug.tsv".format(mainInitializer.output)
         self._verified_df.to_csv(debug_table, sep='\t', header=True, index=False)
         print("Dumped debug table: '{}'".format(debug_table))
Exemplo n.º 2
0
    def ___fai2genome(self):
        """Process existing fasta index, depends from 'samtools_faidx' function"""
        def ____parse_fai_line(split_line: list):
            if len(split_line) >= 2:
                return split_line[:2]
            print("Bad FAI file line: {}".format("\t".join(split_line)))

        fai_2d_array = Utilities.load_2d_array("{}_samtools.fai".format(self._reference_mask))
        genome_2d_array = []
        for line in fai_2d_array:
            genome_2d_array.append(____parse_fai_line(line))
        out = "{}_samtools.genome".format(self._reference_mask)
        Utilities.dump_2d_array(array=Utilities.remove_empty_values(genome_2d_array), file=out)
        print("Created BEDTools genome index: '{}'".format(out))
Exemplo n.º 3
0
 def dump_annotation(self, file: str):
     Utilities.dump_2d_array(array=self._annotations_2d_array, file=file)
     print("Created annotation file: '{}'".format(file))