Pooling samples in ISAjson

33 views
Skip to first unread message

rafael buono

unread,
Apr 26, 2021, 3:38:31 PM4/26/21
to ISAforum
Hi all,

We are wondering how ISAjson deals with merging multiple Samples into one.

Can someone direct me to an ISA-JSON example where pooling of Samples is done?

In the documentation (copied and pasted below), there is an example of how to deal with this in ISA-Tab. But I couldn't find a similar example for ISA-JSON.

Example copied below from https://isa-specs.readthedocs.io/en/latest/isamodel.html#study :

"In a pooling example, multiple sources may be used to create a single sample:

(source material 1)->(sample collection)->(sample material 1)

(source material 2)->(sample collection)->(sample material 1)"

All the best,

Rafael

Philippe

unread,
Apr 27, 2021, 7:10:14 AM4/27/21
to isaf...@googlegroups.com, rafael buono, Massimiliano Izzo, Dominique Batista

Hi Rafael,

Hope all is well in Ghent.

Here is a code snippet and the corresponding serialization to ISA-JSON:

(I have also documented that in an jupyter-notebook, which will be posted on the ISA-API documentation with the coming release).

-------

from isatools.model import *
from isatools.create.model import *
import datetime

# creating an ISA.Investigation object
investigation = Investigation()

# creating an ISA.Study object
study = Study(filename="s_study.txt")
study.identifier = "S1"
study.title = "ISA Study example: creating sample pools"

# creating the necessary ISA.Protocol objects
study.protocols = [Protocol(name="sample collection",protocol_type="pooling"),
                   Protocol(name="intracellular fraction extraction",
                            protocol_type=OntologyAnnotation(term="extraction"),
                            parameters=[ProtocolParameter(parameter_name=OntologyAnnotation(term="concentration")),
                                        ProtocolParameter(parameter_name=OntologyAnnotation(term="sample QC"))]),
                    Protocol(name="data collection",
                             protocol_type=OntologyAnnotation(term="data acquisition")),
                    Protocol(name="data transformation",
                             protocol_type=OntologyAnnotation(term="data normalization"))
                  ]

# creating 4 ISA.Source objects
study.sources = [Source(name="source1"),Source(name="source2"),Source(name="source3"),Source(name="source4")]

# creating 2 ISA.Sample objects
study.samples = [Sample(name="sample1"),Sample(name="sample2")]

# creating an ISA.ProtocolApplication pooling Source1 and Source2 into Sample1
study.process_sequence = [Process(executes_protocol=study.protocols[0], inputs=[study.sources[0],study.sources[1]], outputs=[study.samples[0]])]


# doing the same again for pooling Source3 and Source4 into Sample2
study.process_sequence.append(Process(executes_protocol=study.protocols[0], inputs=[study.sources[2],study.sources[3]], outputs=[study.samples[1]]))

investigation.studies = [study]

# let's check how this looks in ISA-Tab
from isatools.isatab import dumps
print(dumps(investigation))

# let's check how this looks in ISA-JSON

import json
from isatools.isajson import ISAJSONEncoder
print(json.dumps(investigation, cls=ISAJSONEncoder, sort_keys=True, indent=4, separators=(',', ': ')))

--------

the JSON looks like this:

{
    "comments": [],
    "description": "",
    "identifier": "",
    "ontologySourceReferences": [],
    "people": [],
    "publicReleaseDate": "",
    "publications": [],
    "studies": [
        {
            "assays": [],
            "characteristicCategories": [],
            "comments": [],
            "description": "a jupytern notebook showing how to create pooled samples (a node merging event with material nodes)",
            "factors": [],
            "filename": "s_study.txt",
            "identifier": "S1",
            "materials": {
                "otherMaterials": [],
                "samples": [
                    {
                        "@id": "#sample/5116543904",
                        "characteristics": [],
                        "factorValues": [],
                        "name": "sample1"
                    },
                    {
                        "@id": "#sample/5116545584",
                        "characteristics": [],
                        "factorValues": [],
                        "name": "sample2"
                    }
                ],
                "sources": [
                    {
                        "@id": "#source/5116545344",
                        "characteristics": [],
                        "name": "source1"
                    },
                    {
                        "@id": "#source/5116545824",
                        "characteristics": [],
                        "name": "source2"
                    },
                    {
                        "@id": "#source/5119072912",
                        "characteristics": [],
                        "name": "source3"
                    },
                    {
                        "@id": "#source/5119071040",
                        "characteristics": [],
                        "name": "source4"
                    }
                ]
            },
            "people": [],
            "processSequence": [
                {
                    "@id": "#process/5119073488",
                    "comments": [],
                    "date": "",
                    "executesProtocol": {
                        "@id": "#5109903952"
                    },
                    "inputs": [
                        {
                            "@id": "#source/5116545344"
                        },
                        {
                            "@id": "#source/5116545824"
                        }
                    ],
                    "name": "",
                    "outputs": [
                        {
                            "@id": "#sample/5116543904"
                        }
                    ],
                    "parameterValues": [],
                    "performer": ""
                },
                {
                    "@id": "#process/5119071088",
                    "comments": [],
                    "date": "",
                    "executesProtocol": {
                        "@id": "#5109903952"
                    },
                    "inputs": [
                        {
                            "@id": "#source/5119072912"
                        },
                        {
                            "@id": "#source/5119071040"
                        }
                    ],
                    "name": "",
                    "outputs": [
                        {
                            "@id": "#sample/5116545584"
                        }
                    ],
                    "parameterValues": [],
                    "performer": ""
                }
            ],
            "protocols": [
                {
                    "@id": "#5109903952",
                    "comments": [],
                    "components": [],
                    "description": "",
                    "name": "sample collection",
                    "parameters": [],
                    "protocolType": {
                        "@id": "#87632ca1-1109-4f42-bdc9-fd56c30cead8",
                        "annotationValue": "pooling",
                        "comments": [],
                        "termAccession": "",
                        "termSource": ""
                    },
                    "uri": "",
                    "version": ""
                },
                {
                    "@id": "#5118472000",
                    "comments": [],
                    "components": [],
                    "description": "",
                    "name": "intracellular fraction extraction",
                    "parameters": [
                        {
                            "@id": "#5119051952",
                            "parameterName": {
                                "@id": "#590aaeb5-2e11-4aff-a2c9-9b34bf676249",
                                "annotationValue": "concentration",
                                "comments": [],
                                "termAccession": "",
                                "termSource": ""
                            }
                        },
                        {
                            "@id": "#5119050704",
                            "parameterName": {
                                "@id": "#33dfce38-e133-4bc0-9666-9a81bfb39362",
                                "annotationValue": "sample QC",
                                "comments": [],
                                "termAccession": "",
                                "termSource": ""
                            }
                        }
                    ],
                    "protocolType": {
                        "@id": "#9a41779d-eb92-467d-88ac-d1595fe189de",
                        "annotationValue": "extraction",
                        "comments": [],
                        "termAccession": "",
                        "termSource": ""
                    },
                    "uri": "",
                    "version": ""
                },
                {
                    "@id": "#5118472096",
                    "comments": [],
                    "components": [],
                    "description": "",
                    "name": "data collection",
                    "parameters": [],
                    "protocolType": {
                        "@id": "#26e7d865-e6be-454b-bd91-a8ee33a3cbcd",
                        "annotationValue": "data acquisition",
                        "comments": [],
                        "termAccession": "",
                        "termSource": ""
                    },
                    "uri": "",
                    "version": ""
                },
                {
                    "@id": "#5116464528",
                    "comments": [],
                    "components": [],
                    "description": "",
                    "name": "data transformation",
                    "parameters": [],
                    "protocolType": {
                        "@id": "#e3ed694a-215c-45f5-bb09-cf4c2a6154e7",
                        "annotationValue": "data normalization",
                        "comments": [],
                        "termAccession": "",
                        "termSource": ""
                    },
                    "uri": "",
                    "version": ""
                }
            ],
            "publicReleaseDate": "",
            "publications": [],
            "studyDesignDescriptors": [],
            "submissionDate": "",
            "title": "ISA Study example: creating sample pools",
            "unitCategories": []
        }
    ],
    "submissionDate": "",
    "title": ""
}
--
--
--
 
You received this message because you are subscribed to the Google
Groups "ISAforum" group.
To post to this group, send email to isaf...@googlegroups.com
To unsubscribe from this group, send email to
isaforum+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/isaforum?hl=en-GB
 
Visit the ISA tools website at http://isa-tools.org and http://isacommons.org
---
You received this message because you are subscribed to the Google Groups "ISAforum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isaforum+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isaforum/be058b4f-9e94-4cbe-9699-8d49f6b8f2a2n%40googlegroups.com.

rafael buono

unread,
Apr 27, 2021, 7:37:36 AM4/27/21
to ISAforum
Hi Philippe!

Thank you so much for the fast and complete answer!

To make sure I am following, in summary I would have the following.

For splitting one material into more than one:
I have one value for the Inputs key and more than one for the Outputs in processSequence.

For pooling / merging materials into one:
I have more than one value for Inputs and a single value in Outputs in processSequence.

I assume I can generalize this for other things in processSequence.

Thank you again,

Rafael
Reply all
Reply to author
Forward
0 new messages