Mercurial > repos > peterjc > mira_datatypes
changeset 53:7f01823efdd5 draft
planemo upload for repository https://github.com/peterjc/pico_galaxy/tree/master/datatypes/mira_datatypes commit 791c2c3ab336c519634fc0d335e3010fbf41a088
author | peterjc |
---|---|
date | Mon, 02 Apr 2018 12:54:44 -0400 |
parents | 0ea7020685e2 |
children | 2bd1f1175fb2 |
files | README.rst datatypes_conf.xml mira.py |
diffstat | 3 files changed, 168 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/README.rst Mon Mar 26 13:21:40 2018 -0400 +++ b/README.rst Mon Apr 02 12:54:44 2018 -0400 @@ -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:: + + <datatype extension="mira" type="galaxy.datatypes.mira:MiraAssemblyFormat" mimetype="text/plain" display_in_upload="true"/> + +and later in the sniffer section:: + + <sniffer type="galaxy.datatypes.mira:MiraAssemblyFormat"/> -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.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datatypes_conf.xml Mon Apr 02 12:54:44 2018 -0400 @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<datatypes> + <datatype_files> + <datatype_file name="mira.py"/> + </datatype_files> + <registration> + <datatype extension="mira" type="galaxy.datatypes.mira:MiraAssemblyFormat" mimetype="text/plain" display_in_upload="true"/> + </registration> + <sniffers> + <sniffer type="galaxy.datatypes.mira:MiraAssemblyFormat"/> + </sniffers> +</datatypes>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mira.py Mon Apr 02 12:54:44 2018 -0400 @@ -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)