forked from viash-hub/biobox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into samtools_sort
- Loading branch information
Showing
12 changed files
with
204 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: samtools_index | ||
namespace: samtools | ||
description: Index SAM/BAM/CRAM files. | ||
keywords: [index, bam, sam, cram] | ||
links: | ||
homepage: https://www.htslib.org/ | ||
documentation: https://www.htslib.org/doc/samtools-index.html | ||
repository: https://github.com/samtools/samtools | ||
references: | ||
doi: [10.1093/bioinformatics/btp352, 10.1093/gigascience/giab008] | ||
license: MIT/Expat | ||
|
||
argument_groups: | ||
- name: Inputs | ||
arguments: | ||
- name: --input | ||
type: file | ||
description: Input file name | ||
required: true | ||
must_exist: true | ||
- name: Outputs | ||
arguments: | ||
- name: --output | ||
alternatives: -o | ||
type: file | ||
description: Output file name | ||
required: true | ||
direction: output | ||
example: out.bam.bai | ||
- name: Options | ||
arguments: | ||
- name: --bai | ||
alternatives: -b | ||
type: boolean_true | ||
description: Generate BAM index | ||
- name: --csi | ||
alternatives: -c | ||
type: boolean_true | ||
description: | | ||
Create a CSI index for BAM files instead of the traditional BAI | ||
index. This will be required for genomes with larger chromosome | ||
sizes. | ||
- name: --min_shift | ||
alternatives: -m | ||
type: integer | ||
description: | | ||
Create a CSI index, with a minimum interval size of 2^INT. | ||
resources: | ||
- type: bash_script | ||
path: script.sh | ||
test_resources: | ||
- type: bash_script | ||
path: test.sh | ||
- type: file | ||
path: test_data | ||
engines: | ||
- type: docker | ||
image: quay.io/biocontainers/samtools:1.19.2--h50ea8bc_1 | ||
setup: | ||
- type: docker | ||
run: | | ||
samtools --version 2>&1 | grep -E '^(samtools|Using htslib)' | \ | ||
sed 's#Using ##;s# \([0-9\.]*\)$#: \1#' > /var/software_versions.txt | ||
runners: | ||
- type: executable | ||
- type: nextflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
``` | ||
samtools index | ||
``` | ||
|
||
Usage: samtools index -M [-bc] [-m INT] <in1.bam> <in2.bam>... | ||
or: samtools index [-bc] [-m INT] <in.bam> [out.index] | ||
Options: | ||
-b, --bai Generate BAI-format index for BAM files [default] | ||
-c, --csi Generate CSI-format index for BAM files | ||
-m, --min-shift INT Set minimum interval size for CSI indices to 2^INT [14] | ||
-M Interpret all filename arguments as files to be indexed | ||
-o, --output FILE Write index to FILE [alternative to <out.index> in args] | ||
-@, --threads INT Sets the number of threads [none] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
## VIASH START | ||
## VIASH END | ||
|
||
set -e | ||
[[ "$par_multiple" == "false" ]] && unset par_multiple | ||
[[ "$par_bai" == "false" ]] && unset par_bai | ||
[[ "$par_csi" == "false" ]] && unset par_csi | ||
[[ "$par_multiple" == "false" ]] && unset par_multiple | ||
|
||
samtools index \ | ||
"$par_input" \ | ||
${par_csi:+-c} \ | ||
${par_bai:+-b} \ | ||
${par_min_shift:+-m "par_min_shift"} \ | ||
${par_multiple:+-M} \ | ||
-o "$par_output" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/bin/bash | ||
|
||
test_dir="${meta_resources_dir}/test_data" | ||
|
||
echo ">>> Testing $meta_functionality_name" | ||
|
||
echo ">>> Generating BAM index" | ||
"$meta_executable" \ | ||
--input "$test_dir/a.sorted.bam" \ | ||
--bai \ | ||
--output "$test_dir/a.sorted.bam.bai" | ||
|
||
echo ">>> Check whether output exists" | ||
[ ! -f "$test_dir/a.sorted.bam.bai" ] && echo "File 'a.sorted.bam.bai' does not exist!" && exit 1 | ||
|
||
echo ">>> Check whether output is empty" | ||
[ ! -s "$test_dir/a.sorted.bam.bai" ] && echo "File 'a.sorted.bam.bai' is empty!" && exit 1 | ||
|
||
echo ">>> Check whether output is correct" | ||
diff "$test_dir/a.sorted.bam.bai" "$test_dir/a_ref.sorted.bam.bai" || \ | ||
(echo "File 'a.sorted.bam.bai' does not match expected output." && exit 1) | ||
|
||
rm "$test_dir/a.sorted.bam.bai" | ||
|
||
################################################################################################# | ||
|
||
echo ">>> Generating CSI index" | ||
"$meta_executable" \ | ||
--input "$test_dir/a.sorted.bam" \ | ||
--csi \ | ||
--output "$test_dir/a.sorted.bam.csi" | ||
|
||
echo ">>> Check whether output exists" | ||
[ ! -f "$test_dir/a.sorted.bam.csi" ] && echo "File 'a.sorted.bam.csi' does not exist!" && exit 1 | ||
|
||
echo ">>> Check whether output is empty" | ||
[ ! -s "$test_dir/a.sorted.bam.csi" ] && echo "File 'a.sorted.bam.csi' is empty!" && exit 1 | ||
|
||
echo ">>> Check whether output is correct" | ||
diff "$test_dir/a.sorted.bam.csi" "$test_dir/a_ref.sorted.bam.csi" || \ | ||
(echo "File 'a.sorted.bam.csi' does not match expected output." && exit 1) | ||
|
||
rm "$test_dir/a.sorted.bam.csi" | ||
|
||
################################################################################################# | ||
|
||
echo ">>> Generating bam index with -M option" | ||
"$meta_executable" \ | ||
--input "$test_dir/a.sorted.bam" \ | ||
--bai \ | ||
--output "$test_dir/a_multiple.sorted.bam.bai" \ | ||
--multiple | ||
|
||
echo ">>> Check whether output exists" | ||
[ ! -f "$test_dir/a_multiple.sorted.bam.bai" ] && echo "File 'a_multiple.sorted.bam.bai' does not exist!" && exit 1 | ||
|
||
echo ">>> Check whether output is empty" | ||
[ ! -s "$test_dir/a_multiple.sorted.bam.bai" ] && echo "File 'a_multiple.sorted.bam.bai' is empty!" && exit 1 | ||
|
||
echo ">>> Check whether output is correct" | ||
diff "$test_dir/a_multiple.sorted.bam.bai" "$test_dir/a_multiple_ref.sorted.bam.bai" || \ | ||
(echo "File 'a_multiple.sorted.bam.bai' does not match expected output." && exit 1) | ||
|
||
|
||
################################################################################################# | ||
|
||
echo ">>> Generating BAM index with -m option" | ||
|
||
"$meta_executable" \ | ||
--input "$test_dir/a.sorted.bam" \ | ||
--min_shift 4 \ | ||
--bai \ | ||
--output "$test_dir/a_4.sorted.bam.bai" | ||
|
||
echo ">>> Check whether output exists" | ||
[ ! -f "$test_dir/a_4.sorted.bam.bai" ] && echo "File 'a_4.sorted.bam.bai' does not exist!" && exit 1 | ||
|
||
echo ">>> Check whether output is empty" | ||
[ ! -s "$test_dir/a_4.sorted.bam.bai" ] && echo "File 'a_4.sorted.bam.bai' is empty!" && exit 1 | ||
|
||
echo ">>> Check whether output is correct" | ||
diff "$test_dir/a_4.sorted.bam.bai" "$test_dir/a_4_ref.sorted.bam.bai" || \ | ||
(echo "File 'a_4.sorted.bam.bai' does not match expected output." && exit 1) | ||
|
||
rm "$test_dir/a_4.sorted.bam.bai" | ||
|
||
################################################################################################# | ||
|
||
|
||
echo "All tests succeeded!" | ||
exit 0 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# dowload test data from snakemake wrapper | ||
if [ ! -d /tmp/idxstats_source ]; then | ||
git clone --depth 1 --single-branch --branch master https://github.com/snakemake/snakemake-wrappers.git /tmp/idxstats_source | ||
fi | ||
|
||
cp -r /tmp/idxstats_source/bio/samtools/idxstats/test/mapped/* src/samtools/idxstats/test_data | ||
# samtools index a_ref.sorted.bam -o a_ref.sorted.bam.bai | ||
# samtools index a_ref.sorted.bam -c a_ref.sorted.bam.csi | ||
|
||
|