Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MetaboLights ISA slicer #1

Closed
djcomlab opened this issue Oct 26, 2016 · 1 comment
Closed

MetaboLights ISA slicer #1

djcomlab opened this issue Oct 26, 2016 · 1 comment
Assignees

Comments

@djcomlab
Copy link
Member

A utility to select data files from an ISA-Tab based on factor values.

Intended usage of mtbls.py functionality:

from isatools.io import mtbls

study_id = 'MTBLS1'

factor_names = mtbls.get_factor_names(study_id)
# response:
# {'Gender', 'Age'}

if 'Gender' in factor_names:
    factor_values = mtbls.get_factor_values(study_id, 'Gender')
    # response:
    # {'Male', 'Female'}

    query = { "Gender": "Male" }
    samples_and_files = mtbls.get_data_files(study_id, factor_query=query)
    # response:
    #  [
    #     {
    #        'sample': 'ADG10003u_007'},
    #        'data_files': ['ADG10003u_007.zip'],
    #        'query_used': {'Gender': 'Male'}
    #     }, ...
    #  ]

    for sample_and_files in samples_and_files:
        sample_name = sample_and_files['sample']
        data_files = sample_and_files['data_files']
        for data_file in data_files:
            # do something with the file name, e.g. make it an ftp URL.

The slicer should produce:

  • The list of data files/study files to be downloaded by another tool.
@djcomlab
Copy link
Member Author

Merged to upstream origin ISA-tools#156

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant