# HG changeset patch
# User peterjc
# Date 1519663777 18000
# Node ID b232f85a53defd5c1a4be75d38823e9ab7ce6467
# Parent bd6ae8a5ce10b30e2494139881f1e127c24c146e
planemo upload for repository https://github.com/peterjc/pico_galaxy/tree/master/datatypes/mira_datatypes commit 6c6f88d0400776b12a54065b0242fc1334f4e81a
diff -r bd6ae8a5ce10 -r b232f85a53de README.rst
--- a/README.rst Thu Feb 08 06:03:05 2018 -0500
+++ b/README.rst Mon Feb 26 11:49:37 2018 -0500
@@ -1,11 +1,112 @@
-Galaxy packages for MIRA
-========================
+Galaxy datatypes for MIRA Assembly Format (MAF)
+===============================================
+
+These Galaxy datatypes are copyright 2013 by Peter Cock, The James Hutton
+Institute (formerly SCRI, Scottish Crop Research Institute), UK. All rights reserved.
+
+See the licence text below (MIT licence).
+
+This code defines a 'mira' datatype within Galaxy for the MIRA Assembly Format
+(specifically v2 of the format introduced by MIRA 4.0 and the development
+preview releases of MIRA v3.9). See http://chevreux.org/projects_mira.html
+and https://sourceforge.net/projects/mira-assembler/ for background.
+
+This format is not to be confused with the existing 'maf' datatype within Galaxy
+for the unrelated Multiple (sequence) Alignment Format (MAF).
+
+It is available from the Galaxy Tool Shed at:
+http://toolshed.g2.bx.psu.edu/view/peterjc/mira_datatypes
+
+
+History
+=======
-The code for my Galaxy wrappers for MIRA and associated packages has been
-moved to a new repository:
+======= ======================================================================
+Version Changes
+------- ----------------------------------------------------------------------
+v0.0.1 - First public release
+======= ======================================================================
+
+
+Installation
+============
+
+Doing this automatically via the Galaxy Tool Shed is probably simplest, and will
+happen automatically as a dependency of the Galaxy wrapper for MIRA v4.0.
+
+
+Manual Installation
+===================
+
+Normally you would install this via the Galaxy ToolShed, which would move
+the provided mira.py file into a suitable location and process the
+``datatypes_conf.xml`` entry to be combined with your local configuration.
+
+However, if you really want to this should work for a manual install. Add
+the following lines to the ``datatypes_conf.xml`` file in the Galaxy main folder::
+
+
+
+and later in the sniffer section::
+
+
-https://github.com/peterjc/galaxy_mira/
+Also create the file ``lib/galaxy/datatypes/mira.py`` by moving, copying or linking
+the mira.py file provided in this tar-ball. Finally add ``import mira`` near
+the start of file ``lib/galaxy/datatypes/registry.py`` (after the other import
+lines).
+
+
+Bug Reports
+===========
+
+You can file an issue here https://github.com/peterjc/pico_galaxy/issues or ask
+us on the Galaxy development list http://lists.bx.psu.edu/listinfo/galaxy-dev
+
+
+Developers
+==========
+
+Development is done on this GitHub repository:
+https://github.com/peterjc/pico_galaxy
+
+For making the "Galaxy Tool Shed" http://toolshed.g2.bx.psu.edu/ tarball I use
+the following command from the ``mira_datatypes`` folder::
+
+ $ tar -czf mira_datatypes.tar.gz README.rst datatypes_conf.xml mira.py
+
+Check this worked::
-The tools, datatypes and packages remain available from the Galaxy Tool Shed:
+ $ tar -tzf mira_datatypes.tar.gz
+ README.rst
+ datatypes_conf.xml
+ mira.py
+
+For development, rather than having a local ToolShed running, I currently
+use a symlink from ``lib/galaxy/datatypes/mira.py`` to the actual file as
+described above.
+
+
+Licence (MIT)
+=============
-http://toolshed.g2.bx.psu.edu/view/peterjc/
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+NOTE: This is the licence for the Galaxy MIRA datatypes **only**. MIRA itself
+is available and licenced separately.
diff -r bd6ae8a5ce10 -r b232f85a53de datatypes_conf.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/datatypes_conf.xml Mon Feb 26 11:49:37 2018 -0500
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff -r bd6ae8a5ce10 -r b232f85a53de mira.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mira.py Mon Feb 26 11:49:37 2018 -0500
@@ -0,0 +1,48 @@
+"""
+MiraAssemblyFormat class for the 'mira' format within Galaxy
+"""
+
+from galaxy.datatypes.data import Text
+
+
+class MiraAssemblyFormat(Text):
+ """MIRA Assembly Format data"""
+ file_ext = "mira"
+
+ def sniff(self, filename):
+ """Determines whether the file is a MIRA Assembly Format file.
+
+ Note currently this only detects MIRA Assembly Format v2.0,
+ as used in MIRA v3.9 and v4.0.
+
+ It does not detect MIRA Assembly Format v1 as used in both
+ MIRA v3.2 and v3.4.
+ """
+ h = open(filename)
+ line = h.readline()
+ if line.rstrip() != "@Version\t2\t0":
+ h.close()
+ return False
+ line = h.readline()
+ if line.rstrip() != "@Program\tMIRALIB":
+ h.close()
+ return False
+ return True
+
+ def merge(split_files, output_file):
+ """Merging multiple MIRA files is non-trivial and may not be possible..."""
+ if len(split_files) == 1:
+ # For one file only, use base class method (move/copy)
+ return Text.merge(split_files, output_file)
+ if not split_files:
+ raise ValueError("Given no MIRA, %r, to merge into %s"
+ % (split_files, output_file))
+ raise NotImplementedError("Merging MIRA Assembly Files has not been implemented")
+ merge = staticmethod(merge)
+
+ def split(cls, input_datasets, subdir_generator_function, split_params):
+ """Split a MIRA Assembly File (not implemented for now)."""
+ if split_params is None:
+ return None
+ raise NotImplementedError("Can't yet split a MIRA Assembly Format file")
+ merge = staticmethod(merge)