comparison COBRAxy/marea.py @ 279:7f37f9626071 draft

Uploaded
author francesco_lapi
date Mon, 12 May 2025 16:10:38 +0000
parents 5e8f1ab4242f
children f5635309779a
comparison
equal deleted inserted replaced
278:5e8f1ab4242f 279:7f37f9626071
676 if sizeMismatch > 0: row.extend([FIELD_NOT_AVAILABLE] * sizeMismatch) 676 if sizeMismatch > 0: row.extend([FIELD_NOT_AVAILABLE] * sizeMismatch)
677 writer.writerow({ field : data for field, data in zip(fieldNames, row) }) 677 writer.writerow({ field : data for field, data in zip(fieldNames, row) })
678 678
679 OldEnrichedScores = Dict[str, List[Union[float, FoldChange]]] #TODO: try to use Tuple whenever possible 679 OldEnrichedScores = Dict[str, List[Union[float, FoldChange]]] #TODO: try to use Tuple whenever possible
680 def writeTabularResult(enrichedScores : OldEnrichedScores, ras_enrichment: bool, outPath :utils.FilePath) -> None: 680 def writeTabularResult(enrichedScores : OldEnrichedScores, ras_enrichment: bool, outPath :utils.FilePath) -> None:
681 fieldNames = ["ids", "P_Value", "fold change"] 681 fieldNames = ["ids", "P_Value", "fold change", "average_1", "average_2"]
682 if not ras_enrichment: fieldNames.extend(["average_1", "average_2"])
683 682
684 writeToCsv([ [reactId] + values for reactId, values in enrichedScores.items() ], fieldNames, outPath) 683 writeToCsv([ [reactId] + values for reactId, values in enrichedScores.items() ], fieldNames, outPath)
685 684
686 def temp_thingsInCommon(tmp :Dict[str, List[Union[float, FoldChange]]], core_map :ET.ElementTree, max_z_score :float, dataset1Name :str, dataset2Name = "rest", ras_enrichment = True) -> None: 685 def temp_thingsInCommon(tmp :Dict[str, List[Union[float, FoldChange]]], core_map :ET.ElementTree, max_z_score :float, dataset1Name :str, dataset2Name = "rest", ras_enrichment = True) -> None:
687 # this function compiles the things always in common between comparison modes after enrichment. 686 # this function compiles the things always in common between comparison modes after enrichment.