From e8d0ce39cf60b8311d9b749189a29025ad476144 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 23 Aug 2018 18:26:00 +0200 Subject: [PATCH] Fix random order of fasta headers in maf_to_bed --- tools/maf/maf_to_bed.py | 8 +++++--- tools/maf/maf_to_bed.xml | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/maf/maf_to_bed.py b/tools/maf/maf_to_bed.py index 764168990ab..6347924cf2a 100644 --- a/tools/maf/maf_to_bed.py +++ b/tools/maf/maf_to_bed.py @@ -6,6 +6,7 @@ from __future__ import print_function import os import sys +from collections import OrderedDict from bx.align import maf @@ -23,14 +24,15 @@ def __main__(): primary_spec = None if "None" in species: - species = set() + species = OrderedDict() try: for i, m in enumerate(maf.Reader(open(input_filename, 'r'))): for c in m.components: spec, chrom = maf.src_split(c.src) if not spec or not chrom: - spec = chrom = c.src - species.add(spec) + spec = c.src + species[spec] = None + species = species.keys() except Exception: print("Invalid MAF file specified", file=sys.stderr) return diff --git a/tools/maf/maf_to_bed.xml b/tools/maf/maf_to_bed.xml index 2464296cc2a..e7e56b6d32d 100644 --- a/tools/maf/maf_to_bed.xml +++ b/tools/maf/maf_to_bed.xml @@ -22,7 +22,7 @@ - +