Entering edit mode
7.3 years ago
trisha
▴
10
Its a silly question
How to extract list of read names and their corresponding aligned fasta sequence name as table from the reference provided based on alignment.bam file
Just in case your end goal is to find how many reads are aligned to each chromosome. You can just use:
Thank you, this gives me the number of the reads mapped to each chromosome, However I would like to know the name of the read corresponding to its mapped chromosome
for example from your given samtools indexstats
chr1 38193400 19672 0
I would like to know the name of the reads that mapped to the chromosome one
What about my suggestion?
Thank you for your suggestion, However I get the following error. may be I did not understand correctly.
samtools view sorted_trimmed_corrected_merged.bam | cut -f1,3 Unless fasta identifier != "fasta sequence name"
cut: Unless: No such file or directory
cut: fasta: No such file or directory
cut: identifier: No such file or directory
cut: fasta sequence name: No such file or directory
What?! But. The last sentence was not part of the command. You just need to run the following:
Thank you so much, I really apologies for this stupid blunder. This works perfectly well.
Great, I have moved my comment to an answer so you can mark it as accepted and as such mark this question as solved.