This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
samtools view -h sample1.bam | grep -vf read_ids_to_remove.txt | samtools view -bS -o sample1_filter.bam - |
Note the trailing hyphen at the end.
Thank you so much. I learnt that the tools downstream wont work when we remove manually lines from sam files - convert them to bam and index them. Its much better using commands to do tasks.
ReplyDeleteHeMan, glad you found the post helpful!
DeleteThis comment has been removed by the author.
DeleteHello!
ReplyDeleteI try to use this script for my RNA-seq project.
I have accepted_hits.bam file from TopHat, and for creating counting_table at HTSeq I need to remove three reads from this bam file with following headers:
1) HWI-ST538:357:D2BKUACXX:1:1105:13318:13823.
2) HWI-ST538:357:D2BKUACXX:1:1107:19710:10717
3) HWI-ST538:357:D2BKUACXX:1:2314:13745:61117
After running aforementioned script, samtools create 0 bytes sample1_filter.bam file.
How I can fix this issue?
Thank You for help.
May I ask what's the purpose of the trailing hyphen at the end?
ReplyDeleteOh, it means standard input here
DeleteThis does not work.
ReplyDeleteTo elaborate, the command goes through but the new output file still has all the reads I setup to delete.
ReplyDelete