Indeed, I may have missed the "name" part at the end (on my screen it's showing up on a separate line). I saw the title and thought that the sequence from the fasta file itself was what was needed.
• 0 views
•
link
This is such an obscure thing to want to do that you'll very likely have to write something (using pysam) to do it.
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.