def phenotype_data(self):
        """Get the phenotype data for each of the sample."""
        if self._phenotype_data is None:
            pheno_data = {}
            for gsm_name, gsm in iteritems(self.gsms):
                tmp = {}
                for key, value in iteritems(gsm.metadata):
                    if len(value) == 0:
                        tmp[key] = np.nan
                    elif key.startswith("characteristics_"):
                        for i, char in enumerate(value):
                            char = re.split(":\s+", char)
                            char_type, char_value = [char[0],
                                                     ": ".join(char[1:])]
                            tmp[key + "." + str(
                                i) + "." + char_type] = char_value
                    else:
                        tmp[key] = ",".join(value)
                pheno_data[gsm_name] = tmp
            self._phenotype_data = DataFrame(pheno_data).T
        return self._phenotype_data
def phenotype_data ( self ) : if self . _phenotype_data is None : pheno_data = { } for gsm_name , gsm in iteritems ( self . gsms ) : tmp = { } for key , value in iteritems ( gsm . metadata ) : if len ( value ) == 0 : tmp [ key ] = np . nan elif key . startswith ( "characteristics_" ) : for i , char in enumerate ( value ) : char = re . split ( ":\s+" , char ) char_type , char_value = [ char [ 0 ] , ": " . join ( char [ 1 : ] ) ] tmp [ key + "." + str ( i ) + "." + char_type ] = char_value else : tmp [ key ] = "," . join ( value ) pheno_data [ gsm_name ] = tmp self . _phenotype_data = DataFrame ( pheno_data ) . T return self . _phenotype_data
Get the phenotype data for each of the sample.