FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: Check for both .csi and .tbi VCF index files (#395) · alignoth/alignoth@dd5059f · GitHub

Commit dd5059f

Browse files
authored
fix: Check for both .csi and .tbi VCF index files (#395)
* fix: Check for both .csi and .tbi VCF index files * Clarify VCF index error message with tabix instruction * Refactor error message to use named format arguments
1 parent 148a653 commit dd5059f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎src/main.rs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ async fn main() -> Result<()> {
4646
)?;
4747
let mut highlight = opt.highlight.as_ref().cloned().unwrap_or_default();
4848
if let Some(vcf_path) = opt.vcf.as_ref() {
49-
let index = PathBuf::from(&format!("{}.csi", vcf_path.display()));
50-
if index.exists() {
49+
let csi_index = PathBuf::from(&format!("{}.csi", vcf_path.display()));
50+
let tbi_index = PathBuf::from(&format!("{}.tbi", vcf_path.display()));
51+
if csi_index.exists() || tbi_index.exists() {
5152
highlight.extend(VcfHighlight::new(vcf_path.clone()).intervals(region)?);
5253
} else {
5354
bail!(
54-
"VCF/BCF index not found: {}. Please create an index using `bcftools index {}`",
55-
index.display(),
56-
vcf_path.display()
55+
"VCF/BCF index not found: {csi} or {tbi}. Please create an index using `bcftools index {vcf}` or `tabix {vcf}`.",
56+
csi = csi_index.display(),
57+
tbi = tbi_index.display(),
58+
vcf = vcf_path.display()
5759
);
5860
}
5961
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL