IsoQuant icon indicating copy to clipboard operation
IsoQuant copied to clipboard

Best practices for multi-experiment isoform quantification and resolving barcode collisions in single-cell Nanopore datasets

Open ExctOcean opened this issue 7 months ago • 4 comments

Hi IsoQuant Team,

I am seeking guidance on the best practices for quantifying isoform-level expression in a single-cell Nanopore experiment consisting of two distinct groups (Group_A and Group_B), each containing a single sample.

Data Preprocessing with scNanoGPS 2.0: The input BAM files were pre-processed using the scNanoGPS 2.0 pipeline. Based on this specific curation logic:

Barcodes and UMIs are integrated into the Read ID and assigned to BAM tags (e.g., RG:Z), though these may represent specific processed identifiers defined by scNanoGPS 2.0 rather than raw sequences.

Each group used its own barcode whitelist. However, there is a minor overlap (collision) of 40 barcodes between the two whitelists across a total of ~12,000 detected cells.

Supporting Evidence (BAM Format): To provide more context, here are the first few lines of my curated BAM file:

2eb5b75b-7bfb-4855-974f-235dda9d9e81_TAGAGATTCGTA   272     chr1    10477   0       33S165M1D49M565N2I315M69S       * 0       0       * * NM:i:20 ms:i:471   AS:i:434 nn:i:0 ts:A:-  tp:A:S  cm:i:108        s1:i:425        de:f:0.0358     rl:i:73 RG:Z:TCCGGGACACCTGCAG
dc9228ce-98c1-4d62-8655-fa24f2ea8c09_AAGATCGTAGTC   2064    chr1    10544   0       446H86M2D21M4H  * 0       0       AAATCTGTGCAGAGGAGAACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAACTCCGCCGTCGCAAAGGCGCCGCGCCGGCGCAGGCGC * NM:i:4  ms:i:97 AS:i:97 nn:i:0  tp:A:P  cm:i:17 s1:i:90 s2:i:96 de:f:0.0278     SA:Z:chr1,168131,+,108S445M12615D4S,22,64;      rl:i:0  RG:Z:CTCACTGAGCCTGTGC
7fcaf83d-7984-4a2d-8b27-9efdc989a26e_GTAATCCTCCTA   272     chr1    10569   0       1S73M1D49M171084N2I237M1I5M2D13M1I41M1D19M78S   * 0       0       * * NM:i:21     ms:i:379        AS:i:341        nn:i:0  ts:A:-  tp:A:S  cm:i:90 s1:i:338        de:f:0.0429     rl:i:84 RG:Z:AAAGTCCGTTGTACGT

Current Implementation: I attempted to run IsoQuant on both samples simultaneously using the following command:

isoquant --reference reference.fa \
         --genedb annotation.gtf \
         --bam ./group_A_curated.bam ./group_B_curated.bam \
         --illumina_bam ./group_A_NGS.bam ./group_B_NGS.bam \
         --read_group tag:RG \
         --data_type nanopore \
         --complete_genedb \
         --sqanti_output \
         --threads 40 \
         --labels "Group_A" "Group_B" \
         --report_novel_unspliced true \
         -o ./isoquant_output

Observed Problem: The resulting count matrix and barcodes.tsv do not distinguish between the two groups (e.g., no sample-specific prefixes for barcodes). This makes it impossible to accurately assign cells to their respective experimental conditions, especially for the overlapping barcodes.

Questions for the Developers: To ensure a robust downstream differential isoform usage analysis, which of the following workflows do you recommend?

Workflow 1 (Consensus discovery then split): Run IsoQuant once with both BAMs to generate a comprehensive transcript_models.gtf (Joint Discovery), then re-run IsoQuant for each sample independently using this GTF as --genedb to ensure sample-specific barcode separation.

Workflow 2 (Single-run multi-grouping): Is there a parameter configuration to force sample-specific prefixes in the final matrix?

Given the scNanoGPS 2.0 output shown above, what is the most reliable way for IsoQuant to interpret these identifiers while preserving the sample metadata in a single-cell context?

Thank you for your assistance and for this excellent tool!

ExctOcean avatar Apr 11 '26 04:04 ExctOcean

Dear @ExctOcean

Thanks for the positive feedback!

Answering the main question - unfortunately there is not way to combine sample id and barcode automatically if case you want to perform a merged analysis of two samples. This is not a typical use case. I see two options:

  • Perform the analysis separately, add sample if prefixes to the barcodes and merge the counts. The easiest way to do that would be to edit linear grouped counts, concatenate them and convert them into MTX or TSV matix (the later can be time-consuming) using isoquant_lib/convert_grouped_counts.py;
  • For each BAM file, extract read id and corresponding BAM tag into a TSV file, add the sample id prefixes, combine TSVs and provide them to IsoQuant for read grouping.

Workflow 1 (Consensus discovery then split): Run IsoQuant once with both BAMs to generate a comprehensive transcript_models.gtf (Joint Discovery), then re-run IsoQuant for each sample independently using this GTF as --genedb to ensure sample-specific barcode separation.

Yes, I would prefer this option. Perform transcript discovery by combining the data as pseudobulk and the running each sample separately with --no_model_construction to perform quantification.

However, I would run quantification in single-cell mode (e.g. --mode tenX_v3) - this mode can automatically detect barcodes in long reads (or use previously called barcodes from TSV or BAM), remove PCR duplicates and do per-barocde and per-cell-type quantification (if --barcode2spot is provided). You can read about singl-cell mode here: https://ablab.github.io/IsoQuant/single_cell.html

Hope that helps!

Best Andrey

andrewprzh avatar Apr 13 '26 12:04 andrewprzh

Dear @ExctOcean

Thanks for the positive feedback!

Answering the main question - unfortunately there is not way to combine sample id and barcode automatically if case you want to perform a merged analysis of two samples. This is not a typical use case. I see two options:

  • Perform the analysis separately, add sample if prefixes to the barcodes and merge the counts. The easiest way to do that would be to edit linear grouped counts, concatenate them and convert them into MTX or TSV matix (the later can be time-consuming) using isoquant_lib/convert_grouped_counts.py;
  • For each BAM file, extract read id and corresponding BAM tag into a TSV file, add the sample id prefixes, combine TSVs and provide them to IsoQuant for read grouping.

Workflow 1 (Consensus discovery then split): Run IsoQuant once with both BAMs to generate a comprehensive transcript_models.gtf (Joint Discovery), then re-run IsoQuant for each sample independently using this GTF as --genedb to ensure sample-specific barcode separation.

Yes, I would prefer this option. Perform transcript discovery by combining the data as pseudobulk and the running each sample separately with --no_model_construction to perform quantification.

However, I would run quantification in single-cell mode (e.g. --mode tenX_v3) - this mode can automatically detect barcodes in long reads (or use previously called barcodes from TSV or BAM), remove PCR duplicates and do per-barocde and per-cell-type quantification (if --barcode2spot is provided). You can read about singl-cell mode here: https://ablab.github.io/IsoQuant/single_cell.html

Hope that helps!

Best Andrey

Dear Andrey,

Thank you and the team for the prompt and detailed feedback! Your suggestions regarding the workflow options are incredibly helpful.

I am planning to proceed with the tests using Workflow 1 (Joint Discovery followed by independent quantification) as you suggested. However, I have a small concern regarding the single-cell mode (--mode tenX_v3).

In my upstream processing, I am using scNanoGPS. Based on my current understanding (which is still developing), the BAM files generated by scNanoGPS do not typically contain the CB tag. Therefore, I am slightly unsure if I can directly implement the --mode tenX_v3 without these tags.

I will continue to explore the documentation and my data to see if there is a workaround, but I wanted to share this technical constraint with you. Thanks again for your continuous support!

Best regards, ExctOcean

ExctOcean avatar Apr 15 '26 13:04 ExctOcean

Dear @ExctOcean

I am not sure I entirely got your concern but I'll try to clarify. When using --mode tenX_v3 there are 3 ways:

If you have your barcodes/UMIs detected by another tool you either:

  1. provide them as TSV with read id, barcode and UMI via --barcoded_reads ;
  2. tell IsoQuant they can be found in BAM tags by setting --barcoded_bam with --barcode_tag XX and --umi_tag XX. If barcode tag is missing, the read will be discarded before UMI deduplication.

If barcodes and UMIs are not detected:

  1. You can provide barcode whitelist (preferably short one containing only actual cells, e.g. output of cellranger ran on short-read data). In this case IsoQuant will detect barcodes and UMIs by itself and store them in the TSV file.

Hope that gives some information, but feel free to ask for more details.

Best Andrey

andrewprzh avatar Apr 17 '26 12:04 andrewprzh

Dear Andrey,

Thank you very much for the further clarification. I now have a much clearer understanding of the --mode tenX_v3 and how it handles barcode/UMI information. I apologize for the previous confusion regarding the BAM tags.

As you pointed out, since I have matched short-read (Illumina) single-cell data, I will provide the corresponding barcode whitelist generated from the short-read processing in my next run. I will proceed with the "Joint Discovery then Independent Quantification" workflow as suggested to ensure the sample-specific barcode separation.

I will keep you updated on the progress once the tests are completed. Thank you again for your patience and for the invaluable guidance!

Best regards, ExctOcean

ExctOcean avatar Apr 17 '26 13:04 ExctOcean