arpcard / rgi

Resistance Gene Identifier (RGI). Software to predict resistomes from protein or nucleotide data, including metagenomics data, based on homology and SNP models.
Other
314 stars 75 forks source link

Is the command bamtools filter missing -length parameter? #257

Closed hunglin59638 closed 8 months ago

hunglin59638 commented 8 months ago

In the file BWT.py, there is a function extract_alignments_with_length that attempts to filter alignments based on length. The filename sorted_bam_sorted_file_length_100 suggests that it should filter alignments with a length longer than 100 base pairs. However, it seems that the bamtools filter command used in the function doesn't utilize the -length parameter for length filtering.

Is this behavior expected, or should the -length parameter be incorporated into the bamtools filter command?

Relevant code

    def extract_alignments_with_length(self, length=10, map_quality=2):
        """
        Get alignments from bam file using length as a filter (default length=10, map_quality=2)
        TODO:: add filters (mapped, length, coverage and map_quality)
        """
        cmd="bamtools filter -in {input_bam} -out {output_bam}".format(
            input_bam=self.output_bam_sorted_file,
            output_bam=self.sorted_bam_sorted_file_length_100,
            length=length,
            map_quality=map_quality
        )
        # logger.info(cmd)
        subprocess.run(["bamtools","filter","-in",self.output_bam_sorted_file,"-out",self.sorted_bam_sorted_file_length_100])
raphenya commented 8 months ago

@hunglin59638, the items in the TODO:: are not used currently with the filter. Cheers.