Skip to content

Add opt-in strict preprocessing validation and streamline study validation - #183

Open
jamesqo wants to merge 10 commits into
mainfrom
codex/validator-hot-paths
Open

jamesqo wants to merge 10 commits into
mainfrom
codex/validator-hot-paths

Conversation

@jamesqo

@jamesqo jamesqo commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Adds opt-in preprocessing validation through --strict (alias --strict-mode) in both validateData.py and metaImport.py. Without the flag, existing validation behavior remains: duplicate CNA genes are warnings, and the added preprocessing requirements do not run.

Strict mode checks CNA gene identifier syntax and duplicate genes, unreferenced clinical/timeline/mutation files, mutation samples missing from the sequenced case list, additional lists from the bundled case_list_config.tsv, and OncoTree codes and labels. Unresolved CNA genes remain warnings. Checks do not rewrite study data or curated case lists. Configured lists must have the expected stable IDs; matching categories do not substitute for them. Strict mode requires a study-specific SV case list when structural-variant metadata is present, including when no events are reported. SV-only data does not require a mutation case list. Default validation is unchanged.

--strict_maf_checks (-m) remains independent. OncoTree references are loaded only when strict validation needs them, from a saved oncotree.json or the selected --oncotree-version (default oncotree_latest_stable). The selected reference should match the destination database; it is not automatically discovered from that database.

Retains the validator speed optimizations: set-based uniqueness checks, cached mutation column/check indexes, simpler generic-assay numeric parsing, and reuse of the mandatory UTF-8 scan for strict case-list membership.

Companion documentation: cBioPortal/cbioportal#12414

Validation: 177 existing tests passed across validator regressions, preprocessing helpers, and six mode tests. Paired tests cover CLI propagation and independent MAF flags, default versus strict CNA diagnostics, existing errors in both modes, OncoTree reference access, unreferenced files, generated lists, and mutation case-list membership. Temporary full-study checks also verified strict versus default SV requirements, arbitrary data and case-list filenames, and category-only mismatches. No new unit tests were added for this review update. git diff --check passed.

Follow-up validation: Python sample-ID normalization now matches Java for trailing separators (including TCGA---), ASCII character classes, and line terminators. All 177 existing tests passed, plus a temporary comparison of 1,547 identifiers against the Java StableIdUtil implementation.

Remaining review decisions:

  • Configuration ownership: the proposed consolidation keeps the bundled core case_list_config.tsv as the authoritative copy, with other repositories migrated separately after agreement. Those migrations are not part of this PR. Extra configured lists remain required only in strict mode.
  • OncoTree source: using oncotree_latest_stable by default remains the tentative choice pending reviewer agreement. A saved reference or explicit --oncotree-version can be used to match the destination.

@jamesqo jamesqo changed the title Reduce matrix mutation and preprocessing validation overhead Enforce preprocessing requirements and speed up study validation Sep 14, 2026
@jamesqo
jamesqo changed the base branch from codex/validate-preprocessing to main September 14, 2026 16:47
@jamesqo
jamesqo force-pushed the codex/validator-hot-paths branch 4 times, most recently from ba803c4 to 6539ddd Compare October 2, 2026 18:49
@jamesqo jamesqo changed the title Enforce preprocessing requirements and speed up study validation Validate study preprocessing requirements without changing inputs Oct 2, 2026
@jamesqo
jamesqo force-pushed the codex/validator-hot-paths branch from 6539ddd to c82604d Compare October 2, 2026 19:14
@jamesqo jamesqo changed the title Validate study preprocessing requirements without changing inputs Enforce preprocessing requirements and streamline study validation Oct 2, 2026
@@ -0,0 +1,27 @@
CASE_LIST_FILENAME STAGING_FILENAME META_STABLE_ID META_CASE_LIST_CATEGORY META_CANCER_STUDY_ID META_CASE_LIST_NAME META_CASE_LIST_DESCRIPTION

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file already lives in the datahub-study-curation-tools, but we want to avoid having to download it from the internet every time we run the validator. If this is a problem / there are suggestions how to not duplicate this file feel free to comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not introduce another copy, especially because this changes the behavior of the actual script that uses it. We hae a copy of this in google sheets (?), pipelines-configuration, etc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion the validator should only validate the rules present in FileFormats.MD, which do not specify filenames. After reading through the section in FileFormats, it seems that any file ... regardless of name ... is considered a case list file if it is present in the case_lists subdirectory under the main study directory. So this config file seems unnecessary to me. Every file in case_lists should be evaluated to see that it is a valid case list file, and all required case_lists should be validly defined. (regardless of filenames).

If we are changing FileFormats.MD, I need to understand those changes before I can evaluate this.

Maybe I am misunderstanding and this is not planned to be used by the validator. Or maybe this is a different validator process distinct from scripts/importer/validateData.py ... but I see many changes to validateData.py below which seem to indicate that this is planning to make those changes part of the validation process for the whole community.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

James told me the case list config file is meant to stay in this PR, and that the copies in the other repos will be deleted later. If that is the plan, it should be written down here and agreed on. The file in this PR is not the same as the one in pipelines-configuration (resources/case_list_config.tsv): it adds data_mutations.txt rows, changes _sequenced, and drops _sv, so the agreement should cover which copy remains.

Strict mode is a separate question. Without it, the validator errors when _all is missing, when _sequenced is missing and there is mutation data, and when _cna is missing and there is discrete CNA data. _cnaseq is only a warning when both mutation and CNA data are present. Strict mode reads this config and turns a missing list into an error whenever the named data files have samples, including _cnaseq, _3way_complete, and the log2 CNA, methylation, microRNA, mRNA, RNA-seq, RPPA, and protein-quantification lists. Those are optional in the published file formats and in the draft. Neither mode requires _sv, which the draft does require when structural-variant data is present. That needs to be agreed before this is resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved: we're keeping the errors for missing files (eg cnaseq) in strict mode only

@jamesqo
jamesqo force-pushed the codex/validator-hot-paths branch from ff11557 to e89322f Compare October 6, 2026 18:17
@jamesqo
jamesqo force-pushed the codex/validator-hot-paths branch from 357347e to 0d06a8b Compare October 6, 2026 18:27
@jamesqo
jamesqo marked this pull request as ready for review October 6, 2026 18:27
Comment thread scripts/importer/validateData.py Resolved
Comment thread scripts/importer/validateStudies.py Resolved

@sheridancbio sheridancbio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only began looking at this PR. After some looking it appears that many data file constraint checks are being added which are not specified in the current FileFormats.md for cBioPortal. I think that before we do the coding of these checks into the importer / validate_data.py code, we should agree upon changes to the FileFormats.md documentation which spell out what the new requirements are. I'm not sure if these new requirements match what we are capturing in the engineering / curation process practices/contract document we are working on at MSK. But even when that document has been finalized and agreed upon, we need to decide which of those new constraints are going to be imposed on the entire cBioPortal community through a change to validate_data.py ... and which will be constraints which only apply to the curation efforts at MSK.

If there are going to be MSK-specific constraints (such as rules about sample stable id patterns specific to MSK such as the dmp identifier schema ... as a hypothetical example) we need to separate those checks so that the extra MSK constraints could be evaluated by the MSK curation team and the MSK import process but would not apply the the whole community.

If this definition and categorization has already been done, I'd like to begin by looking at the planned revision to FileFormats.md.

@@ -0,0 +1,27 @@
CASE_LIST_FILENAME STAGING_FILENAME META_STABLE_ID META_CASE_LIST_CATEGORY META_CANCER_STUDY_ID META_CASE_LIST_NAME META_CASE_LIST_DESCRIPTION

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion the validator should only validate the rules present in FileFormats.MD, which do not specify filenames. After reading through the section in FileFormats, it seems that any file ... regardless of name ... is considered a case list file if it is present in the case_lists subdirectory under the main study directory. So this config file seems unnecessary to me. Every file in case_lists should be evaluated to see that it is a valid case list file, and all required case_lists should be validly defined. (regardless of filenames).

If we are changing FileFormats.MD, I need to understand those changes before I can evaluate this.

Maybe I am misunderstanding and this is not planned to be used by the validator. Or maybe this is a different validator process distinct from scripts/importer/validateData.py ... but I see many changes to validateData.py below which seem to indicate that this is planning to make those changes part of the validation process for the whole community.

@@ -0,0 +1,244 @@
"""Read-only checks for missing generated case lists.

Checks:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to FileFormats.md, there are three case lists which must be provided by the study curator (or can be autogenerated by setting add_global_case_list in the meta_study file):

  • one with stable id <study_stable_id>_all
  • one with stable id <study_stable_id>_sequenced
  • one with stable id <study_stable_id>_cna

From these rules the responsibility of the validator is to check whether three such case lists are provided in the case_lists subdirectory or if the meta_study file contains the add_global_case_list property setting.

Aside from that, no other validation is required. If FileFormats.md is being changed to required additional case list files under certain circumstances (such as requiring a case_list file for the structural variants when the study contains a data_sv.txt file), I'd want to see the new rules first before evaluating this code.

I think we also can have a larger conversation about case list files which represent the complete content of a genetic profile which is covered by a column in data_gene_panel_matrix.txt. I have proposed (In the contract file we are evaluating) that every study which contains a genetic profile (or at least a genetic profile within these types : {mutations, cna, sv}) must contain a data_gene_panel_matrix.txt file which has a record for every sample in the study's clinical data file. That record would define the gene_panel used for the profiling if the profiling was targeted, or WGS/WXS if a profiling of all genes was done, or NA if no profiling was done. If that proposal is adopted, we may drop support for accepting the three required case list files because the sample set is defined completely in data_gene_panel_matrix.txt. We also may drop support for a "_sv" case list file because that would also be covered. If we want to extend this all the way ... then every genetic profile would have a column in the data_gene_panel_matrix.txt file, even profiles such as expression, rppa, methylation, or any kind of generic assay. The values present in those columns would either indicate whether the sample was assessed for the profile or not ... or if there are several forms of assessment for the profile type there might be several defined codes which would specify how the profile was assessed. In that case, the only files which would appear in the case_lists subdirectory would be arbitrary files defined by the study curators. Perhaps cancer type specific subsets of samples. But the validator would not need to check those for accuracy (checking whether all LUAD samples were correctly listed out in a sample list which was creating a LUAD case set) ... it would only need to check that the case list was valid (in the correct syntax, and containing only valid sample stable ids and other metadata constrains like the cancer_study_identifier)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're going to keep the errors for other files like cnaseq in strict mode only

Remove the --oncotree-file option and the hidden batch cache that
validateStudies shared across validator subprocesses. Declare
--oncotree-version directly in the validateData and metaImport parsers
instead of adding it through a helper. An offline portal info directory
can still supply oncotree.json.

Claude-Session: https://claude.ai/code/session_01G2oReNWxCQxGQrb5yopuKR
@jamesqo

jamesqo commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@sheridancbio Thanks for the feedback. You raised a good point that the checks here should be explicitly stated in the cBioPortal File Formats documentation. I'm going to open up a draft PR that addresses that.

Re changing behavior on existing users of cBioPortal -- I've talked with Anusha, she has told me that we shouldn't have to worry about these enhanced checks "breaking" the community's use case. We will have the studies updated in datahub before long so that the community won't run into these issues.

@mandawilson

Copy link
Copy Markdown
Contributor

@jamesqo You write:

@sheridancbio Thanks for the feedback. You raised a good point that the checks here should be explicitly stated in the cBioPortal File Formats documentation. I'm going to open up a draft PR that addresses that.

Re changing behavior on existing users of cBioPortal -- I've talked with Anusha, she has told me that we shouldn't have to worry about these enhanced checks "breaking" the community's use case. We will have the studies updated in datahub before long so that the community won't run into these issues.

That update covers the public studies, but it does not cover private studies that are valid under the current documentation. We should not make these checks validation errors for the whole community until the requirements are agreed upon and documented in the cBioPortal File Formats documentation. MSK-specific requirements should remain separate from the community validator.

@mandawilson

mandawilson commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

These checks affect private studies that pass validation today. metaImport.py stops on an error, so those studies would not be imported. We need others to agree, and this needs to match the file-format draft (#12414) once that draft is finalized. MSK-only rules should stay out of the community validator.

  • Each case_list_config.tsv row is required when those filenames are present and have samples, including _cnaseq and the expression lists. The draft requires only _all, _sequenced, _cna, and _sv, and filenames are free. This also errors when the suggested filename already belongs to another list.
  • An unreferenced clinical, timeline, or mutation file is an error here. The draft says it will not be imported.
  • get_sample_id should stay in this file and match Java and the pipelines copy. For "TCGA---", this copy returns "TCGA---" and Java returns "TCGA----01".

@sheridancbio

Copy link
Copy Markdown
Contributor

I think we plan to cover this during a discussion tomorrow. I'll return to the details of this PR when I understand the planned changes better.

@mandawilson

Copy link
Copy Markdown
Contributor

@sheridancbio @jamesqo Just making a note here that the validator is saying things are errors that the importer doesn't consider errors. Importer hasn't been changed to reflect our new rules.

@mandawilson

Copy link
Copy Markdown
Contributor

@jamesqo @sheridancbio I don't remember if the validator checks gene aliases -- if it doesn't the importer could again end up with duplicate records.

@jamesqo jamesqo changed the title Enforce preprocessing requirements and streamline study validation Add opt-in strict preprocessing validation and streamline study validation Oct 26, 2026
James Ko added 2 commits October 26, 2026 19:05
Strict mode checked ONCOTREE_CODE against an OncoTree release downloaded
by version, defaulting to the latest stable release, so it could disagree
with the cancer types loaded in the destination database.

Check codes against the portal's own cancer types instead, from the web
API or cancer-types.json in a portal info directory, plus any types the
study's cancer type file adds. Codes match case-insensitively, since the
portal stores lower-case IDs. CANCER_TYPE_DETAILED must still match the
cancer type's name exactly. CANCER_TYPE is no longer checked, because the
portal does not store OncoTree main types.

Remove the OncoTree download, the --oncotree-version option and the
oncotree.json portal info file.
…pes"

This reverts commit 1776de6. Strict mode goes back to checking
ONCOTREE_CODE against a downloaded OncoTree release. The portal-based
check is kept on the codex/oncotree-portal-cancer-types branch.
@mandawilson

mandawilson commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

These checks affect private studies that pass validation today. metaImport.py stops on an error, so those studies would not be imported. We need others to agree, and this needs to match the file-format draft (#12414) once that draft is finalized. MSK-only rules should stay out of the community validator.

  • Each case_list_config.tsv row is required when those filenames are present and have samples, including _cnaseq and the expression lists. The draft requires only _all, _sequenced, _cna, and _sv, and filenames are free. This also errors when the suggested filename already belongs to another list.
  • An unreferenced clinical, timeline, or mutation file is an error here. The draft says it will not be imported.
  • get_sample_id should stay in this file and match Java and the pipelines copy. For "TCGA---", this copy returns "TCGA---" and Java returns "TCGA----01".

Updating my note above. The extra checks are opt-in through --strict, as described in this pull request and in the file-format draft (#12414). Without that flag, metaImport.py keeps the current validation behavior, so a private study that passes today still passes. With --strict, an error still stops the import.

The unreferenced clinical, timeline, and mutation file point is covered: the draft says that file is not imported, and that --strict reports an error. That matches the code.

Two points are still open:

  • Neither validation mode requires a _sv case list when a meta_structural_variants file is present. The draft requires that list when structural-variant data is loaded. The case_list_config.tsv in this pull request is also not the pipelines-configuration copy: it adds data_mutations.txt rows, changes _sequenced, and drops _sv.
  • get_sample_id should match the Java importer and the pipelines copy. For TCGA---, this copy returns TCGA--- and Java returns TCGA----01.

@@ -0,0 +1,27 @@
CASE_LIST_FILENAME STAGING_FILENAME META_STABLE_ID META_CASE_LIST_CATEGORY META_CANCER_STUDY_ID META_CASE_LIST_NAME META_CASE_LIST_DESCRIPTION

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

James told me the case list config file is meant to stay in this PR, and that the copies in the other repos will be deleted later. If that is the plan, it should be written down here and agreed on. The file in this PR is not the same as the one in pipelines-configuration (resources/case_list_config.tsv): it adds data_mutations.txt rows, changes _sequenced, and drops _sv, so the agreement should cover which copy remains.

Strict mode is a separate question. Without it, the validator errors when _all is missing, when _sequenced is missing and there is mutation data, and when _cna is missing and there is discrete CNA data. _cnaseq is only a warning when both mutation and CNA data are present. Strict mode reads this config and turns a missing list into an error whenever the named data files have samples, including _cnaseq, _3way_complete, and the log2 CNA, methylation, microRNA, mRNA, RNA-seq, RPPA, and protein-quantification lists. Those are optional in the published file formats and in the draft. Neither mode requires _sv, which the draft does require when structural-variant data is present. That needs to be agreed before this is resolved.

"case list to specify which samples are profiled for this data type. On the query page, this "
"case list will be selected by default when both mutation and CNA data are available.",
cancer_study_id + '_cnaseq')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a meta file of type meta_structural_variants is present, this should require a case list whose stable_id is _sv.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

Comment thread scripts/importer/validateData.py Outdated
if entrez_id is not None:
normalized = entrez_id.lstrip('0') or '0'
if (not re.fullmatch(r'[0-9]+', entrez_id) or len(normalized) > 10
or not 0 < int(normalized) <= 2147483647):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This limit is still here. Rob asked to drop the signed 32-bit maximum in #12414 because entrez_gene_id is Int64, and that comment has no reply.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

if code.upper() in UNAVAILABLE_VALUES:
return
if code not in nodes:
yield 'ONCOTREE_CODE', code, 'a code in the selected OncoTree reference; remap retired codes'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

James removed the retired-code wording from the file-format draft, let's remove it here too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed


class OncotreeReference:
"""Load the reference when first needed and reuse the result for later rows."""
def __init__(self, filename=None, version='oncotree_latest_stable'):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we agree to download oncotree_latest_stable, or should this check the OncoTree version in the destination database? Downloading the latest stable release is fine if that was the decision. The portal-based check was added and reverted on October 26.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reached a tentative decision with @averyniceday to go with latest stable

these checks are going to be strict mode only so we shouldn't have to worry too much about breaking people's imports when we use oncotree

@mandawilson

Copy link
Copy Markdown
Contributor

@jamesqo @sheridancbio I don't remember if the validator checks gene aliases -- if it doesn't the importer could again end up with duplicate records.

Duplicates are counted on the resolved Entrez ID, so two aliases for the same gene are caught.

Comment thread scripts/importer/case_list_config.tsv Outdated
cases_RNA_Seq_mRNA.txt data_RNA_Seq_expression_median.txt <CANCER_STUDY>_rna_seq_mrna all_cases_with_mrna_rnaseq_data <CANCER_STUDY> Tumor Samples with mRNA data (RNA Seq) All samples with mRNA expression data (<NUM_CASES> samples)
cases_RNA_Seq_v2_mRNA.txt data_RNA_Seq_v2_mRNA_median_Zscores.txt <CANCER_STUDY>_rna_seq_v2_mrna all_cases_with_mrna_rnaseq_data <CANCER_STUDY> Tumor Samples with mRNA data (RNA Seq V2) All samples with mRNA expression data (<NUM_CASES> samples)
cases_rppa.txt data_rppa.txt <CANCER_STUDY>_rppa all_cases_with_rppa_data <CANCER_STUDY> Tumor Samples with RPPA data Tumors with reverse phase protein array (RPPA) data for about 200 antibodies (<NUM_CASES> samples)
cases_sequenced.txt data_mutations_extended.txt|data_sv.txt|data_mutations_mskcc.txt|data_mutations_uniprot.txt <CANCER_STUDY>_sequenced all_cases_with_mutation_data <CANCER_STUDY> Sequenced Tumors All (Next-Gen) sequenced samples (<NUM_CASES> samples)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config's _sequenced rows include data_sv.txt, so strict asks a study with structural variants and no mutation data for a _sequenced list. The file format draft defines _sequenced as samples profiled for mutations. Also, the cases_protein_quantification.txt row has a trailing space.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

if stable_id in reported:
continue
category = spec['meta_case_list_category']
if category and category != 'other' and category in categories:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A matching case_list_category should not suppress this warning. The portal looks up {study}_sequenced by stable id. A list with the matching category does not supply that id.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

@jamesqo

jamesqo commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

@mandawilson I could not reply directly to your comment about the _cnaseq files, but I chose to keep those checks on the strict side just to enforce consistency within our internal studies.

@cBioPortal cBioPortal deleted a comment from kojah Nov 11, 2026
@cBioPortal cBioPortal deleted a comment from kojah Nov 11, 2026

@averyniceday averyniceday left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TCGA barcode conversion shouldn't be tied into the generate case lists check

@averyniceday averyniceday left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I understand correctly, we need to hit the oncotree website when checking oncotree. There's an "offline" mode -- in this case let's make it so strict mode has to be run not in offline mode

if portal_instance.strict_mode:
# Case lists were read before mutation rows, so compare membership now.
if mutation_sample_ids is not None:
called_samples = set().union(*(validator.mutation_samples for validator in

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this crashes in strict mode if a mutation meta file is missing data_filename -- process_metadata_files appends None to the validator list in that case, so we hit None.mutation_samples and get an AttributeError instead of the actual meta file error

Comment thread scripts/importer/metaImport.py Outdated
type=str, help='path to study directory.')
data_source_group.add_argument('-d', '--data_directory',
type=str, help='path to data directory for incremental upload.')
parser.add_argument('--strict', '--strict-mode', action='store_true', default=False,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--strict used to be interchangeable with the longform --strict_maf_checks - so behavior is changing if someone was using --strict before. Need to flag this if we release to community. Are --strict-maf-checks a subset of this --strict mode as well?

help='OncoTree version used with --strict to check ONCOTREE_CODE values '
'(default: oncotree_latest_stable)')
parsed_args = parser.parse_args(args)
if parsed_args.strict and parsed_args.portal_info_dir is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's also restrict so you can't use -n with --strict since -n skips portal checks

code = row.get('ONCOTREE_CODE', '').strip()
if code.upper() in UNAVAILABLE_VALUES:
return
if code not in nodes:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

case sensitivity?

self.error = IndexError(f"{self.filename}: data row has no column {self.id_column}: {line[:80]}")
self.active = False
else:
self.members.add(row[self.id_column])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might potentially be adding another entry even if it's empty value

Comment thread scripts/importer/validateData.py Outdated
entrez_id = normalized
resolved = super().checkGeneIdentification(gene_symbol, entrez_id)
if resolved is None:
self.logger.warning('CNA gene could not be resolved; this row would not be loaded. '

@averyniceday averyniceday Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is double logged - according to Claude

 checkGeneIdentification already logs when it returns None, so this double-reports every unresolved CNA gene

@averyniceday averyniceday left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, minor changes

@jamesqo
jamesqo dismissed mandawilson’s stale review November 24, 2026 20:31

addressed feedback, was handed off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants