Exemple #1
0
class LocationSchema(mm.Schema):

    studies = mm.Nested('StudySchema', many=True, only='pmid')
    images = mm.Nested('ImageSchema', many=True, only='id')

    class Meta:

        fields = ('x', 'y', 'z', 'studies', 'images')
Exemple #2
0
class StudySchema(mm.Schema):

    peaks = mm.Nested('PeakSchema', many=True)
    analyses = mm.Nested('AnalysisSchema', many=True, only='id')

    class Meta:

        fields = ('pmid', 'doi', 'title', 'authors', 'journal', 'year',
                  'peaks', 'analyses')
Exemple #3
0
class AnalysisSchema(mm.Schema):

    studies = mm.Nested('StudySchema', many=True, only='pmid')
    images = mm.Nested('ImageSchema', many=True, only='id')

    class Meta:

        fields = ('id', 'name', 'description', 'n_studies', 'n_activations',
                  'type', 'studies', 'images')
Exemple #4
0
class ImageSchema(mm.Schema):

    analysis = mm.Nested('AnalysisSchema', only='id')
    location = mm.Nested('LocationSchema', only='id')
    file = mm.Function(lambda obj: url_for('images.download', val=obj.id))

    class Meta:

        fields = ('id', 'label', 'description', 'stat', 'type', 'analysis',
                  'location', 'file')
Exemple #5
0
class GeneSchema(mm.Schema):

    images = mm.Nested('ImageSchema', many=True, only='id')

    class Meta:

        fields = ('symbol', 'name', 'synonyms', 'locus_type', 'images')
Exemple #6
0
class DecodingSchema(mm.Schema):
    def get_values(self, dec):
        data = open(join(settings.DECODING_RESULTS_DIR,
                         dec.uuid + '.txt')).read().splitlines()
        data = [x.split('\t') for x in data]
        return dict([(f, round(float(v), 3)) for (f, v) in data if v.strip()])

    image = mm.Nested('ImageSchema', allow_null=True)
    reference = mm.Function(lambda obj: obj.decoding_set.name)
    values = mm.Method('get_values')

    class Meta:

        fields = ('id', 'url', 'neurovault_id', 'comments', 'image',
                  'reference', 'values')