changeset 3:97a43bcbf44d draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/progressivemauve commit fc61c9d4850614a6580d25f92e3032dc8edbc10d"
author iuc
date Fri, 26 Jun 2020 05:35:25 -0400
parents bdb752f3c6bb
children 4d869208bd52
files test-data/1.gff3 xmfa2gff3.py xmfa2gff3.xml
diffstat 3 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/test-data/1.gff3	Thu Feb 07 05:24:24 2019 -0500
+++ b/test-data/1.gff3	Fri Jun 26 05:35:25 2020 -0400
@@ -1,6 +1,6 @@
 ##gff-version 3
 ##sequence-region karma 1 1
-karma	progressiveMauve	match	83044	149558	.	-	.	ID=phagey;target=phagey
+karma	progressiveMauve	match	83044	149558	.	-	.	ID=phagey;Target=phagey 61896 118870 +
 karma	progressiveMauve	match_part	83044	83053	30.0	+	.	Parent=phagey
 karma	progressiveMauve	match_part	83054	83063	70.0	+	.	Parent=phagey
 karma	progressiveMauve	match_part	83064	83073	30.0	+	.	Parent=phagey
--- a/xmfa2gff3.py	Thu Feb 07 05:24:24 2019 -0500
+++ b/xmfa2gff3.py	Fri Jun 26 05:35:25 2020 -0400
@@ -16,6 +16,15 @@
 log = logging.getLogger(__name__)
 
 
+# Patch bcbio gff to work around url encoding issue. This is clearly
+# sub-optimal but we should transition to the newer library.
+def _new_format_keyvals(self, keyvals):
+    return ";".join(["%s=%s" % (k, ",".join(v)) for (k, v) in sorted(keyvals.items())])
+
+
+GFF.GFFOutput.GFF3Writer._format_keyvals = _new_format_keyvals
+
+
 def parse_xmfa(xmfa):
     """Simple XMFA parser until https://github.com/biopython/biopython/pull/544
     """
@@ -112,7 +121,7 @@
                 type="match", strand=parent['strand'],
                 qualifiers={
                     "source": "progressiveMauve",
-                    "target": label_convert.get(other['id'], other['id']),
+                    "Target": " ".join(map(str, [label_convert.get(other['id'], other['id']), other['start'], other['end'], '+' if other['strand'] > 0 else '-'])),
                     "ID": label_convert.get(other['id'], 'xmfa_' + other['rid'])
                 }
             )
@@ -158,10 +167,10 @@
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(description='Convert XMFA alignments to gff3', prog='xmfa2gff3')
-    parser.add_argument('xmfa_file', type=file, help='XMFA File')
+    parser.add_argument('xmfa_file', type=argparse.FileType('r'), help='XMFA File')
     parser.add_argument('--window_size', type=int, help='Window size for analysis', default=1000)
     parser.add_argument('--relative_to', type=str, help='Index of the parent sequence in the MSA', default='1')
-    parser.add_argument('--sequences', type=file, nargs='+',
+    parser.add_argument('--sequences', type=argparse.FileType('r'), nargs='+',
                         help='Fasta files (in same order) passed to parent for reconstructing proper IDs')
     parser.add_argument('--version', action='version', version='%(prog)s 1.0')
 
--- a/xmfa2gff3.xml	Thu Feb 07 05:24:24 2019 -0500
+++ b/xmfa2gff3.xml	Fri Jun 26 05:35:25 2020 -0400
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<tool id="xmfa2gff3" name="Convert XMFA to gapped GFF3" version="@WRAPPER_VERSION@.0">
+<tool id="xmfa2gff3" name="Convert XMFA to gapped GFF3" version="@WRAPPER_VERSION@.1">
   <description></description>
   <macros>
     <import>macros.xml</import>