This is a test version of Biostars. For the public version, visit https://www.biostars.org.
calculate the median k-mer coverage from a genomic BAM file command- linux

I am in the middle of a testing custom NIPT pipelinee and trying to calculate the median k-mer coverage from a genomic BAM file using a k-mer size of 21, using below command:

python kmer_coverage_med_bam.py demo.bwa.out.sam.F4.q20.sorted.bam.rmdup.bam.gc_corrected.bam 21

after inputting above command ram usase peaks and terminal crashes. How can i not have this happen? my comp ram is 16 gb. any suggestions are welcome.

bam k-mer nipt

Not a lot to go on...try breaking it up per chromosome?

Did you write this script yourself or is it pack of a pre-existing package?

Thanks for your reply . it was from pre-existing pipeline.

1 answer

You can use an AI like gemini or claude haiku on github (both free) to analyze how to optimize RAM usage in the script. 16 GB is very low for many genomic analyses. You did not say how large the BAM file is.

The easiest solution is to rent and try it on a cloud machine with more RAM or ask around your contacts.

Thank you for your response. BAM file size was 1 GB.

I tried to run the script on 48 GB RAM system and it is working.

Thanks all

Log in to answer this question.