This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Do I need to remove unmapped reads before running MACS2?

I tried to use samtools view -S -F 4 file.sam > mapped.sam to remove the unmapped reads,

But after that, I can't use

samtools view -S -F 0x40 mapped.sam | cut -f1 | sort | uniq | wc -l

to count the mapped read, it said 'missing header',

Anyone know the reason?

Thanks

chip-seq

2 answers

You lost the header when you executed the first samtools command. Just add the parameter -h if you want to keep the header for downstream analyses.

samtools view -h -S -F 4 file.sam > mapped.sam

As for the question in the title of the post, the answer is no.

MACS2 will remove the duplicated reads before calling peaks.

Log in to answer this question.