Skip to content

Commit

Permalink
check for sc
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Kofman committed Nov 29, 2024
1 parent 2aedc8f commit ba8b0c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion marine.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def generate_depths(output_folder, bam_filepaths, paired_end=False, barcode_tag=
'{}/final_edit_info_no_coverage.tsv'.format(output_folder),
'{}/depths_source_cells.txt'.format(output_folder),
'{}/final_edit_info.tsv'.format(output_folder),
header_columns, paired_end=paired_end)
header_columns, barcode_tag=barcode_tag)

coverage_total_time = time.perf_counter() - coverage_start_time

Expand Down
10 changes: 5 additions & 5 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,14 +652,14 @@ def concat_and_write_bams_wrapper(params):
concat_and_write_bams(contig, df_dict, header_string, split_bams_folder, barcode_tag=barcode_tag, number_of_expected_bams=number_of_expected_bams, verbose=verbose)


def generate_and_run_bash_merge(output_folder, file1_path, file2_path, output_file_path, header_columns, paired_end=False):
def generate_and_run_bash_merge(output_folder, file1_path, file2_path, output_file_path, header_columns, barcode_tag=None):
# Convert header list into a tab-separated string
header = "\t".join(header_columns)

position_adjustment = '1'
if paired_end:
position_adjustment = '0'
print(f"position adjustment is {position_adjustment} (paired_end is {paired_end})")
position_adjustment = '1' # for samtools view
if not barcode_tag:
position_adjustment = '0' # for samtools depth
print(f"position adjustment is {position_adjustment} (barcode_tag is {barcode_tag})")

# Generate the Bash command for processing
bash_command = f"""#!/bin/bash
Expand Down
4 changes: 3 additions & 1 deletion tests/integration_tests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2889,7 +2889,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"id": "f5c3ed3e-13dd-4399-924e-3d1ac17ce387",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -3012,6 +3012,7 @@
"\t >>> long_read_sc_test passed! <<<\n",
"\n",
"Checking that analyzing a single-cell dataset in 'bulk' mode (i.e. not specificying the 'CB' barcode) yields the exact same positions and base changes, but with counts and coverages aggregated rather than at a single-cell resolution\n",
"grouped_sc_rows: 62, bulk_rows: 26\n",
"Exception: \n",
"\n",
"\t ~~~ single cell vs bulk modes on sc dataset equivalency test FAILED! ~~~\n",
Expand Down Expand Up @@ -3359,6 +3360,7 @@
" bulk_rows.append((r['contig'], r['position'], r['strand_conversion']))\n",
"\n",
"try:\n",
" print(\"grouped_sc_rows: {}, bulk_rows: {}\".format(len(grouped_sc_rows), len(bulk_rows)))\n",
" assert(grouped_sc_rows == bulk_rows)\n",
" for bulk_item, grouped_sc_item in zip(bulk_rows, grouped_sc_rows):\n",
" assert(bulk_item == grouped_sc_item)\n",
Expand Down

0 comments on commit ba8b0c2

Please sign in to comment.