Hello, my name is Elisabeth. I am seeking help about some analysis I've been doing with samtools and bcftools. In my SNP calling process, I face a problem in the step passing from the BAM to the VCF file, I always get the following error message and I wanted to know if you know what that error means and how to solve this.Error message:[mpileup] 1 samples in 1 input files [E::bcf_hdr_read] Failed to read BCF header Failed to open -: could not parse header
My command is:samtools mpileup -uf reference.fa file.sorted.bam | bcftools call -m -v -O z - > file.raw.vcf.gz I have searched online for solutions but did not find any that works. Could you please help me figure out what I am doing wrong in the calling?Thank you. Best,Elisabeth On Tue, Sep 22, 2020 at 9:36 AM, Robert Davies<r...@sanger.ac.uk> wrote: Samtools (and HTSlib and BCFtools) version 1.11 is now available from GitHub and SourceForge https://sourceforge.net/projects/samtools/ https://github.com/samtools/htslib/releases/tag/1.11 https://github.com/samtools/samtools/releases/tag/1.11 https://github.com/samtools/bcftools/releases/tag/1.11 The main changes are listed below: ------------------------------------------------------------------------ htslib - changes v1.11 ------------------------------------------------------------------------ Features and Updates -------------------- * Support added for remote reference files. fai_path() can take a remote reference file and will return the corresponding index file. Remote indexes can be handled by refs_load_fai(). UR tags in @SQ lines can now be set to remote URIs. (#1017) * Added tabix --separate-regions option, which adds header comment lines separating different regions' output records when multiple target regions are supplied on the command line. (#1108) * Added tabix --cache option to set a BGZF block cache size. Most beneficial when the -R option is used and the same blocks need to be re-read multiple times. (#1053) * Improved error checking in tabix and added a --verbosity option so it is possible to change the amount of logging when it runs. (#1040) * A note about the maximum chromosome length usable with TBI indexes has been added to the tabix manual page. Thanks to John Marshall. (#1070) * New method vcf_open_mode() changes the opening mode of a variant file based on its file extension. Similar to sam_open_mode(). (#1096) * The VCF parser has been made faster and easier to maintain. (#1057) * bcf_record_check() has been made faster, giving a 15% speed increase when reading an uncompressed BCF file. (#1130) * The VCF parser now recognises the "<NON_REF>" symbolic allele produced by GATK. (#1045) * Support has been added for simultaneous reading of unindexed VCF/BCF files when using the synced_bcf_reader interface. Input files must have the chromosomes in the same order as each other and be consistent with the order of sequences in the header. (#1089) * The VCF and BCF readers will now attempt to fix up invalid INFO/END tags where the stored END value is less than POS, resulting in an apparently negative record length. Such files have been generated by programs which used END incorrectly, and by broken lift-over processes that failed to update any END tags present. (#1021; fixed samtools/bcftools#1154) * The htsFile interface can now detect the crypt4gh encrypted format (see https://samtools.github.io/hts-specs/crypt4gh.pdf). If HTSlib is built with external plug-in support, and the hfile_crypt4gh plug-in is present, the file will be passed to it for decryption. The plug-in can be obtained from https://github.com/samtools/htslib-crypt4gh. (#1046) * hts_srand48() now seeds the same POSIX-standard sequences of pseudo-random numbers regardless of platform, including on OpenBSD where plain srand48() produces a different cryptographically-strong non-deterministic sequence. Thanks to John Marshall. (#1002) * Iterators now work with 64 bit positions. (#1018) * Improved the speed of range queries when using BAI indexes by making better use of the linear index data included in the file. The best improvement is on low-coverage data. (#1031) * Alignments which consume no reference bases are now considered to have length 1. This would make such alignments cover 1 reference position in the same manner as alignments that are unmapped or have no CIGAR strings. These alignments can now be returned by iterator-based queries. Thanks to John Marshall. (#1063; fixed samtools/samtools#1240, see also samtools/hts-specs#521). * A bam_set_seqi() function to modify a single base in the BAM structure has been added. This is a companion function to bam_seqi(). (#1022) * Writing SAM format is around 30% faster. (#1035) * Added sam_format_aux1() which converts a BAM aux tag to a SAM format string. (#1134) * bam_aux_update_str() no longer requires NUL-terminated strings. It is also now possible to create tags containing part of a longer string. (#1088) * It is now possible to use external plug-ins in language bindings that dynamically load HTSlib. Note that a side-effect of this change is that some plug-ins now link against libhts.so, which means that they have to be able to find the shared library when they are started up. Thanks to John Marshall. (#1072) * bgzf_close(), and therefore hts_close(), will now return non-zero when closing a BGZF handle on which errors have been detected. (Part of #1117) * Added a special case to the kt_fisher_exact() test for when the table probability is too small to be represented in a double. This fixes a bug where it would, for some inputs, fail to correctly determine which side of the distribution the table was on resulting in swapped p-values being returned for the left- and right-tailed tests. The two-tailed test value was not affected by this problem. (#1126) * Improved error diagnostics in the CRAM decoder (#1042), BGZF (#1049), the VCF and BCF readers (#1059), and the SAM parser (#1073). * ks_resize() now allocates 1.5 times the requested size when it needs to expand a kstring instead of rounding up to the next power of two. This has been done mainly to make the inlined function smaller, but it also reduces the overhead of storing data in kstrings at the expense of possibly needing a few more reallocations. (#1129) CRAM improvements ----------------- * Delay CRAM crc32 checks until the data actually needs to be used. With other changes this leads to a 20x speed up in indexing and other sub-query based actions. (#988) * CRAM now handles the transition from mapped to unmapped data in a better way, improving compression of the unmapped data. (#961) * CRAM can now use libdeflate. (#961) * Fixed bug in MD tag generation with "b" read feature codes, causing the numbers in the tag to be too large. Note that HTSlib never uses this feature code so it is unlikely that this bug would be seen on real data. The problem was found when testing against hand-crafted CRAM files. (#1086) * Fixed a regression where the CRAM multi-region iterator became much less efficient when using threads. It now works more like the single iterator and does not preemptively decode the next container unless it will be used. (#1061) * Set CRAM default quality in lossy quality modes. If lossy quality is enabled and 'B', 'q' or 'Q' features are used, CRAM starts off with QUAL being all 255 (as per BAM spec and "*" quality) and then modifies individual qualities as dictated by the specific features. However that then produces ASCII quality " " (space, q=-1) for the unmodified bases. Instead ASCII quality "?" (q=30) is used, as per HTSJDK. Quality 255 is still used for sequences with no modifications at all. (#1094) Build changes ------------- These are compiler, configuration and makefile based changes. * `make all` now also builds htslib_static.mk and htslib-uninstalled.pc. Thanks to John Marshall. (#1011) * Various cppcheck-1.90 warnings have been fixed. (#995, #1011) * HTSlib now prefers its own headers when being compiled, fixing build failures on machines that already had a system-installed HTSlib. Thanks to John Marshall. (#1078; fixed #347) * Define HTSLIB_EXPORT without using a helper macro to reduce the length of compiler diagnostics that mention exported functions. Thanks to John Marshall. (#1029) * Fix dirty default build by including latest pkg.m4 instead of using aclocal.m4. Thanks to Damien Zammit. (#1091) * Struct tags have been added to htslib/*.h public typedefs. This makes it possible to forward declare htsFile without including htslib/hts.h. Thanks to Lucas Czech and John Marshall. (#1115; fixed #1106) * Fixed compiler warnings emitted by the latest gcc and clang releases when compiling HTSlib, along with some -Wextra warnings in the public include files. Thanks to John Marshall. (#1066, #1063, #1083) Bug fixes --------- * Fixed hfile_libcurl breakage when using libcurl 7.69.1 or later. Thanks to John Marshall for tracking down the exact libcurl change that caused the incompatibility. (#1105; fixed samtools/samtools#1254 and samtools/samtools#1284) * Fixed overflows kroundup32() and kroundup_size_t() which caused them to return zero when rounding up values where the most significant bit was set. When this happens they now return the highest value that can be stored (#1044). All of the kroundup macro definitions have also been gathered together into a unified implementation (#1051). * Fixed missing return parameter value in idx_test_and_fetch(). Thanks to Lilian Janin. (#1014) * Fixed crashes due to inconsistent selection between BGZF and plain (hFILE) interfaces when reading files. [fuzz] (#1019) * Added and/or fixed byte swapping code for big-endian platforms. Thanks to Jun Aruga, John Marshall, Michael R Crusoe and Gianfranco Costamagna for their help. (#1023; fixed #119 and #355) * Fixed a problem with multi-threaded on-the-fly indexes which would occasionally write virtual offsets pointing at the end of a BGZF block. Attempting to read from such an offset caused EOF to be incorrectly reported. These offsets are now handled correctly, and the indexer has been updated to avoid generating them. (#1028; fixed samtools/samtools#1197) * In sam_hdr_create(), free newly allocated SN strings when encountering an error. [fuzz] (#1034) * Prevent double free in case of idx_test_and_fetch() failure. Thanks to @fanwayne for the bug report. (#1047; fixed #1033) * In the header, link a new PG line only to valid chains. Prevents an explosive growth of PG lines on headers where PG lines are already present but not linked together correctly. (#1062; fixed samtools/samtools#1235) * Also in the header, when calling sam_hdr_update_line(), update target arrays only when the name or length is changed. (#1007) * Fixed buffer overflows in CRAM MD5 calculation triggered by files with invalid compression headers, or files with embedded references that were one byte too short. [fuzz] (#1024, #1068) * Fix mpileup regression between 1.9 and 1.10 where overlap detection was incorrectly skipped on reads where RNEXT, PNEXT and TLEN were set to the "unavailable" values ("*", 0, 0 in SAM). (#1097) * kputs() now checks for null pointer in source string. [fuzz] (#1087) * Fix potential bcf_update_alleles() crash on 0 alleles. Thanks to John Marshall. (#994) * Added bcf_unpack() calls to some bcf_update functions to fix a bug where updates made after a call to bcf_dup() could be lost. (#1032; fixed #1030) * Error message typo "Number=R" instead of "Number=G" fixed in bcf_remove_allele_set(). Thanks to Ilya Vorontsov. (#1100) * Fixed crashes that could occur in BCF files that use IDX= header annotations to create a sparse set of CHROM, FILTER or FORMAT indexes, and include records that use one of the missing index values. [fuzz] (#1092) * Fixed potential integer overflows in the VCF parser and ensured that the total length of FORMAT fields cannot go over 2Gbytes. [fuzz] (#1044, #1104) * Download index files atomically in idx_test_and_fetch(). This prevents corruption when running parallel jobs on S3 files. Thanks to John Marshall. (#1112; samtools/samtools#1242). * The pileup constructor callback is now given the copy of the bam1_t struct made by pileup instead of the original one passed to bam_plp_push(). This makes it the same as the one passed to the destructor and ensures that cached data, for example the location of an aux tag, will remain valid. (#1127) * Fixed possible error in code_sort() on negative CRAM Huffman code length. (#1008) * Fixed possible undefined shift in cram_byte_array_stop_decode_init(). (#1009) * Fixed a bug where range queries to the end of a given reference would return incorrect results on CRAM files. (#1016; fixed samtools/samtools#1173) * Fixed an integer overflow in cram_read_slice(). [fuzz] (#1026) * Fixed a memory leak on failure in cram_decode_slice(). [fuzz] (#1054) * Fixed a regression which caused cram_transcode_rg() to fail, resulting in a crash in "samtools cat" on CRAM files. (#1093; fixed samtools/samtools#1276) * Fixed an undersized string reallocation in the threaded SAM reader which caused it to crash when reading SAM files with very long lines. Numerous memory allocation checks have also been added. (#1117) ------------------------------------------------------------------------ samtools - changes v1.11 ------------------------------------------------------------------------ * New samtools ampliconclip sub-command for removing primers from amplicon-based sequencing experiments, including the current COVID-19 projects. The primers are listed in a BED file and can be either soft-clipped or hard-clipped. (#1219) * New samtools ampliconstats sub-command to produce a textual summary of primer and amplicon usage, in a similar style to "samtools stats". The misc/plot-ampliconstats script can generate PNG images based on this text report. (#1227) * Samtools fixmate, addreplacerg, markdup, ampliconclip and sort now accept a -u option to enable uncompressed output, which is useful when sending data over a pipe to another process. Other subcommands which already support this option for the same purpose are calmd, collate, merge, view and depad. (#1265) * samtools stats has a new GCT section, where it reports ACGT content percentages, similar to GCC but taking into account the read orientation. (#1274) * Samtools split now supports splitting by tag content with the -d option (#1211) * samtools merge now accepts a BED file as a command line argument (-L) and does the merging only with reads overlapping the specified regions (#1156) * Samtools sort now has a minhash collation (-M) to group unmapped reads with similar sequence together. This can sometimes significantly reduce the file size. (#1093) * Samtools bedcov now has -g and -G options to filter-in and filter-out based on the FLAG field. Also the new -d option adds an extra column per file counting the number of bases with a depth greater than or equal to a given threshold. (#1214) * Fixed samtools bedcov -j option (discard deletions and ref-skips) with multiple input files (#1212) * samtools bedcov will now accept BED files with columns separated by spaces as well as tabs (#1246; #1188 reported by Mary Carmack) * samtools depth can now include deletions (D) when computing the base coverage depth, if the user adds the -J option to the command line (#1163). * samtools depth will count only the bases of one read, for the overlapping section of a read pair, if the -s option is used in the command line (#1241, thanks to Teng Li). * samtools depth will now write zeros for the entire reference length, when "samtools depth -aa" is run on a file with no alignments. (#1252; #1249 reported by Paul Donovan) * Stopped depth from closing stdout, which triggered test fails in pysam (#1208, thanks to John Marshall). * samtools view now accepts remote URIs for FASTA and FAI files. Furthermore, the reference and index file can be provided in a single argument, such as samtools view -T ftp://x.com/ref.fa##idx##ftp://y.com/index.fa.fai a.cram (#1176; samtools/htslib#933 reported by @uitde007) * samtools faidx gets new options --fai-idx and --gzi-idx to allow specification of the locations of the .fai and (if needed) .gzi index files. (#1283) * The samtools fasta/fastq '-T' option can now add SAM array (type 'B') tags to the output header lines. (#1301) * samtools mpileup can now display MAPQ either as ASCII characters (with -s/--output-MQ; column now restored to its documented order as in 1.9 and previous versions) or comma-separated numbers (with --output-extra MAPQ; in SAM column order alongside other selected --output-extra columns). When both -s/--output-MQ and -O/--output-BP are used, samtools 1.10 printed the extra columns in the opposite order. This changes the format produced by 1.10's --output-extra MAPQ. (#1281, thanks to John Marshall; reported by Christoffer Flensburg) * samtools tview now accepts a -w option to set the output width in text mode (-d T). (#1280) * The dict command can now add AN tags containing alternative names with "chr" prefixes added to or removed from each sequence name as appropriate and listing both "M" and "MT" alternatives for mitochondria. (#1164, thanks to John Marshall) * The samtools import command, labelled as obsolete in May 2009 and removed from all help and documentation later that year, has finally been removed. Use samtools view instead. (#1185) * Replaced the remaining usage of the Samtools 0.1 legacy API with htslib calls. (#1187, thanks to John Marshall) * Documentation / help improvements (#1154; #1168; #1191; #1199; #1204; #1313): - Fixed a few man-page table layout issues - Added <file>##idx##<index> filename documentation - Fixed usage statement for samtools addreplacerg - Miscellaneous spelling and grammar fixes - Note fixmate/markdup name collated rather than name sorted input - Note that fastq and fasta inputs should also be name collated - Reshuffled order of main man-page and added -@ to more sub-pages - The misc/seq_cache_populate.pl script now gives REF_CACHE guidance * Additional documentation improvements, thanks to John Marshall (#1181; #1224; #1248; #1262; #1300) - Emphasise that samtools index requires a position-sorted file - Document 2^29 chromosome length limit in BAI indexes - Numerous typing, spelling and formatting fixes * Improved the message printed when samtools view fails to read its input (#1296) * Added build support for the OpenIndiana OS (#1165, thanks to John Marshall) * Fixed failing tests on OpenBSD (#1151, thanks to John Marshall) * The samtools sort tests now use less memory so the test suite works better on small virtual machines. (#1159) * Improved markdup's calculation of insert sizes (#1161) Also improved tests (#1150) and made it run faster when not checking for optical duplicates or adding 'do' tags (#1308) * Fixed samtools coverage minor inconsistency vs idxstats (#1205; #1203 reported by @calliza) * Fixed samtools coverage quality thresholding options which were the wrong way round compared to mpileup (-q is the mapping quality threshold and -Q is base quality). (#1279; #1278 reported by @kaspernie) * Fixed bug where `samtools fastq -i` would add two copies of the barcode in the fastq header if both reads in a pair had a "BC:Z" tag (#1309; #1307 reported by @mattsoup) * Samtools calmd no longer errors with a SEQ of "*" (#1230; #1229 reported by Bob Harris) * Samtools tview now honours $COLUMNS, fixing some CI tests (#1171; #1162 reported by @cljacobs) * Fixed a samtools depad overflow condition (#1200) * Improved curses detection in configure script (#1170, #577, #940) * Fixed samtools stats integer overflows and added support for long references (#1174; #1173) * Fixed a 1-byte undersized memory allocation in samtools merge. (#1302) ------------------------------------------------------------------------ bcftools - changes v1.11 ------------------------------------------------------------------------ Changes affecting the whole of bcftools, or multiple commands: * Filtering -i/-e expressions - Breaking change in -i/-e expressions on the FILTER column. Originally it was possible to query only a subset of filters, but not an exact match. The new behavior is: FILTER="A" .. exact match, for example "A;B" does not pass FILTER!="A" .. exact match, for example "A;B" does pass FILTER~"A" .. both "A" and "A;B" pass FILTER!~"A" .. neither "A" nor "A;B" pass - Fix in commutative comparison operators, in some cases reversing sides would produce incorrect results (#1224; #1266) - Better support for filtering on sample subsests - Add SMPL_*/S* family of functions that evaluate within rather than across all samples. (#1180) * Improvements in the build system Changes affecting specific commands: * bcftools annotate: - Previously it was not possible to use `--columns =TAG` with INFO tags and the `--merge-logic` feature was restricted to tab files with BEG,END columns, now extended to work also with REF,ALT. - Make `annotate -TAG/+TAG` work also with FORMAT fields. (#1259) - ID and FILTER can be transferred to INFO and ID can be populated from INFO. However, the FILTER column still cannot be populated from an INFO tag because all possible FILTER values must be known at the time of writing the header (#947; #1187) * bcftools consensus: - Fix in handling symbolic deletions and overlapping variants. (#1149; #1155; #1295) - Fix `--iupac-codes` crash on REF-only positions with `ALT="."`. (#1273) - Fix `--chain` crash. (#1245) - Preserve the case of the genome reference. (#1150) - Add new `-a, --absent` option which allows to set positions with no supporting evidence to "N" (or any other character). (#848; #940) * bcftools convert: - The option `--vcf-ids` now works also with `-haplegendsample2vcf`. (#1217) - New option `--keep-duplicates` * bcftools csq: - Add `misc/gff2gff.py` script for conversion between various flavors of GFF files. The initial commit supports only one type and was contributed by @flashton2003. (#530) - Add missing consequence types. (PR #1203; #1292) - Allow overlapping CDS to support ribosomal slippage. (#1208) * bcftools +fill-tags: - Added new annotations: INFO/END, TYPE, F_MISSING. * bcftools filter: - Make `--SnpGap` optionally filter also SNPs close to other variant types. (#1126) * bcftools gtcheck: - Complete revamp of the command. The new version is faster and allows N:M sample comparisons, not just 1:N or NxN comparisons. Some functionality was lost (plotting and clustering) but may be added back on popular demand. * bcftools +mendelian: - Revamp of user options, output VCFs with mendelian errors annotation, read PED files (thanks to Giulio Genovese). * bcftools merge: - Update headers when appropriate with the '--info-rules *:join' INFO rule. (#1282) - Local alleles merging that produce LAA and LPL when requested, a draft implementation of https://github.com/samtools/hts-specs/pull/434 (#1138) - New `--no-index` which allows to merge unindexed files. Requires the input files to have chromosomes in th same order and consistent with the order of sequences in the header. (PR #1253; samtools/htslib#1089) - Fixes in gVCF merging. (#1127; #1164) * bcftools norm: - Fixes in `--check-ref s` reference setting features with non-ACGT bases. (#473; #1300) - New `--keep-sum` switch to keep vector sum constant when splitting multiallelics. (#360) * bcftools +prune: - Extend to allow annotating with various LD metrics: r^2, Lewontin's D' (PMID:19433632), or Ragsdale's D (PMID:31697386). * bcftools query: - New `%N_PASS()` formatting expression to output the number of samples that pass the filtering expression. * bcftools reheader: - Improved error reporting to prevent user mistakes. (#1288) * bcftools roh: - Several fixes and improvements - the `--AF-file` description incorrectly suggested "REF\tALT" instead of the correct "REF,ALT". (#1142) - RG lines could have negative length. (#1144) - new `--include-noalt` option to allow also ALT=. records. (#1137) * bcftools scatter: - New plugin intended as a convenient inverse to `concat` (thanks to Giulio Genovese, PR #1249) * bcftools +split: - New `--groups-file` option for more flexibility of defining desired output. (#1240) - New `--hts-opts` option to reduce required memory by reusing one output header and allow overriding the default hFile's block size with `--hts-opts block_size=XXX`. On some file systems (lustre) the default size can be 4M which becomes a problem when splitting files with 10+ samples. - Add support for multisample output and sample renaming * bcftools +split-vep: - Add default types (Integer, Float, String) for VEP subfields and make `--columns -` extract all subfields into INFO tags in one go. -- The Wellcome Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE. _______________________________________________ Samtools-help mailing list Samtools-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/samtools-help
_______________________________________________ Samtools-help mailing list Samtools-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/samtools-help