Repository revision
16:e7452697afd9

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

bcftools filter tool metadata
Miscellaneous
Apply fixed-threshold filters
bcftools_filter
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_filter/bcftools_filter/1.15.1+galaxy0
1.15.1+galaxy0
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_filter/bcftools_filter/1.15.1+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_filter/bcftools_filter/1.15.1+galaxy0 (this tool)
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_filter/bcftools_filter/1.10
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_filter/bcftools_filter/1.9+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_filter/bcftools_filter/1.9
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_filter/bcftools_filter/1.4.0
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_filter/bcftools_filter/1.3.1
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_filter/bcftools_filter/1.3.0
bcftools_filter
Requirements (dependencies defined in the <requirements> tag set)
name version type
bcftools 1.15.1 package
htslib 1.15.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 = $sec_restrict


#set $targets_path = None
#if 'targets' in $section
  #if $section.targets.targets_src == 'targets_file':
    #set $targets_path = 'targets_file.tab.gz'
    bgzip -c "$section.targets.targets_file" > $targets_path &&
    tabix -s 1 -b 2 -e 2 $targets_path &&
  #end if
#elif $tgts_sec.targets_file:
  #set $targets_path = 'targets_file.tab.gz'
  bgzip -c "$section.targets_file" > $targets_path &&
  tabix -s 1 -b 2 -e 2 $targets_path &&
#end if

  


#set $regions_path = None
#if 'regions' in $section
  #if $section.regions.regions_src == 'regions_file' and $section.regions.regions_file:
    #if $section.regions.regions_file.ext.startswith('bed'):
      #set $regions_path = 'regions_file.bed'
      ln -s '$section.regions.regions_file' $regions_path &&
    #end if
  #end if
#end if

  

bcftools filter

## Filter section
#set $section = $sec_filter
#if $section.SnpGap:
  --SnpGap "${section.SnpGap}"
#end if
#if $section.IndelGap:
  --IndelGap "${section.IndelGap}"
#end if
#if $section.mode:
  #set $mode = str($section.mode).replace(',','')
  --mode '$mode'
#end if
#if $section.conditional_soft_filter.selector == 'enabled':
  --soft-filter '${section.conditional_soft_filter.soft_filter}'
  

#if $section.conditional_soft_filter.selector == 'enabled' and $section.conditional_soft_filter.soft_filter
  #if $section.conditional_soft_filter.masks.masks_src == 'regions':
    #set $intervals = $section.conditional_soft_filter.masks.masks
    

#set $components = []
#for $i in $intervals:
  #set $chrom = str($i.chrom).strip()
  #set $start = str($i.start).strip()
  #set $stop = str($i.stop).strip()
  #if $start or $stop:
    $components.append($chrom + ':' + ($start or '0') + '-' + $stop)
  #else:
    $components.append($chrom)
  #end if
#end for
#set $intervals_spec = ','.join($components)

  
    --mask '$intervals_spec'
  #elif $section.conditional_soft_filter.masks.masks_src == 'masks_file' and $section.conditional_soft_filter.masks.masks_file:
    #if $masks_path is not None:
      --mask-file '$masks_path'
    #else:
      --mask-file '$section.conditional_soft_filter.masks.masks_file'
    #end if
  #end if
  #if $section.conditional_soft_filter.masks_overlap
    --mask-overlap $section.conditional_soft_filter.masks_overlap
  #end if
#end if


  
#end if
#if $section.select_set_GTs:
  --set-GTs "${section.select_set_GTs}"
#end if

#set $section = $sec_restrict


#if $section.regions.regions_src == 'regions':
  #set $intervals = $section.regions.regions
  

#set $components = []
#for $i in $intervals:
  #set $chrom = str($i.chrom).strip()
  #set $start = str($i.start).strip()
  #set $stop = str($i.stop).strip()
  #if $start or $stop:
    $components.append($chrom + ':' + ($start or '0') + '-' + $stop)
  #else:
    $components.append($chrom)
  #end if
#end for
#set $intervals_spec = ','.join($components)

  
  --regions '$intervals_spec'
#elif $section.regions.regions_src == 'regions_file' and $section.regions.regions_file:
  #if $regions_path is not None:
    --regions-file '$regions_path'
  #else:
    --regions-file '$section.regions.regions_file'
  #end if
#end if
#if $section.regions_overlap
  --regions-overlap $section.regions_overlap
#end if


  


#if $targets_path:
  --targets-file "${section.targets.invert_targets_file}${targets_path}"
#elif $section.targets.targets_src == 'targets':
  #set $intervals = $section.targets.targets
  

#set $components = []
#for $i in $intervals:
  #set $chrom = str($i.chrom).strip()
  #set $start = str($i.start).strip()
  #set $stop = str($i.stop).strip()
  #if $start or $stop:
    $components.append($chrom + ':' + ($start or '0') + '-' + $stop)
  #else:
    $components.append($chrom)
  #end if
#end for
#set $intervals_spec = ','.join($components)

  
  --targets '${section.targets.invert_targets_file}$intervals_spec'
#elif $section.targets.targets_src == 'targets_file' and $section.targets.targets_file:
  --targets-file "${section.targets.invert_targets_file}${section.targets.targets_file}"
#end if
#if $section.targets_overlap
  --targets-overlap $section.targets_overlap
#end if

  

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

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


#if str($output_type) != "__none__":
  --output-type '${output_type}'
#end if
  

  --threads \${GALAXY_SLOTS:-4}
  

## Primary Input/Outputs

$input_vcf
  
> '$output_file'

    
None
False
Functional tests
name inputs outputs required files
Test-1 input_file: filter.1.vcf
sec_filter|SnpGap: 2
sec_filter|IndelGap: 2
sec_filter|mode: x
output_type: v
name: value
filter.1.vcf
value
Test-2 input_file: filter.2.vcf
sec_restrict|exclude: QUAL==59.2 || (INDEL=0 & (FMT/GQ=25 | FMT/DP=10))
sec_filter|select_set_GTs: .
output_type: v
name: value
filter.2.vcf
value
Test-3 input_file: filter.3.vcf
sec_restrict|exclude: INFO/DP=19
output_type: v
name: value
filter.3.vcf
value
Test-4 input_file: filter.3.vcf
sec_restrict|exclude: INFO/DP=19
sec_filter|conditional_soft_filter|soft_filter: XX
sec_filter|conditional_soft_filter|selector: enabled
output_type: v
name: value
filter.3.vcf
value
Test-5 input_file: filter.3.vcf
sec_restrict|exclude: INFO/DP=19
sec_filter|conditional_soft_filter|soft_filter: XX
sec_filter|conditional_soft_filter|selector: enabled
output_type: v
name: value
filter.3.vcf
value
Test-6 input_file: filter.3.vcf
sec_restrict|exclude: INFO/DP=19
sec_filter|conditional_soft_filter|soft_filter: XX
sec_filter|conditional_soft_filter|selector: enabled
output_type: v
name: value
filter.3.vcf
value
Test-7 input_file: filter.3.vcf
sec_restrict|exclude: INFO/DP=19
sec_filter|conditional_soft_filter|soft_filter: XX
sec_filter|conditional_soft_filter|selector: enabled
output_type: v
name: value
filter.3.vcf
value
Test-8 input_file: filter.3.vcf
sec_restrict|exclude: FMT/GT="0/2"
output_type: v
name: value
filter.3.vcf
value
Test-9 input_file: filter.2.vcf
sec_restrict|include: FMT/GT="0/0" && AC[*]=2
output_type: v
name: value
filter.2.vcf
value
Test-10 input_file: filter.2.vcf
sec_restrict|regions_overlap: 1
sec_restrict|include: FMT/GT="0/0" && AC[*]=2
output_type: v
name: value
filter.2.vcf
value
Test-11 input_file: filter.3.vcf
sec_restrict|exclude: INFO/DP=19
sec_filter|mode: ['+', 'x']
sec_filter|conditional_soft_filter|soft_filter: XX
sec_filter|conditional_soft_filter|masks_overlap: 1
sec_filter|conditional_soft_filter|selector: enabled
output_type: v
name: value
filter.3.vcf
value