Skip to content

Commit

Permalink
Use sample id instead of case id for rnafusion (#3069) (patch)
Browse files Browse the repository at this point in the history
### Changed

- Use sample id instead of case id for rnafusion
  • Loading branch information
fevac authored Aug 6, 2024
1 parent ed66523 commit b54a0e2
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 45 deletions.
14 changes: 7 additions & 7 deletions cg/constants/delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@
]

RNAFUSION_ANALYSIS_CASE_TAGS: list[set[str]] = [
{AnalysisTag.MULTIQC_HTML, AnalysisTag.RNA},
{HK_DELIVERY_REPORT_TAG},
]

RNAFUSION_ANALYSIS_SAMPLE_TAGS: list[set[str]] = [
{AlignmentFileTag.CRAM},
{AlignmentFileTag.CRAM_INDEX},
{AnalysisTag.FUSION, AnalysisTag.ARRIBA},
{AnalysisTag.FUSION, AnalysisTag.STARFUSION},
{AnalysisTag.FUSION, AnalysisTag.FUSIONCATCHER},
Expand All @@ -159,17 +166,10 @@
{AnalysisTag.FUSIONREPORT, AnalysisTag.RESEARCH},
{AnalysisTag.FUSIONINSPECTOR_HTML, AnalysisTag.RESEARCH},
{AnalysisTag.ARRIBA_VISUALIZATION, AnalysisTag.RESEARCH},
{AnalysisTag.MULTIQC_HTML, AnalysisTag.RNA},
{HK_DELIVERY_REPORT_TAG},
{AnalysisTag.VCF_FUSION},
{AnalysisTag.GENE_COUNTS},
]

RNAFUSION_ANALYSIS_SAMPLE_TAGS: list[set[str]] = [
{AlignmentFileTag.CRAM},
{AlignmentFileTag.CRAM_INDEX},
]

NF_ANALYSIS_CASE_TAGS: list[set[str]] = [{HermesFileTag.CLINICAL_DELIVERY}]

NF_ANALYSIS_SAMPLE_TAGS: list[set[str]] = [{HermesFileTag.CLINICAL_DELIVERY}]
Expand Down
10 changes: 2 additions & 8 deletions cg/meta/workflow/rnafusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from cg.models.deliverables.metric_deliverables import MetricsBase
from cg.models.rnafusion.rnafusion import RnafusionParameters, RnafusionSampleSheetEntry
from cg.resources import RNAFUSION_BUNDLE_FILENAMES_PATH
from cg.store.models import CaseSample, Sample
from cg.store.models import CaseSample

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -76,7 +76,7 @@ def get_sample_sheet_content_per_sample(self, case_sample: CaseSample) -> list[l
sample=case_sample.sample
)
sample_sheet_entry = RnafusionSampleSheetEntry(
name=case_sample.case.internal_id,
name=case_sample.sample.internal_id,
fastq_forward_read_paths=fastq_forward_read_paths,
fastq_reverse_read_paths=fastq_reverse_read_paths,
strandedness=Strandedness.REVERSE,
Expand All @@ -100,12 +100,6 @@ def get_references_path(self, genomes_base: Path | None = None) -> Path:
return genomes_base.absolute()
return Path(self.references).absolute()

def get_multiqc_search_patterns(self, case_id: str) -> dict:
"""Return search patterns for MultiQC for Rnafusion."""
samples: list[Sample] = self.status_db.get_samples_by_case_id(case_id=case_id)
search_patterns: dict[str, str] = {case_id: sample.internal_id for sample in samples}
return search_patterns

@staticmethod
def ensure_mandatory_metrics_present(metrics: list[MetricsBase]) -> None:
"""Check that all mandatory metrics are present.
Expand Down
44 changes: 22 additions & 22 deletions cg/resources/rnafusion_bundle_filenames.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
- format: tsv
id: CASEID
path: PATHTOCASE/fusioncatcher/CASEID.fusioncatcher.fusion-genes.txt
id: SAMPLEID
path: PATHTOCASE/fusioncatcher/SAMPLEID.fusioncatcher.fusion-genes.txt
path_index: ~
step: fusioncatcher
tag: fusioncatcher
- format: txt
id: CASEID
path: PATHTOCASE/fusioncatcher/CASEID.fusioncatcher.summary.txt
id: SAMPLEID
path: PATHTOCASE/fusioncatcher/SAMPLEID.fusioncatcher.summary.txt
path_index: ~
step: fusioncatcher
tag: fusioncatcher-summary
- format: tsv
id: CASEID
path: PATHTOCASE/starfusion/CASEID.starfusion.fusion_predictions.tsv
id: SAMPLEID
path: PATHTOCASE/starfusion/SAMPLEID.starfusion.fusion_predictions.tsv
path_index: ~
step: star-fusion
tag: star-fusion
- format: tsv
id: CASEID
path: PATHTOCASE/arriba/CASEID.arriba.fusions.tsv
id: SAMPLEID
path: PATHTOCASE/arriba/SAMPLEID.arriba.fusions.tsv
path_index: ~
step: arriba
tag: arriba
- format: cram
id: SAMPLEID
path: PATHTOCASE/cram_starfusion/CASEID.star_for_starfusion.Aligned.sortedByCoord.out.cram
path: PATHTOCASE/cram_starfusion/SAMPLEID.star_for_starfusion.Aligned.sortedByCoord.out.cram
path_index: ~
step: star-fusion
tag: star-fusion-cram
- format: cram
id: SAMPLEID
path: PATHTOCASE/cram_starfusion/CASEID.star_for_starfusion.Aligned.sortedByCoord.out.cram.crai
path: PATHTOCASE/cram_starfusion/SAMPLEID.star_for_starfusion.Aligned.sortedByCoord.out.cram.crai
path_index: ~
step: star-fusion
tag: star-fusion-cram-index
- format: html
id: CASEID
path: PATHTOCASE/fusionreport/CASEID/CASEID_fusionreport_index.html
id: SAMPLEID
path: PATHTOCASE/fusionreport/SAMPLEID/SAMPLEID_fusionreport_index.html
path_index: ~
step: report
tag: fusionreport
- format: tsv
id: CASEID
path: PATHTOCASE/fusioninspector/CASEID.FusionInspector.fusions.tsv
id: SAMPLEID
path: PATHTOCASE/fusioninspector/SAMPLEID.FusionInspector.fusions.tsv
path_index: ~
step: report
tag: fusioninspector
- format: html
id: CASEID
path: PATHTOCASE/fusioninspector/CASEID.fusion_inspector_web.html
id: SAMPLEID
path: PATHTOCASE/fusioninspector/SAMPLEID.fusion_inspector_web.html
path_index: ~
step: report
tag: fusioninspector-html
- format: pdf
id: CASEID
path: PATHTOCASE/arriba_visualisation/CASEID_combined_fusions_arriba_visualisation.pdf
id: SAMPLEID
path: PATHTOCASE/arriba_visualisation/SAMPLEID_combined_fusions_arriba_visualisation.pdf
path_index: ~
step: arriba
tag: arriba-visualisation
Expand All @@ -77,14 +77,14 @@
step: software-versions
tag: software-versions
- format: vcf
id: CASEID
path: PATHTOCASE/vcf/CASEID_fusion_data.vcf.gz
id: SAMPLEID
path: PATHTOCASE/vcf/SAMPLEID_fusion_data.vcf.gz
path_index: ~
step: vcf-collect
tag: vcf-fusion
- format: tab
id: CASEID
path: PATHTOCASE/star_for_starfusion/CASEID.ReadsPerGene.out.tab
id: SAMPLEID
path: PATHTOCASE/star_for_starfusion/SAMPLEID.ReadsPerGene.out.tab
path_index: ~
step: star-align
tag: star-align-gene-counts
Expand Down
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2773,6 +2773,7 @@ def rnafusion_workflow() -> str:
@pytest.fixture(scope="function")
def rnafusion_sample_sheet_content(
rnafusion_case_id: str,
sample_id: str,
fastq_forward_read_path: Path,
fastq_reverse_read_path: Path,
strandedness: str,
Expand All @@ -2781,7 +2782,7 @@ def rnafusion_sample_sheet_content(
headers: str = ",".join(RnafusionSampleSheetEntry.headers())
row: str = ",".join(
[
rnafusion_case_id,
sample_id,
fastq_forward_read_path.as_posix(),
fastq_reverse_read_path.as_posix(),
strandedness,
Expand Down Expand Up @@ -3034,7 +3035,7 @@ def rnafusion_deliverable_data(rnafusion_dir: Path, rnafusion_case_id: str, samp
"path_index": "",
"step": "report",
"tag": ["multiqc-html", "rna"],
"id": rnafusion_case_id,
"id": sample_id,
"format": "html",
"mandatory": True,
},
Expand Down
12 changes: 6 additions & 6 deletions tests/fixtures/analysis/rnafusion/multiqc_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"report_data_sources": {},
"report_general_stats_data": [
{
"rnafusion_case_enough_reads": {
"ADM1": {
"PF_BASES": 14818118467.0,
"PF_ALIGNED_BASES": 14216931956.0,
"RIBOSOMAL_BASES": 93556030.0,
Expand Down Expand Up @@ -37,7 +37,7 @@
}
},
{
"rnafusion_case_enough_reads": {
"ADM1": {
"LIBRARY": "Unknown Library",
"UNPAIRED_READS_EXAMINED": 589.0,
"READ_PAIRS_EXAMINED": 72391566.0,
Expand All @@ -51,7 +51,7 @@
}
},
{
"rnafusion_case_enough_reads": {
"ADM1": {
"total_reads": 74557102.0,
"avg_input_read_length": 198.0,
"uniquely_mapped": 67865050.0,
Expand Down Expand Up @@ -81,7 +81,7 @@
}
},
{
"rnafusion_case_enough_reads": {
"ADM1": {
"filtering_result_passed_filter_reads": 149114204.0,
"filtering_result_low_quality_reads": 855796.0,
"filtering_result_too_many_N_reads": 4992.0,
Expand All @@ -105,15 +105,15 @@
}
},
{
"rnafusion_case_enough_reads_1": {
"ADM1_1": {
"percent_gc": 51.0,
"avg_sequence_length": 98.42709962090532,
"median_sequence_length": 100,
"total_sequences": 74557102.0,
"percent_duplicates": 64.54554620264767,
"percent_fails": 18.181818181818183
},
"rnafusion_case_enough_reads_2": {
"ADM1_2": {
"percent_gc": 51.0,
"avg_sequence_length": 151.0,
"median_sequence_length": 151,
Expand Down

0 comments on commit b54a0e2

Please sign in to comment.