mg-rest-dm server

Methods

class rest.app.EndPoints[source]

Class to handle the http requests for returning information about the end points

get()[source]

GET list all end points

List of all of the end points for the current service.

Example

1
curl -X GET http://localhost:5002/mug/api/dmp
class rest.app.FileMeta[source]

Class to handle the http requests for retrieving the data from a file. This class is able to handle big[Bed|Wig] file and serve back the matching region in the relevant format. It is also possible to stream back the whole file of any type for use in other tools.

delete(*args, **kwargs)[source]

DELETE Remove a file from the DM API

Function to remove the file from teh DM API. This will result in the file being removed from the records and therefore not available within the VRE or from the RESTful interface

Parameters:
  • should be passed as the data block with the HTTP request (This) –
  • json (dict) –
    file_id : str
    ID of the stored file

Example

1
2
3
4
5
6
7
8
echo '{
    "file_id":"<file_id>"
}' > data.json

curl -X DELETE
    -H "Content-Type: application/json"
    -H "Authorization: Bearer teststring"
    -d @data.json http://localhost:5002/mug/api/dmp/file
get(*args, **kwargs)[source]

GET List values from the file

Call to optain regions from the conpressed index files for Bed, Wig and TSV based file formats that contain genomic information.

Other files can be streamed.

Parameters:file_id (str) – Identifier of the file to retrieve data from
Returns:Returns a formated in the relevant file type with any genomic features matching the format of the file.
Return type:file

Examples

1
curl -X GET http://localhost:5002/mug/api/dmp/track?file_id=test_file
post(*args, **kwargs)[source]

POST Add a new file to the DM API

Parameters:
  • should be passed as the data block with the HTTP request (This) –
  • json (dict) –
    user_id : str
    User identifier
    file_path : str
    Location of the file
    file_type : str
    Tag for the file extension. The valid parameters are defined within the DM API documentation (mg-dm-api)
    data_type : str
    What type of experiment is this data from. Options include
    RNA-seq ChIP-seq MNase-seq WGBS HiC
    taxon_id : int
    Taxonomic identifier for a species (Human = 9606)
    compressed
    Options of the compression level of the file. If file is not compressed then do not include this parameter
    source_id : list
    List of file_ids that were used for generating this file. If this is the root file then do not include this parameter.
    meta_data : dict
    Hash array describing the relevant metadata for the file, including the assembly if relevant
Returns:

Returns the id of the stored file

Return type:

file_id

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
echo '{
    "data_type": "RNA-seq",
    "file_type": "fastq",
    "meta_data": {
        "assembly" : "GRCh38"
    }, "taxon_id": 9606,
    "file_path": "/tmp/test/path/RNA-seq/testing_123.fastq",
    "parent_dir" "/tmp/test/path/RNA-seq/",
    "size": 64000,
}' > data.json

curl -X POST
    -H "Content-Type: application/json"
    -H "Authorization: Bearer teststring"
    -d @data.json http://localhost:5002/mug/api/dmp/file
put(*args, **kwargs)[source]

PUT Update meta data

Request to update the meta data for a given file. This allows for the adding or removal of key-value pairs from the meta data.

Parameters:
  • should be passed as the data block with the HTTP request (This) –
  • json (dict) –
    user_id : str
    User identifier
    file_id : str
    ID of the stored file
    type : str
    Options are ‘add_meta’ or ‘remove_meta’ to modify they key-value pairs for the file entry. Minimum sets of pairs are defined within the DM API (mg-dm-api)
    meta_data : dict
    Hash array describing the relevant metadata key-value pairs that are to be added
Returns:

Returns the id of the stored file

Return type:

file_id

Example

To add a new key value pair:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
echo '{
    "type":"add_meta",
    "file_id":"<file_id>",
    "meta_data":{"citation":"PMID:1234567890"}
}' > data.json

curl -X PUT
    -H "Content-Type: application/json"
    -H "Authorization: Bearer teststring"
    -d @data.json http://localhost:5002/mug/api/dmp/file

To remove a key value pair:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
echo '{
    "type":"remove_meta",
    "file_id":"<file_id>",
    "meta_data":["citation"]
}' > data.json

curl -X PUT
    -H "Content-Type: application/json"
    -H "Authorization: Bearer teststring"
    -d @data.json http://localhost:5002/mug/api/dmp/file

To modify a column value (file size):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
echo '{
    "type":"modify_column",
    "file_id":"<file_id>",
    "key":"<column_key>"
    "value":"<new_value>"
}' > data.json

curl -X PUT
    -H "Content-Type: application/json"
    -H "Authorization: Bearer teststring"
    -d @data.json http://localhost:5002/mug/api/dmp/file
class rest.app.Files[source]

Class to handle the http requests for retrieving the list of files for a given user handle

get(*args, **kwargs)[source]

GET List user tracks

Function to list the filess that are owned by a single user. It is possible to filter by assembly, file or data type, or to find track files that contain data for a given region

Parameters:
  • assembly (str) – Genome assembly accession
  • region (str) – <chromosome>:<start_pos>:<end_pos>
  • file_type (str) –
  • data_type (str) –

Example

1
curl -X GET http://localhost:5002/mug/api/dmp/Files?>
class rest.app.FileHistory[source]

Class to handle the http requests for retrieving the list of file history of a given file for a given user handle

get(*args, **kwargs)[source]

GET the list of files that were used for generating the defined file

Example

1
curl -X GET http://localhost:5002/mug/api/dmp/file_history?file_id=<file_id>
class rest.app.Ping[source]

Class to handle the http requests to ping a service

get()[source]

GET Status

List the current status of the service along with the relevant information about the version.

Example

1
curl -X GET http://localhost:5002/mug/api/dmp/ping