artic-network / fieldbioinformatics

The ARTIC field bioinformatics pipeline
MIT License
110 stars 69 forks source link

fix: Ignore bases outside the reference #113

Open RenanWA opened 2 years ago

RenanWA commented 2 years ago

This PR fixes a bug we bumped into, where reads that map partially beyond the end of the reference cause artic minion to crash.

The problem arises because the size of the vector depths in make_depth_mask.py is equal to the length of the reference. When calling bamFile.pileup(...), however, pileupcolumn.pos might cause an Index out of range error if there is a read that goes beyond the end of the reference or before its start position.

Since these sections of the reads are irrelevant to calculate coverage, the solution implemented here is to set boundaries for the bamFile.pileup(...) function, so that it only considers bases within the reference.