snsxt.sns_classes package

Submodules

snsxt.sns_classes.classes module

General utility classes for the program

class snsxt.sns_classes.classes.SnsAnalysisSample(id, analysis_config, sns_config, extra_handlers=None)[source]

Bases: util.classes.AnalysisItem

Container for metadata about a sample in the sns WES targeted exome sequencing run analysis output

from sns_classes import SnsWESAnalysisOutput import config d = ‘/ifs/data/molecpathlab/scripts/snsxt/snsxt/fixtures/sns_output/sns_analysis1’ x = SnsWESAnalysisOutput(dir = d, id = ‘sns_analysis1’, sns_config = config.sns) samples = x.get_samples() sample = samples[0] sample.sns_config[‘analysis_output_index’].items() pattern = sample.id + ‘.dd.ra.rc.bam’ sample.get_output_files(analysis_step = ‘BAM-GATK-RA-RC’, pattern = pattern)

_init_analysis_attrs(analysis_config=None)[source]

Initialize the attributes passed from the parent analysis

_init_dirs(analysis_config=None)[source]

Initialize the paths to dirs for the sample in the analysis

_init_files(analysis_config=None)[source]

Initialize the paths to files in the analysis

get_output_files(analysis_step, pattern)[source]

Get a file from the sample’s analysis output

class snsxt.sns_classes.classes.SnsWESAnalysisOutput(dir, id, sns_config, results_id=None, extra_handlers=None)[source]

Bases: util.classes.AnalysisItem

Container for metadata about a sns WES targeted exome sequencing run analysis

__init__(dir, id, sns_config, results_id=None, extra_handlers=None)[source]

Initialize the object

dir = path to the analysis output directory id = ID for the analysis, typically the parent analysis output dir name, corresponding to a NextSeq run ID results_id = typically a time-stamped ID of the results for the analysis, and the subdir name for the anaysis output

e.g.: dir = “/ifs/data/molecpathlab/NGS580_WES/170623_NB501073_0015_AHY5Y3BGX2/results_2017-06-26_20-11-26” id = “170623_NB501073_0015_AHY5Y3BGX2” results_id = “results_2017-06-26_20-11-26”

sns_config = dictionary of configuration items for the run; requires ‘analysis_output_index’ dict, and ‘email_recipients’ extra_filehandlers = None or a list of handlers to add

from sns_classes import SnsWESAnalysisOutput import config d = ‘/ifs/data/molecpathlab/scripts/snsxt/snsxt/fixtures/sns_output/sns_analysis1’ x = SnsWESAnalysisOutput(dir = d, id = ‘sns_analysis1’, sns_config = config.sns)

_init_attrs()[source]

Initialize attributes for the analysis

_init_dirs()[source]

Initialize the paths attributes for items associated with the sequencing run from list of dirnames and filename patterns for the output steps in the sns WES analysis output

_init_files()[source]

Initialize the paths to files that might not have consistent naming including: the targets .bed file with the chromosome target regions

_init_static_files()[source]

Initialize paths to files that should always exist in the same location for an analysis output directory

check_qsub_log_errors_present(log_files=None, err_patterns=('ERROR:', ))[source]

Check the qsub logs for errors

expected_static_files()[source]

Return a dict of files that are expected to exist in the analysis dir

get_analysis_config()[source]

Return a dictionary of config values to pass to child Sample objects

get_qsub_logfiles(logdir=None)[source]

Get the list of log files from the qsub dir

logdir = x.list_none(x.get_dirs(‘logs-qsub’)) log_files = [item for item in find.find(logdir, search_type = ‘file’)]

get_samples(samplesIDs=None)[source]

Get the samples for the analysis samplesIDs is a list of character string sample ID’s

get_samplesIDs_from_samples_fastq_raw(samples_fastq_raw_file=None)[source]

Get the samples in the run from the samples_fastq_raw file

get_summary_combined_contents(summary_combined_wes_file=None)[source]

Get the contents of the ‘summary-combined.wes.csv’ file

summary_combined_contains_errors(summary_combined_wes_rows=None, err_pattern='X')[source]

Check the ‘summary-combined.wes.csv’ file for errors; any entry in the sheet that looks like ‘X’ summary_combined_wes_rows = list of dicts read in by CSV DictReader

validate()[source]

Check if the analysis is valid for downstream usage

snsxt.sns_classes.test module

Run all the unit tests

snsxt.sns_classes.test_sns_classes module

unit tests for the find module

class snsxt.sns_classes.test_sns_classes.TestAnalysisItem(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
tearDown()[source]
test_AnalysisItem_files_entry1()[source]

Test a NextSeq demo run that should be valid

test_AnalysisItem_files_entry_listnone()[source]

Test a NextSeq demo run that should be valid

test_AnalysisItem_files_entry_missingkey()[source]

Test a NextSeq demo run that should be valid

test_AnalysisItem_files_type()[source]

Test a NextSeq demo run that should be valid

test_true()[source]
class snsxt.sns_classes.test_sns_classes.TestSnsWESAnalysisOutput(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
tearDown()[source]
test_get_bam_dir_exists()[source]
test_get_samples()[source]
test_invalid_path()[source]
test_no_settings()[source]
test_qsub_errors()[source]
test_summary_combined_errors()[source]
test_valid_analysis_output()[source]

Module contents