Skip to content

compare_report

ensembl.brc4.runnable.compare_report

compare_report

Bases: BaseRunnable

Source code in src/python/ensembl/brc4/runnable/compare_report.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
class compare_report(eHive.BaseRunnable):
    def param_defaults(self):
        return {}

    def run(self):
        stats = self.param("stats")
        output_dir = self.param_required("output_dir")

        # Print report
        report = output_dir + "/report.log"
        print("Write report in %s" % report)

        fields = (
            "species",
            "accession",
            "seq_count_1",
            "seq_count_2",
            "num_diff_seq",
            "common",
            "only1",
            "only2",
            "max_only1",
            "max_only2",
            "other_locations",
            "summary",
            "organellar_summary",
            "Assembly_level_1",
            "Assembly_level_2",
        )

        with open(report, "w") as out_fh:
            out_fh.write("#" + "\t".join(fields) + "\n")

            for species in sorted(stats.keys()):
                stat = stats[species]
                stat["species"] = species

                line = []
                for f in fields:
                    if f in stat:
                        line.append(str(stat[f]))
                out_fh.write("\t".join(line) + "\n")

param_defaults()

Source code in src/python/ensembl/brc4/runnable/compare_report.py
31
32
def param_defaults(self):
    return {}

run()

Source code in src/python/ensembl/brc4/runnable/compare_report.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
def run(self):
    stats = self.param("stats")
    output_dir = self.param_required("output_dir")

    # Print report
    report = output_dir + "/report.log"
    print("Write report in %s" % report)

    fields = (
        "species",
        "accession",
        "seq_count_1",
        "seq_count_2",
        "num_diff_seq",
        "common",
        "only1",
        "only2",
        "max_only1",
        "max_only2",
        "other_locations",
        "summary",
        "organellar_summary",
        "Assembly_level_1",
        "Assembly_level_2",
    )

    with open(report, "w") as out_fh:
        out_fh.write("#" + "\t".join(fields) + "\n")

        for species in sorted(stats.keys()):
            stat = stats[species]
            stat["species"] = species

            line = []
            for f in fields:
                if f in stat:
                    line.append(str(stat[f]))
            out_fh.write("\t".join(line) + "\n")