This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extract unmapped sequenced from a sam file output from minimap2

Hi, I am interested in using PSMC to run a historic population size analysis and I ran into a problem. I assembled the genome of my species using a reference, and got the consensus for PSMC, but I forgot to separate autosomes from X and Y chromosomes. Including those in PSMC biased the results.

I have 92 scaffolds in my assembly, and I have merged the X and Y mouse chromosomes to then get only the autosomes. I used minimap2 to map my scaffolds to the merged file, but I do not know what else to do. I posted a question in the minimap2 github forum for help to split those, and got the useless/stupid response: "You can write a python/perl script to do that.". Well, I do not know perl nor python for doing that.

How can I get the unmapped scaffolds from the sam file output from minimap2?

Thanks;

get unmapped reads from sam file

1 answer

you can use samtools to extract the unmaped reads:

samtools fasta -f 4 <align.sam>

Log in to answer this question.