Skip to content

Commit

Permalink
updated alternative header reading mechanism to only work for VCF files
Browse files Browse the repository at this point in the history
  • Loading branch information
atks committed Jun 8, 2015
1 parent 53a65cb commit 4588a7b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion hts_utils.cpp
Expand Up @@ -441,6 +441,7 @@ void bcf_print_lite_sorted(bcf_hdr_t *h, bcf1_t *v)
* allow for an alternative header file to be read in.
*
* this searches for the alternative header saved as <filename>.hdr
* If the VCF files is BCF, any alternative header is ignored.
*/
bcf_hdr_t *bcf_alt_hdr_read(htsFile *fp)
{
Expand All @@ -451,7 +452,8 @@ bcf_hdr_t *bcf_alt_hdr_read(htsFile *fp)
kputs(fp->fn, &alt_hdr_fn);
kputs(".hdr", &alt_hdr_fn);
FILE *file = fopen(alt_hdr_fn.s, "r");
if (!file)

if (fp->format.format ==bcf || !file)
{
h = bcf_hdr_read(fp);
}
Expand Down
1 change: 1 addition & 0 deletions hts_utils.h
Expand Up @@ -254,6 +254,7 @@ int32_t bcf_hdr_get_n_sample(bcf_hdr_t *h);
* allow for an alternative header file to be read in.
*
* this searches for the alternative header saved as <filename>.hdr
* If the VCF files is BCF, any alternative header is ignored.
*/
bcf_hdr_t *bcf_alt_hdr_read(htsFile *fp);

Expand Down
4 changes: 4 additions & 0 deletions main.cpp
Expand Up @@ -102,6 +102,7 @@ void help()
std::clog << "view view vcf/vcf.gz/bcf files\n";
std::clog << "index index vcf.gz/bcf files\n";
std::clog << "normalize normalize variants\n";
std::clog << "decompose decompose variants\n";
std::clog << "uniq drop duplicate variants\n";
std::clog << "cat concatenate VCF files\n";
std::clog << "paste paste VCF files\n";
Expand All @@ -110,7 +111,10 @@ void help()
std::clog << "\n";
std::clog << "peek summary of variants in the vcf file\n";
std::clog << "partition partition variants\n";
std::clog << "multi_partition partition variants from multiple VCF files\n";
std::clog << "annotate_variants annotate variants\n";
std::clog << "annotate_db_rsid annotate variants with dbSNP rsid\n";
std::clog << "annotate_1000g annotate variants with 1000 Genomes variants\n";
std::clog << "annotate_regions annotate regions\n";
std::clog << "compute_concordance compute genotype concordance between 2 call sets\n";
std::clog << "compute_features compute genotype likelihood based statistics\n";
Expand Down
3 changes: 2 additions & 1 deletion paste.cpp
Expand Up @@ -66,11 +66,12 @@ class Igor : Program
try
{
std::string desc = "Pastes VCF files like the unix paste functions.\n"
" This is used after the per sample genotyping step in vt.\n"
" Input requirements and assumptions:\n"
" 1. Same variants are represented in the same order for each file (required)\n"
" 2. Genotype fields are the same for corresponding records (required)\n"
" 3. Sample names are different in all the files (warning will be given if not)\n"
" 4. Headers are the same for all the files (assumption, not checked, will fail if output is BCF)\n"
" 4. Headers (not including the samples) are the same for all the files (unchecked assumption, will fail if output is BCF)\n"
" Outputs:\n"
" 1. INFO fields output will be that of the first file\n"
" 2. Genotype fields are the same for corresponding records\n";
Expand Down

0 comments on commit 4588a7b

Please sign in to comment.