Git Product home page Git Product logo

samplesheet_validator's Introduction

Samplesheet Validator

Checks sample sheet naming and contents. Carries out a series of checks on the sample sheet and collects any errors that it identifies (SamplesheetCheck.errors_list). It also identifies whether or not a run is a TSO run from the sample sheet (SamplesheetCheck.tso).

Protocol

Runs a series of checks on the sample sheet, collects any errors identified. Checks whether:

  • Sample sheet exists
  • Samplesheet name is valid (validates using the seglh-naming library)
  • Sequencer ID is in the list of allowed sequencer IDs supplied to the script
  • Samplesheet is not empty (>10 bytes)
  • Samplesheet is for a development run, using the development pan number supplied to the script
  • Samplesheet contains the minimum expected [Data] section headers: Sample_ID, Sample_Name, index
  • Sample_ID and Sample_Name match for each sample in the data section of the samplesheet
  • Sample name does not contain any illegal characters
  • Sample name is valid (validates using the seglh-naming library)
  • Pan numbers are in the list of allowed pan numbers supplied to the script
  • Samplesheet contains any TSO samples

If samplesheet contains an input dev_panno, the package will skip samplesheet chcks for the samplesheet.

Usage

Python package

The repository provides a python package which can be installed with:

python3 setup.py install

NB: Use the --user flag or install into an virtualenv/pipenv if not installing globally.

from samplesheet_validator.samplesheet_validator import SamplesheetCheck

sscheck_obj = SamplesheetCheck(
    samplesheet_path,  # str
    sequencer_ids,  # list
    panels,  # list
    tso_panels,  # list
    dev_panno,  # str
    logdir,  # str
)
sscheck_obj.ss_checks()  # Carry out samplesheeet validation

print(sscheck_obj.errors_dict)  # View the dictionary of error messages

Command line

The environment must be set up as follows:

python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt

The script can then be used as follows:

usage: Used to validate a samplesheet using the seglh-naming conventions

Given an input samplesheet, will validate the samplesheet using seglh-naming conventions and output a logfile

options:
  -h, --help            show this help message and exit
  -S SAMPLESHEET_PATH, --samplesheet_path SAMPLESHEET_PATH
                        Path to samplesheet requiring validation
  -SI SEQUENCER_IDS, --sequencer_ids SEQUENCER_IDS
                        Comma separated string of allowed sequencer IDS
  -P PANELS, --panels PANELS
                        Comma separated string of allowed panel numbers
  -T TSO_PANELS, --tso_panels TSO_PANELS
                        Comma separated string of tso panels
  -D DEV_PANNO, --dev_panno DEV_PANNO
                        Development pan number
  -L LOGDIR, --logdir LOGDIR
                        Directory to save the output logfile to
  -NSH NO_STREAM_HANDLER, --no_stream_handler NO_STRAM_HANDLER
                        Provide flag when we don't want a stream handler (prevents
                        duplication of log messages to terminal if using another
                        logging instance)

Testing

This repository currently has 92% test coverage.

Test datasets are stored in /test/data. The script has a full test suite:

See test/README.md for details about test cases.

These tests should be run before pushing any code to ensure all tests in the GitHub Actions workflow pass. These can be run as follows:

python3 -m pytest

N.B. Tests and test cases/files MUST be maintained and updated accordingly in conjunction with script development N.B. This includes ensuring that the arguments passed to pytest in the pytest.ini file are kept up to date

Logging

Logging is performed by ss_logger. The directory to save the log file to is supplied as an argument. The output log file is named by the script as follows:

  • $LOGFILE_DIR/$RUNFOLDER_NAME_$TIMESTAMP_samplesheet_validator.log

The script also collects the error messages as it runs, which can be used by other scripts when this script is used as an import.

Developed by the Synnovis Genome Informatics Team

samplesheet_validator's People

Contributors

graeme-smith avatar rachelduffin avatar rebeccahaines1 avatar

Watchers

 avatar  avatar  avatar  avatar

samplesheet_validator's Issues

Add more info to readme about dev runs

Add that package skips the samplesheet checks if dev_run is True - is this the required behaviour?

Either add a flag that bypasses this or remove this behaviour? Need to check

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.