Skip to content

Commit 8b9524e

Browse files
Merge pull request #179 from genestack/feature/attachments-transformation-guide
Attachments transformation guide
2 parents a764663 + fa3e9eb commit 8b9524e

File tree

5 files changed

+197
-0
lines changed

5 files changed

+197
-0
lines changed
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# Attachments transformation
2+
3+
## Transformations in General
4+
Transformation is a process that allows users to convert any attached file format type into a format that ODM can index.
5+
Currently, ODM can't accept csv files as a source of metadata, but ODM can accept tsv files for that purpose.
6+
This is solved with the help of transformation.
7+
8+
Each transformation consists of transformation script (image) and its configuration. For example, image has ability
9+
to transform CSV file to TSV, at the same time configuration provides information where this TSV should be places,
10+
e.g. Samples, Libraries, Preparations, Cell metadata, Expression, Variants, etc.
11+
12+
![Diagram](../doc-odm-user-guide/doc-odm-user-guide/images/attachments-transformation-diagram.png)
13+
14+
## Get the list of available images
15+
Currently ODM has default image called `metadata-basic`.
16+
This image allows user to transform `CSV` files into `TSV` to create Sample group.
17+
18+
To get the list of available images via API go to `processorsController` Swagger definition of endpoints and use
19+
GET `transformations/images`. Endpoint response example:
20+
21+
```json
22+
[
23+
{
24+
"name": "metadata-basic",
25+
"version": "0.0.1",
26+
"description": "Basic converter from attachment to metadata",
27+
"input_formats": [
28+
"csv"
29+
],
30+
"output_formats": [
31+
"samples"
32+
]
33+
},
34+
{
35+
"name": "metadata-basic",
36+
"version": "0.0.2",
37+
"description": "Basic converter from attachment to metadata",
38+
"input_formats": [
39+
"csv"
40+
],
41+
"output_formats": [
42+
"samples"
43+
]
44+
},
45+
{
46+
"name": "metadata-basic",
47+
"version": "latest",
48+
"description": "Basic converter from attachment to metadata",
49+
"input_formats": [
50+
"csv"
51+
],
52+
"output_formats": [
53+
"samples"
54+
]
55+
}
56+
]
57+
```
58+
This transformation works only in combination with configuration.
59+
60+
## Create new configuration
61+
62+
To create new configuration for `metadata-basic` image use POST `transformations/configurations` endpoint.
63+
64+
Initial request body:
65+
66+
```json
67+
{
68+
"data": {
69+
"additionalProp1": "string",
70+
"additionalProp2": "string",
71+
"additionalProp3": "string"
72+
},
73+
"description": "string",
74+
"name": "string"
75+
}
76+
```
77+
Let’s create configuration that allows image to place transformed `CSV` file to Samples:
78+
79+
```json
80+
{
81+
"data": {
82+
"source": "csv",
83+
"destination": "samples"
84+
},
85+
"description": "Configuration which allows you to transform csv file into Sample group",
86+
"name": "csv to samples"
87+
}
88+
```
89+
Response body example:
90+
91+
```json
92+
[
93+
{
94+
"id": 294862386,
95+
"name": "csv to samples",
96+
"data": {
97+
"destination": "samples",
98+
"source": "csv"
99+
},
100+
"description": "Configuration which allows you to transform csv file into Sample group"
101+
}
102+
]
103+
```
104+
105+
Now configuration is created and can be found via GET `transformations/configurations` endpoint:
106+
107+
```json
108+
[
109+
{
110+
"id": 294862386,
111+
"name": "csv to samples",
112+
"data": {
113+
"destination": "samples",
114+
"source": "csv"
115+
},
116+
"description": "Configuration which allows you to transform csv file into Sample group"
117+
}
118+
]
119+
```
120+
121+
## Run the transformation
122+
123+
To proceed with transformation let’s use the following `CSV` table with Samples metadata:
124+
125+
[Samples_metadata](https://bio-test-data.s3.us-east-1.amazonaws.com/User_guide_test_data/Attachments+transformation/samples.csv),
126+
a CSV file with Sample attributes.
127+
128+
Upload the file as attachment to your Study:
129+
130+
![CSV-attachment](../doc-odm-user-guide/doc-odm-user-guide/images/attachments-transformation-csv.png)
131+
132+
Go to `Transformation Jobs` section in `processorsController` group in API. Use POST `transformations/jobs`
133+
endpoint to transform `CSV` file into Sample group.
134+
135+
Initial request body:
136+
137+
```json
138+
{
139+
"attachment_accession": "string",
140+
"configuration_id": 1,
141+
"image_reference": {
142+
"name": "string",
143+
"version": "string"
144+
},
145+
"volume_size": 30
146+
}
147+
```
148+
Fill in information about attachment genestack accession, configuration, image name and version:
149+
150+
```json
151+
{
152+
"attachment_accession": "GSF016786",
153+
"configuration_id": 294862386,
154+
"image_reference": {
155+
"name": "metadata-basic",
156+
"version": "0.0.2"
157+
},
158+
"volume_size": 30
159+
}
160+
```
161+
162+
Response contains information about your Job id:
163+
164+
```json
165+
{
166+
"$schema": "https://odm-processors-controller:8080/schemas/TransformationJobId.json",
167+
"id": 341346019
168+
}
169+
```
170+
171+
To check the status of the Job use GET `transformations/jobs/{id}` endpoint:
172+
173+
```json
174+
{
175+
"$schema": "https://odm-processors-controller:8080/schemas/TransformationJobFields.json",
176+
"image_reference": {
177+
"name": "metadata-basic",
178+
"version": "0.0.2"
179+
},
180+
"attachment_accession": "GSF016786",
181+
"configuration_id": 294862386,
182+
"volume_size": 30,
183+
"create_time": "2025-10-31T12:28:57Z",
184+
"status": {
185+
"state": "TERMINATED"
186+
}
187+
}
188+
```
189+
190+
Transformation converts `CSV` file to `TSV` format and triggers POST `jobs/import/samples/multipart` endpoint
191+
automatically. It uploads new `TSV` file to Sample metadata group to the Study where initial `CSV` attachment
192+
is placed.
193+
194+
As the result new Sample metadata group was created in ODM:
195+
196+
![Sample-group](../doc-odm-user-guide/doc-odm-user-guide/images/attachments-transformation-samples.png)
340 KB
Loading
97.8 KB
Loading
500 KB
Loading

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ nav:
4848
- Getting a Genestack API token: user-guide/doc-odm-user-guide/getting-a-genestack-api-token.md
4949
- Getting Access Token (Azure): user-guide/doc-odm-user-guide/getting-access-token-azure.md
5050
- Supported File Formats: user-guide/doc-odm-user-guide/supported-formats.md
51+
- Attachments transformation: user-guide/doc-odm-user-guide/attachment-transformation.md
5152
- Access Control:
5253
- Users: access-control/users.md
5354
- Permissions: access-control/permissions.md

0 commit comments

Comments
 (0)