Back to top

Metagenomic Thermometer API

REST API for Metagenomic Thermometer

You can use the API to submit jobs and retrieve results from the command line without going through a web browser.

Example using the curl command:

  1. Submit job
curl -X POST -F "input_file=@./my_sequence.fastq" http://palaeo.nig.ac.jp/metathermo/api/upload
{
    "response": {
        "Message":"Success. Job submitted.",
        "Status":"Success",
        "job_id":"LRodgtAx"
    }
}
  1. Get results
curl http://palaeo.nig.ac.jp/metathermo/api/results?job_id=LRodgtAx

Result JSON:

{
    "response": {
        "AACounts":"{'*': 2222, 'A': 67287, 'C': 6389, 'D': 43669, 'E': 39861, 'F': 26185, 'G': 47596, 'H': 16220, 'I': 48687, 'K': 37057, 'L': 71071, 'M': 20044, 'N': 32817, 'P': 28653, 'Q': 33918, 'R': 31975, 'S': 46745, 'T': 42823, 'V': 47998, 'W': 8243, 'Y': 21935}",
        "MPT":"16.48",
        "Message":"Job finished.",
        "Status":"Success"
    }
}

Resource Group

Submit Job API

Submit Job API
POST/upload

  • API for Job Submission

    • POST a input file in form-data with the name “input_file”.
    • Upload one of the following files. Since the file format is inferred by the file name extension, please be sure to name the file with the corresponding extension.
      • FASTQ: Metagenomic or genomic sequenced fastq file. Filename extension = [fq|fastq|fq.gz|fastq.gz]
      • Genomic FASTA: Genomic DNA sequence file. Filename extension = [fasta|fna|fa|fasta.gz|fna.gz|fa.gz]
      • Protein FASTA: Multi-FASTA Protein sequence file. Filename extension = [faa|faa.gz]
    • In any of the following cases, JSON containing the error message will be returned.
      • No input_file.
      • The attached file is not in FASTA format.
      • The filename extension of the attached file is unsupported.
      • Database registration failed for some unknown reason. Please try again after a while.
  • If the job registration is successful, JSON will be returned. “job_id” is the unique ID for the registered job. Please remember it as you will need it to access the results later.

Example URI

POST http://palaeo.nig.ac.jp/metathermo/api/upload
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "response": {
    "Status": "Success",
    "Message": "Success. Job submitted.",
    "job_id": "LRodgtAx"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "response": {
      "type": "object",
      "properties": {
        "Status": {
          "type": "string"
        },
        "Message": {
          "type": "string"
        },
        "job_id": {
          "type": "string"
        }
      },
      "required": [
        "Status",
        "Message",
        "job_id"
      ]
    }
  }
}

Get Result API

Get Result API
GET/results{?job_id}

  • API to obtain prediction results in JSON format.
    • Get JSON of prediction results.
    • Specify your “job_id” as parameter.
    • If the job is still running, JSON with “Status”:“Running” will be returned.
    • If the job is finished, JSON with “Status”:“Success” will be returned.
    • The resulting JSON file contains the following elements.
      • Status: Job status.
      • Message: A message describing the result of the job.
      • MPT: Metagenomic predicted temperature. Main result of this tool.
      • AACounts: Counts of the amino acids in the input file that served as the basis for the temperature calculation.
    • In any of the following cases, JSON containing the error message will be returned.
      • No job_id specified.
      • Specified job_id is not registered in database.
      • Your job is not yet completed. Please wait and try later.
      • Prediction failed for some unknown reason. Please start over from your job submission.

Example URI

GET http://palaeo.nig.ac.jp/metathermo/api/results?job_id=LRodgtAx
URI Parameters
HideShow
job_id
string (required) Example: LRodgtAx

Parameter specifying your job ID.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "response": {
    "Status": "Success",
    "Message": "Job finished.",
    "MPT": "16.48",
    "AACounts": "\"{'*': 2222, 'A': 67287, 'C': 6389, 'D': 43669, 'E': 39861, 'F': 26185, 'G': 47596, 'H': 16220, 'I': 48687, 'K': 37057, 'L': 71071, 'M': 20044, 'N': 32817, 'P': 28653, 'Q': 33918, 'R': 31975, 'S': 46745, 'T': 42823, 'V': 47998, 'W': 8243, 'Y': 21935}\""
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "response": {
      "type": "object",
      "properties": {
        "Status": {
          "type": "string"
        },
        "Message": {
          "type": "string"
        },
        "MPT": {
          "type": "string"
        },
        "AACounts": {
          "type": "string"
        }
      },
      "required": [
        "Status",
        "Message",
        "MPT",
        "AACounts"
      ]
    }
  }
}

Generated by aglio on 20 Jul 2022