GMOD / Apollo3

JBrowse 2 plugin for editing annotations on an Apollo server
Apache License 2.0
6 stars 4 forks source link

`getFeatures` always returns an array of two arrays #362

Open dariober opened 4 months ago

dariober commented 4 months ago

I'm sure I've asked this before... The getFeatures endpoint seems to always (?) return an array of two arrays. The first array contains the features while the second array is always (?) empty. Is this intentional? If so, do we want the cli apollo refseq get to also return these two arrays only the first (the feature) array?

A couple of example:

curl -s -H 'Authorization: Bearer blablabla' 'http://127.0.0.1:3999/features/getFeatures?refSeq=65e5d29ca293d9b1b75dfcbf&start=1&end=1000' | jq .
[
  [
    {
      "_id": "65e5d29c529ba705a1c3c15b",
      "gffId": "65e5d29c529ba705a1c3c15b",
      "refSeq": "65e5d29ca293d9b1b75dfcbf",
      "allIds": [
        "65e5d29c529ba705a1c3c15b"
      ],
      "type": "contig",
      "start": 0,
      "end": 50,
      "discontinuousLocations": [],
      "attributes": {
        "source": [
          "example"
        ],
        "gff_name": [
          "ctgA"
        ],
        "multivalue": [
          "val1",
          "val2",
          "val3"
        ]
      },
      "status": 0,
      "user": "dario.beraldi@gmail.com-1026",
      "createdAt": "2024-03-04T13:54:36.555Z",
      "updatedAt": "2024-03-04T13:54:36.681Z",
      "__v": 0
    },
    {
      "_id": "65e5d29c529ba705a1c3c15c",
      "gffId": "b101.2",
      "refSeq": "65e5d29ca293d9b1b75dfcbf",
      "allIds": [
        "65e5d29c529ba705a1c3c15c"
      ],
      "type": "BAC",
      "start": 9,
      "end": 20,
      "discontinuousLocations": [],
      "attributes": {
        "source": [
          "example"
        ],
        "_id": [
          "b101.2"
        ],
        "gff_name": [
          "b101.2"
        ],
        "gff_note": [
          "Fingerprinted BAC with end reads"
        ]
      },
      "status": 0,
      "user": "dario.beraldi@gmail.com-1026",
      "createdAt": "2024-03-04T13:54:36.574Z",
      "updatedAt": "2024-03-04T13:54:36.681Z",
      "__v": 0
    },
    {
      "_id": "65e5d29c529ba705a1c3c15d",
      "gffId": "FakeSNP1",
      "refSeq": "65e5d29ca293d9b1b75dfcbf",
      "allIds": [
        "65e5d29c529ba705a1c3c15d"
      ],
      "type": "SNP",
      "start": 9,
      "end": 30,
      "discontinuousLocations": [],
      "score": 0.987,
      "attributes": {
        "source": [
          "example"
        ],
        "_id": [
          "FakeSNP1"
        ],
        "gff_name": [
          "FakeSNP"
        ],
        "gff_note": [
          "This is a fake SNP that should appear at 1000 with length 1"
        ]
      },
      "status": 0,
      "user": "dario.beraldi@gmail.com-1026",
      "createdAt": "2024-03-04T13:54:36.589Z",
      "updatedAt": "2024-03-04T13:54:36.681Z",
      "__v": 0
    },
    {
      "_id": "65e5d29c529ba705a1c3c15e",
      "gffId": "EDEN",
      "refSeq": "65e5d29ca293d9b1b75dfcbf",
      "allIds": [
        "65e5d29c529ba705a1c3c15e",
        "65e5d29c529ba705a1c3c15f"
      ],
      "type": "gene",
      "start": 99,
      "end": 200,
      "discontinuousLocations": [],
      "strand": 1,
      "attributes": {
        "source": [
          "example"
        ],
        "_id": [
          "EDEN"
        ],
        "gff_name": [
          "EDEN"
        ],
        "gff_note": [
          "protein kinase"
        ]
      },
      "status": 0,
      "user": "dario.beraldi@gmail.com-1026",
      "children": {
        "65e5d29c529ba705a1c3c15f": {
          "gffId": "EDEN.1",
          "refSeq": "65e5d29ca293d9b1b75dfcbf",
          "allIds": [],
          "type": "mRNA",
          "start": 99,
          "end": 200,
          "discontinuousLocations": [],
          "strand": 1,
          "attributes": {
            "source": [
              "example"
            ],
            "_id": [
              "EDEN.1"
            ],
            "gff_name": [
              "EDEN.1"
            ],
            "gff_note": [
              "Eden splice form 1"
            ],
            "index": [
              "1"
            ]
          },
          "_id": "65e5d29c529ba705a1c3c15f",
          "createdAt": "2024-03-04T13:54:36.599Z",
          "updatedAt": "2024-03-04T13:54:36.599Z"
        }
      },
      "createdAt": "2024-03-04T13:54:36.599Z",
      "updatedAt": "2024-03-04T13:54:36.681Z",
      "__v": 0
    }
  ],
  []
]

## No feature in this interval:
curl -s -H 'Authorization: Bearer blablabla' 'http://127.0.0.1:3999/features/getFeatures?refSeq=65e5d29ca293d9b1b75dfcbf&start=1000&end=1000' | jq .
[
  [],
  []
]
dariober commented 2 months ago

Partially answering my own question: The first array contains the features, the second array the checks (empty if no checking has been applied).