mrvollger / SDA

Segmental Duplication Assembler (SDA).
MIT License
44 stars 6 forks source link

Temporary samtools sort files may be overwritten #19

Closed SergejN closed 1 year ago

SergejN commented 3 years ago

Hi,

I have another suggestion. In denovo_SDA.smk, I would change https://github.com/mrvollger/SDA/blob/6c10c70f5a17d7b594a1ffc3519050c48f7696d0/denovo_SDA.smk#L153 and https://github.com/mrvollger/SDA/blob/6c10c70f5a17d7b594a1ffc3519050c48f7696d0/denovo_SDA.smk#L176 to

samtools sort -@ {threads} -m 4G -T {TMPDIR} -o {output}

The reason is that if you have multiple jobs running on the same compute node, then one job may overwrite temporary files of the other since they will all be called /tmp/pbmm2.XXX.bam, where XXX is not a random number, but the index of the chunk. But if you only specify the directory, then samtools adds a random number to the filename, which is unique to the running process.

And out of curiosity, what's the meaning of the flag 2308 in samtools view -u -F 2308? 2308 doesn't look like a valid combination of SAM flags (basically, the bits thereof set READ IS UNMAPPED (0x004) and ALIGNMENT ISN'T PRIMARY (0x100). Basically, I'm wondering why it's not just -F 260. Is it a typo?

thanks and sorry for yet another (potential) bug report / suggestion!

mrvollger commented 3 years ago

Thanks again! Should be fixed now.

The samflag can be an int as well. 2308 is 4+256+2048, which filters unaligned, secondary, and supplementary.

SergejN commented 3 years ago

ah, true! I overlooked the supplementary. Thanks!