def calculate_distances(self, peptides): import sys print "@@@", sys.getrecursionlimit() dd = self.__d2s.getDistance2Self(p2s(peptides), self.__max_res) print "derp" result = {key: value.values() for key, value in dd.iteritems()} # create temporary file with peptides for distance computation resultDf = Distance2SelfResult.from_dict(result) resultDf['matrix'] = self.__matrix.name return resultDf
def parse_external_result(self, result): """ :rtype : DataFrame """ parsedResult = {} for line in result.strip().split('\n'): splitted = line.strip().split(" ")[-1].split(";") distanceValues = [] peptide = splitted[0].split(":")[0] for s in splitted[:-1]: distanceValues.append(float(s.split(",")[-1])) parsedResult[peptide] = distanceValues resultDf = Distance2SelfResult.from_dict(parsedResult) resultDf['trie'] = self.__trie.split('/')[-1] resultDf['matrix'] = self.__matrix.path_to_matrix_file.split('/')[-1] return resultDf