Skip to content

Repository files navigation

snp-filter-cli

A cross-platform .NET console tool that filters a 23andMe raw data export down to a set of rsIDs (SNP identifiers) you provide, writing the matching records to a new output file.

Requirements

Build

dotnet build

Test

dotnet test

Usage

dotnet run --project src/SnpFilterCli -- --input <path> --rsids <path> --output <path> [--verbose] [--strict]

Or, after building, run the executable directly (no -- separator needed):

src/SnpFilterCli/bin/Debug/net10.0/SnpFilterCli.exe -i <path> -r <path> -o <path>

When invoking through dotnet run, the -- separator is required so dotnet run doesn't try to interpret the app's flags (e.g. -r) as its own options.

Options

Flag Short Description
--input -i Path to the 23andMe raw data file.
--rsids -r Path to a text file listing rsIDs to keep, one per line. Blank lines and #-prefixed comments are ignored.
--output -o Path to write the filtered output file.
--verbose Print progress and the full list of missing rsIDs.
--strict Write any requested rsIDs that weren't found to <output>.errors.log and exit with a non-zero status.
--help -h Show usage.

Example

dotnet run --project src/SnpFilterCli -- -i sample.txt -r rsids.txt -o filtered.txt --verbose --strict

Behavior

  • Input rows are tab-delimited rsid, chromosome, position, genotype. Lines starting with # and blank lines are treated as comments/header and skipped.
  • Malformed data rows are skipped and counted rather than causing a failure; a file where every data row is malformed is rejected as invalid.
  • rsID matching is case-insensitive; the rsID list is deduplicated, but duplicate rows in the input file are preserved in the output.
  • If zero requested rsIDs are found, the tool reports an error and writes no output file, regardless of --strict.
  • Without --strict, missing rsIDs are reported on the console (in full under --verbose) but don't affect the exit code.
  • With --strict, missing rsIDs are still written to <output>.errors.log alongside a completed output file, and the process exits with status 1.

Project Layout

src/SnpFilterCli/       Console application
  Cli/                   Argument parsing and options
  Models/                SNP record model
  Services/              Parsing, filtering, and output/error-log writers
  Results/               Parse/filter result DTOs
  Exceptions/            Argument and format validation errors
tests/SnpFilterCli.Tests/ xUnit test suite
docs/                    Requirements and requirements analysis

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages