Entering edit mode
7.4 years ago
himanimalhotra89
•
0
hello
I am using cmpbam to compare bam files.For this I have to extract read names from original bamfile by using this command.
samtools view file1.bam K01:2179-2179 | cut -d ' ' -f 1 | sort | uniq > names.txt
Can someone help me that how I can find read id from my original bam file as k01:2179-2179 as shown in example.
Please help me to find this id from my original bam file.
Thank you
Is that command not putting read id's in file called
names.txt
?I believe the OP is trying to find and extract reads by name from a BAM file
What is
cmpbam
? I can't find this tool.Most likely @Pierre's software.
not this one. But picard http://broadinstitute.github.io/picard/command-line-overview.html FilterSamReads with
READ_LIST_FILE=read_names.txt
This will output the line in the bam file with the "K01:2179-2179" read name in it, thus giving you the sequence of that read. (Is that what you're looking for?) Remove the
-m 1
option if there is more than one read in the file expected to match the "K01:2179-2179" string. The-m 1
makes it stop after the first find.That is not the read name. It is the
chromosome:start-stop
interval for which the OP wants to retrieve the reads (or just names). We are speculating until OP chooses to respond to comments in this post.Thanks for the clarification.