Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrepareHetero:Sort order warning and lazy parsing genotype fields triggers vague error #4

Open
mmterpstra opened this issue Dec 15, 2020 · 0 comments

Comments

@mmterpstra
Copy link

Tabix indexing triggers sorting error

Tabix indexing on the line below assumes vcf-sort(vcftools package) natural sort order(1,10,11, etc) instead of picard tools sort by chromosome size/dictionary order (1,2,3, etc).

try(indexTabix(vcffile,"vcf"))

This triggers the following warning:

[E::hts_idx_push] Unsorted positions on sequence #1: 865534 followed by 865482
Error in value[[3L]](cond) : index build failed
``


# Lazy parsing
Lazy parsing assuming GATK ordering on:
https://github.com/ykong2/MADSEQ/blob/4a71380b53853cdfec26fd366b4fdd0031fea3ff/R/PreProcessingShow.R#L390

This assumes the genotype fields are formatted starting GT:AD:DP just like gatk does by default (freebayes has different ordering). 

All variants processed
processing vcf file
Error in S4Vectors:::normarg_names(value, class(x), length(x)) :
attempt to set too many names (2) on IRanges object of length 0
Calls: prepareHetero ... names<- -> setNames -> names<- -> names<- ->
Execution halted


Fix since this github is inactive

(for i in *.vcf.gz; do zcat $i | perl -wnae 'BEGIN{use Data::Dumper;}; if(not(m/^#/)){my @vals=split(":",$F[9]); my @keys = split(":",$F[8]); my %gt_parsed;for my $key ( @keys){$gt_parsed{$key}=shift(@vals);};$F[8] = "GT:AD:DP";$F[9]=join(":",@gt_parsed{"GT","AD","DP"})}; print join("\t",@f)."\n"' | vcf-sort | bgzip -c > $(basename $i .vcf.gz).vcftoolssort.vcf.gz; done)&

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant