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.
- Loading branch information
1 parent
d9e7fdf
commit 84c61b4
Showing
9 changed files
with
137 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: samtools_index | ||
namespace: samtools | ||
description: Index BAM files | ||
keywords: [stats, mapping, counts, chromosome, bam, sam, cram] | ||
links: | ||
homepage: https://www.htslib.org/ | ||
documentation: https://www.htslib.org/doc/samtools-index.html | ||
repository: https://github.com/samtools/samtools.git | ||
references: | ||
doi: 10.1093/bioinformatics/btp352, 10.1093/gigascience/giab008 | ||
license: MIT/Expat | ||
|
||
argument_groups: | ||
- name: Inputs | ||
arguments: | ||
- name: --bam | ||
alternatives: -b | ||
type: file | ||
description: BAM input file. | ||
- name: "--bam_csi_index" | ||
type: boolean | ||
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: Outputs | ||
arguments: | ||
- name: --output_bai | ||
alternatives: [ -o, --output ] | ||
type: file | ||
description: BAM index | ||
direction: output | ||
required: true | ||
must_exist: false | ||
example: out.bam.bai | ||
must_exist: false | ||
- name: --output_csi | ||
alternatives: [ -c, --csi ] | ||
type: file | ||
description: CSI index | ||
direction: output | ||
default: out.bam.csi | ||
- name: --min-shift | ||
alternatives: -m | ||
type: integer | ||
description: Create a CSI index, with a minimum interval size of 2^INT. | ||
default: 0 | ||
- name: Options | ||
arguments: | ||
- name: --individual | ||
alternatives: -M | ||
type: integer | ||
description: | | ||
Interpret all filename arguments as alignment files to | ||
be indexed individually. (Without -M, filename arguments | ||
are interpreted solely as per the second synopsis.) | ||
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: | | ||
echo "$(samtools --version 2>&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,9 @@ | ||
``` | ||
samtools index | ||
``` | ||
|
||
Usage: samtools index [-bc] [-m INT] <in.bam> [out.index] | ||
Options: | ||
-b Generate BAI-format index for BAM files [default] | ||
-c Generate CSI-format index for BAM files | ||
-m INT Set minimum interval size for CSI indices to 2^INT [14] |
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 @@ | ||
#!/bin/bash | ||
|
||
## VIASH START | ||
## VIASH END | ||
|
||
set -e | ||
|
||
[[ "$par_output_csi" == "false" ]] && unset par_output_csi | ||
|
||
samtools index \ | ||
"$par_input" \ | ||
${par_output_csi:+-c} \ | ||
-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,27 @@ | ||
#!/bin/bash | ||
|
||
test_dir="${meta_resources_dir}test_data" | ||
echo ">>> Testing $meta_functionality_name" | ||
|
||
echo ">>> Generating BAM index" | ||
"$meta_executable" \ | ||
--input "$test_dir/chr19.bam" \ | ||
--bam_csi_index false \ | ||
--output_bai "$test_dir/chr19.bam.bai" | ||
|
||
echo ">>> Check whether output exists" | ||
[ ! -f chr19.bam.bai ] && echo "File 'mapt.NA12156.altex.bam.bai' does not exist!" && exit 1 | ||
[ ! -s chr19.bam.bai ] && echo "File 'mapt.NA12156.altex.bam.bai' is empty!" && exit 1 | ||
|
||
echo ">>> Generating CSI index" | ||
"$meta_executable" \ | ||
--input "$test_dir/chr19.bam" \ | ||
--bam_csi_index true \ | ||
--output_csi "$test_dir/chr19.bam.csi" | ||
|
||
echo ">>> Check whether output exists" | ||
[ ! -f "chr19.bam.csi" ] && echo "File 'mapt.NA12156.altex.bam.csi' does not exist!" && exit 1 | ||
[ ! -s "chr19.bam.csi" ] && echo "File 'mapt.NA12156.altex.bam.csi' is empty!" && exit 1 | ||
|
||
echo "All tests succeeded!" | ||
exit 0 |
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,14 @@ | ||
#!/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 idxstats a.sorted.bam > a.sorted.idxstats | ||
|
||
# dowload test data from nf-core module | ||
wget https://github.com/nf-core/test-datasets/raw/modules/data/genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam | ||
wget https://github.com/nf-core/test-datasets/raw/modules/data/genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai | ||
# samtools idxstats test.paired_end.sorted.bam > test_ref.paired_end.sorted.idxstats |
Binary file not shown.