Accessions and Cohorts¶
Accessions¶
Consider an instance where you want to characterize data generated from an
experiment. This can be accomplished by using an Accession
object.
An accession is a simple structure that houses an identifier along with
associated data files and accompanying metadata.
-
class
minus80.
Accession
(name, files=None, **kwargs)[source] From google: Definition (noun): a new item added to an existing collection of books, paintings, or artifacts.
An Accession is an item that exists in an experimental collection.
Most of the time an accession is interoperable with a sample. However, the term sample can become confusing when an experiment has multiple samplings from the same sample, e.g. timecourse or different tissues.
The minimal amount of information needed is an identifier:
In [1]: x = m80.Accession('Sample1')
In [2]: x
Out[2]: Accession(Sample1, files=set(), {})
Files and metadata can be associated with the accession upon initialization using the files kwarg and any number of additional kwargs for metadata:
In [3]: x = m80.Accession('Sample2',
...: files=['reads1.fastq','reads2.fastq'],
...: gender='male',
...: age=45
...: )
...:
In [4]: x
Out[4]: Accession(Sample2, files={'reads1.fastq', 'reads2.fastq'}, {'gender': 'male', 'age': 45})
Once created, data can be accessed from the object in the usual, pythonic way:
In [5]: 'reads1.fastq' in x.files
Out[5]: True
In [6]: x['gender']