@@ -4010,9 +4010,24 @@ def export_pathogens(pathway_logic_network: pd.DataFrame,
40104010 get_pathogen_entities , "pathogen-derived" )
40114011
40124012
4013+ def export_rnas (pathway_logic_network : pd .DataFrame ,
4014+ reactome_id_to_uuid : Dict [str , str ],
4015+ output_file : str ) -> None :
4016+ """Write rnas.csv: which entities in THIS network are RNA species (deltasignal
4017+ specs/100), by :func:`src.neo4j_connector.get_rna_entities`. A consumer joins
4018+ node copies of one RNA (a root mRNA copy reads the copy transcription makes).
4019+ Same columns and always-written rule as drugs.csv and pathogens.csv."""
4020+ from src .neo4j_connector import get_rna_entities
4021+ # only nodes that ARE an RNA species: a variant of a complex that chose an RNA
4022+ # member (a miR-26A RISC) is a complex, not the RNA (the drug rule's member
4023+ # clause would list it; the first variant build listed 2,393 such rows)
4024+ _export_derived (pathway_logic_network , reactome_id_to_uuid , output_file ,
4025+ get_rna_entities , "RNA" , by_member = False )
4026+
4027+
40134028def _export_derived (pathway_logic_network : pd .DataFrame ,
40144029 reactome_id_to_uuid : Dict [str , str ],
4015- output_file : str , finder , label : str ) -> None :
4030+ output_file : str , finder , label : str , by_member : bool = True ) -> None :
40164031 """The node listing shared by drugs.csv and pathogens.csv. ``finder`` maps
40174032 stable ids to {stId: {"schema_class", "name"}} for the derived ones."""
40184033 from src .neo4j_connector import get_reactome_release
@@ -4042,7 +4057,8 @@ def parts(node_id: str):
40424057 rows = []
40434058 for n in sorted (node_ids ):
40444059 parent , members = parts (n )
4045- hit = parent if parent in derived else next ((m for m in members if m in derived ), None )
4060+ hit = parent if parent in derived else \
4061+ (next ((m for m in members if m in derived ), None ) if by_member else None )
40464062 if hit is None :
40474063 continue
40484064 rows .append ({"stable_id" : n , "schema_class" : derived [hit ]["schema_class" ],
0 commit comments