cBioFormatter v0.2.0
This release adds mutation data processing to cbioformatter, converting per-sample VCFs into cBioPortal-compatible mutation files alongside the existing clinical-data support.
Installation
pip install --upgrade cbioformatteror with uv:
uv add cbioformatterRequires Python 3.10 or newer.
Highlights
Mutation data processing
When sample_data contains a VCF_PATH column, ClinicalStudy now converts each VCF to MAF via a user-installed mafsmith, concatenates the per-sample MAFs into data_mutations.txt, and writes the matching meta_mutations.txt and case_lists/cases_sequenced.txt.
- New constructor kwargs:
ref_fasta_path(optional override; mafsmith uses its bundled reference by default) andmafsmith_path, withCBIOFORMATTER_REF_FASTAandCBIOFORMATTER_MAFSMITH_PATHenv-var fallbacks. - Samples with null
VCF_PATHvalues are skipped but still appear incases_all.txt. - New error classes:
MutationToolNotAvailableError,MutationConversionError,MissingReferenceFastaError.
Note: mafsmith does not currently populate the optional
SWISSPROTcolumn, so cBioPortal's Pfam-domain mutations view will be unavailable until nf-osi/mafsmith closes that gap.
Quick start
import pandas as pd
from cbioformatter import ClinicalStudy
# sample_data includes a VCF_PATH column pointing to each sample's VCF
study = ClinicalStudy(
study_id="my_study",
name="My Study",
description="A short description",
cancer_type="brca",
sample_data=sample_df,
patient_data=patient_df,
)
study.write_files(output_dir="./studies")See the README for a fuller walkthrough.
What's next
- cBioPortal study upload to a running local instance (#42).
- See the open issues for the full backlog.
Full changelog
See CHANGELOG.md or the v0.1.0...v0.2.0 comparison for the complete list of changes.
Feedback
Please file an issue if you hit problems or have feature requests.