66 - gene-level SummarizedExperiment (genes.rds)
77
88Usage:
9- Register a coldata TSV in mwconf['ids'] under a chosen <coldata_id> key.
10- The TSV must have two tab-separated columns:
11- name sample label (used as column name in the SE)
12- file path to the corresponding salmon quant.sf
9+ mapper.py populates mwconf['ids'][coldata_id] with a list of
10+ "sample_name\\ tquant_sf_path" strings for each RNA exp group (GRCh38).
11+ The rules below write the coldata TSV and run the R script.
1312
14- Then request:
13+ Alternatively, register a list of "name\\ tfile" strings manually in
14+ mwconf['ids'] under a chosen <coldata_id> key and request:
1515 out/fishpond/tximeta_GRCh38_ensembl/<coldata_id>/transcripts.rds
1616 out/fishpond/tximeta_GRCh38_ensembl/<coldata_id>/genes.rds
1717"""
1818
1919
20- def _fishpond_tximeta_quant_files (wildcards ):
21- """Return the list of quant.sf paths declared in the coldata TSV."""
22- coldata_path = mwconf ['ids' ][wildcards .coldata_id ]
23- with open (coldata_path ) as fh :
24- reader = csv .DictReader (fh , delimiter = '\t ' )
25- return [row ['file' ] for row in reader ]
20+ rule fishpond_coldata_from_ids :
21+ """
22+ Created:
23+ 2026-02-22
24+ Aim:
25+ Write a coldata TSV (columns: name, file) from the list of
26+ "name\\ tfile" strings stored in mwconf['ids'][coldata_id].
27+ Populated automatically by mapper.py for each RNA exp group.
28+ """
29+ output :
30+ "out/fishpond/coldata/{coldata_id}.tsv"
31+ wildcard_constraints :
32+ coldata_id = r"[-a-zA-Z0-9_]+"
33+ run :
34+ import os
35+ os .makedirs (os .path .dirname (output [0 ]), exist_ok = True )
36+ with open (output [0 ], 'w' ) as fh :
37+ fh .write ("name\t file\n " )
38+ for entry in mwconf ['ids' ][wildcards .coldata_id ]:
39+ fh .write (entry + "\n " )
2640
2741
2842rule fishpond_tximeta_GRCh38_ensembl :
@@ -33,19 +47,24 @@ rule fishpond_tximeta_GRCh38_ensembl:
3347 Import salmon quant.sf files (human GRCh38, Ensembl release detected
3448 automatically from salmon index metadata) with tximeta, add SYMBOL IDs,
3549 scale inferential replicates, and summarise to gene level.
36- Input coldata_id:
37- Key in mwconf['ids'] that points to a TSV with 'name' and 'file' columns.
50+ coldata_id:
51+ Key in mwconf['ids'] whose value is a list of "name\\ tfile" strings.
52+ Populated automatically by mapper.py for RNA exp groups.
3853 Test:
39- out/fishpond/tximeta_GRCh38_ensembl/my_coldata_id/transcripts.rds
40- out/fishpond/tximeta_GRCh38_ensembl/my_coldata_id/genes.rds
54+ out/fishpond/tximeta_GRCh38_ensembl/coldata-GRCh38-myexp/transcripts.rds
55+ out/fishpond/tximeta_GRCh38_ensembl/coldata-GRCh38-myexp/genes.rds
56+ out/fishpond/tximeta_GRCh38_ensembl/coldata-GRCh38-myexp/transcripts_counts.csv.gz
57+ out/fishpond/tximeta_GRCh38_ensembl/coldata-GRCh38-myexp/genes_counts.csv.gz
4158 """
4259 input :
43- coldata = lambda wildcards : mwconf [ 'ids' ][ wildcards . coldata_id ] ,
44- quant_sf = _fishpond_tximeta_quant_files ,
45- script = "src/r/scripts/fishpond_tximeta.R"
60+ coldata = "out/fishpond/coldata/{ coldata_id}.tsv" ,
61+ quant_sf = lambda wildcards : [ e . split ( ' \t ' )[ 1 ] for e in mwconf [ 'ids' ][ wildcards . coldata_id ]] ,
62+ script = "../mw-lib/ src/r/scripts/fishpond_tximeta.R"
4663 output :
47- transcripts = "out/fishpond/tximeta_GRCh38_ensembl/{coldata_id}/transcripts.rds" ,
48- genes = "out/fishpond/tximeta_GRCh38_ensembl/{coldata_id}/genes.rds"
64+ transcripts = "out/fishpond/tximeta_GRCh38_ensembl/{coldata_id}/transcripts.rds" ,
65+ genes = "out/fishpond/tximeta_GRCh38_ensembl/{coldata_id}/genes.rds" ,
66+ transcripts_counts = "out/fishpond/tximeta_GRCh38_ensembl/{coldata_id}/transcripts_counts.csv.gz" ,
67+ genes_counts = "out/fishpond/tximeta_GRCh38_ensembl/{coldata_id}/genes_counts.csv.gz"
4968 params :
5069 outdir = "out/fishpond/tximeta_GRCh38_ensembl/{coldata_id}" ,
5170 bfc_path = "out/TximetaBFC"
0 commit comments