<s> from chanjo . parse import sambamba <EOL> BASE_HEADERS = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> THRESHOLDS = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> EXTRA_HEADERS = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> SAMBAMBA_HEADERS = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> BASE_COLS = [ '<STR_LIT:1>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> EXTRA_COLS = [ '<STR_LIT>' , '<STR_LIT:0>' , '<STR_LIT:+>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> SAMBAMBA_COLS = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> THRESHOLD_COLS = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> SAMBAMBA_END_COLS = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> def test_expand_header_no_thresholds ( ) : <EOL> header_row = BASE_HEADERS + SAMBAMBA_HEADERS + [ '<STR_LIT>' ] <EOL> header = sambamba . expand_header ( header_row ) <EOL> assert header [ '<STR_LIT>' ] == <NUM_LIT:3> <EOL> assert header [ '<STR_LIT>' ] == { } <EOL> assert header [ '<STR_LIT>' ] == slice ( <NUM_LIT:3> , <NUM_LIT:3> ) <EOL> assert header [ '<STR_LIT>' ] == <NUM_LIT:5> <EOL> def test_expand_header_single_threshold ( ) : <EOL> header_row = ( BASE_HEADERS + SAMBAMBA_HEADERS + THRESHOLDS [ : <NUM_LIT:1> ] <EOL> + [ '<STR_LIT>' ] ) <EOL> header = sambamba . expand_header ( header_row ) <EOL> assert header [ '<STR_LIT>' ] == <NUM_LIT:3> <EOL> assert header [ '<STR_LIT>' ] == { <NUM_LIT:10> : <NUM_LIT:5> } <EOL> assert header [ '<STR_LIT>' ] == <NUM_LIT:6> <EOL> def test_expand_header_multi_thresholds ( ) : <EOL> header_row = ( BASE_HEADERS + SAMBAMBA_HEADERS + THRESHOLDS <EOL> + [ '<STR_LIT>' ] ) <EOL> header = sambamba . expand_header ( header_row ) <EOL> assert header [ '<STR_LIT>' ] == <NUM_LIT:3> <EOL> assert header [ '<STR_LIT>' ] == { <NUM_LIT:10> : <NUM_LIT:5> , <NUM_LIT:20> : <NUM_LIT:6> , <NUM_LIT:100> : <NUM_LIT:7> } <EOL> assert header [ '<STR_LIT>' ] == <NUM_LIT:8> <EOL> def test_expand_header_extra_cols ( ) : <EOL> header_row = ( BASE_HEADERS + EXTRA_HEADERS + SAMBAMBA_HEADERS <EOL> + [ '<STR_LIT>' ] ) <EOL> header = sambamba . expand_header ( header_row ) <EOL> assert header [ '<STR_LIT>' ] == <NUM_LIT:6> <EOL> assert header [ '<STR_LIT>' ] == slice ( <NUM_LIT:3> , <NUM_LIT:6> ) <EOL> assert header [ '<STR_LIT>' ] == <NUM_LIT:8> <EOL> def test_expand_row_basic ( ) : <EOL> header = { '<STR_LIT>' : slice ( <NUM_LIT:3> , <NUM_LIT:3> ) , '<STR_LIT>' : <NUM_LIT:3> , '<STR_LIT>' : <NUM_LIT:4> , <EOL> '<STR_LIT>' : { } , '<STR_LIT>' : <NUM_LIT:5> } <EOL> row = BASE_COLS + SAMBAMBA_COLS + SAMBAMBA_END_COLS <EOL> row_data = sambamba . expand_row ( header , row ) <EOL> assert row_data [ '<STR_LIT>' ] == '<STR_LIT:1>' <EOL> assert row_data [ '<STR_LIT>' ] == <NUM_LIT> <EOL> assert row_data [ '<STR_LIT>' ] == <NUM_LIT> <EOL> assert row_data [ '<STR_LIT>' ] == [ ] <EOL> assert row_data [ '<STR_LIT>' ] == <NUM_LIT> <EOL> assert row_data [ '<STR_LIT>' ] == <NUM_LIT> <EOL> assert row_data [ '<STR_LIT>' ] == { } <EOL> assert row_data [ '<STR_LIT>' ] == '<STR_LIT>' <EOL> def test_expand_row_with_threshold ( ) : <EOL> header = { '<STR_LIT>' : slice ( <NUM_LIT:3> , <NUM_LIT:3> ) , '<STR_LIT>' : <NUM_LIT:3> , '<STR_LIT>' : <NUM_LIT:4> , <EOL> '<STR_LIT>' : { <NUM_LIT:10> : <NUM_LIT:5> , <NUM_LIT:20> : <NUM_LIT:6> , <NUM_LIT:100> : <NUM_LIT:7> } , '<STR_LIT>' : <NUM_LIT:8> } <EOL> row = BASE_COLS + SAMBAMBA_COLS + THRESHOLD_COLS + SAMBAMBA_END_COLS <EOL> row_data = sambamba . expand_row ( header , row ) <EOL> assert row_data [ '<STR_LIT>' ] [ <NUM_LIT:10> ] == <NUM_LIT> <EOL> assert row_data [ '<STR_LIT>' ] [ <NUM_LIT:20> ] == <NUM_LIT> <EOL> assert row_data [ '<STR_LIT>' ] [ <NUM_LIT:100> ] == <NUM_LIT> <EOL> assert row_data [ '<STR_LIT>' ] == '<STR_LIT>' <EOL> def test_expand_row_with_extra_fields ( ) : <EOL> header = { '<STR_LIT>' : slice ( <NUM_LIT:3> , <NUM_LIT:8> ) , '<STR_LIT>' : <NUM_LIT:8> , '<STR_LIT>' : <NUM_LIT:9> , <EOL> '<STR_LIT>' : { } , '<STR_LIT>' : <NUM_LIT:10> } <EOL> row = BASE_COLS + EXTRA_COLS + SAMBAMBA_COLS + SAMBAMBA_END_COLS <EOL> row_data = sambamba . expand_row ( header , row ) <EOL> assert row_data [ '<STR_LIT>' ] == EXTRA_COLS <EOL> assert row_data [ '<STR_LIT>' ] == <NUM_LIT> <EOL> assert row_data [ '<STR_LIT>' ] == <NUM_LIT> <EOL> assert row_data [ '<STR_LIT>' ] == '<STR_LIT>' <EOL> def test_depth_output_exon ( ) : <EOL> bed_lines = [ "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ] <EOL> row_data = sambamba . depth_output ( bed_lines ) <EOL> results = [ data for data in row_data ] <EOL> assert len ( results ) == <NUM_LIT:1> <EOL> assert results [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == '<STR_LIT>' <EOL> assert results [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == <NUM_LIT> <EOL> def test_depth_output_gene ( ) : <EOL> bed_lines = [ "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ] <EOL> row_data = sambamba . depth_output ( bed_lines ) <EOL> results = [ data for data in row_data ] <EOL> assert len ( results ) == <NUM_LIT:1> <EOL> assert results [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == '<STR_LIT:1>' <EOL> assert results [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == <NUM_LIT> <EOL> assert results [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == <NUM_LIT> <EOL> assert results [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == [ '<STR_LIT>' ] <EOL> assert results [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == <NUM_LIT> <EOL> assert results [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == <NUM_LIT> <EOL> assert results [ <NUM_LIT:0> ] [ '<STR_LIT>' ] [ <NUM_LIT:20> ] == <NUM_LIT> <EOL> assert results [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == '<STR_LIT>' </s>
