output.append(', '.join(cladeA.ncbiNames) + ':') output.append('') cladeAEcGraph = cladeA.coreMetabolism(majorityPercentageCoreMetabolism) cladeAEcCount = len(cladeAEcGraph.getECs()) output.append('core metabolism ECs: ' + str(cladeAEcCount)) output.append('') #- get "neofunctionalised" ECs cladeANeofunctionalisedMetabolismSet = cladeA.neofunctionalisedECs( majorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation).getECs() cladeASortedList = list(cladeANeofunctionalisedMetabolismSet) cladeASortedList.sort() #- calculate redundancy cladeARedundancy = Redundancy(cladeAEcGraph) cladeARedundancyContribution = RedundancyContribution( cladeARedundancy, cladeANeofunctionalisedMetabolismSet) cladeARobustECsForNeofunctionalisedEC = cladeARedundancyContribution.getContributedKeysForSpecial( RedundancyType.ROBUSTNESS) cladeAFlexibleECsForNeofunctionalisedEC = cladeARedundancyContribution.getContributedKeysForSpecial( RedundancyType.TARGET_FLEXIBILITY) #- REPEAT for each "neofunctionalised" EC output.append('"neofunctionalised" ECs: ' + str(len(cladeASortedList)) + ' (' + str( Percent.getPercentStringShort(len(cladeASortedList), cladeAEcCount, 0)) + '%)') for ecNumber in cladeASortedList: #- print number of ECs the "neofunctionalised" EC provides redundancy for (robustness and flexibility) output.append(
#- get Deltaproteobacteria clade = getClade() majorityPercentageCoreMetabolism = 80 output.append( 'core metabolism majority: ' + str(majorityPercentageCoreMetabolism) + '%' ) output.append('') output.append(', '.join(clade.ncbiNames) + ':') output.append('') #- get ECs cladeEcGraph = clade.coreMetabolism(majorityPercentageCoreMetabolism) cladeEcCount = len(cladeEcGraph.getECs()) output.append( 'core metabolism ECs: ' + str(cladeEcCount) ) output.append('') #- calculate redundancy cladeRedundancy = Redundancy(cladeEcGraph) #- print number of redundant ECs, including percentage of all ECs, for all types of redundancy output.append('') output.append( 'Robustness fully: ' + Percent.floatToPercentString(cladeRedundancy.getRedundancyRatio(RedundancyType.ROBUSTNESS) ) ) output.append( 'Robustness partial: ' + Percent.floatToPercentString(cladeRedundancy.getRedundancyRatio(RedundancyType.ROBUSTNESS_PARTIAL) ) ) output.append( 'Robustness both: ' + Percent.floatToPercentString(cladeRedundancy.getRedundancyRatio(RedundancyType.ROBUSTNESS_BOTH) ) ) output.append('') output.append( 'Flexibility fully: ' + Percent.floatToPercentString(cladeRedundancy.getRedundancyRatio(RedundancyType.FLEXIBILITY) ) ) output.append( 'Flexibility partial: ' + Percent.floatToPercentString(cladeRedundancy.getRedundancyRatio(RedundancyType.FLEXIBILITY_PARTIAL) ) ) output.append( 'Flexibility both: ' + Percent.floatToPercentString(cladeRedundancy.getRedundancyRatio(RedundancyType.FLEXIBILITY_BOTH) ) ) output.append('') output.append( 'Target-flexibility fully: ' + Percent.floatToPercentString(cladeRedundancy.getRedundancyRatio(RedundancyType.TARGET_FLEXIBILITY) ) ) output.append( 'Target-flexibility partial: ' + Percent.floatToPercentString(cladeRedundancy.getRedundancyRatio(RedundancyType.TARGET_FLEXIBILITY_PARTIAL) ) ) output.append( 'Target-flexibility both: ' + Percent.floatToPercentString(cladeRedundancy.getRedundancyRatio(RedundancyType.TARGET_FLEXIBILITY_BOTH) ) ) output.append('')
output.append('\t[see ' + clade.ncbiNames[0] + '_Neofunctionalisations-For-FunctionChange.html]') output.append('') #- calculate "neofunctionalised" ECs cladeNeofunctionalisedMetabolismSet = clade.neofunctionalisedECs( majorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation, eValue=eValue).getECs() cladeNeofunctionalisationsForFunctionChange = clade.neofunctionalisationsForFunctionChange( majorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation, eValue=eValue) #- calculate redundancy cladeRedundancy = Redundancy(cladeEcGraph) cladeRedundancyContribution = RedundancyContribution( cladeRedundancy, cladeNeofunctionalisedMetabolismSet) cladeRobustnessContributedECsForContributingNeofunctionalisedEC = cladeRedundancyContribution.getContributedKeysForSpecial( redundancyType) cladeRobustnessContributingNeofunctionalisedECs = set( cladeRobustnessContributedECsForContributingNeofunctionalisedEC.keys()) #- REPEAT for each function change consisting of "neofunctionalised" ECs, which also contribute to redundancy output.append( '"neofunctionalised" ECs: ' + str(len(cladeNeofunctionalisedMetabolismSet)) + ' (' + str( Percent.getPercentStringShort( len(cladeNeofunctionalisedMetabolismSet), cladeEcCount, 0)) + '%)')
cladeEcCount = len(cladeEcGraph.getECs()) output.append('core metabolism ECs: ' + str(cladeEcCount)) output.append('') #- calculate "neofunctionalised" ECs cladeNeofunctionalisedMetabolismSet = clade.neofunctionalisedECs( majorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation, eValue=eValue).getECs() cladeNeofunctionalisationsForFunctionChange = clade.neofunctionalisationsForFunctionChange( majorityPercentageCoreMetabolism, majorityPercentageNeofunctionalisation, eValue=eValue) #- calculate redundancy cladeRedundancy = Redundancy(cladeEcGraph) cladeRedundancyContribution = RedundancyContribution( cladeRedundancy, cladeNeofunctionalisedMetabolismSet) cladeRobustnessContributedECsForContributingNeofunctionalisedEC = cladeRedundancyContribution.getContributedKeysForSpecial( redundancyType) cladeRobustnessContributingNeofunctionalisedECs = set( cladeRobustnessContributedECsForContributingNeofunctionalisedEC.keys()) #- export graph of core metabolism, colouring the edges of (contributing) neofunctionalised ECs edgesOfNeofunctionalisedECs = set() for key in cladeNeofunctionalisedMetabolismSet: for edge in cladeEcGraph.getEdgesFromKey(key): edgesOfNeofunctionalisedECs.add(edge) Export.addColourAttribute(cladeEcGraph, Export.Colour.BLUE,