Mercurial > repos > tomnl > nmrml2isa
changeset 0:5990ad113145 draft
Uploaded
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/.gitignore Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,7 @@ +*.pyc +.idea +*.egg-info +.egg +*~ +*. +.DS_Store
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/.travis.yml Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,16 @@ +language: python + +before_install: + - sudo apt-get install -y python-virtualenv + - virtualenv planemo-venv + - . planemo-venv/bin/activate + - pip install --upgrade pip setuptools + - pip install planemo + - planemo conda_init + +install: + - planemo conda_install ${TRAVIS_BUILD_DIR}/galaxy/nmrml2isa/ + +script: + - planemo test --install_galaxy --no_cache_galaxy --conda_dependency_resolution ${TRAVIS_BUILD_DIR}/galaxy/nmrml2isa/ --galaxy_branch "dev" +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/README.md Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,32 @@ +nmrml2isa for galaxy +=============== + +[![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat-square)](http://bioconda.github.io/recipes/nmrml2isa/README.html) [![Build Status](https://travis-ci.org/ISA-tools/nmrml2isa-galaxy.svg?branch=master)](https://travis-ci.org/ISA-tools/nmrml2isa-galaxy) + +This is a Galaxy wrapper for the nmrml2isa python package tool. + +- Full documentation: http://2isa.readthedocs.io/en/latest/ +- Python PyPi package: https://pypi.python.org/pypi/mzml2isa/ +- Github code: https://github.com/ISA-tools/mzml2isa + +nmrml2isa is a program that allows you to convert metabolomic studies in .mzML format to the open ISA-Tab standard supported by the MetaboLights database. + +Installation +=============== + +The recommended installation is by means of the toolshed (https://toolshed.g2.bx.psu.edu/). Dependencies should be installed automatically when using Galaxy version >= 16.10. + +The dependencies are dealt with Bioconda. To ensure that Bioconda is working check to make sure the following settings are in the config/galaxy.ini file. + +``` +# dependencies before each job runs. +conda_auto_install = True +# Set to True to instruct Galaxy to install Conda from the web automatically +# if it cannot find a local copy and conda_exec is not configured. +conda_auto_init = True +``` + + +Licence +=============== +GNU General Public License v3 (GPLv3)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/nmrml2isa.xml Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,256 @@ +<tool id="nmrml2isa" name="nmrml2isa" version="0.1.0"> + <description>Parser to get meta information from nmrML files and create an ISA-Tab structure</description> + + <macros> + <import>nmrml2isa_macros.xml</import> + </macros> + + <code file="ontology_search.py" /> + + <requirements> + <requirement type="package" version="0.3.0">nmrml2isa</requirement> + </requirements> + + <stdio> + <exit_code range="1:" /> + </stdio> + + <command interpreter="python"><![CDATA[ + #set $s_submission_date = "" + #set $s_release_date = "" + #set $s_description = "" + #set $s_pubmed = "" + #set $s_pub_doi = "" + #set $s_pub_status = "" + #set $s_pub_author = "" + #set $s_pub_title = "" + + #set $s_first_name = "" + #set $s_mid_initials = "" + #set $s_last_name = "" + #set $s_telephone = "" + #set $s_fax = "" + #set $s_affiliation = "" + #set $s_role = "" + #set $s_mail = "" + #set $s_address = "" + + #set $i_submission_date = "" + #set $i_release_date = "" + #set $i_description = "" + #set $i_pubmed = "" + #set $i_pub_doi = "" + #set $i_pub_title = "" + #set $i_pub_status = "" + #set $i_pub_author = "" + + #set $i_first_name = "" + #set $i_mid_initials = "" + #set $i_last_name = "" + #set $i_telephone = "" + #set $i_fax = "" + #set $i_affiliation = "" + #set $i_role = "" + #set $i_mail = "" + #set $i_address = "" + + #set $organism_text = "" + #set $organism_ref = "" + #set $organism_iri = "" + #set $organism_variant_text = "" + #set $organism_variant_ref = "" + #set $organism_variant_iri = "" + #set $organism_part_text = "" + #set $organism_part_ref = "" + #set $organism_part_iri = "" + + + #if $study_meta.study_select=="show" + #set $submission_date = $study_meta.s_submission_date + #set $s_release_date = $study_meta.s_release_date + #set $s_description = $study_meta.s_description + #set $s_pubmed = $study_meta.s_pubmed + #set $s_pub_doi = $study_meta.s_pub_doi + #set $s_pub_status = $study_meta.s_pub_status + #set $s_pub_author = $study_meta.s_pub_author + #set $s_pub_title = $study_meta.s_pub_title + #end if + + #if ($s_contacts.s_contacts_select=="show"): + #set $s_first_name = $s_contacts.s_first_name + #set $s_mid_initials = $s_contacts.s_mid_initials + #set $s_last_name = $s_contacts.s_last_name + #set $s_telephone = $s_contacts.s_telephone + #set $s_fax = $s_contacts.s_fax + #set $s_affiliation = $s_contacts.s_affiliation + #set $s_role = $s_contacts.s_role + #set $s_mail = $s_contacts.s_mail + #set $s_address = $s_contacts.s_address + #end if + + #if ($i_contacts.i_contacts_select=="show"): + #set $i_first_name = $i_contacts.i_first_name + #set $i_mid_initials = $i_contacts.i_mid_initials + #set $i_last_name = $i_contacts.i_last_name + #set $i_telephone = $i_contacts.i_telephone + #set $i_fax = $i_contacts.i_fax + #set $i_affiliation = $i_contacts.i_affiliation + #set $i_role = $i_contacts.i_role + #set $i_mail = $i_contacts.i_mail + #set $i_address = $i_contacts.i_address + #end if + + #if ($invest_meta.invest_select=="show"): + #set $i_submission_date = $invest_meta.i_submission_date + #set $i_release_date = $invest_meta.i_release_date + #set $i_description = $invest_meta.i_description + #set $i_pubmed = $invest_meta.i_pubmed + #set $i_pub_doi = $invest_meta.i_pub_doi + #set $i_pub_title = $invest_meta.i_pub_title + #set $i_pub_status = $invest_meta.i_pub_status + #set $i_pub_author = $invest_meta.i_pub_author + #end if + + #if ($exp_meta.exp_select=="show"): + #set $organism_text = $exp_meta.organism_text + #set $organism_ref = $exp_meta.organism_ref + #set $organism_iri = $exp_meta.organism_iri + #set $organism_variant_text = $exp_meta.organism_variant_text + #set $organism_variant_ref = $exp_meta.organism_variant_ref + #set $organism_variant_iri = $exp_meta.organism_variant_iri + #set $organism_part_text = $exp_meta.organism_part_text + #set $organism_part_ref = $exp_meta.organism_part_ref + #set $organism_part_iri = $exp_meta.organism_part_iri + #end if + + + wrapper.py -inputzip "$inputzip" + -jsontxt "$jsontxt" + -html_file "$html_file" + -out_dir . + -study_title "$name_of_study" + --s_submission_date "$s_submission_date" + --s_release_date "$s_release_date" + --s_description "$s_description" + --s_pubmed "$s_pubmed" + --s_pub_doi "$s_pub_doi" + --s_pub_status "$s_pub_status" + --s_pub_title "$s_pub_title" + --s_pub_author "$s_pub_author" + --s_first_name "$s_first_name" + --s_mid_initials "$s_mid_initials" + --s_last_name "$s_last_name" + --s_telephone "$s_telephone" + --s_fax "$s_fax" + --s_affiliation "$s_affiliation" + --s_role "$s_role" + --s_mail "$s_mail" + --s_address "$s_address" + --i_submission_date "$i_submission_date" + --i_release_date "$i_release_date" + --i_description "$i_description" + --i_pubmed "$i_pubmed" + --i_pub_doi "$i_pub_doi" + --i_pub_title "$i_pub_title" + --i_pub_status "$i_pub_status" + --i_pub_author "$i_pub_author" + --i_first_name "$i_first_name" + --i_mid_initials "$i_mid_initials" + --i_last_name "$i_last_name" + --i_telephone "$i_telephone" + --i_fax "$i_fax" + --i_affiliation "$i_affiliation" + --i_role "$i_role" + --i_mail "$i_mail" + --i_address "$i_address" + --organism_text "$organism_text" + --organism_ref "$organism_ref" + --organism_iri "$organism_iri" + --organism_variant_text "$organism_variant_text" + --organism_variant_ref "$organism_variant_ref" + --organism_variant_iri "$organism_variant_iri" + --organism_part_text "$organism_part_text" + --organism_part_ref "$organism_part_ref" + --organism_part_iri "$organism_part_iri"; + + ln -s ./"$name_of_study" study_dir; + + cd study_dir; + zip isa.zip i_* a_* s_* && mv isa.zip "$ISA_zip"; + ]]> + </command> + + <inputs> + <param name="name_of_study" type="text" label="Name study" help="This should not contain any spaces as the name will be used a prefix for ISA-tab file names" /> + <param format="zip" name="inputzip" type="data" label="nmrML zip file" help="A zipped folder of nmrML files"/> + <param optional="true" format="txt" name="jsontxt" type="data" label="Additional user Metadata in json" help="A user can add additional metadata directory through a json see link for example format"/> + <expand macro="studymacro"/> + <expand macro="investmacro"/> + <expand macro="expmacro"/> + <expand macro="scontactmacro"/> + <expand macro="icontactmacro"/> + </inputs> + <outputs> +<!-- +Notes: + +- Multiple a_ files +- Single s_ as per mzml2isa definition (ISA does allow more than one s_ file). +- Single i_ file. + +The html output is now redundant, have left as hidden for now in case we revert back later. However, +this would require changing the out_dir for wrapper.py back to $html_file.extra_files_path. i.e. +'wrapper.py -out_dir $html_file.extra_files_path' + +--> + <data format="html" name="html_file" label="" hidden="true" /> + <data name="ISA_zip" format="zip" label="ISA Zip file"/> + <collection type="list" label="A Files" name="a_files"> + <discover_datasets pattern="(?P<designation>a_.+)\.txt" directory="study_dir" format="tabular"/> + </collection> + <collection type="list" label="S Files" name="s_files"> + <discover_datasets pattern="(?P<designation>s_.+)\.txt" directory="study_dir" format="tabular"/> + </collection> + <data name="i_file" format="tabular" label="I File" from_work_dir="study_dir/i_Investigation.txt" visible="true"/> + </outputs> + <tests> + <test> + <param name="name_of_study" value="test" /> + <param name="inputzip" value="metabolomics_study.zip" ftype="zip" /> + <output name="html_file" value="metabolomics_study/test/index.html" /> + <output name="i_file" value="metabolomics_study/test/i_Investigation.txt" /> + <output_collection name="a_files" type="list" count="1"> + <element name="a_test_metabolite_profiling_NMR_spectroscopy"> + <assert_contents> + <has_n_columns n="81" /> + </assert_contents> + </element> + </output_collection> + <output_collection name="s_files" type="list" count="1"> + <element name="s_test"> + <assert_contents> + <has_n_columns n="12" /> + </assert_contents> + </element> + </output_collection> + </test> + </tests> + <help><![CDATA[ +**Overview** + A program to automatically generate ISA-Tab metadata files from nmrML data files. + + Additional meta-information not found within the nmrML file can be added either through a JSON file or via the drop + down menus. However, it is recommended that the nmrML2ISA tool is used to create a semi-completed ISA-Tab file structure + that is further annotated using ISAcreator https://github.com/ISA-tools/ISAcreator + + ]]></help> + <citations> + <citation type="doi">10.1002/0471250953.bi1413s53</citation> + <citation type="doi">10.1007/s11306-015-0879-3</citation> + <citation type="doi">10.1038/ng.1054</citation> + </citations> +</tool> + + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/nmrml2isa_macros.xml Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,112 @@ +<macros> + <xml name="studymacro" > + <conditional name="study_meta"> + <param name="study_select" type="select" label="Add study meta" help=""> + <option value="hide" selected="true">Hide</option> + <option value="show">Show</option> + </param> + <when value="hide"/> + <when value="show"> + <!--<param name="study_title" type="text" label="Study Title"/>--> + <param name="s_submission_date" type="text" label="Submission date" help="Date in format YYYY-MM-DD e.g 2016-07-03"/> + <param name="s_release_date" type="text" label="Release date" help="Date in format YYYY-MM-DD e.g 2016-07-03"/> + <param name="s_description" type="text" label="Description" size="30" help="Short description of the study"/> + <param name="s_pubmed" type="text" label="Publication PubMed identifier"/> + <param name="s_pub_doi" type="text" label="Publication DOI"/> + <param name="s_pub_title" type="text" label="Publication Title"/> + <param name="s_pub_status" type="select" label="Publication Status" dynamic_options = "getNames('status')"/> + <param name="s_pub_author" type="text" label="Publication Authors"/> + + </when> + </conditional> + </xml> + + <xml name="investmacro"> + <conditional name="invest_meta"> + <param name="invest_select" type="select" label="Add investigation meta" help=""> + <option value="hide" selected="true">Hide</option> + <option value="show">Show</option> + </param> + <when value="hide"/> + <when value="show"> + <param name="i_submission_date" type="text" label="Submission date" help="Date in format YYYY-MM-DD e.g 2016-07-03"/> + <param name="i_release_date" type="text" label="Release date" help="Date in format YYYY-MM-DD e.g 2016-07-03"/> + <param name="i_description" type="text" label="Description" size="30" help="Short description of the investigation"/> + <param name="i_pubmed" type="text" label="Publication PubMed identifier"/> + <param name="i_pub_doi" type="text" label="Publication DOI"/> + <param name="i_pub_title" type="text" label="Publication Title"/> + <param name="i_pub_status" type="select" label="Publication Status" dynamic_options = "getNames('status')"/> + <param name="i_pub_author" type="text" label="Publication Authors"/> + </when> + </conditional> + </xml> + + <xml name="scontactmacro"> + <conditional name="s_contacts"> + <param name="s_contacts_select" type="select" label="Add contact (study)" help=""> + <option value="hide" selected="true">Hide</option> + <option value="show">Show</option> + </param> + <when value="hide"/> + <when value="show"> + <param name="s_first_name" type="text" label="First name" /> + <param name="s_mid_initials" type="text" label="Mid initials"/> + <param name="s_last_name" type="text" label="Last name"/> + <param name="s_telephone" type="text" label="Telephone"/> + <param name="s_fax" type="text" label="fax"/> + <param name="s_affiliation" type="text" label="Affiliation"/> + <param name="s_role" type="select" label="Role" help="Role in study publication" dynamic_options = "getNames('role')"/> + <param name="s_mail" type="text" label="Mail"/> + <param name="s_address" type="text" label="Address"/> + </when> + </conditional> + </xml> + + + <xml name="icontactmacro"> + <conditional name="i_contacts"> + <param name="i_contacts_select" type="select" label="Add contact (investigation)" help=""> + <option value="hide" selected="true">Hide</option> + <option value="show">Show</option> + </param> + <when value="hide"/> + <when value="show"> + <param name="i_first_name" type="text" label="First name" /> + <param name="i_mid_initials" type="text" label="Mid initials"/> + <param name="i_last_name" type="text" label="Last name"/> + <param name="i_telephone" type="text" label="Telephone"/> + <param name="i_fax" type="text" label="fax"/> + <param name="i_affiliation" type="text" label="Affiliation"/> + <param name="i_role" type="select" label="Role" help="Role in investigation publication" dynamic_options = "getNames('role')"/> + <param name="i_mail" type="text" label="Mail"/> + <param name="i_address" type="text" label="Address"/> + </when> + </conditional> + </xml> + + + + <xml name="expmacro"> + <conditional name="exp_meta"> + <param name="exp_select" type="select" label="Add experimental meta" help=""> + <option value="hide" selected="true">Hide</option> + <option value="show">Show</option> + </param> + <when value="hide"/> + + <when value="show"> + <param name="organism_text" type="text" label="Organism name (text)" help="Ontological names can be search for on http://www.ontobee.org/ e.g. Homo sapiens"/> + <param name="organism_ref" type="text" label="Organism name (ontology reference)" help="e.g. NCBITAXON"/> + <param name="organism_iri" type="text" label="Organism name (link to ontology source)" help="e.g. http://purl.obolibrary.org/obo/NCBITaxon_9606"/> + <param name="organism_variant_text" type="text" label="Organism variant (text)" help="e.g. Saccharomyces cerevisiae M3836" /> + <param name="organism_variant_ref" type="text" label="Organism variant (ontology reference)" help="e.g. NCBITAXON"/> + <param name="organism_variant_iri" type="text" label="Organism variant (link to ontology source)" help="e.g. http://purl.obolibrary.org/obo/NCBITaxon_1162671"/> + <param name="organism_part_text" type="text" label="Organism part (text)" help="e.g. lacrimal artery"/> + <param name="organism_part_ref" type="text" label="Organism part (ontology reference)" help="e.g. UBERON"/> + <param name="organism_part_iri" type="text" label="Organism part (link to ontology source)" help="e.g. http://purl.obolibrary.org/obo/UBERON_0001622"/> + + </when> + </conditional> + </xml> + +</macros>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/ontology_search.py Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,33 @@ +#!/usr/bin/python +import os +import csv +import inspect + + +def getNames(source="role"): + + + filename = inspect.getframeinfo(inspect.currentframe()).filename + path = os.path.dirname(os.path.abspath(filename)) + + + if source == "role": + tablepth = os.path.join(path, 'pub_role.loc') + elif source == "status": + tablepth = os.path.join(path, 'pub_status.loc') + else: + print "Table not recognised" + return "" + + print tablepth + + with open(tablepth, "rb") as csvfile: + reader = csv.reader(csvfile, delimiter='\t') + l = list(reader) + + l = [i + [""] for i in l] + + l.sort(key=lambda x: x[0]) + + return l +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/pub_role.loc Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,33 @@ +"Biographer" "http://purl.org/spar/pro/biographer" +"Critic" "http://purl.org/spar/pro/critic" +"Librarian" "http://purl.org/spar/pro/librarian" +"Illustrator" "http://purl.org/spar/pro/illustrator" +"Producer" "http://purl.org/spar/pro/producer" +"Ghost writer" "http://purl.org/spar/pro/ghost-writer" +"Deputy editor" "http://purl.org/spar/pro/deputy-editor" +"Senior editor" "http://purl.org/spar/pro/senior-editor" +"Production editor" "http://purl.org/spar/pro/production-editor" +"Author" "http://purl.org/spar/pro/author" +"Author's agent" "http://purl.org/spar/pro/authors-agent" +"Translator" "http://purl.org/spar/pro/translator" +"Commissioning editor" "http://purl.org/spar/pro/commissioning-editor" +"Publisher" "http://purl.org/spar/pro/publisher" +"Proof reader" "http://purl.org/spar/pro/proof-reader" +"Managing editor" "http://purl.org/spar/pro/managing-editor" +"Copy editor" "http://purl.org/spar/pro/copy-editor" +"Journalist" "http://purl.org/spar/pro/journalist" +"Blogger" "http://purl.org/spar/pro/blogger" +"Guest editor" "http://purl.org/spar/pro/guest-editor" +"Reader" "http://purl.org/spar/pro/reader" +"Contributor" "http://purl.org/spar/pro/contributor" +"Reviewer" "http://purl.org/spar/pro/reviewer" +"Printer" "http://purl.org/spar/pro/printer" +"Editor" "http://purl.org/spar/pro/editor" +"Executive editor" "http://purl.org/spar/pro/executive-editor" +"Archivist" "http://purl.org/spar/pro/archivist" +"Distributor" "http://purl.org/spar/pro/distributor" +"Copyright owner" "http://purl.org/spar/pro/copyright-owner" +"Compiler" "http://purl.org/spar/pro/compiler" +"Peer reviewer" "http://purl.org/spar/pro/peer-reviewer" +"Editor-in-chief" "http://purl.org/spar/pro/editor-in-chief" +"Series editor" "http://purl.org/spar/pro/series-editor"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/pub_status.loc Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,36 @@ +"Peer reviewed" "http://purl.org/spar/pso/peer-reviewed" +"Published" "http://purl.org/spar/pso/published" +"Draft" "http://purl.org/spar/pso/draft" +"Anonymized" "http://purl.org/spar/pso/anonymized" +"Intermediate draft" "http://purl.org/spar/pso/intermediate-draft" +"Republished" "http://purl.org/spar/pso/republished" +"Open access" "http://purl.org/spar/pso/open-access" +"Closed access" "http://purl.org/spar/pso/closed-access" +"Under review" "http://purl.org/spar/pso/under-review" +"Corrected" "http://purl.org/spar/pso/corrected" +"Confidential" "http://purl.org/spar/pso/confidential" +"Rejected for publication" "http://purl.org/spar/pso/rejected-for-publication" +"Unpublished" "http://purl.org/spar/pso/unpublished" +"Catalogued" "http://purl.org/spar/pso/catalogued" +"Enhanced" "http://purl.org/spar/pso/enhanced" +"Green open access" "http://purl.org/spar/pso/green-open-access" +"Reviewed" "http://purl.org/spar/pso/reviewed" +"Restricted access" "http://purl.org/spar/pso/restricted-access" +"Withdrawn from submission" "http://purl.org/spar/pso/withdrawn-from-submission" +"Embargoed" "http://purl.org/spar/pso/embargoed" +"Revised" "http://purl.org/spar/pso/revised" +"Accepted for publication" "http://purl.org/spar/pso/accepted-for-publication" +"Final draft" "http://purl.org/spar/pso/final-draft" +"Archived" "http://purl.org/spar/pso/archived" +"Proof" "http://purl.org/spar/pso/proof" +"Version of record" "http://purl.org/spar/pso/version-of-record" +"Gold open access" "http://purl.org/spar/pso/gold-open-access" +"Gratis open access" "http://purl.org/spar/pso/gratis-open-access" +"Subscription access" "http://purl.org/spar/pso/subscription-access" +"Non-confidential" "http://purl.org/spar/pso/non-confidential" +"Initial draft" "http://purl.org/spar/pso/initial-draft" +"Retracted from publication" "http://purl.org/spar/pso/retracted-from-publication" +"Copy-edited" "http://purl.org/spar/pso/copy-edited" +"Submitted" "http://purl.org/spar/pso/submitted" +"Libre open access" "http://purl.org/spar/pso/libre-open-access" +"In press" "http://purl.org/spar/pso/in-press"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/shed.yml Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,15 @@ +name: nmrml2isa +owner: rjmweber +description: Contains a tool dependency definition that downloads and extract version 0.2.1 of nmrml2isa. +homepage_url: https://github.com/ISA-tools/nmrml2isa +long_description: nmrml2isa is a Python program that can be used to generate an ISA-Tab structure out of nmrML files, providing the backbone of a study which can then be edited with an ISA editing tool (see MetaboLights pre-packaged ISA Creator - http://www.ebi.ac.uk/metabolights/) +remote_repository_url: https://github.com/ISA-tools/nmrml2isa +type: unrestricted +categories: + - "Metabolomics" +include: + - nmrml2isa.xml + - static/images/** + - test-data/** + - README.rst +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/test-data/metabolomics_study/test/a_test_metabolite_profiling_NMR_spectroscopy.txt Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,4 @@ +"Sample Name" "Protocol REF" "Parameter Value[Extraction Method]" "Term Source REF" "Term Accession Number" "Extract Name" "Protocol REF" "Parameter Value[NMR tube type]" "Term Source REF" "Term Accession Number" "Parameter Value[Solvent]" "Term Source REF" "Term Accession Number" "Parameter Value[Sample pH]" "Parameter Value[Temperature]" "Unit" "Term Source REF" "Term Accession Number" "Labeled Extract Name" "Label" "Term Source REF" "Term Accession Number" "Protocol REF" "Parameter Value[Instrument manufacturer]" "Term Source REF" "Term Accession Number" "Parameter Value[Instrument]" "Term Source REF" "Term Accession Number" "Parameter Value[NMR Probe]" "Term Source REF" "Term Accession Number" "Parameter Value[Instrument software]" "Term Source REF" "Term Accession Number" "Parameter Value[Instrument software version]" "Parameter Value[Acquisition Nucleus]" "Term Source REF" "Term Accession Number" "Parameter Value[Number of transients]" "Parameter Value[Number of steady state scans]" "Parameter Value[Pulse sequence]" "Term Source REF" "Term Accession Number" "Parameter Value[Pulse Width]" "Unit" "Term Source REF" "Term Accession Number" "Parameter Value[Sweep Width]" "Unit" "Term Source REF" "Term Accession Number" "Parameter Value[Relaxation Delay]" "Unit" "Term Source REF" "Term Accession Number" "Parameter Value[Magnetic field strength]" "Unit" "Term Source REF" "Term Accession Number" "Parameter Value[Acquisition Parameter Data Format]" "Term Source REF" "Term Accession Number" "Protocol REF" "NMR Assay Name" "Free Induction Decay Data File" "Protocol REF" "Normalization Name" "Derived Spectral Data File" "Protocol REF" "Parameter Value[Data transformation software]" "Term Source REF" "Term Accession Number" "Parameter Value[Data Transformation software version]" "Data Transformation Name" "Term Source REF" "Term Accession Number" "Data Transformation Name" "Term Source REF" "Term Accession Number" "Metabolite Assignment File" +"ADG10003u_007" "Extraction" "" "" "" "" "NMR sample" "Sample-tube" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400132" "" "" "" "" "300.0" "kelvin" "UO" "http://purl.obolibrary.org/obo/UO_0000012" "" "" "" "" "NMR spectroscopy" "Bruker" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400256" "Bruker NMR instrument" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400198" "5 mm PATXI 1H-13C/15N XYZ-GRD Z561501/0002" "" "" "Bruker UXNMR/XWIN-NMR format" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400320" "Version 3.5" "hydrogen atom" "CHEBI" "http://purl.obolibrary.org/obo/CHEBI_49637" "128" "8" "noesypr1d" "" "" "7.75" "microsecond" "UO" "http://purl.obolibrary.org/obo/UO_0000029" "14005.602241" "hertz" "UO" "http://purl.obolibrary.org/obo/UO_0000106" "3.0" "second" "UO" "http://purl.obolibrary.org/obo/UO_0000010" "16.438" "tesla" "UO" "http://purl.obolibrary.org/obo/UO_0000228" "Bruker UXNMR/XWIN-NMR format" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400320" "NMR assay" "ADG10003u_007" "ADG10003u_007/10/fid" "Data transformation" "" "<zipfile.ZipExtFile object at 0x7f28f715f390>" "Metabolite identification" "Bruker UXNMR/XWIN-NMR format" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400320" "Version 3.5" "phase correction" "NMRCV" "http://nmrML.org/nmrCV#NMR:1000071" "fourier transformation" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400044" "" +"ADG10003u_008" "Extraction" "" "" "" "" "NMR sample" "Sample-tube" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400132" "" "" "" "" "300.0" "kelvin" "UO" "http://purl.obolibrary.org/obo/UO_0000012" "" "" "" "" "NMR spectroscopy" "Bruker" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400256" "Bruker NMR instrument" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400198" "5 mm PATXI 1H-13C/15N XYZ-GRD Z561501/0002" "" "" "Bruker UXNMR/XWIN-NMR format" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400320" "Version 3.5" "hydrogen atom" "CHEBI" "http://purl.obolibrary.org/obo/CHEBI_49637" "128" "8" "noesypr1d" "" "" "7.86" "microsecond" "UO" "http://purl.obolibrary.org/obo/UO_0000029" "14005.602241" "hertz" "UO" "http://purl.obolibrary.org/obo/UO_0000106" "3.0" "second" "UO" "http://purl.obolibrary.org/obo/UO_0000010" "16.438" "tesla" "UO" "http://purl.obolibrary.org/obo/UO_0000228" "Bruker UXNMR/XWIN-NMR format" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400320" "NMR assay" "ADG10003u_008" "ADG10003u_008/10/fid" "Data transformation" "" "<zipfile.ZipExtFile object at 0x7f28f715f3d0>" "Metabolite identification" "Bruker UXNMR/XWIN-NMR format" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400320" "Version 3.5" "phase correction" "NMRCV" "http://nmrML.org/nmrCV#NMR:1000071" "fourier transformation" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400044" "" +"ADG10003u_009" "Extraction" "" "" "" "" "NMR sample" "Sample-tube" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400132" "" "" "" "" "300.0" "kelvin" "UO" "http://purl.obolibrary.org/obo/UO_0000012" "" "" "" "" "NMR spectroscopy" "Bruker" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400256" "Bruker NMR instrument" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400198" "5 mm PATXI 1H-13C/15N XYZ-GRD Z561501/0002" "" "" "Bruker UXNMR/XWIN-NMR format" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400320" "Version 3.5" "hydrogen atom" "CHEBI" "http://purl.obolibrary.org/obo/CHEBI_49637" "128" "8" "noesypr1d" "" "" "8.16" "microsecond" "UO" "http://purl.obolibrary.org/obo/UO_0000029" "14005.602241" "hertz" "UO" "http://purl.obolibrary.org/obo/UO_0000106" "3.0" "second" "UO" "http://purl.obolibrary.org/obo/UO_0000010" "16.438" "tesla" "UO" "http://purl.obolibrary.org/obo/UO_0000228" "Bruker UXNMR/XWIN-NMR format" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400320" "NMR assay" "ADG10003u_009" "ADG10003u_009/10/fid" "Data transformation" "" "<zipfile.ZipExtFile object at 0x7f28f715f450>" "Metabolite identification" "Bruker UXNMR/XWIN-NMR format" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400320" "Version 3.5" "phase correction" "NMRCV" "http://nmrML.org/nmrCV#NMR:1000071" "fourier transformation" "NMRCV" "http://nmrML.org/nmrCV#NMR:1400044" ""
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/test-data/metabolomics_study/test/i_Investigation.txt Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,94 @@ +ONTOLOGY SOURCE REFERENCE +Term Source Name "EFO" "CHMO" "OBI" "NCIT" "NMRCV" "UO" "CHEBI" +Term Source File "http://data.bioontology.org/ontologies/EFO" "http://data.bioontology.org/ontologies/CHMO" "http://data.bioontology.org/ontologies/OBI" "http://data.bioontology.org/ontologies/NCIT" "http://nmrml.org/cv/v1.0.rc1/nmrCV.owl" "http://purl.obolibrary.org/obo/uo.owl" "http://purl.bioontology.org/ontology/CHEBI" +Term Source Version "119" "12" "23" "34" "1.0.rc1" "1.2" "141" +Term Source Description "Experimental Factor Ontology" "Chemical Methods Ontology" "Ontology for Biomedical Investigations" "National Cancer Institute Thesaurus" "NMR Controled Vocabulary" "Units of measurement Ontology" "Chemical Entities of Biological Interest" +INVESTIGATION +Investigation Identifier "test" +Investigation Title "Investigation" +Investigation Description "" +Investigation Submission Date "" +Investigation Public Release Date "" +Comment[Created With Configuration] "" +Comment[Last Opened With Configuration] "" +Comment[Created with Tool] "nmrml2isa 0.3.0" +INVESTIGATION PUBLICATIONS +Investigation PubMed ID "" "" "" "" "" +Investigation Publication DOI "" "" "" "" "" +Investigation Publication Author List "" "" "" "" "" +Investigation Publication Title "" "" "" "" "" +Investigation Publication Status "" "" "" "" "" +Investigation Publication Status Term Accession Number "" "" "" "" "" +Investigation Publication Status Term Source REF "" "" "" "" "" +INVESTIGATION CONTACTS +Investigation Person Last Name "" +Investigation Person First Name "" +Investigation Person Mid Initials "" +Investigation Person Email "" +Investigation Person Phone "" +Investigation Person Fax "" +Investigation Person Address "" +Investigation Person Affiliation "" +Investigation Person Roles "" +Investigation Person Roles Term Accession Number "" +Investigation Person Roles Term Source REF "" +STUDY +Study Identifier "test" +Study Title "test" +Study Description "" +Study Submission Date "" +Study Public Release Date "" +Study File Name "s_test.txt" +STUDY DESIGN DESCRIPTORS +Study Design Type "" +Study Design Type Term Accession Number "" +Study Design Type Term Source REF "" +STUDY PUBLICATIONS +Study PubMed ID "" +Study Publication DOI "" +Study Publication Author List "" +Study Publication Title "" +Study Publication Status "" +Study Publication Status Term Accession Number "" +Study Publication Status Term Source REF "PSO" +STUDY FACTORS +Study Factor Name "" +Study Factor Type "" +Study Factor Type Term Accession Number "" +Study Factor Type Term Source REF "" +STUDY ASSAYS +Study Assay File Name "a_test_metabolite_profiling_NMR_spectroscopy.txt" +Study Assay Measurement Type "metabolite profiling" +Study Assay Measurement Type Term Accession Number "http://purl.obolibrary.org/obo/OBI_0000366" +Study Assay Measurement Type Term Source REF "OBI" +Study Assay Technology Type "NMR spectroscopy" +Study Assay Technology Type Term Accession Number "http://purl.obolibrary.org/obo/OBI_0000623" +Study Assay Technology Type Term Source REF "OBI" +Study Assay Technology Platform "{'ref': 'NMRCV', 'name': 'Bruker NMR instrument', 'accession': 'http://nmrML.org/nmrCV#NMR:1400198'}" +STUDY PROTOCOLS +Study Protocol Name "Extraction" "NMR sample" "NMR spectroscopy" "NMR assay" "Data transformation" "Metabolite identification" "Sample collection" +Study Protocol Type "Extraction" "NMR sample" "NMR spectroscopy" "NMR assay" "Data transformation" "Metabolite identification" "Sample collection" +Study Protocol Type Term Accession Number "" "" "" "" "" "" "" +Study Protocol Type Term Source REF "" "" "" "" "" "" "" +Study Protocol Description "" "" "" "" "" "" "" +Study Protocol URI "" "" "" "" "" "" "" +Study Protocol Version "" "" "" "" "" "" "" +Study Protocol Parameters Name "Extraction Method" "NMR tube type;Temperature;Sample pH;Solvent" "Magnetic field strength;Pulse sequence name;Instrument;NMR Probe;Number of transients" "" "" "" "" +Study Protocol Parameters Name Term Accession Number "" ";;;" ";;;;" "" "" "" "" +Study Protocol Parameters Name Term Source REF "" ";;;" ";;;;" "" "" "" "" +Study Protocol Components Name "" "" "" "" "" "" "" +Study Protocol Components Type "" "" "" "" "" "" "" +Study Protocol Components Type Term Accession Number "" "" "" "" "" "" "" +Study Protocol Components Type Term Source REF "" "" "" "" "" "" "" +STUDY CONTACTS +Study Person Last Name "mse" +Study Person First Name "" +Study Person Mid Initials "" +Study Person Email "" +Study Person Phone "" +Study Person Fax "" +Study Person Address "" +Study Person Affiliation "" +Study Person Roles "" +Study Person Roles Term Accession Number "" +Study Person Roles Term Source REF ""
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/test-data/metabolomics_study/test/index.html Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,1 @@ +<a href="test/a_test_metabolite_profiling_NMR_spectroscopy.txt">a_test_metabolite_profiling_NMR_spectroscopy.txt</a><br/><a href="test/i_Investigation.txt">i_Investigation.txt</a><br/><a href="test/s_test.txt">s_test.txt</a><br/> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/test-data/metabolomics_study/test/s_test.txt Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,4 @@ +"Source Name" "Characteristics[Organism]" "Term Source REF" "Term Accession Number" "Characteristics[Organism variant]" "Term Source REF" "Term Accession Number" "Characteristics[Organism part]" "Term Source REF" "Term Accession Number" "Protocol REF" "Sample Name" +"" "" "" "" "" "" "" "" "" "" "Sample collection" "ADG10003u_007" +"" "" "" "" "" "" "" "" "" "" "Sample collection" "ADG10003u_008" +"" "" "" "" "" "" "" "" "" "" "Sample collection" "ADG10003u_009"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/tool-data/get_status_ont.py Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,51 @@ +import sys +import os +import json +import urllib.error +import urllib.request as rq +from urllib.parse import quote +import csv + +############################################################################### +# Python3 script to get tab seperated maf_index.loc files for drop down menus +############################################################################### +# Code modified from mzm2isa-qt python package developed by Martin Larralde +# https://github.com/althonos/mzml2isa-qt/scrapers.py + + +def get_ont_loc(jsonSourceUrl, sparName, ontoClass, filepth): + onto = json.loads(rq.urlopen(jsonSourceUrl).read().decode('utf-8')) + info = [] + for x in onto: + if '@type' in x: + if ontoClass in x['@type']: + info.append(x) + info = [ (x['http://www.w3.org/2000/01/rdf-schema#label'],x['@id']) for x in info ] + + ontd = {x[0]['@value'].capitalize():y for (x,y) in info} + + with open(filepth, 'w') as f: + writer = csv.writer(f, delimiter='\t', quoting=csv.QUOTE_ALL) + writer.writerow(["name", "link"]) + for key, value in ontd.items(): + writer.writerow([key, value]) + + return ontd + +#------------------------------- +# publication status ontology +#------------------------------- +jsonSourceUrl = "http://www.sparontologies.net/ontologies/pso/source.json" +sparName = "pso" +ontoClass = "http://purl.org/spar/pso/PublicationStatus" +get_ont_loc(jsonSourceUrl, sparName, ontoClass, './pub_status.loc') + +#------------------------------- +# Job role ontology +#------------------------------- +jsonSourceUrl = "http://www.sparontologies.net/ontologies/pro/source.json" +sparName = "pro" +ontoClass = "http://purl.org/spar/pro/PublishingRole" +get_ont_loc(jsonSourceUrl, sparName, ontoClass, './pub_role.loc') + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/galaxy/nmrml2isa/wrapper.py Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,229 @@ +#!/usr/bin/env python + +import sys +import json +import os +import argparse +import textwrap +import csv +import inspect + + +def ontology_lookup(name, table): + # takes in ontology name and source (e.g. loc file) and outputs the associated accesion number + filename = inspect.getframeinfo(inspect.currentframe()).filename + path = os.path.dirname(os.path.abspath(filename)) + + # check if correct table + if table=="role": + tablepth = os.path.join(path, 'pub_role.loc') + elif table=="status": + tablepth = os.path.join(path, 'pub_status.loc') + else: + print "Table not recognised" + return "" + + with open(tablepth, "rb") as csvfile: + reader = csv.reader(csvfile, delimiter='\t') + ont_dict = dict((k, v) for k, v in reader) + try: + print ont_dict[name] + return ont_dict[name] + except KeyError: + return "" + + + +def main(): + + p = argparse.ArgumentParser(prog='PROG', + formatter_class=argparse.RawDescriptionHelpFormatter, + description='''nmrml2isa''', + epilog=textwrap.dedent('''\ + ------------------------------------------------------------------------- + ''')) + + + p.add_argument('-inputzip', dest='inputzip', required=True) + p.add_argument('-out_dir', dest='out_dir', required=True) + p.add_argument('-html_file', dest='html_file', required=True) + p.add_argument('-study_title', dest='study_title', required=True) + + p.add_argument('-jsontxt', dest='jsontxt', required=False, nargs='?') + + p.add_argument('--s_submission_date', dest='s_submission_date', required=False, default="", nargs='?') + p.add_argument('--s_release_date', dest='s_release_date', required=False, default="", nargs='?') + p.add_argument('--s_description', dest='s_description', required=False, default="", nargs='?') + p.add_argument('--s_pubmed', dest='s_pubmed', required=False, default="", nargs='?') + p.add_argument('--s_pub_doi', dest='s_pub_doi', required=False, default="", nargs='?') + p.add_argument('--s_pub_status', dest='s_pub_status', required=False, default="", nargs='?') + p.add_argument('--s_pub_author', dest='s_pub_author', required=False, default="", nargs='?') + p.add_argument('--s_pub_title', dest='s_pub_title', required=False, default="", nargs='?') + p.add_argument('--s_first_name', dest='s_first_name', required=False, default="", nargs='?') + p.add_argument('--s_mid_initials', dest='s_mid_initials', required=False, default="", nargs='?') + p.add_argument('--s_last_name', dest='s_last_name', required=False, default="", nargs='?') + p.add_argument('--s_telephone', dest='s_telephone', required=False, default="", nargs='?') + p.add_argument('--s_fax', dest='s_fax', required=False, default="", nargs='?') + p.add_argument('--s_affiliation', dest='s_affiliation', required=False, default="", nargs='?') + p.add_argument('--s_role', dest='s_role', required=False, default="", nargs='?') + p.add_argument('--s_mail', dest='s_mail', required=False, default="", nargs='?') + p.add_argument('--s_address', dest='s_address', required=False, default="", nargs='?') + p.add_argument('--i_submission_date', dest='i_submission_date', required=False, default="", nargs='?') + p.add_argument('--i_release_date', dest='i_release_date', required=False, default="", nargs='?') + p.add_argument('--i_description', dest='i_description', required=False, default="", nargs='?') + p.add_argument('--i_pubmed', dest='i_pubmed', required=False, default="", nargs='?') + p.add_argument('--i_pub_doi', dest='i_pub_doi', required=False, default="", nargs='?') + p.add_argument('--i_pub_title', dest='i_pub_title', required=False, default="", nargs='?') + p.add_argument('--i_pub_status', dest='i_pub_status', required=False, default="", nargs='?') + p.add_argument('--i_pub_author', dest='i_pub_author', required=False, default="", nargs='?') + p.add_argument('--i_first_name', dest='i_first_name', required=False, default="", nargs='?') + p.add_argument('--i_mid_initials', dest='i_mid_initials', required=False, default="", nargs='?') + p.add_argument('--i_last_name', dest='i_last_name', required=False, default="", nargs='?') + p.add_argument('--i_telephone', dest='i_telephone', required=False, default="", nargs='?') + p.add_argument('--i_fax', dest='i_fax', required=False, default="", nargs='?') + p.add_argument('--i_affiliation', dest='i_affiliation', required=False, default="", nargs='?') + p.add_argument('--i_role', dest='i_role', required=False, default="", nargs='?') + p.add_argument('--i_mail', dest='i_mail', required=False, default="", nargs='?') + p.add_argument('--i_address', dest='i_address', required=False, default="", nargs='?') + p.add_argument('--organism_text', dest='organism_text', required=False, default="", nargs='?') + p.add_argument('--organism_ref', dest='organism_ref', required=False, default="", nargs='?') + p.add_argument('--organism_iri', dest='organism_iri', required=False, default="", nargs='?') + p.add_argument('--organism_part_text', dest='organism_part_text', required=False, default="", nargs='?') + p.add_argument('--organism_part_ref', dest='organism_part_ref', required=False, default="", nargs='?') + p.add_argument('--organism_part_iri', dest='organism_part_iri', required=False, default="", nargs='?') + p.add_argument('--organism_variant_text', dest='organism_variant_text', required=False, default="", nargs='?') + p.add_argument('--organism_variant_ref', dest='organism_variant_ref', required=False, default="", nargs='?') + p.add_argument('--organism_variant_iri', dest='organism_variant_iri', required=False, default="", nargs='?') + + args = p.parse_args() + + USERMETA = {'characteristics': {'organism': {'name': '', 'accession': '', 'ref': ''}, + 'organism_variant': {'name': '', 'accession': '', 'ref': ''}, + 'organism_part': {'name': '', 'accession': '', 'ref': ''}, + }, + 'investigation': {'identifier': '', 'title': 'Investigation', 'description': '', + 'submission_date': '', 'release_date': '' + }, + 'investigation_publication': {'pubmed': '', 'doi': '', 'author_list': '', 'title': '', + 'status': {'name': '', 'accession': '', 'ref': 'PSO'}, + }, + + 'study': { + 'title': '', 'description': '', 'submission_date': '', 'release_date': '', + }, + 'study_publication': {'pubmed': '', 'doi': '', 'author_list': '', 'title': '', + 'status': {'name': '', 'accession': '', 'ref': 'PSO'}, + }, + + 'description': {'sample_collect': '', 'extraction': '', 'chroma': '', 'mass_spec': '', + 'data_trans': '', 'metabo_id': '' + }, + + # Multiple Values Parameters + 'study_contacts': [ + {'first_name': '', 'last_name': '', 'mid': '', 'email': '', + 'fax': '', 'phone': '', 'adress': '', 'affiliation': '', + 'roles': {'name': '', 'accession': '', 'ref': ''}, + }, + ], + + 'investigation_contacts': [ + {'first_name': '', 'last_name': '', 'mid': '', 'email': '', + 'fax': '', 'phone': '', 'adress': '', 'affiliation': '', + 'roles': {'name': '', 'accession': '', 'ref': ''}, + }, + ], + + } + + # check if using json file + if args.jsontxt and os.path.isfile(args.jsontxt): + with open(args.jsontxt, 'r') as f: + USERMETA = json.load(f) + else: + + # Fill in USERMETA dictionary + USERMETA['characteristics']['organism']['value'] = args.organism_text + USERMETA['characteristics']['organism']['accession'] = args.organism_iri + USERMETA['characteristics']['organism']['ref'] = args.organism_ref + + USERMETA['characteristics']['organism_variant']['value'] = args.organism_variant_text + USERMETA['characteristics']['organism_variant']['accession'] = args.organism_variant_iri + USERMETA['characteristics']['organism_variant']['ref'] = args.organism_variant_ref + + USERMETA['characteristics']['organism_part']['value'] = args.organism_part_text + USERMETA['characteristics']['organism_part']['accession'] = args.organism_part_iri + USERMETA['characteristics']['organism_part']['ref'] = args.organism_part_ref + + # USERMETA['investigation']['identifier'] = # uses study identifier + USERMETA['investigation']['description'] = args.i_description + USERMETA['investigation']['submission_date'] = args.i_submission_date + USERMETA['investigation']['release_date'] = args.i_release_date + + USERMETA['investigation_publication']['pubmed'] = args.i_pubmed + USERMETA['investigation_publication']['author_list'] = args.i_pub_author + USERMETA['investigation_publication']['title'] = args.i_pub_title + USERMETA['investigation_publication']['doi'] = args.i_pub_doi + USERMETA['investigation_publication']['status']['name'] = args.i_pub_status + USERMETA['investigation_publication']['status']['accession'] = ontology_lookup(args.i_pub_status, 'status') + + USERMETA['investigation_contacts'][0]['first_name'] = args.i_first_name + USERMETA['investigation_contacts'][0]['last_name'] = args.i_last_name + USERMETA['investigation_contacts'][0]['mid'] = args.i_mid_initials + USERMETA['investigation_contacts'][0]['email'] = args.i_mail + USERMETA['investigation_contacts'][0]['fax'] = args.i_fax + USERMETA['investigation_contacts'][0]['phone'] = args.i_telephone + USERMETA['investigation_contacts'][0]['adress'] = args.i_address + USERMETA['investigation_contacts'][0]['affiliation'] = args.i_affiliation + USERMETA['investigation_contacts'][0]['roles']['name'] = args.i_role + USERMETA['investigation_contacts'][0]['roles']['accession'] = ontology_lookup(args.i_role, 'role') + + USERMETA['study']['title'] = args.study_title + USERMETA['study']['description'] = args.s_description + USERMETA['study']['submission_date'] = args.s_submission_date + USERMETA['study']['release_date'] = args.s_release_date + + USERMETA['study_publication']['pubmed'] = args.s_pubmed + USERMETA['study_publication']['author_list'] = args.s_pub_author + USERMETA['study_publication']['title'] = args.s_pub_title + USERMETA['study_publication']['doi'] = args.s_pub_doi + USERMETA['study_publication']['status']['name'] = args.s_pub_status + USERMETA['study_publication']['status']['accession'] = ontology_lookup(args.s_pub_status, 'status') + + USERMETA['study_contacts'][0]['first_name'] = args.s_first_name + USERMETA['study_contacts'][0]['last_name'] = args.s_last_name + USERMETA['study_contacts'][0]['mid'] = args.s_mid_initials + USERMETA['study_contacts'][0]['email'] = args.s_mail + USERMETA['study_contacts'][0]['fax'] = args.s_fax + USERMETA['study_contacts'][0]['phone'] = args.s_telephone + USERMETA['study_contacts'][0]['adress'] = args.s_address + USERMETA['study_contacts'][0]['affiliation'] = args.s_affiliation + USERMETA['study_contacts'][0]['roles']['name'] = args.s_role + USERMETA['study_contacts'][0]['roles']['accession'] = ontology_lookup(args.s_role, 'role') + + + try: + from nmrml2isa.parsing import full_parse + # import progressbar as pb + # parse the files + full_parse(args.inputzip, args.out_dir, args.study_title, usermeta=USERMETA, verbose=True) + + except ImportError: + import tempfile + temp = tempfile.NamedTemporaryFile() + temp.write(json.dumps(USERMETA)) + temp.seek(0) + os.system("nmrml2isa -i %s -o %s -s %s -m %s" % (args.inputzip, args.out_dir, args.study_title, temp.name)) + temp.close() + + html_code = '<a href="%s/a_%s_metabolite_profiling_NMR_spectroscopy.txt">a_%s_metabolite_profiling_NMR_spectroscopy.txt</a>' \ + '<br/><a href="%s/i_Investigation.txt">i_Investigation.txt</a><br/>' \ + '<a href="%s/s_%s.txt">s_test.txt</a><br/>' % tuple([args.study_title] * 6) + + with open(args.html_file, 'wb') as f: + f.write(html_code) + + + +if __name__ == "__main__": + main()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmrml2isa-galaxy/test.sh Fri Feb 03 11:25:37 2017 -0500 @@ -0,0 +1,22 @@ +sudo apt-get install python-dev libxml2-dev libxslt1-dev zlib1g-dev +sudo apt-get install -y python-virtualenv +virtualenv planemo-venv +. planemo-venv/bin/activate +pip install --upgrade pip setuptools +pip install planemo +#planemo travis_before_install +#. .travis/env.sh # source environment created by planemo +export DOWNLOAD_CACHE=$HOME/download_cache +mkdir $DOWNLOAD_CACHE +#git clone https://github.com/ISA-tools/nmrml2isa-galaxy.git +planemo dependency_script -r packages/package_nmrml2isa_0_4_22/ +. env.sh +bash dep_install.sh +planemo test --galaxy_root=../galaxy galaxy/nmrml2isa/ +rm env.sh +rm dep_install.sh +deactivate #exit virtualenv +rm -r planemo-venv +rm -r lib + +