Repository revision
18:0238f68ad641

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

bcftools cnv tool metadata
Miscellaneous
bcftools cnv
Call copy number variation from VCF B-allele frequency (BAF) and Log R Ratio intensity (LRR) values
bcftools_cnv
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.15.1+galaxy2
1.15.1+galaxy2
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_cnv/bcftools_cnv/1.15.1+galaxy3
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.15.1+galaxy2 (this tool)
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.15.1+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.15.1+galaxy0
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.10+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.10
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.9+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.9
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.4.0.0
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.3.1.0
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.3.1
toolshed.g2.bx.psu.edu/repos/iuc/bcftools_cnv/bcftools_cnv/1.3.0
bcftools_cnv
Requirements (dependencies defined in the <requirements> tag set)
name version type
bcftools 1.15.1 package
htslib 1.15.1 package
matplotlib 3.5.3 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 cnv

#set $output_dir = 'cnv_tmp'
--output-dir $output_dir

## General section
#set $query_sample = str($query_sample).strip()
#set $control_sample = str($control_sample).strip()
#if $control_sample:
  -c '$control_sample'
#end if
#if $query_sample:
  -s '$query_sample'
#end if

#if 'AF_file' in $section and $section.AF_file:
  --AF-file '${section.AF_file}'
#end if
  
#if str($plotting.generate_plots) != 'none':
  -p ${plotting.plot_threshold}
#end if

## HMM section
#set $section = $sec_hmm
--aberrant "${section.aberrant_query},${section.aberrant_control}"
#if str($section.aberrant_optimization.do_optimize) == 'yes':
  --optimize ${section.aberrant_optimization.lower_bound}
#end if
--BAF-weight ${section.score_usage.baf_weight}
--BAF-dev "${section.score_usage.baf_dev_query},${section.score_usage.baf_dev_control}"
--LRR-weight ${section.score_usage.lrr_weight}
#if str($section.score_usage.compute_on) == 'baf+lrr':
  --LRR-dev "${section.score_usage.lrr_dev_query},${section.score_usage.lrr_dev_control}"
  --LRR-smooth-win ${section.score_usage.lrr_smooth_win}
#end if
#if $section.same_prob:
  --same-prob ${section.same_prob}
#end if
#if $section.err_prob:
  --err-prob ${section.err_prob}
#end if
#if $section.xy_prob:
  --xy-prob ${section.xy_prob}
#end if

## Filter section
#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

  

## Primary Input/Outputs

$input_vcf
  

&& mv $output_dir/cn.*.tab '$output_cn'
#if $control_sample:
  && mv ${output_dir}/summary.tab '$output_summary'
#else:
  && mv ${output_dir}/summary.*.tab '$output_summary'
#end if

#if str($plotting.generate_plots) != 'none':
  ## collect all generated plots and embed them in html as base-64 encoded data
  && (echo '<html><body><head><title>Copy-number variation plots (bcftools cnv)</title><style type="text/css">
  @media print {
	img {
		max-width:100% !important;
		page-break-inside: avoid;
	}
  </style>' > $output_plots;
  for plot in $output_dir/*.png; do
    [ -f "\$plot" ] || break;
    echo '<div><img src="data:image/png;base64,' >> $output_plots;
    python -m base64 \$plot >> $output_plots;
    echo '" /></div><hr>' >> $output_plots;
  done;
  echo '</body></html>' >> $output_plots;)
#end if


    
None
False
Functional tests
name inputs outputs required files
Test-1 input_file: cnv.vcf
name: value
cnv.vcf
value
Test-2 input_file: cnv.vcf
plotting|generate_plots: none
name: value
cnv.vcf
value
Test-3 input_file: cnv.vcf
query_sample: test
control_sample: test
name: value
cnv.vcf
value
Test-4 input_file: cnv_baf_only.vcf
plotting|generate_plots: none
sec_hmm|score_usage|compute_on: baf
name: value
cnv_baf_only.vcf
value
Test-5 input_file: cnv.vcf
sec_restrict|regions_overlap: 1
name: value
cnv.vcf
value