These examples illustrate configuring a custom web service to fetch features for a track.
(1) In the first example we configure a simple web service that fetches bed records definig cytobads. This service requires no parameter manipulation or result mapping. Track configuration:
{ name: "Cytobands", type: "annotation", sourceType: "custom", source: { url: "https://lk85l6ycte.execute-api.us-east-1.amazonaws.com/dev/testservice/bands?chr=$CHR&start=$START&end=$END", contentType: "application/json" } }
(2) In the second example we configure configure a cBio web service to fetch copy number segments. This service uses a combination of query and POST parameters to specify the requested segments. The source url is a function which checks and modifies the input chr name to conform to the webservice requirements. The returned json properties must be mapped to conform to igv.js expectations. This is specified in the "mapping" object. Track configuration:
{ name: "P101MF - query by chromosome", type: "seg", sourceType: "custom", source: { url: function (options) { const chr = options.chr.startsWith("chr") ? options.chr.substring(3) : options.chr; return `https://www.cbioportal.org/api/copy-number-segments/fetch?chromosome=${chr}&projection=SUMMARY`; }, method: "POST", contentType: "application/json", body: JSON.stringify([{ sampleId: "PT101MF", studyId: "sarc_mskcc" }]), mappings: { chr: "chromosome", value: "segmentMean", sampleKey: "uniqueSampleKey", sample: "sampleId" } }