Created
June 21, 2012 21:22
-
-
Save icaoberg/2968607 to your computer and use it in GitHub Desktop.
Shows how to calculate the SLF34 features subset using using pyslic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Ivan E. Cao-Berg (icaoberg@scs.cmu.edu) | |
# | |
# Copyright (C) 2012 Murphy Lab | |
# Lane Center for Computational Biology | |
# School of Computer Science | |
# Carnegie Mellon University | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published | |
# by the Free Software Foundation; either version 2 of the License, | |
# or (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, but | |
# WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
# General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program; if not, write to the Free Software | |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | |
# 02110-1301, USA. | |
# | |
# For additional information visit http://murphylab.web.cmu.edu or | |
# send email to murphy@cmu.edu | |
import Image #Python Image Library | |
import numpy | |
import pyslic | |
#Important info | |
name = 12345 | |
scale = 0.67 | |
#Reference Channel | |
dna = Image.open( "E43_dna.png" ) | |
dna = numpy.asarray( dna ) | |
#Protein Channel | |
protein = Image.open( "E43_styryl.png" ) | |
protein = numpy.asarray( protein ) | |
#make pyslic image container | |
img=pyslic.Image() | |
img.label = name | |
img.scale = scale | |
img.channels[ 'protein' ] = 0 | |
img.channels[ 'dna' ] = 1 | |
img.channeldata[ 'protein' ] = protein | |
img.channeldata[ 'dna' ] = dna | |
img.loaded = True | |
#SLF34 | |
features = pyslic.computefeatures(img,'field-dna+') | |
#save features | |
numpy.save( "features.npy", features ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment