-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new versions for biopet-bamstats (#11571)
- Loading branch information
1 parent
9446d05
commit 75a0596
Showing
6 changed files
with
193 additions
and
5 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,107 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Wrapper script for starting the biopet-bamstats JAR package | ||
# | ||
# This script is written for use with the Conda package manager and is copied | ||
# from the peptide-shaker wrapper. Only the parameters are changed. | ||
# (https://github.com/bioconda/bioconda-recipes/blob/master/recipes/peptide-shaker/peptide-shaker.py) | ||
# | ||
# This file was automatically generated by the sbt-bioconda plugin. | ||
|
||
import os | ||
import subprocess | ||
import sys | ||
import shutil | ||
|
||
from os import access | ||
from os import getenv | ||
from os import X_OK | ||
|
||
jar_file = 'BamStats-assembly-1.0.1.jar' | ||
|
||
default_jvm_mem_opts = [] | ||
|
||
# !!! End of parameter section. No user-serviceable code below this line !!! | ||
|
||
|
||
def real_dirname(path): | ||
"""Return the symlink-resolved, canonicalized directory-portion of path.""" | ||
return os.path.dirname(os.path.realpath(path)) | ||
|
||
|
||
def java_executable(): | ||
"""Return the executable name of the Java interpreter.""" | ||
java_home = getenv('JAVA_HOME') | ||
java_bin = os.path.join('bin', 'java') | ||
|
||
if java_home and access(os.path.join(java_home, java_bin), X_OK): | ||
return os.path.join(java_home, java_bin) | ||
else: | ||
return 'java' | ||
|
||
|
||
def jvm_opts(argv): | ||
"""Construct list of Java arguments based on our argument list. | ||
The argument list passed in argv must not include the script name. | ||
The return value is a 3-tuple lists of strings of the form: | ||
(memory_options, prop_options, passthrough_options) | ||
""" | ||
mem_opts = [] | ||
prop_opts = [] | ||
pass_args = [] | ||
exec_dir = None | ||
|
||
for arg in argv: | ||
if arg.startswith('-D'): | ||
prop_opts.append(arg) | ||
elif arg.startswith('-XX'): | ||
prop_opts.append(arg) | ||
elif arg.startswith('-Xm'): | ||
mem_opts.append(arg) | ||
elif arg.startswith('--exec_dir='): | ||
exec_dir = arg.split('=')[1].strip('"').strip("'") | ||
if not os.path.exists(exec_dir): | ||
shutil.copytree(real_dirname(sys.argv[0]), exec_dir, symlinks=False, ignore=None) | ||
else: | ||
pass_args.append(arg) | ||
|
||
# In the original shell script the test coded below read: | ||
# if [ "$jvm_mem_opts" == "" ] && [ -z ${_JAVA_OPTIONS+x} ] | ||
# To reproduce the behaviour of the above shell code fragment | ||
# it is important to explictly check for equality with None | ||
# in the second condition, so a null envar value counts as True! | ||
|
||
if mem_opts == [] and getenv('_JAVA_OPTIONS') is None: | ||
mem_opts = default_jvm_mem_opts | ||
|
||
return (mem_opts, prop_opts, pass_args, exec_dir) | ||
|
||
|
||
def main(): | ||
""" | ||
PeptideShaker updates files relative to the path of the jar file. | ||
In a multiuser setting, the option --exec_dir="exec_dir" | ||
can be used as the location for the peptide-shaker distribution. | ||
If the exec_dir dies not exist, | ||
we copy the jar file, lib, and resources to the exec_dir directory. | ||
""" | ||
java = java_executable() | ||
(mem_opts, prop_opts, pass_args, exec_dir) = jvm_opts(sys.argv[1:]) | ||
jar_dir = exec_dir if exec_dir else real_dirname(sys.argv[0]) | ||
|
||
if pass_args != [] and pass_args[0].startswith('eu'): | ||
jar_arg = '-cp' | ||
else: | ||
jar_arg = '-jar' | ||
|
||
jar_path = os.path.join(jar_dir, jar_file) | ||
|
||
java_args = [java] + mem_opts + prop_opts + [jar_arg] + [jar_path] + pass_args | ||
|
||
sys.exit(subprocess.call(java_args)) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() | ||
|
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 @@ | ||
#!/usr/bin/env bash | ||
# Build file is copied from VarScan | ||
# https://github.com/bioconda/bioconda-recipes/blob/master/recipes/varscan/build.sh | ||
# This file was automatically generated by the sbt-bioconda plugin. | ||
|
||
outdir=$PREFIX/share/$PKG_NAME | ||
mkdir -p $outdir | ||
mkdir -p $PREFIX/bin | ||
cp BamStats-assembly-1.0.1.jar $outdir/BamStats-assembly-1.0.1.jar | ||
cp $RECIPE_DIR/biopet-bamstats.py $outdir/biopet-bamstats | ||
ln -s $outdir/biopet-bamstats $PREFIX/bin | ||
|
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,69 @@ | ||
# !! THIS FILE WAS AUTOMATICALLY GENERATED BY THE SBT-BIOCONDA PLUGIN !! | ||
# !! DO NOT EDIT MANUALLY !! | ||
|
||
package: | ||
name: biopet-bamstats | ||
version: 1.0.1 | ||
source: | ||
url: https://github.com/biopet/bamstats/releases/download/v1.0.1/BamStats-assembly-1.0.1.jar | ||
sha256: ab1beffd8a5a51e2937cb5efa190d6e57fb8e63d6b19a92e8e83d7db2a9b839e | ||
build: | ||
noarch: generic | ||
number: 0 | ||
requirements: | ||
run: | ||
- openjdk >=8,<9 | ||
- python | ||
about: | ||
home: https://github.com/biopet/bamstats | ||
license: MIT | ||
summary: BamStats is a package that contains tools to generate stats from a BAM file, merge those stats for multiple samples, and validate the generated stats files. | ||
description: | | ||
BamStats is a package that contains tools | ||
to generate stats from a BAM file, | ||
merge those stats for multiple samples, | ||
and validate the generated stats files. | ||
#### Mode - Generate | ||
Generate reports clipping stats, flag stats, insert size and mapping quality on a BAM file. It outputs | ||
a JSON file, but can optionally also output in TSV format. | ||
The output of the JSON file is organized in a sample - library - readgroup tree structure. | ||
If readgroups in the BAM file are not annotated with sample (`SM`) and library (`LB`) tags | ||
an error will be thrown. | ||
This can be fixed by using `samtools addreplacerg` or `picard AddOrReplaceReadGroups`. | ||
#### Mode - Merge | ||
This module will merge bamstats files together and keep the sample/library/readgroup structure. | ||
Values for the same readgroups will be added. | ||
It will also validate the resulting file. | ||
#### Mode - Validate | ||
Validates a BamStats file. | ||
If aggregation values can not be regenerated the file is considered corrupt. | ||
This should only happen when the file has been manually edited. | ||
For documentation and manuals visit our github.io page: https://biopet.github.io/bamstats | ||
test: | ||
commands: | ||
- biopet-bamstats merge --help | ||
- biopet-bamstats merge --version | ||
- biopet-bamstats validate --help | ||
- biopet-bamstats validate --version | ||
- biopet-bamstats generate --help | ||
- biopet-bamstats generate --version | ||
extra: | ||
notes: | | ||
biopet-bamstats is a Java program that comes with a custom wrapper shell script. | ||
By default 'no default java option' is set in the wrapper. | ||
The command that runs the program is 'biopet-bamstats'. | ||
If you want to overwrite it you can specify memory options directly after your binaries. | ||
If you have _JAVA_OPTIONS set globally this will take precedence. | ||
For example run it with 'biopet-bamstats -Xms512m -Xmx1g'. | ||
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