Skip to content

Commit

Permalink
Add support for 5v3, the previous argument 5v3 is actually for 5v2.
Browse files Browse the repository at this point in the history
  • Loading branch information
youyupei committed Aug 15, 2024
1 parent f60973e commit 52997b8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
Binary file added blaze/10X_bc/3M-5pgex-jan-2023.zip
Binary file not shown.
3 changes: 2 additions & 1 deletion blaze/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
DEFAULT_UMI_SIZE= 12 if DEFAULT_GRB_KIT=='v3' else 10

# The 10X barcode whitelists has been packed in the package
DEFAULT_GRB_WHITELIST_V3=os.path.join(os.path.dirname(__file__), '10X_bc', '3M-february-2018.zip')
DEFAULT_GRB_WHITELIST_3V3=os.path.join(os.path.dirname(__file__), '10X_bc', '3M-february-2018.zip')
DEFAULT_GRB_WHITELIST_V2=os.path.join(os.path.dirname(__file__), '10X_bc', '737K-august-2016.txt')
DEFAULT_GRB_WHITELIST_5V3=os.path.join(os.path.dirname(__file__), '10X_bc', '3M-5pgex-jan-2023.zip')

#output
DEFAULT_GRB_OUT_RAW_BC='putative_bc.csv'
Expand Down
16 changes: 9 additions & 7 deletions blaze/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def print_help():
Maximum edit distance allowed between a putative barcode and a barcode
for a read/putative barcdoe to be assigned to the barcode. Default: --max-edit-distance {DEFAULT_ASSIGNMENT_ED}
--kit-version <3v2 or 3v3 or 5v3>:
Choose from 10X Single Cell 3ʹ gene expression v2 or v3 or 5' gene expression. If using other
--kit-version <3v2 3v3 5v2 or 5v3>:
Choose from 10X Single Cell 3ʹ gene expression v2 or v3 or 5' gene expression v2 or v3. If using other
protocols, please do not specify this option and specify --full-bc-whitelist instead. By default,
`--kit_version v3` will be used if --full-bc-whitelist is not specified.
Expand Down Expand Up @@ -223,19 +223,21 @@ def print_help():
out_plot_fn = prefix + DEFAULT_KNEE_PLOT_FN
summary_fn = prefix + DEFAULT_BC_STAT_FN

if kit not in ['3v2', '3v3', '5v3']:
if kit not in ['3v2', '3v3', '5v2', '5v3']:
helper.err_msg("Error: Invalid value of --kit-version (" + kit + "), please choose from 3v3 or 3v2 or 5v3")
sys.exit()
sys.exit()

if full_bc_whitelist:
helper.warning_msg(textwrap.dedent(
f'You are using {os.path.basename(full_bc_whitelist)} as the full barcode '\
'whitelist. Note that the barcodes not listed in the file will never be found.'))
else:
if kit == '3v3':
full_bc_whitelist = DEFAULT_GRB_WHITELIST_V3
elif kit == '3v2' or kit == '5v3':
full_bc_whitelist = DEFAULT_GRB_WHITELIST_3V3
elif kit == '3v2' or kit == '5v2':
full_bc_whitelist = DEFAULT_GRB_WHITELIST_V2
elif kit == '5v3':
full_bc_whitelist = DEFAULT_GRB_WHITELIST_5V3

# Read from args
if not args:
Expand Down Expand Up @@ -735,7 +737,7 @@ def main(argv=None):
logger.info(helper.warning_msg(
f"NOTE: The `{out_fastq_fn}` exists and has NOT been updated.", printit = False))

if os.path.getmtime(out_fastq_fn) < os.path.getmtime(out_whitelist_fn):
if os.path.exists(out_fastq_fn) and os.path.getmtime(out_fastq_fn) < os.path.getmtime(out_whitelist_fn):
logger.info(helper.warning_msg(
f"Warning: the existing `{out_fastq_fn}` is older than the upstream output {out_whitelist_fn}."
f"If it needs to be re-generated. Please remove/rename the existing `{out_fastq_fn}` and re-run BLAZE "
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
test_suite='test',
long_description=long_description,
long_description_content_type='text/markdown',
package_data={'blaze': ['10X_bc/3M-february-2018.zip', '10X_bc/737K-august-2016.txt']},
package_data={'blaze': ['10X_bc/3M-february-2018.zip', '10X_bc/737K-august-2016.txt', '10X_bc/3M-5pgex-jan-2023.zip']},
url="https://github.com/shimlab/BLAZE",
install_requires=["fast-edit-distance==1.2.1",
'matplotlib',
Expand Down
3 changes: 3 additions & 0 deletions test/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# run the following command to test the above commands
mkdir test_out
blaze --expect-cells=500 --threads=12 --output-prefix test_out/test_ data/


blaze --expect-cells=10 --threads=1 --full-bc-whitelist /home/youyupei/github_repo/shimlab/BLAZE/blaze/10X_bc/3M-5pgex-jan-2023.txt --kit-version 5v3 --overwrite --output-prefix test_ test02.fastq.gzls

0 comments on commit 52997b8

Please sign in to comment.