def sex(context, prefix, bam_path): """Guess the sex of a BAM alignment.""" try: result = sex_from_bam(bam_path, prefix=prefix) except Exception: logging.exception("Something went really wrong :(") context.abort() # print the results to the console for pipeability (csv) click.echo("#{prefix}X_coverage\t{prefix}Y_coverage\tsex".format(prefix=prefix)) click.echo("\t".join(map(text_type, result)))
def sex(context, prefix, bam_path): """Guess the sex of a BAM alignment.""" try: result = sex_from_bam(bam_path, prefix=prefix) except Exception: logging.exception('Something went really wrong :(') context.abort() # print the results to the console for pipeability (csv) click.echo("#{prefix}X_coverage\t{prefix}Y_coverage\tsex" .format(prefix=prefix)) click.echo('\t'.join(map(text_type, result)))
def test_sex_from_bam(): # use fixtures bam - doesn't have coverage on Y chromosome result = sex_from_bam('tests/fixtures/ccds.mini.sorted.bam') assert result.x_coverage > result.y_coverage assert result.sex == 'female'
def test_sex_from_bam(bam_path): # use fixtures bam - doesn't have coverage on Y chromosome result = sex_from_bam(bam_path) assert result.x_coverage > result.y_coverage assert result.sex == 'female'