Closed jmintch closed 3 months ago
You appear to be outputting a SAM file instead of a BAM file (samtools view
produces text). You can try converting this to BAM before attempting to use the tool. Please reach out to support@10xgenomics.com if you need further help.
I would like to run bamtofastq on a subset of the CellRanger bam.
When I am running bamtofastq on the actual CellRanger possorted_genome_bam.bam, it works very smoothly, but when I input the bam subset, I am running into the error message: Error opening BAM file.
I would appreciate any help!
Below are the commands I ran to obtain the bam file subset:
awk 'NR % 4 == 1' possorted_genome_bam_modified_R1.fastq | cut -c 2- > readID_labelled.txt
samtools view possorted_genome_bam.bam | fgrep -w -f readID_labelled.txt > possorted_genome_bam_labelled.bam
samtools view -H possorted_genome_bam.bam > bam_subset/header.txt
cat header.txt possorted_genome_bam_labelled.bam > possorted_genome_bam_labelled_h.bam
manual inspection confirms same layout of CellRanger bam and subsetted bam command from bamtofastq:
/local/users/bin/bamtofastq-1.3.2 possorted_genome_bam_labelled_h.bam path/to/file/fastq