Agent skill · Code Review & Quality

bio-alignment-filtering

Filter alignments by flags, mapping quality, and regions using samtools view and pysam. Use when extracting specific reads, removing low-quality alignments, or subsetting to target regions.

BioTender-maxgithub.com/BioTender-maxGitHub ↗
claude-codeships scriptsNOASSERTION
Install
npx skills add BioTender-max/awesome-bio-agent-skills --skill alignment-filtering --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 3
SKILL.md size: 14 KB
Bundled scripts: yes
Path: skills/bioskills/alignment-filtering/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 135
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

## Version Compatibility Reference examples tested with: pysam 0.22+, samtools 1.19+ Before using code patterns, verify installed versions match. If versions differ: - Python: `pip show <package>` then `help(module.function)` to check signatures - CLI: `<tool> --version` then `<tool> --help` to confirm flags If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying. # Alignment Filtering **"Filter my BAM file to keep only high-quality reads"** → Select reads by FLAG bits, mapping quality, and genomic regions using samtools view or pysam. - CLI: `samtools view` with `-F`/`-f`/`-q`/`-L` flags (samtools) - Python: `pysam.AlignmentFile` iteration with attribute filters (pysam) Filter alignments by flags, quality, and regions using samtools and pysam. ## Filter Flags | Option | Description | |--------|-------------| | `-f FLAG` | Include reads with ALL bits set | | `-F FLAG` | Exclude reads with ANY bits set | | `-G FLAG` | Exclude reads with ALL bits set | | `-q MAPQ` | Minimum mapping quality | | `-L BED` | Include reads overlapping regions | ## Common FLAG Values | Flag | Hex | Meaning

What's inside
Steps it walks through
  1. Version Compatibility
  2. Filter Flags
  3. Common FLAG Values
  4. Filter by FLAG
  5. Keep Only Mapped Reads
  6. Keep Only Unmapped Reads
  7. Keep Only Properly Paired
  8. Remove Duplicates
  9. Remove Secondary and Supplementary
  10. Keep Only Primary Alignments
  11. Keep Read1 Only
  12. Keep Read2 Only
  13. Forward Strand Only
  14. Reverse Strand Only
Ships with 2 files
  • examples/filter_bam.py
  • usage-guide.md
Commands it runs
samtools view -F 4 -o mapped.bam input.bam
samtools view -f 4 -o unmapped.bam input.bam
samtools view -f 2 -o proper.bam input.bam
samtools view -F 1024 -o nodup.bam input.bam
samtools view -F 2304 -o primary.bam input.bam
samtools view -F 256 -F 2048 -o primary.bam input.bam
Or combined: -F 2304
samtools view -f 64 -o read1.bam input.bam
samtools view -f 128 -o read2.bam input.bam
samtools view -F 16 -o forward.bam input.bam
More from awesome-bio-agent-skills
All skills →
About this skill
What does the bio-alignment-filtering skill do?

Filter alignments by flags, mapping quality, and regions using samtools view and pysam. Use when extracting specific reads, removing low-quality alignments, or subsetting to target regions.

How do I install it?

Run `npx skills add BioTender-max/awesome-bio-agent-skills --skill alignment-filtering --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From BioTender-max/awesome-bio-agent-skills, a repository with 135 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going