Difference between revisions of "Alternative Content Formats"

From BioDAS
Jump to: navigation, search
m (das-json sources)
m (whitespace)
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
List of alternative content formats:
+
==List of alternative content formats==
  
 
{|
 
{|
Line 13: Line 13:
 
|binary-bigbed||application/octet-stream||features
 
|binary-bigbed||application/octet-stream||features
 
|}
 
|}
 +
 +
==das-xml==
 +
 +
The XML formats described in the [http://www.biodas.org/documents/spec-1.6.html DAS Specification].
 +
  
 
==das-json==
 
==das-json==
  
This format is a native JSON encoding of the DAS data model. The design principle for this format is that the properties accurately match those in the specification, rather than the XML. Thus there are no distinctions made between elements, attributes and text content. Whilst this means that implementing a reciprocal XML-JSON conversion function must be done explicitly for each DAS command, using DAS in Javascript web applications is more natural.
+
This format is a native JSON encoding of the DAS data model. The design principle for this format is that the properties accurately match those in the specification wherever sensible, but are not bound by the restrictions or conventions of XML. Thus there are no distinctions made between elements/attributes/text content, and properties can be of any JSON data type. Whilst this means that implementing a reciprocal XML-JSON conversion function must be done explicitly for each DAS command, using DAS in Javascript web applications is more natural.
 +
 
 +
The properties present in the JSON model for each command mirror those in the [http://www.biodas.org/documents/spec-1.6.html DAS specification], with the same semantics applied to each property (e.g. whether properties are required or optional). Since this is a new format at for the avoidance of confusion, deprecated properties are not included. Some effort to consider potential future changes to the specification is made.
  
 
Currently, the ''das-json'' format is defined for the sources, features and types commands.
 
Currently, the ''das-json'' format is defined for the sources, features and types commands.
  
===das-json sources===
+
===das-json sources command===
  
 
<pre>
 
<pre>
Line 29: Line 36:
 
             "title"      : "My Genes",
 
             "title"      : "My Genes",
 
             "description" : "A source that provides gene features",
 
             "description" : "A source that provides gene features",
             "maintainer" : {
+
            "doc_href"    : "http://myplace.com/info/mysource",
 +
             "maintainer" : {
 
                 "email": "me@myplace.com"
 
                 "email": "me@myplace.com"
 
             },
 
             },
            "doc_href" : "http://myplace.com/info/mysource",
 
 
             "versions" : [
 
             "versions" : [
 
                 {
 
                 {
Line 41: Line 48:
 
                           "type"      : "das1:sources",
 
                           "type"      : "das1:sources",
 
                           "query_uri" : "http://myplace.com/das/mygenes"
 
                           "query_uri" : "http://myplace.com/das/mygenes"
 +
                        },
 +
                        {
 +
                          "type"      : "das1:formats",
 +
                          "query_uri" : "http://myplace.com/das/mygenes/formats"
 
                         },
 
                         },
 
                         {
 
                         {
Line 55: Line 66:
 
                             "source"    : "Chromosome",
 
                             "source"    : "Chromosome",
 
                             "taxid"      : 10090,
 
                             "taxid"      : 10090,
                             "test_range" : "8:1,100"
+
                             "test_range" : "8:1,1000"
 
                         }
 
                         }
 
                     ],
 
                     ],
Line 66: Line 77:
 
                 }
 
                 }
 
             ]
 
             ]
 +
        }
 +
    ]
 +
}
 +
</pre>
 +
 +
===das-json features command===
 +
 +
The below example is a contrived response for a request with four parameters segments: one valid segment, one an unknown segment (i.e. the annotation server doesn't recognise the segment ID), another an error segment (start > end), and an unknown feature.
 +
 +
<pre>
 +
{
 +
    "href" : "http://myplace.com/das/mygenes/features?segment=8:1,1000&segment=foo:10,20&segment=21:5000,4000&feature_id=bar",
 +
    "errors" : [
 +
        {
 +
            "type" : "unknown-segment",
 +
            "id"  : "foo"
 +
        },
 +
        {
 +
            "type"  : "error-segment",
 +
            "id"    : "21",
 +
            "start" : 5000,
 +
            "stop"  : 4000,
 +
        },
 +
        {
 +
            "type" : "unknown-feature",
 +
            "id"  : "bar"
 +
        }
 +
    ],
 +
    "segments" : [
 +
        {
 +
            "id"      : "8",
 +
            "start"    : 1,
 +
            "stop"    : 1000,
 +
            "version"  : "xyz",
 +
            "label"    : "Chromosome 8",
 +
            "features" : [
 +
                {
 +
                    "id"          : "f1",
 +
                    "label"      : "F1",
 +
                    "start"      : 503,
 +
                    "end"        : 512,
 +
                    "orientation" : "+",
 +
                    "phase"      : 0,
 +
                    "score"      : "12.6",
 +
                    "type"        : {
 +
                        "id"        : "t1",
 +
                        "cvId"      : "SO:0000704",
 +
                        "label"      : "Gene",
 +
                        "category"  : "transcription",
 +
                        "reference"  : false,
 +
                        "superparts" : false,
 +
                        "subparts"  : false
 +
                    },
 +
                    "method" : {
 +
                        "id"    : "genewise",
 +
                        "cvId"  : "ECO:0000203",
 +
                        "label" : "GeneWise"
 +
                    },
 +
                    "notes" : [
 +
                        "Something of note",
 +
                        "Something else of note"
 +
                    ],
 +
                    "links" : [
 +
                        {
 +
                            "href"  : "http://myplace.com/info/features/f1",
 +
                            "label" : "More info about F1"
 +
                        }
 +
                    ],
 +
                    "targets" : [
 +
                        {
 +
                            "id"    : "cloneA",
 +
                            "label" : "Clone A",
 +
                            "start" : 3,
 +
                            "stop"  : 12
 +
                        }
 +
                    ],
 +
                    "parents" : [
 +
                        "f24",
 +
                        "f36"
 +
                    ],
 +
                    "parts" : [
 +
                        "f7",
 +
                        "f12"
 +
                    ]
 +
                }
 +
            ]
 +
        }
 +
    ]
 +
}
 +
</pre>
 +
 +
===das-json types command===
 +
 +
The below example is a contrived response for a request for three segments: one valid, one an unknown segment (i.e. the annotation server doesn't recognise the segment ID), and another an error segment (start > end).
 +
 +
<pre>
 +
{
 +
    "href" : "http://myplace.com/das/mygenes/types?segment=8:1,1000&segment=foo:10,20&segment=21:5000,4000",
 +
    "errors" : [
 +
        {
 +
            "type" : "unknown-segment",
 +
            "id"  : "foo"
 +
        },
 +
        {
 +
            "type"  : "error-segment",
 +
            "id"    : "21",
 +
            "start" : 5000,
 +
            "stop"  : 4000,
 +
        }
 +
    ],
 +
    "segments" : [
 +
        {
 +
            "id"      : "8",
 +
            "start"    : 1,
 +
            "stop"    : 1000,
 +
            "version"  : "xyz",
 +
            "label"    : "Chromosome 8",
 +
            "types"    : [
 +
                {
 +
                    "id"          : "t1",
 +
                    "cvId"        : "SO:0000704",
 +
                    "category"  : "transcription",
 +
                    "count"      : 1
 +
                },
 +
                {
 +
                    "id"          : "t2",
 +
                    "cvId"        : "SO:0000147",
 +
                    "category"  : "transcription",
 +
                    "count"      : 6
 +
                }
 +
            ]
 +
        }
 +
    ]
 +
}
 +
</pre>
 +
 +
===das-json sequence command===
 +
 +
The below example is a contrived response for a request for two segments: one valid, one an error segment (e.g. the reference server doesn't recognise the segment ID, or some other error with the start or end). Note that reference servers never serve "unknown segments", so the sequence command does not use these.
 +
 +
<pre>
 +
{
 +
    "href" : "http://myplace.com/das/mygenes/sequence?segment=8:10001,10060&segment=foo:10,20",
 +
    "errors" : [
 +
        {
 +
            "type"  : "error-segment",
 +
            "id"    : "foo",
 +
            "start" : 10,
 +
            "stop"  : 20,
 +
        }
 +
    ],
 +
    "segments" : [
 +
        {
 +
            "id"      : "8",
 +
            "start"    : 10001,
 +
            "stop"    : 10060,
 +
            "version"  : "xyz",
 +
            "label"    : "Chromosome 8",
 +
            "sequence" : "gcaattatgacacaaaaaattaaacagtgcagactgatatataaatcaaaacaaatgtcc"
 
         }
 
         }
 
     ]
 
     ]
 
}
 
}
 
</pre>
 
</pre>

Latest revision as of 03:49, 4 May 2012

List of alternative content formats

Name MIME type Commands
das-xml application/xml all
das-json application/json sources,features,types
binary-bigwig application/octet-stream features
binary-bigbed application/octet-stream features

das-xml

The XML formats described in the DAS Specification.


das-json

This format is a native JSON encoding of the DAS data model. The design principle for this format is that the properties accurately match those in the specification wherever sensible, but are not bound by the restrictions or conventions of XML. Thus there are no distinctions made between elements/attributes/text content, and properties can be of any JSON data type. Whilst this means that implementing a reciprocal XML-JSON conversion function must be done explicitly for each DAS command, using DAS in Javascript web applications is more natural.

The properties present in the JSON model for each command mirror those in the DAS specification, with the same semantics applied to each property (e.g. whether properties are required or optional). Since this is a new format at for the avoidance of confusion, deprecated properties are not included. Some effort to consider potential future changes to the specification is made.

Currently, the das-json format is defined for the sources, features and types commands.

das-json sources command

{
    "sources" : [
        {
            "uri"         : "mygenes",
            "title"       : "My Genes",
            "description" : "A source that provides gene features",
            "doc_href"    : "http://myplace.com/info/mysource",
            "maintainer"  : {
                "email": "me@myplace.com"
            },
            "versions" : [
                {
                    "uri"          : "mysource",
                    "created"      : "2012-03-27T14:23:44Z",
                    "capabilities" : [
                        {
                           "type"      : "das1:sources",
                           "query_uri" : "http://myplace.com/das/mygenes"
                        },
                        {
                           "type"      : "das1:formats",
                           "query_uri" : "http://myplace.com/das/mygenes/formats"
                        },
                        {
                           "type"      : "das1:features",
                           "query_uri" : "http://myplace.com/das/mygenes/features"
                        }
                    ],
                    "coordinates" : [
                        {
                            "uri"        : "http://www.dasregistry.org/dasregistry/coordsys/CS_DS108",
                            "label"      : "NCBIM_37,Chromosome,Mus musculus",
                            "authority"  : "NCBIM",
                            "version"    : "37",
                            "source"     : "Chromosome",
                            "taxid"      : 10090,
                            "test_range" : "8:1,1000"
                        }
                    ],
                    "properties" : [
                        {
                            "name"  : "Some Key",
                            "value" : "Some Value"
                        }
                    ]
                }
            ]
        }
    ]
}

das-json features command

The below example is a contrived response for a request with four parameters segments: one valid segment, one an unknown segment (i.e. the annotation server doesn't recognise the segment ID), another an error segment (start > end), and an unknown feature.

{
    "href" : "http://myplace.com/das/mygenes/features?segment=8:1,1000&segment=foo:10,20&segment=21:5000,4000&feature_id=bar",
    "errors" : [
        {
            "type" : "unknown-segment",
            "id"   : "foo"
        },
        {
            "type"  : "error-segment",
            "id"    : "21",
            "start" : 5000,
            "stop"  : 4000,
        },
        {
            "type" : "unknown-feature",
            "id"   : "bar"
        }
    ],
    "segments" : [
        {
            "id"       : "8",
            "start"    : 1,
            "stop"     : 1000,
            "version"  : "xyz",
            "label"    : "Chromosome 8",
            "features" : [
                {
                    "id"          : "f1",
                    "label"       : "F1",
                    "start"       : 503,
                    "end"         : 512,
                    "orientation" : "+",
                    "phase"       : 0,
                    "score"       : "12.6",
                    "type"        : {
                        "id"         : "t1",
                        "cvId"       : "SO:0000704",
                        "label"      : "Gene",
                        "category"   : "transcription",
                        "reference"  : false,
                        "superparts" : false,
                        "subparts"   : false
                    },
                    "method" : {
                        "id"    : "genewise",
                        "cvId"  : "ECO:0000203",
                        "label" : "GeneWise"
                    },
                    "notes" : [
                        "Something of note",
                        "Something else of note"
                    ],
                    "links" : [
                        {
                            "href"  : "http://myplace.com/info/features/f1",
                            "label" : "More info about F1"
                        }
                    ],
                    "targets" : [
                        {
                            "id"    : "cloneA",
                            "label" : "Clone A",
                            "start" : 3,
                            "stop"  : 12
                        }
                    ],
                    "parents" : [
                        "f24",
                        "f36"
                    ],
                    "parts" : [
                        "f7",
                        "f12"
                    ]
                }
            ]
        }
    ]
}

das-json types command

The below example is a contrived response for a request for three segments: one valid, one an unknown segment (i.e. the annotation server doesn't recognise the segment ID), and another an error segment (start > end).

{
    "href" : "http://myplace.com/das/mygenes/types?segment=8:1,1000&segment=foo:10,20&segment=21:5000,4000",
    "errors" : [
        {
            "type" : "unknown-segment",
            "id"   : "foo"
        },
        {
            "type"  : "error-segment",
            "id"    : "21",
            "start" : 5000,
            "stop"  : 4000,
        }
    ],
    "segments" : [
        {
            "id"       : "8",
            "start"    : 1,
            "stop"     : 1000,
            "version"  : "xyz",
            "label"    : "Chromosome 8",
            "types"    : [
                {
                    "id"          : "t1",
                    "cvId"        : "SO:0000704",
                    "category"   : "transcription",
                    "count"       : 1
                },
                {
                    "id"          : "t2",
                    "cvId"        : "SO:0000147",
                    "category"   : "transcription",
                    "count"       : 6
                }
            ]
        }
    ]
}

das-json sequence command

The below example is a contrived response for a request for two segments: one valid, one an error segment (e.g. the reference server doesn't recognise the segment ID, or some other error with the start or end). Note that reference servers never serve "unknown segments", so the sequence command does not use these.

{
    "href" : "http://myplace.com/das/mygenes/sequence?segment=8:10001,10060&segment=foo:10,20",
    "errors" : [
        {
            "type"  : "error-segment",
            "id"    : "foo",
            "start" : 10,
            "stop"  : 20,
        }
    ],
    "segments" : [
        {
            "id"       : "8",
            "start"    : 10001,
            "stop"     : 10060,
            "version"  : "xyz",
            "label"    : "Chromosome 8",
            "sequence" : "gcaattatgacacaaaaaattaaacagtgcagactgatatataaatcaaaacaaatgtcc"
        }
    ]
}