Miscellaneous |
Version lineage of this tool (guids ordered most recent to oldest) |
toolshed.g2.bx.psu.edu/repos/iuc/samtools_bam_to_cram/samtools_bam_to_cram/1.15.1+galaxy2 (this tool) |
toolshed.g2.bx.psu.edu/repos/iuc/samtools_bam_to_cram/samtools_bam_to_cram/1.15.1+galaxy0 |
toolshed.g2.bx.psu.edu/repos/iuc/samtools_bam_to_cram/samtools_bam_to_cram/1.13 |
toolshed.g2.bx.psu.edu/repos/iuc/samtools_bam_to_cram/samtools_bam_to_cram/1.9 |
toolshed.g2.bx.psu.edu/repos/iuc/samtools_bam_to_cram/samtools_bam_to_cram/1.3.1 |
samtools_bam_to_cram |
Requirements (dependencies defined in the <requirements> tag set) |
name | version | type |
samtools | 1.15.1 | package |
Additional information about this tool |
##compute the number of ADDITIONAL threads to be used by samtools (-@) addthreads=\${GALAXY_SLOTS:-1} && (( addthreads-- )) && ## Make the user-selected reference genome, if any, accessible through ## a shell variable $reffa, index the reference if necessary, and make ## the fai-index file available through a shell variable $reffai. ## For a cached genome simply sets the shell variables to point to the ## genome file and its precalculated index. ## For a genome from the user's history, if that genome is a plain ## fasta file, the code creates a symlink in the pwd, creates the fai ## index file next to it, then sets the shell variables to point to the ## symlink and its index. ## For a fasta.gz dataset from the user's history, it tries the same, ## but this will only succeed if the file got compressed with bgzip. ## For a regular gzipped file samtools faidx will fail, in which case ## the code falls back to decompressing to plain fasta before ## reattempting the indexing. ## Indexing of a bgzipped file produces a regular fai index file *and* ## a compressed gzi file. The former is identical to the fai index of ## the uncompressed fasta. ## If the user has not selected a reference (it's an optional parameter ## in some samtools wrappers), a cheetah boolean use_ref is set to ## False to encode that fact. #set use_ref=True #if $addref_cond.addref_select == "history": #if $addref_cond.ref.is_of_type('fasta'): reffa="reference.fa" && ln -s '${addref_cond.ref}' \$reffa && samtools faidx \$reffa && #else: reffa="reference.fa.gz" && ln -s '${addref_cond.ref}' \$reffa && { samtools faidx \$reffa || { echo "Failed to index compressed reference. Trying decompressed ..." 1>&2 && gzip -dc \$reffa > reference.fa && reffa="reference.fa" && samtools faidx \$reffa; } } && #end if reffai=\$reffa.fai && #elif $addref_cond.addref_select == "cached": ## in case of cached the absolute path is used which allows to read ## a cram file without specifying the reference reffa='${addref_cond.ref.fields.path}' && reffai=\$reffa.fai && #else #set use_ref=False #end if ##prepare input and indices ln -s '$input' infile && #if $input.is_of_type('bam'): #if str( $input.metadata.bam_index ) != "None": ln -s '${input.metadata.bam_index}' infile.bai && #else: samtools index infile infile.bai && #end if #elif $input.is_of_type('cram'): #if str( $input.metadata.cram_index ) != "None": ln -s '${input.metadata.cram_index}' infile.crai && #else: samtools index infile infile.crai && #end if #end if samtools view #if $parameter_regions.target_region == "regions_bed_file" -L '${parameter_regions.regions_bed_file}' #end if -@ \$addthreads -C -h -o '${output_alignment}' -T "\$reffa" -t "\$reffai" --output-fmt-option no_ref infile #if $parameter_regions.target_region == "region" '${parameter_regions.region_string}' #end if
Functional tests |
name | inputs | outputs | required files |
Test-1 |
input: test.bam addref_cond|ref: test.fa addref_cond|addref_select: history parameter_regions|target_region: entire_input_file |
name: value |
test.bam test.fa value |
Test-2 |
input: test.sam addref_cond|ref: test.fa addref_cond|addref_select: history parameter_regions|target_region: entire_input_file |
name: value |
test.sam test.fa value |
Test-3 |
input: test.bam addref_cond|ref: test.fa addref_cond|addref_select: history parameter_regions|region_string: CHROMOSOME_I parameter_regions|target_region: region |
name: value |
test.bam test.fa value |
Test-4 |
input: test.bam addref_cond|ref: test.fa addref_cond|addref_select: history parameter_regions|regions_bed_file: test.bed parameter_regions|target_region: regions_bed_file |
name: value |
test.bam test.fa test.bed value |
Test-5 |
input: sam_to_bam_out2.bam addref_cond|ref: equCab2chrM addref_cond|addref_select: cached parameter_regions|target_region: entire_input_file |
name: value |
sam_to_bam_out2.bam value |