Repository navigation
Conversation
|
This draft needs to be finalized before the validator enforces it. The two PRs (#183) need to describe the same requirements. MSK-only rules should stay out of the community file formats.
|
|
|
||
| This page describes the file formats that cancer study data should assume in order to be successfully imported into the database. Unless otherwise noted, all data files are in tabular-TSV (tab separated value) format and have an associated metadata file which is in a multiline record format. The metadata and data files should follow a [few rules documented at the Data Loading page](data-loading/README.md#preparing-study-data). | ||
|
|
||
| Every data file intended for import must be referenced by a metadata file of the appropriate type, using `data_filename`. A file without this reference will not be imported, even if its filename matches an example on this page. Data filenames are not fixed; the metadata determines which file is loaded and how it is interpreted. |
There was a problem hiding this comment.
I would change this to "using the metafile property/record line with key data_filename."
Further discussion
The line just prior to this does state that "Unless otherwise noted, all data files .... have an associated metadata file ...", and that does seem to justify adding a check for data files which are present but are missing the expected meta file. The ambiguity here is that names for data files are not specified ... the datafile names are defined by the meta file. In other words, a very strict interpretation of this specification is : "datafiles are those files which are referenced in one of the meta files" meaning that a file called data_CNA.txt which has no associated metafile might not be considered a data file, but just a superfluous file sitting in the study directory. Perhaps we should add a line saying "if any file is present which begins with the prefix "data_" which is not linked to a meta file present in the same directory, the validator will generate a warning (or an error in strict mode)".
And in a related topic, we do not consistently specify how meta files are recognized by the importer. Sometimes we are definite and say that the meta file must have a particular filename, such as:
If ... a meta_cancer_type.txt file is also mandatory.
But usually we word it as though the name of the meta file is up to the user to determine .. such as:
An example metadata file could be named meta_cna.txt and its contents could be:
If the metafile is not named meta_cna.txt, but has some other name, the metaImport.py script will only recognize it for 4 particular filenames:
- CNA_DISCRETE = 'meta_CNA'
- CNA_DISCRETE_LONG = 'meta_CNA_long'
- CNA_LOG2 = 'meta_log2CNA'
- CNA_CONTINUOUS = 'meta_contCNA'
and will ignore alternatives (although importing through cbioportalImporter.py will allow the user to specify their own names). I think we need a section in the documentation which reports to the user the set of possible meta filenames they can use in conjunction with metaImport.py (or we need a help output from metaImport.py which will report to the user all meta filenames it can recognize, and mention here that "users of metaImport.py can see a list of all recognized metafile names by running metaImport.py --show-recognized-metafiles)
There was a problem hiding this comment.
Hey @sheridancbio @mandawilson , based on code in the validator, the meta files aren't restricted to just those 4 names. So I don't think we should be very specific about that
I also think it might be risky at this point to extend the check for unreferenced data_ files to every unrecognized data file, that seems to have a higher likelihood of breaking something
There was a problem hiding this comment.
I did update the wording though as you suggested
|
|
||
| Every data file intended for import must be referenced by a metadata file of the appropriate type, using `data_filename`. A file without this reference will not be imported, even if its filename matches an example on this page. Data filenames are not fixed; the metadata determines which file is loaded and how it is interpreted. | ||
|
|
||
| For example, `data_clinical_supp.txt` is not loaded just because `meta_clinical_sample.txt` exists. The metadata must reference that file. If it adds attributes for samples already in the main clinical file, merge those attributes into the main file and resolve conflicting values before import. Likewise, each timeline data file needs its own timeline metadata. Mutation files belonging to the same molecular profile should be combined into one file referenced by that profile's metadata. Separate molecular profiles can have separate data files and metadata. |
There was a problem hiding this comment.
We should be more clear and say something like "If your study folder used to contain multiple files which defined clinical attributes, you now must merge all such files into a single combined file of all samples and all sample attributes (for sample clinical data), and a single combined file of all patients and all patient attributes (for patient clinical data).
The sentence starting with "If it adds attributes..." should at the least be changed to something like "If such a data_clinical_supp.txt file is present and adds attributes..."
regarding profiles
I think being more specific here would be better. Something like:
there are 5 categories of molecular profiles which are recognized:
- mutation
- cna
- structural variant
- expression
- generic assay
The profiles in the categories {mutation, cna, structural variant} must be singular (only one such profile can be defined), and must include all profile data in a single datafile with a single related metafile. Molecular profiles in the categories {expression, generic assay} can be present as multiple datafile/metafile pairs, but each such datafile must contain all of the profiling data for that profile (no splitting of a single profile into multiple datafiles).
There was a problem hiding this comment.
Added the clinical wording / most of the suggestions about profiles. I did not make the mutation / CNA / SV profiles singular because multiple mutation profiles are allowed on purpose
|
|
||
| ### OncoTree annotations | ||
|
|
||
| `ONCOTREE_CODE` is optional. When provided, each populated code must exist in the OncoTree reference version used for validation. Check retired codes against that version and curate their replacements before import. Use the same reference version when preparing and validating a study, so that a later OncoTree update does not change the result unexpectedly. |
There was a problem hiding this comment.
"Check retired codes .." ... is this saying that the validator will check for retired codes? or are we asking that the user/curator should check for retired codes. I'm not sure I would even go into the concept of codes which are "retired" ... because we have had oncotree codes which were removed from the oncotree in one version, and then be reintroduce in another version. Is it still "retired" once it is reintroduced? So I would just leave the statement "When provided, each populated code must exist in the OncoTree reference version used for validation.", and leave the further discussion out.
The last statement
Use the same reference version when preparing and validating a study, so that a later OncoTree update does not change the result unexpectedly.
I'm not clear on what this means ... or what pitfall the user should be avoiding (perhaps developing and validating a study under OncoTree release X, but later importing the study under OncoTree release X+2 ?). This brings up a deeper problem. All studies which are imported are linked to a record in the type_of_cancer table which basically contains oncotree code references. However, we can (and regularly do) update the content of table type_of_cancer by using the ImportTypesOfCancers class in the importer scripts package. Basically, any portal database will be tied to a particular release of OncoTree, and when users call ImportTypesOfCancers and update the type_of_cancer table they may break connections/links from any cancer study which refers to an oncotree code which was just renamed/retired. Users should understand that keeping type_of_cancer up to date regularly may mean that they also must alter oncotree codes linked to their cancer study (in meta_study.txt) or alter/migrate oncotree codes present in their data_clinical_sample.txt files. The burden is on them to keep their studies up to date ... if they are going to keep their type_of_cancer table up to date.
When running ImportTypesOfCancers, I think studies which are present which have invalid oncotree codes in meta_study.txt should be deleted from the database (with notices presented to the user). Also, we should discuss what the appropriate change should be for all clinical records which refer to a no-longer present oncotree code after an upate to type_of_cancer. We might do nothing, or change the ONCOTREE_CODE attribute to NA for that sample, or also change CANCER_TYPE/CANCER_TYPE_DETAILED to NA, or delete the study if there are any samples with invalid oncotree codes and require the user to update data_clinical_sample.txt to contain the (newer) valid oncotree codes from the database. I guess the validator should raise an error in all cases where an import of the study would raise an error. If studies cannot be imported if there is an invalid field in ONCOTREE_CODE, then the validator should also raise an error ---- and that error should be based on the type_of_cancer table currently loaded into the database --- not some user-selected oncotree release name (unless the importer codebase actually fetches the oncotree release from the oncotree api)
There was a problem hiding this comment.
I agree we should validate with the oncotree version of the database the study is being imported into. I also like "When provided, each populated code must exist in the OncoTree reference version used for validation." and not mentioning retired codes. And I agree we need to think about what should be done as oncotree codes in the DB become invalid after an oncotree version update and document it.
There was a problem hiding this comment.
Removed the retired-codes and "same reference version" sentences, and kept just "must exist in the OncoTree reference used for validation". I also added a note that an OncoTree update can mean a previously valid study needs its codes or labels updated
Name data_filename as the metadata property, describe how metadata files are recognized by name and typed by content, and require single sample and patient clinical files and single-file molecular profiles. Keep ONCOTREE_CODE on samples, drop the retired-code guidance, and note that OncoTree updates can invalidate existing labels. Name Entrez gene IDs in the duplicate-row rule and drop the Int32 bound. State that every non-hidden case list file is imported, define the profiled-sample case lists without tying them to reported events, and explain why missing samples inflate mutation frequencies.
A profile's data lives in the data file its metadata references and may not be split, but a discrete CNA profile can also name an optional pd_annotations_filename, so a profile is not always a single file.
Strict validation now checks ONCOTREE_CODE against the cancer types of the portal being validated against, plus any the study adds, instead of a downloaded OncoTree release. Codes match case-insensitively and CANCER_TYPE_DETAILED must match the cancer type's name. CANCER_TYPE is no longer checked, since the portal does not store OncoTree main types.
This reverts commit 945305d. The docs go back to describing the OncoTree release check. The portal-based version is kept on the codex/oncotree-portal-cancer-types branch.
|
|
||
| The additional preprocessing checks described here are opt-in. Run `validateData.py --strict -s STUDY_DIRECTORY` (or pass `--strict` to `metaImport.py`) to check OncoTree annotations, CNA gene identifier syntax and duplicates, unreferenced clinical/timeline/mutation files, mutation samples missing from `_sequenced`, and additional generated case lists. `--strict-mode` is an alias. Without this flag, existing validation errors and warnings still apply, but these additional requirements are not enforced. The existing `--strict_maf_checks` (`-m`) flag controls separate mutation-file checks; neither flag enables the other. | ||
|
|
||
| Strict validation reports problems without rewriting study data. For OncoTree checks, select the destination database's reference using `--oncotree-version VERSION`, or supply a matching `oncotree.json` with the other saved portal information through `-p DIRECTORY`. The default version is `oncotree_latest_stable`; it is not automatically matched to the destination database. Without `--strict`, validation does not load or download an OncoTree reference. |
There was a problem hiding this comment.
With -p, strict validation reads oncotree.json from that directory and does not use --oncotree-version. If that file is missing, the OncoTree check errors.
|
|
||
| These rules apply to wide-format discrete and continuous copy number, expression, and methylation data: a matrix with one gene per row and one sample per column. Each gene must appear at most once in each file. Every data row is resolved to a single Entrez gene ID, the portal's gene identifier: `Entrez_Gene_Id` is used when present, and otherwise the gene symbol or alias in `Hugo_Symbol`. No Entrez gene ID may be resolved from more than one row, so two different symbols that resolve to the same gene are still duplicates. Remove identical duplicate rows. If duplicate rows have different values for a sample, choose a single value before import. The most reliable way to choose is to ask the lab or center that produced the calls. Do not rely on row order to decide which value is loaded. | ||
|
|
||
| For example, two rows with `Entrez_Gene_Id` set to `7157` describe the same gene, even if their `Hugo_Symbol` values differ. They must be combined into one row. The integer spellings `07157` and `7157` also identify the same gene. |
There was a problem hiding this comment.
This normalization happens only for CNA in --strict. In default mode, and for expression and methylation, 07157 and 7157 are counted as two genes.
mandawilson
left a comment
There was a problem hiding this comment.
The file format should describe what goes in the files. Three passages need to change:
- Remove the proposed OncoTree update section. It describes a portal policy, and the current importer does not do it.
- Remove the paragraph about the 32-bit Entrez cap and cbioportal-core #183. A temporary validator limit does not belong here.
- In the case list paragraph, name stable_id only. {study}_sequenced is what makes a file the sequencing case list. case_list_category does not make that choice.
|
|
||
| An empty value, `NA`, `N/A`, `Not Available`, `[Not Available]`, or `[Not Applicable]` is treated as missing, regardless of capitalization. Missing codes and labels do not need to be filled in. When no code is supplied, the OncoTree matching rules do not apply to the cancer type labels. | ||
|
|
||
| #### Proposed handling of OncoTree updates |
There was a problem hiding this comment.
Please remove this section. It describes a possible portal-update policy, not the file format, and it is not behavior of the current importer. The policy needs a wider discussion before it is written down here.
|
|
||
| For example, strict CNA validation treats two rows with `Entrez_Gene_Id` set to `7157` as duplicates even if their `Hugo_Symbol` values differ. It also normalizes the integer spellings `07157` and `7157` to the same gene ID. That normalization is limited to CNA under `--strict`: default-mode CNA, expression, and methylation validation count those two spellings as different gene identifiers. | ||
|
|
||
| The file format does not impose a signed 32-bit maximum on Entrez gene IDs; the portal's `gene.entrez_gene_id` field is `Int64`. The companion validator in [cbioportal-core #183](https://github.com/cBioPortal/cbioportal-core/pull/183) currently rejects strict CNA IDs above `2147483647`; removing that implementation restriction remains follow-up work in that PR. A row that cannot be matched to an Entrez gene ID in the portal's `gene` table produces a validation warning and is skipped during import. |
There was a problem hiding this comment.
Please remove this paragraph except for the last sentence. The file format should not describe a temporary validator limit or point at an open pull request. The 32-bit cap is in #183, where it still needs to be removed.
|
|
||
| Case lists are used to define sample lists that can be selected on the query page. Some case lists have specific functionality, but it's also possible to add custom case lists. The case list files should be placed in a sub-directory called `case_lists` which exists alongside all the other cancer study data. | ||
|
|
||
| All files in the `case_lists` subdirectory are imported as case lists, except hidden files and editor backup files ending in `~`. File names are irrelevant during the import of case lists. The `stable_id` and `case_list_category` fields within each file determine how the case list is used, so naming a file `cases_sequenced.txt` does not make it the sequencing case list. |
There was a problem hiding this comment.
Please name stable_id only in the last sentence. The sequencing case list is the file whose stable_id is {study}_sequenced. case_list_category does not make that choice.
Related: cBioPortal/cbioportal-core#183
Describe changes proposed in this pull request:
_svto the required-list section to match the Gene Panel section.Distinguishes baseline validation from the opt-in
--strictpreprocessing checks in core #183. Documents both CLI flags, independent MAF strictness, OncoTree reference selection, strict CNA errors versus default warnings, unreferenced files, mutation case-list membership, and additional configured case lists. Default validation does not enforce the added preprocessing requirements. The proposed OncoTree update policy and temporary Entrez-limit discussion have been removed. Strict mode requires the SV list when structural-variant metadata is present; additional configured lists remain strict-mode requirements and are identified by stable ID.Validation:
git diff --checkpassed. All five added local links resolve, and existing code fences are unchanged. No application tests were added or run because this change only edits documentation. The documentation site was not built.Checks
Any screenshots or GIFs?
If this is a new visual feature please add a before/after screenshot or gif
here with e.g. Giphy CAPTURE or Peek
Notify reviewers
Read our Pull request merging
policy. It can help to figure out who worked on the
file before you. Please use
git blame <filename>to determine thatand notify them either through slack or by assigning them as a reviewer on the PR