Filtering reads from aligned scRNA reads BAM file by filtered cells barcodes (CB)
1
0
Entering edit mode
2.4 years ago
MYousry ▴ 20

Hello Everyone,

I passed my scRNA fastq data (R1 & R2) through STARsolo to align the reads with genome and produce the count matrix. I want to filter the resulted BAM (Aligned.sortedByCoord.out.bam) using the filtered cells barcode (solo.out/gene/filtered/barcodes.tsv) so as the resulted BAM file contains data from actual cells.

I've tried 10x genomics' subset-bam tool but everytime I run it, I get the following error: enter image description here

Any help with that would be greatly appreciated! A beginner here:)

Best, Yousry

Cell-barcodes • 2.2k views
ADD COMMENT
2
Entering edit mode

save the planet. Why a screenshot when you can just copy-n-paste the text ?

ADD REPLY
0
Entering edit mode

subset-bam --bam Aligned.sortedByCoord.out.bam --cell-barcodes barcodes.tsv --cores 1 --out-bam /results/ --log-level debug

ADD REPLY
0
Entering edit mode

STARsolo has a 10X-esque barcode correction and cell filtering algorithm built in. See their documentation for more information, specifically the --soloCellFilter and --soloCBwhitelist arguments.

ADD REPLY
0
Entering edit mode

Thank you so much for your reply and guidance! I will look into that.

ADD REPLY
0
Entering edit mode

I have tried it but seems like the outputted BAM file is the same? I think these commands has to do with the count matrix only, no? I am interested in getting a filtered BAM like the one produced by subset-bam. Can you please guide me through the process?

these are the commands I ran: STAR --runThreadN 4 --genomeDir Reference/ --readFilesIn FASTQ_data/SRR13040580_2.fastq FASTQ_data/SRR13040580_1.fastq --outFileNamePrefix STAR_SoloCB/ --outReadsUnmapped Fastx --outSAMattributes NH HI NM MD CB UB sM sS sQ --outFilterMultimapNmax 1 --outFilterMatchNmin 30 --outFilterMismatchNmax 4 --alignIntronMax 1 --alignSJDBoverhangMin 999 --soloType CB_UMI_Simple --soloCBwhitelist Whitelist/V2/737K-august-2016.txt --outSAMtype BAM SortedByCoordinate --soloCellFilter EmptyDrops_CR

ADD REPLY
0
Entering edit mode

Looks like your command line options are not correct. Have you looked at in-line help for correct options.

Keep in mind that 10x tool you are working with may only be designed to be used with cellranger generated BAM files.

ADD REPLY
0
Entering edit mode

Thank you for your reply!

I tried to check for errors in the command line but I couldn't find any. I think differences in the generated BAM files might be the issue. Any idea how I can get this to work (e.g any other tool or edits to this command line)? Thank you!

ADD REPLY
0
Entering edit mode

So, yes, i had an error in the command line (clarified it in the comment below). Thank you!!

ADD REPLY
1
Entering edit mode
2.4 years ago
MYousry ▴ 20

So it turned out that I have an error in the command line I wrote. --out-bam should take an argument for the name of the outputted bam file not the directory of the output. I removed the "/" and it worked!

Thanks for the support!

myousry@MYousry:~/BAM_plz$ subset-bam --bam Aligned.sortedByCoord.out.bam --cell-barcodes barcodes.tsv --bam-tag CB:Z --log-level debug --out-bam filtered

13:07:55 [DEBUG] subset_bam: Loaded 2150 barcodes

13:12:08 [INFO] Chunk 0 is done

13:12:09 [INFO] Done!

13:12:09 [INFO] Visited 14050588 alignments, found 14050588 with barcodes and kept 11545307
ADD COMMENT

Login before adding your answer.

Traffic: 2506 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6