8 votes

How to get fasta alignment file from SAM/BAM file?

I am not sure what you mean by "fasta alignment file". If you mean a multi-sequence alignment (MSA) in the fasta format, you can't get that because SAM keeps pairwise alignments only and doesn't align ...
user172818's user avatar
  • 6,525
5 votes

extracting last few lines of a growing bgzip compressed .vcf.gz file

27GB is not huge. You can zcat the file and see the last few lines. It will take ~10 minutes. It is theoretically possible to peek a bgzf file, but no such tools ...
user172818's user avatar
  • 6,525
5 votes
Accepted

bcftools filtering all files in a directory

I assume your shell is looking for the variable $f_out, but can't find it because you did not define it. It probably generated a hidden file with the name ...
Wouter De Coster's user avatar
5 votes

How can I retrieve the GRCh38 coordinates of a list of rsids?

Several years ago I created rsidx to address this particular use case. https://github.com/bioforensics/rsidx ...
Daniel Standage's user avatar
4 votes

Strategy for merging many VCFs

We created this over the pandemic when we needed to merge loads of VCFs which all have the same header and first few columns (ie same variants) https://github.com/iqbal-lab-org/ivcfmerge That page ...
Zamin Iqbal's user avatar
3 votes

Strategy for merging many VCFs

I ended up using an iterative approach (inspired by this post), which took 1.5 hours - so a massive speed up (and that was just the sequential version). Note: fd is ...
Michael Hall's user avatar
3 votes
Accepted

Can not launch bcftools using python's subprocess module, as it only accepts first command of commands list

Never mind, I figured it out. As it turned out I had to write to file like so and extra quotes ("\'") around samples were not needed. Also shell=True does ...
YKY's user avatar
  • 171
3 votes
Accepted

Filter with bcftools

First of all, bcftools might be a bit of overkill if you want one specific variant. All you need is GNU grep (the default on Linux): ...
terdon's user avatar
  • 9,826
3 votes

Convert VCF file to mpileup.txt

Going VCF to mpileup is not really something one does or can do. The mpileup should be generated from a BAM or SAM file or something else that has raw, unfiltered read alignments in it. The VCF just ...
Michael Weinstein's user avatar
3 votes

Generate VCF from different .bam files with different chromosome names

The main issue here is that your bam files have different chromosome labels. (i.e. 1,2,3 vs. chr1,chr2,chr3) as you mentioned. This suggests that the data was mapped to a slightly different version ...
KT8's user avatar
  • 81
2 votes

bcftools filtering all files in a directory

Using a for loop for this is by far the safer option. However, you need to quote your variables and also make sure you're passing the right variable name. While you'...
terdon's user avatar
  • 9,826
2 votes

Masking sites in a vcf file

I've tried many ways to do this with bcftools but don't think it's possible to exclude a bed file. What you want is ...
pgcudahy's user avatar
  • 152
2 votes

How do I call variants using BCFTools without piping mpileup file?

Why not use tee? Please see this post. You can write mpileup to file while also piping it to another process. For example, ...
user324810's user avatar
  • 1,115
2 votes

bcftools mpileup "Failed to open the file" questions

Regarding a human genome reference, have a look at CHM13/HG002 from the Telomere-to-Telomere consortium: https://github.com/marbl/CHM13#assembly-releases The benefit of the T2T assembly is that it is ...
gringer's user avatar
  • 13.9k
2 votes

How can I retrieve the GRCh38 coordinates of a list of rsids?

rsids_chr1.txt contains a list of rsids, one per line. ...
Cristian Riccio's user avatar
1 vote

How can I retrieve the GRCh38 coordinates of a list of rsids?

This was part of a custom liftover function which handled multiple alleles and reverse compliments. I do not know if it will be useful. I believe there was a separate thing somewhere with lookup that ...
BigMistake's user avatar
1 vote

Strategy for merging many VCFs

Perform a tree based merge of the files. Sort the files into groups that can easily be merged in a measurable amount of time. Merge each group into a separate Variant Call Format (VCF) file Has the ...
G. Putnam's user avatar
  • 111
1 vote
Accepted

Non-ACGTN alternate alleles in VCF

That isn't a valid ALT field according to the VCF standard: ALT — alternate base(s): Comma-separated list of alternate non-reference alleles. These alleles do not have to be called in any of the ...
terdon's user avatar
  • 9,826
1 vote
Accepted

Large amount of REF prefix differences after lifting

It is important that after lifting over a VCF/BCF file from one coordinate system to another, the header of the resulting file contains the chromosome/contig names as present in the coordinate system ...
JRodrigoF's user avatar
  • 827
1 vote
Accepted

Can I discard missing alleles?

If you can, do not discard missing allele information. Generally you often benefit from being able to distinguish between a position that you interrogated and genotyped as REF (reference) versus one ...
JRodrigoF's user avatar
  • 827
1 vote

Compare VCF files

If I understood you correctly you are searching for a way to represent the genomic locations in your vcf file. However, the vcf file is already a human readable file (vcf specification). The first ...
user16294's user avatar
1 vote
Accepted

Filtering a vcf with a text file of SNP rsIDs

I'd advise against using grep, sed, awk for processing vcfs unless you really know what you'...
user438383's user avatar
  • 1,679
1 vote

How do I call variants using BCFTools without piping mpileup file?

Bcftools and samtools both follow the very common Unix filter pattern: they read from all input files specified (as non-option plain arguments), or if there are none they read from standard input. <...
John Marshall's user avatar
1 vote

Snakemake rule issue with bcftools view filtering

Something like the following would work: ...
Devon Ryan's user avatar
  • 19.6k
1 vote

Masking sites in a vcf file

If you are familiar with Python, check out the pyvcf.VcfFrame.filter_bed() method I wrote: ...
Seung-been Steven Lee's user avatar
1 vote

Generate VCF from different .bam files with different chromosome names

I am not familiar with getting variants from bam files, so I will just answer the second part. From the error message, it seems that it is necessary to have consistent chromosome labels across ...
Phoenix Mu's user avatar
1 vote
Accepted

How to do the reverse of bcf merge?

bcftools has the view command which can do this. Create a text file (samples) which has the ...
terdon's user avatar
  • 9,826
1 vote

bcftools filtering all files in a directory

For one-liners, xargs is often more convenient than the for loop: ...
user172818's user avatar
  • 6,525

Only top scored, non community-wiki answers of a minimum length are eligible