Skip to content

Commit

Permalink
New Dataset: MurphyLab Hela-2d SLF7dna features
Browse files Browse the repository at this point in the history
This is a homegrown feature set & problem, but it's useful to have.
  • Loading branch information
Luís Pedro Coelho committed Sep 22, 2009
1 parent 14e799f commit 830b4f4
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 0 deletions.
24 changes: 24 additions & 0 deletions milksets/murphy_hela_slf7dna/__init__.py
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2009, Luís Pedro Coelho <lpc@cmu.edu>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from .murphy_hela2d_slf7dna import *

# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
13 changes: 13 additions & 0 deletions milksets/murphy_hela_slf7dna/data/compute.py
@@ -0,0 +1,13 @@
import numpy as np
MURPHYLAB_HELA2D_PATH = '/home/luispedro/work/murphylab/images/hela-2d/'
print r'''\
This is only to be run if you have got the Murphylab images installed at
%s
Otherwise, you will get errors!
''' % MURPHYLAB_HELA2D_PATH
import pyslic
imgs = pyslic.image.io.dirtransversal.dirtransversal(MURPHYLAB_HELA2D_PATH)
labels = np.array([img.label for img in imgs])
features = pyslic.computefeatures(imgs, 'SLF7DNA')
np.savez('murphylab.npz', features=features, labels=labels)
Binary file added milksets/murphy_hela_slf7dna/data/murphylab.npz
Binary file not shown.
55 changes: 55 additions & 0 deletions milksets/murphy_hela_slf7dna/murphy_hela2d_slf7dna.py
@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2009, Luís Pedro Coelho <lpc@cmu.edu>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from __future__ import division
import numpy as np
from os.path import dirname
from ..vtypes import continuous
from ..utils import standard_properties, standard_classification_loader

__all__ = ['load'] + standard_properties

name = 'Murphy Lab 2D HeLa (SLF7DNA)'
short_name = 'Hela2D'
long_name = name
reference = '''\
'''
url = 'http://murphylab.cbi.cmu.edu/download'
data_source = 'MurphyLab'
label_names = ['dap', 'erdak', 'giant', 'gpp130', 'h4b4', 'mc151', 'nucle', 'phal', 'tfr', 'tubul']
missing_values = False
value_types = [
continuous('_%s' % i) for i in xrange(90)
]

_datafile = dirname(__file__)+'/data/murphylab.npz'

@standard_classification_loader(name)
def load(force_contiguous=True):
data = np.load(_datafile)
features = data['features']
labels = np.array([label_names.index(lab) for lab in data['labels']])
if force_contiguous:
features = np.ascontiguousarray(features)
labels = np.ascontiguousarray(labels)
return features,labels

# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
1 change: 1 addition & 0 deletions tests/test_classification_loaders.py
Expand Up @@ -10,4 +10,5 @@ def test_loader(module):
assert (features.std(0)**2).sum() > 1e-8
yield test_loader, milksets.wine
yield test_loader, milksets.yeast
yield test_loader, milksets.murphy_hela_slf7dna

0 comments on commit 830b4f4

Please sign in to comment.