Skip to content

one empty contig fasta file after splitting the contigs >=5x depth #2

Description

@tpshea2

Hello-

I have a test run of modifi on a metagenome running at the moment and I encountered the following:

[W::fai_get_val] Reference ctg19232 not found in FASTA file, returning empty sequence
[W::fai_get_val] Reference ctg19232 not found in FASTA file, returning empty sequence
[faidx] Failed to fetch sequence in ctg19232
[E::fai_build_core] File truncated at line 2
[faidx] Could not build fai index test/contigs/ctg19232.fa.fai

The job is still running but was curious what may have caused this one contig to be split out with only a header and no sequence:

cat test/contigs/ctg19232.fa
>ctg19232

I can confirm that this contig was not empty in the input file:

>ctg19232 length=10327 coverage=6.22 circular=no
TGACGGAATTTTTCCAGTCCGGCCGGAGCAGCCACGAGGGTCAGCGCACCATCTACCTCTGTCAGGGACAGCTTTCTCACCAGGGTTGCCTGGCCACAGTACTCTTCTGTCGGAGTCTGTGCTGCATACTGCCAGTTCATACCCCATCCCATCAGCAGAACATCTTTCGCATTCTGGAATGTAACGGCTGCATAGTTGTCGAAGCCTTCATCCAGCCATCTTGGCT......

and here is the context of the contigs immediately before and after in the input fasta file:

grep  -A 3 -B 3 "ctg19232" ../contigs.fasta | grep  ">"
>ctg22782 length=24670 coverage=2.28 circular=no
>ctg19232 length=10327 coverage=6.22 circular=no
>ctg22284 length=27340 coverage=4.21 circular=no 

and here is how the contig appears in the .fai file:

grep -A 2 -B 2 ctg19232  ../contigs.fasta.fai
ctg18253	10830	32835805	10830	10831
ctg22782	24670	32846685	24670	24671
ctg19232	10327	32871405	10327	10328
ctg22284	27340	32881782	27340	27341
ctg21285	9656	32909172	9656	9657

On RHEL 9.4 and the command (still running) is :

modifi -r ../contigs.fasta -b hifi_reads.bc2085.bam --mge_file ../genomad/contigs_summary/contigs_plasmid_summary.tsv --threads 2 -o test

Also of note is that this was the only contig (out of the 1782 with >=5x depth) which was empty:

[2026-04-01 07:44 - main.py - INFO: 8965 contigs in the assembly.]
[2026-04-01 07:44 - main.py - INFO: 8953 contigs with depth > 0.]
[2026-04-01 07:44 - main.py - INFO: Mean depth: 4.12, Median depth: 3.24 in 8953 contigs with depth > 0.]
[2026-04-01 07:44 - main.py - INFO: 1782 contigs with depth >= 5.]

and things also look okay with the test/bams/ctg19232.bam file.

Lastly, and importantly, before I hit submit here I thought I would re-test this. In the event this was simply a filesystem glitch I re-ran this job in a new test directory (on an older OS, RH7, since that was what I had available to re-run while the first test still going ) and now this contig looks fine:

ls -l test/contigs/ctg19232

-rw-r--r-- 1 x x 10338 Apr  1 09:47 test/contigs/ctg19232.fa
-rw-r--r-- 1 x x    30 Apr  1 09:47 test/contigs/ctg19232.fa.fai

so fortunately or unfortunately I am not able to recreate the issue. And there are no other contigs for which there was an empty split fasta file. for this reason I realize this might be an quick open/close ticket but since I got this far I figure I can still submit so that there is a record of this happening at least for one user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions