Skip to content

Gene-based analysis fails to match chromosomes & Window-based annotation segfaults on Linux #162

Description

@silvewheat

Hi selscan team,

Thank you for developing this great tool! I am currently using selscan v3.0.0 and attempting to perform downstream analyses using the norm subcommand with the --gene-bed option. However, I encountered some issues related to chromosome matching and platform-specific crashes.

System Environment

Platform 1: macOS (Apple Silicon M1)

Platform 2: Linux

Selscan version: v3.0.0

Issue 1: Gene-based analysis fails to match chromosomes (Both macOS and Linux)

When trying to run the gene-based analysis directly from the .ihs.out files, the program consistently throws warnings that it cannot find the corresponding chromosomes in the BED file. The run finishes, but the resulting .genetable file only contains the header row with no data.

Command used:

selscan-v3.0.0-linux norm --ihs --files out/chr*.ihs.out --gene-bed chrAll.genes.bed

Console output (Warning):

...
Annotating 29files with chrAll.genes.bed
Using 29 normalized output files for gene-based analysis.
Reading norm files for annotation...
Opening chrAll.genes.bed...
WARNING: chromosome chr1 not found in gene BED file.
WARNING: chromosome chr1 not found in gene BED file.
WARNING: chromosome chr1 not found in gene BED file.
...(same from chr1 to chr29)
WARNING: chromosome chr29 not found in gene BED file.
WARNING: chromosome chr29 not found in gene BED file.
WARNING: chromosome chr29 not found in gene BED file.
Fitted length regression: score = 0 + 0 * log(length)
Written gene table to chrAll.genes.bed.ihs.genetable

My .genes.bed file is like (tab-separated):

chr1    61442   77016   ZNF596
chr1    127739  145769  SGO1
chr1    165224  267048  KAT2B
chr1    297402  313779  PP2D1
...
chr29	46764352	46799992	VSTM5
chr29	46986113	47088628	HEPHL1
chr29	47106064	47166189	PANX1
chr29	48470624	48481156	TNFRSF10D

My .ihs.out files:

chr     id      pos     freq    ihh1    ihh0    ihs
chr1    chr1_27838      27838   0.05    0.002241        0.00313206      -0.145388
chr1    chr1_28062      28062   0.05    0.0001955       0.00185876      -0.978076
chr1    chr1_29235      29235   0.575   0.00254397      0.00384104      -0.178938
...

Troubleshooting steps I've already tried:

I ensured the chromosome names match exactly between the .ihs.out files and the .gene.bed file. I also tested both with the chr prefix (e.g., chr1) and without it (e.g., 1), but the warning persists.

I concatenated all .ihs.out files into a single merged file.

I strictly sorted the .gene.bed file to ensure the chromosome order perfectly matches the .out files.

I cleaned the BED file to ensure it's strictly tab-separated with no empty lines or weird line endings.

Despite these efforts, the "chromosome not found" issue remains.

Issue 2: Window-based annotation segfaults on Linux

I also tried the window-based annotation approach.
Interestingly, this command executes successfully on macOS (M1). However, when I run the exact same command with the exact same input files on Linux, it crashes and exits with a Segmentation fault.

Command used:

selscan-v3.0.0-linux norm --ihs --win-files out/chr*.ihs.out.100bins.norm.100kb.windows --gene-bed chrAll.genes.bed

Console output:

...
Annotating 29files with chrAll.genes.bed
You have provided 29 window files for gene annotation.
Reading gene annotations from BED file: chrAll.genes.bed
IHS_norm_window.sh: line 12: 2927816 Segmentation fault      (core dumped) selscan-v3.0.0-linux  norm --ihs  --win-files out/chr*.ihs.out.100bins.norm.100kb.windows  --gene-bed chrAll.genes.bed

Summary

  1. Gene-based analysis: Fails to map chromosomes to the BED file on both Mac and Linux, resulting in an empty .genetable.

  2. Window-based annotation: Works fine on Mac (M1) but throws a Segmentation fault on Linux.

Files

To help reproduce and debug these issues, I have attached my actual chr1 iHS output file and the complete gene annotation BED file to this issue. Thank you for your time and help!
chr1.iHS.ihs.out.gz
chrAll.genes.sort.bed.gz

Best,
Yudong

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions