You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the option --write-index together with bcltools view makes it possible to automatically create an index-file. Currenlty the default ouput (at least for a vcf.gz file) is a csi-file and I would like to have the possibility of having a tbi files as output.
I have been looking into adding the possibility of specifying output type for a vcf.gz index (csi or tbi) but got stuck trying to understand the code.
if ( !fname|| !*fname|| !strcmp(fname, "-") ) return-1;
char*delim=strstr(fname, HTS_IDX_DELIM);
if (delim)
{
delim+=strlen(HTS_IDX_DELIM);
*idx_fname=strdup(delim);
if ( !*idx_fname ) return-1;
size_tl=strlen(*idx_fname);
if ( l >= 4&&strcmp(*idx_fname+l-4, ".tbi")==0 ) min_shift=0;
}
else
{
if ( !(*idx_fname=malloc(strlen(fname)+6)) ) return-1;
sprintf(*idx_fname, "%s.csi", fname);
}
if ( bcf_idx_init(fh, hdr, min_shift, *idx_fname) <0 ) return-1;
return0;
}
If I understand the code correctly the function will look for occurrences of HTS_IDX_DELIM (##idx##) in the name of the file that we are trying to index, which I never will have in my filename.
Feels like I have misunderstood the code. Is the idea that the function should get the filename of the indexed-file, ex nam.vcf.gz.tbi as input? And then using some kind of regex (which isn't ##idx##) find the files that should get a tbi filetype?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Using the option --write-index together with bcltools view makes it possible to automatically create an index-file. Currenlty the default ouput (at least for a vcf.gz file) is a csi-file and I would like to have the possibility of having a tbi files as output.
I have been looking into adding the possibility of specifying output type for a vcf.gz index (csi or tbi) but got stuck trying to understand the code.
bcftools/version.c
Lines 116 to 141 in 95c1fb6
If I understand the code correctly the function will look for occurrences of HTS_IDX_DELIM (##idx##) in the name of the file that we are trying to index, which I never will have in my filename.
Feels like I have misunderstood the code. Is the idea that the function should get the filename of the indexed-file, ex nam.vcf.gz.tbi as input? And then using some kind of regex (which isn't ##idx##) find the files that should get a tbi filetype?
Beta Was this translation helpful? Give feedback.
All reactions