Substock actions

updated: 2024-04-11 (v. 3.4.18)

General parameters

  • performed - real date of the action, format: "YYYY-mm-dd"
  • description - user's note related to the action

These parameters are common for all substock actions. Below, you can find a full list of parameters for each action type. Parameters in square brackets are optional.

Count

PUT /api/substock/<substock id>/count/ + DATA

Schema

[count: int],
[all: bool],
counttype_id: int,
[experiment_id: int],
[method_id: int],
performed: str,
[description: str]
  • Either count or all must be set
  • all works only for counttypes of type sub (subtractive) (GUI function "terminate" uses all=true)
  • counttype setting public has to be set to true in order to use the count type
  • experiment and method are mandatory depending on counttype settings bound_to_experiment, respectively bound_to_method

Example data

Terminate substock

{
  "all": true,
  "counttype_id": 3,
  "performed": "2021-02-12"
}

3 fish died

{
  "count": 3,
  "counttype_id": 2,
  "performed": "2021-02-12"
}

Transfer

PUT /api/substock/<substock id>/transfer/ + DATA

Schema

position_id: null or int,
[switch: bool],
[shuffle: bool],
[remove_colliding: bool],
[target_width: int 1-4],
[source_width: int 1-4],
performed: str,
[description: str]
  • position_id = null - substock will be removed from its position in the facility
  • switch, shuffle and remove_colliding specifies what to do if the target position is already occupied; only one can be set true at the same time
  • target_width and source_width allow to set the width of the target, resp. source tank

Example data

Switch position with substocks on target position

{
  "position_id": 156,
  "switch": true,
  "performed": "2021-02-12"
}

Genotyping

PUT /api/substock/<substock id>/genotyping/ + DATA

Schema

genotyping_data: list(
  genotype_id: int,
  zygosity_id: int
),
performed: str,
[description: str]
  • You don't have to set zygosities for all substock's genotypes

Example data

Set zygosity for 2 genotypes

{
  "genotyping_data": [
    {
      "genotype_id": 1,
      "zygosity_id": 3
    },
    {
      "genotype_id": 2,
      "zygosity_id": 2
    }
  ],
  "performed": "2021-02-12"
}

Productivity

PUT /api/substock/<substock_id>/productivity/ + DATA

Schema

productivity: str,
performed: str,
[description: str]
  • productivity values: unproductive, productive, retired (needs special permission substock_retired)

Example data

Set productivity to productive

{
  "productivity": "productive",
  "performed": "2021-02-12"
}

Merge

PUT /api/substock/<substock_id>/merge/ + DATA

Schema

substocks: list(int),
performed: str,
[description: str]

The substock specified in the curl call will be the target substock for the merge (the other substocks will be merged into it). All substocks must belong to the same stock.

Example data

Merge specified siblings into a substock

{
  "substocks": [125, 126, 127],
  "performed": "2021-02-12"
}

Conditions

PUT /api/substock/<substock id>/conditions/ + DATA

Schema

[light_id: int],
[diet_id: int],
performed: str,
[description: str]
  • At least one of light_id, diet_id must be set

Example data

Set all

{
  "diet_id": 2,
  "light_id": 1,
  "performed": "2021-02-12"
}

Split

POST /api/substock/<substock_id>/split/ + DATA

Split has 2 variants, here are schemas for each of them

Schema 1 - simple

splits: int,
[owners: list(int)],
[projects: list(int)],
[workgroups: list(int)],
performed: str,
[description: str]
  • Note that split uses the POST method as opposed to other substock actions
  • splits - number of new substocks with an unspecified count to split off (count value will be not set)
  • owners, projects, workgroups - parameters to be set to the new substocks

Schema 2 - detailed

split_data: list(
    count: int,
    [terminate: bool],
    [position_id: null or int],
    [tank_width: int 1-4],
    [productivity: str],
    [productivity_detail_id: null or int],
    [genotyping_data: list(
        genotype_id: int,
        zygosity_id: int
    )],
    [suffix: str],
    [sex_id: int],
    [substockuse_id: int],
    [owners: list(int)],
    [projects: list(int)],
    [workgroups: list(int)]
),
[owners: list(int)],
[projects: list(int)],
[workgroups: list(int)],
performed: str,
[description: str]
  • split_data - list of specifications of the new substocks
    • count - fish count
    • terminate - should the substock be terminated just after the split?
    • position_id, tank_width - parameters for automatic transfer
    • productivity, productivity_detail_id - parameters for automatic productivity action
    • genotyping_data - parameters for automatic genotyping
    • owners, projects, workgroups - parameters to be set to the new substock; override the same parameters on the top level for this specific substock
  • owners, projects, workgroups - parameters to be set to the newly created substocks (can be overridden for each substock)

Example data

Simple split

{
  "splits": 2,
  "performed": "2021-02-12"
}

Detailed split

{
  "split_data": [
    {
      "count": 3,
      "owners": [5],
      "suffix": "xyz"
    },
    {
      "count": 5,
      "terminate": true
    },
    {
      "count": 4,
      "projects": [2, 3],
      "genotyping_data": [
        {
          "genotype_id": 3,
          "zygosity_id": 1
        }
      ]
    }
  ],
  "owners": [3, 4, 6],
  "performed": "2021-02-12"
}

Crossing

POST /api/substock/crossing/ + DATA

Crossing is a very complex action, especially choosing the fishline for the progeny substock. Using the GUI interface is recommended in this case.

Available fishlines

GET /api/fishline/by_genotypes/?genotypes=<comma-separated list of genotype_id>

This function returns 3 lists of fishlines available for progeny substock when crossing substocks with genotypes (parameter genotypes):

  • The exact match category contains fishlines with all genotypes of all parents.
  • The partial match category contains fishlines with a subset of genotypes of the parents.
  • The wild-type category contains fishlines without genotypes.

Schema

parents: list(
    id: int,
    [sex_id: int]
),
[count: int],
[owners: list(int)],
[projects: list(int)],
[fishline_id: int],
[force_new_fishline: bool],
[fishline_data: dictionary(
    [genotypes: list(int)],
    [alias: str],
    [description: str],
    [workgroups: list(int)],
    [suffix: str],
    [responsible_user_id: int]
)],
performed: str,
[description: str]
  • Note that split uses the POST method as opposed to other substock actions
  • parents - you need at least 2 parents for crossing, set the same parent twice for incross
    • id - id of the parent-to-be substock
  • count, owners, projects, fishline_id - optional parameters for the progeny substock
  • fishline_id - not every fishline can be set, see crossing documentation
  • fishline_data - parameters for the new fishline, force_new_fishline must be set to true

Example data

Two parents (automatic fishline)

{
  "parents": [
    {
      "id": 14349, 
      "sex_id": 3
    }, 
    {
      "id": 17221, 
      "sex_id": 2
    }
  ], 
  "owners": [1008], 
  "performed": "2024-04-12"
}