Entering edit mode
6.5 years ago
Clark_BioMorgan
▴
50
Dear all, Is there a way to save a specific Gene in IGV of a whole exome sample? For example I have the whole exome sequencing of a sample but I would like to view and save only one gene out of that whole BAM as only one gene specific BAM?
Thanks in advance
Thank you for the tip. I tried it and get the BAM file. But now I need to get the index file of the bam. When I use
samtools index test.bam > test.bai I get an error like this
EOF marker is absent. invalid BAM binary header (this is not a BAM file) Invalid BAM header. Fail to index..
I have tried this command and it worked.
samtools view -b test.bam > output.bam
Changed -h to -b ...
Thank you.
Are you using latest version of
samtools
? If so, command to index issamtools index test.bam
. You should also sort thetest.bam
file to be safe by doingsamtools sort -o test_sorted.bam test.bam
.Probably bam headers are not extracted.
@OP: Try this instead:
@OP: Btw, you do not have to output bai file like
samtools index test.bam > test.bai
. Run samtools index test.bam. That would create .bai file automatically.if you are on ubuntu, could you please post the output from test.bam:
$ od -x test.bam | head -1
It should be 0000000 8b1f 0408 0000 0000 ff00 0006 4342 0002
Command for bam files is
-b
(implies-h
).@ ATpoint. Thanks and updated the code.