Repository revision
23:8aa352093d73

Repository 'bcftools_consensus'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus

bcftools consensus tool metadata
Miscellaneous
Create consensus sequence by applying VCF variants to a reference fasta file
bcftools_consensus
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.15.1+galaxy4
1.15.1+galaxy4
bcftools 2>&1 | grep 'Version:'
True
Version lineage of this tool (guids ordered most recent to oldest)
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.15.1+galaxy4 (this tool)
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.15.1+galaxy3
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.15.1+galaxy2
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.15.1+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.15.1+galaxy0
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.10+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.10
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.9+galaxy2
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.9+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.9
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.4.0
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.3.1
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_consensus/bcftools_consensus/1.3.0
bcftools_consensus
Requirements (dependencies defined in the <requirements> tag set)
name version type
bcftools 1.15.1 package
htslib 1.15.1 package
samtools 1.15.1 package
gawk 5.0.1 package
Additional information about this tool
export BCFTOOLS_PLUGINS=`which bcftools | sed 's,bin/bcftools,libexec/bcftools,'`;

  


## May need to symlink input if there is an associated
#set $input_vcf = 'input.vcf.gz'
#if $input_file.is_of_type('vcf')
  bgzip -c '$input_file' > $input_vcf &&
  bcftools index $input_vcf &&
##elif $input_file.is_of_type('vcf_bgzip') or $input_file.is_of_type('vcf.gz')
#elif $input_file.is_of_type('vcf_bgzip')
  ln -s '$input_file' $input_vcf &&
  #if $input_file.metadata.tabix_index:
    ln -s '${input_file.metadata.tabix_index}' ${input_vcf}.tbi &&
  #else
    bcftools index $input_vcf &&
  #end if
#elif $input_file.is_of_type('bcf')
  #set $input_vcf = 'input.bcf'
  ln -s '$input_file' $input_vcf &&
  #if $input_file.metadata.bcf_index:
    ln -s '${input_file.metadata.bcf_index}' ${input_vcf}.csi &&
  #else
    bcftools index $input_vcf &&
  #end if
#end if

  
#set $section = $reference_source


#set $input_fa_ref = None
#if 'fasta_ref' in $section and $section.fasta_ref:
  #if 'reference_source_selector' in $section:
    #if str($section.reference_source_selector) == "history":
      #set $input_fa_ref = 'ref.fa'
      ln -s '$section.fasta_ref' $input_fa_ref &&
      samtools faidx $input_fa_ref &&
    #else:
      #set $input_fa_ref = str($section.fasta_ref.fields.path)
    #end if
  #end if
#end if

  

bcftools consensus


#if $input_fa_ref is not None:
  --fasta-ref $input_fa_ref
#elif 'fasta_ref' in $section and $section.fasta_ref:
  --fasta-ref '${section.fasta_ref}'
#end if
  

## Default section
#set $section = $sec_default

${section.iupac_codes}

#if $section.mask:
  --mask '${section.mask}'
#end if

#if $section.mark_del
    --mark-del '$section.mark_del'
#end if

#if $section.mark_ins
    --mark-ins $section.mark_ins
#end if

#if $section.mark_snv
    --mark-snv $section.mark_snv
#end if

#if $section.select_haplotype:
  --haplotype '${section.select_haplotype}'
#end if

#if $section.sample:
  --sample '${section.sample}'
#end if
  

#set $section = $sec_restrict

#if $section.include:
  --include '${section.include}'
#end if
  

#if $section.exclude:
  --exclude '${section.exclude}'
#end if
  

#if $chain:
    --chain '$chain_file'
#end if

#if $absent
    --absent '$absent'
#end if

## Primary Input/Outputs
#if str($rename) == "no"
    --output '$output_file'
#end if

$input_vcf
  
#if str($rename) == "yes":
    #set basename=$input_file.element_identifier
    | awk 'BEGIN {i=1} {if (match($0, /^>/)) {if (i==1) {name="${basename}"} else {name=sprintf("%s-%d","${basename}",i);} print(gensub(/>[^ ]+( ?.*)/, ">" name "\\1", 1)); i=i+1;} else {print}}' > '$output_file'
#end if

    
None
False
Functional tests
name inputs outputs required files
Test-1 input_file: consensus.vcf
reference_source|fasta_ref: consensus.fa
reference_source|reference_source_selector: history
sec_default|mask: consensus.tab
chain: True
name: value
name: value
consensus.vcf
consensus.fa
consensus.tab
value
Test-2 input_file: consensus.vcf
reference_source|fasta_ref: consensus
reference_source|reference_source_selector: cached
sec_default|mask: consensus.tab
chain: True
name: value
name: value
consensus.vcf
consensus.tab
value
Test-3 input_file: consensus.vcf
reference_source|fasta_ref: consensus.fa
reference_source|reference_source_selector: history
sec_default|mask: consensus.tab
chain: False
rename: True
name: value
consensus.vcf
consensus.fa
consensus.tab
value
Test-4 input_file: consensus.vcf
reference_source|fasta_ref: consensus.fa
reference_source|reference_source_selector: history
sec_restrict|include: TYPE="snp"
name: value
consensus.vcf
consensus.fa
value
Test-5 input_file: consensus.vcf
reference_source|fasta_ref: consensus.fa
reference_source|reference_source_selector: history
absent: W
sec_restrict|include: TYPE="snp"
name: value
consensus.vcf
consensus.fa
value
Test-6 input_file: consensus.vcf
reference_source|fasta_ref: consensus.fa
reference_source|reference_source_selector: history
sec_default|mark_del: DEL
sec_default|mark_ins: uc
sec_default|mark_snv: uc
sec_restrict|include: TYPE="snp"
name: value
consensus.vcf
consensus.fa
value