Mercurial > repos > marc-wilkins > samifier
changeset 2:66ad014e6975 draft default tip
Uploaded
author | marc-wilkins |
---|---|
date | Tue, 06 Aug 2013 20:43:24 -0400 |
parents | afa0439120d8 |
children | |
files | samifier/datatypes_conf.xml samifier/protein_generator.jar samifier/protein_generator.sh samifier/protein_generator.xml samifier/protein_merger.sh samifier/protein_merger.xml samifier/result_analyser.sh samifier/result_analyser.xml samifier/results_analyser.jar samifier/samifier.jar samifier/samifier.sh samifier/samifier.xml samifier/tar.py samifier/virtual_protein_merger.jar |
diffstat | 14 files changed, 327 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samifier/datatypes_conf.xml Tue Aug 06 20:43:24 2013 -0400 @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<datatypes> + <datatype_files> + <datatype_file name="tar.py"/> + </datatype_files> + <registration> + <datatype extension="tar" type="galaxy.datatypes.tar:Tar" display_in_upload="true"/> + </registration> + <sniffers> + <sniffer type="galaxy.datatypes.tar:Tar"/> + </sniffers> +</datatypes> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samifier/protein_generator.sh Tue Aug 06 20:43:24 2013 -0400 @@ -0,0 +1,25 @@ +#!/bin/bash + +if (type -p java >> /dev/null); then + _java=java +elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then + _java="$JAVA_HOME/bin/java" +else + echo "You must install java before runing this tool" >&2 + exit 1 +fi + +if [[ "$_java" ]]; then + version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}') + if ! [[ "$version" > "1.6" ]]; then + echo "Java version should be > 1.6" >&2 + exit 1 + fi +fi + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +jar_path="${DIR}/${1}" +shift + +java -Xmx3072M -jar $jar_path $@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samifier/protein_generator.xml Tue Aug 06 20:43:24 2013 -0400 @@ -0,0 +1,56 @@ +<tool id="protgenerator" name="Protein Generator" version="1.0.9"> + <description>Protein Generator</description> + <command interpreter="bash"> + protein_generator.sh protein_generator.jar + -d "$databasename" + -f "$genomeFile" + #if $GlimmerFile + -g "$GlimmerFile" + #end if + #if $SplitInterval + -i "$SplitInterval" + #end if + -o "$output1" + #if $condition1.gffFile == "yes" + -p "$output2" + #end if + #if $condition2.accessionFile == "yes" + -q "$output3" + #end if + #if $trans_tab_file + -t "$trans_tab_file" + #end if + </command> + <inputs> + <param name="databasename" type="text" label="Database name" /> + <param name="genomeFile" type="data" format="faa" label="Select genome file" help="Genome file in gff format" /> + + <param name="GlimmerFile" type="data" format="txt" label="Select Glimmer File" help="Glimmer txt file. Can't be used with the Split Interval" optional="true" /> + <param name="SplitInterval" type="integer" label="Size of the intervals" help="Size of the intervals (number of codons) into which the genome will be split. Can't be used with the Glimmer File" optional="true" /> + + <param name="trans_tab_file" type="data" format="txt" label="Select Translation Table File" help="File containing a mapping of codons to amino acids, in the format used by NCBI." optional="true" /> + <conditional name="condition1"> + <param name="gffFile" type="select" help="write the GFF file"> + <option value="yes" selected="True">Yes</option> + <option value="no" selected="False">No</option> + </param> + </conditional> + <conditional name="condition2"> + <param name="accessionFile" type="select" label="Accession File" help="Write the accession file"> + <option value="yes" selected="True">Yes</option> + <option value="no" selected="False">No</option> + </param> + </conditional> + </inputs> + <outputs> + <data format="sam" name="output1" /> + <data format="gff" name="output2" label="GFF file"> + <filter>condition1['gffFile'] == "yes"</filter> + </data> + <data format="txt" name="output3" label="Accession File"> + <filter>condition2['accessionFile'] == "yes"</filter> + </data> + </outputs> + <help> + </help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samifier/protein_merger.sh Tue Aug 06 20:43:24 2013 -0400 @@ -0,0 +1,34 @@ +#!/bin/bash + +# Check java version +if (type -p java >> /dev/null); then + _java=java +elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then + _java="$JAVA_HOME/bin/java" +else + echo "You must install java before runing this tool" + exit 1 +fi +if [[ "$_java" ]]; then + version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}') + if ! [[ "$version" > "1.6" ]]; then + echo "Java version should be > 1.6" + exit 1 + fi +fi + +# Locate the jar directory +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +jar_path="${DIR}/${1}" +shift + +# Untar the chromosome file into a temporary directory +tar_file="$1" +shift +tmp_dir="/tmp/$(basename "$tar_file")" +mkdir -p $tmp_dir +tar -C $tmp_dir -xvf $tar_file + +# Run the jar and remove the temporary directory +java -Xmx3072M -jar $jar_path $@ -c "$tmp_dir" +rm -rf $tmp_dir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samifier/protein_merger.xml Tue Aug 06 20:43:24 2013 -0400 @@ -0,0 +1,25 @@ +<tool id="protmerger" name="Protein Merger" version="1.0.9"> + <description>Virtual Protein Merger</description> + <command interpreter="bash"> + protein_merger.sh virtual_protein_merger.jar $chromosome_tar -g "$genomeFile" -o "$output1" + -r "$searchResultsFile" + #if $trans_tab_file + -t "$trans_tab_file" + #end if + #if $confidence_score + -s "$confidence_score" + #end if + </command> + <inputs> + <param name="chromosome_tar" type="data" format="tar" label="Select chromosome tar file" help="A Tar file containing all the chromosome files" /> + <param name="genomeFile" type="data" format="gff" label="Select genome file" help="Genome file in gff format" /> + <param name="searchResultsFile" type="data" format="txt" label="Select Mascot search result" help="Mascot search results file in txt format" /> + <param name="trans_tab_file" type="data" format="txt" label="Select Translation Table File" help="File containing a mapping of codons to amino acids, in the format used by NCBI." optional="True"/> + <param name="confidence_score" type="integer" label="Confidence score thresold" help="Minimum confidence score for peptides to be included" optional="True" /> + </inputs> + <outputs> + <data format="sam" name="output1" /> + </outputs> + <help> + </help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samifier/result_analyser.sh Tue Aug 06 20:43:24 2013 -0400 @@ -0,0 +1,34 @@ +#!/bin/bash + +# Check java version +if (type -p java >> /dev/null); then + _java=java +elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then + _java="$JAVA_HOME/bin/java" +else + echo "You must install java before runing this tool" + exit 1 +fi +if [[ "$_java" ]]; then + version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}') + if ! [[ "$version" > "1.6" ]]; then + echo "Java version should be > 1.6" + exit 1 + fi +fi + +# Locate the jar directory +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +jar_path="${DIR}/${1}" +shift + +# Untar the chromosome file into a temporary directory +tar_file="$1" +shift +tmp_dir="/tmp/$(basename "$tar_file")" +mkdir -p $tmp_dir +tar -C $tmp_dir -xvf $tar_file + +# Run the jar and remove the temporary directory +java -Xmx3072M -jar $jar_path $@ -c "$tmp_dir" +rm -rf $tmp_dir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samifier/result_analyser.xml Tue Aug 06 20:43:24 2013 -0400 @@ -0,0 +1,31 @@ +<tool id="resanalyser" name="Result Analyser" version="1.0.9"> + <description>Result Analyser</description> + <command interpreter="bash"> + result_analyser.sh results_analyser.jar $chromosome_tar -g "$genomeFile" -m "$mapping" -o "$output1" -r "$searchResultsFile" + #if $reportId + -rep "$reportId" + #end if + #if $reportList + -replist "$reportList" + #end if + #if $sqlQuery + -sql "$sqlQuery" + #end if + </command> + <inputs> + <param name="chromosome_tar" type="data" format="tar" label="Select chromosome tar file" help="A Tar file containing all the chromosome files" /> + <param name="genomeFile" type="data" format="gff" label="Select genome file" help="Genome file in gff format" /> + <param name="searchResultsFile" type="data" format="txt" label="Select Mascot search result" help="Mascot search results file in txt format" /> + <param name="mapping" type="data" format="txt" label="Select file mapping" help="File mapping protein identifier to ordered locus name" /> + + <param name="reportId" optional="true" type="data" format="txt" label="Select reportId" help="Access a built in report query" /> + <param name="reportList" optional="true" type="data" format="txt" label="Select reportList" help="A file containing all the pre-built SQL queries" /> + <param name="sqlQuery" optional="true" type="data" format="txt" label="Select SQL Query" help="Filters the result through the use of a SQL statement to the output file" /> + + </inputs> + <outputs> + <data format="sam" name="output1" /> + </outputs> + <help> + </help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samifier/samifier.sh Tue Aug 06 20:43:24 2013 -0400 @@ -0,0 +1,34 @@ +#!/bin/bash + +# Check java version +if (type -p java >> /dev/null); then + _java=java +elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then + _java="$JAVA_HOME/bin/java" +else + echo "You must install java before runing this tool" + exit 1 +fi +if [[ "$_java" ]]; then + version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}') + if ! [[ "$version" > "1.6" ]]; then + echo "Java version should be > 1.6" + exit 1 + fi +fi + +# Locate the jar directory +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +jar_path="${DIR}/${1}" +shift + +# Untar the chromosome file into a temporary directory +tar_file="$1" +shift +tmp_dir="/tmp/$(basename "$tar_file")" +mkdir -p $tmp_dir +tar -C $tmp_dir -xvf $tar_file + +# Run the jar and remove the temporary directory +java -Xmx3072M -jar $jar_path $@ -c "$tmp_dir" +rm -rf $tmp_dir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samifier/samifier.xml Tue Aug 06 20:43:24 2013 -0400 @@ -0,0 +1,46 @@ +<tool id="samifier" name="Samifier" version="1.0.9"> + <description>Samifier</description> + <command interpreter="bash"> + samifier.sh samifier.jar $chromosome_tar -g "$genome" -m "$mapping" -o "$output1" -r "$mascot" + #if $score_thresold + -s "$score_thresold" + #end if + #if $condition2.tool_option2 == "yes" + -l "$output2" + #end if + #if $condition3.tool_option3 == "yes" + -b "$output3" + #end if + </command> + <inputs> + <param name="chromosome_tar" type="data" format="tar" label="Select chromosome zip files" help="A zip file containing all the chromosome files" /> + <param name="genome" type="data" format="gff" label="Select genome file" help="Genome file in gff format" /> + <param name="mascot" type="data" format="txt" label="Select Mascot search result" help="Mascot search results file in txt format" /> + <param name="mapping" type="data" format="txt" label="Select file mapping" help="File mapping protein identifier to ordered locus name" /> + <param name="score_thresold" type="integer" label="Confidence Score thresold" help="Minimum confidence score for peptides to" optional="true"/> + + <conditional name="condition2"> + <param name="tool_option2" type="select" label="Write log file" help="Create an output containing the logs"> + <option value="yes" selected="No">Yes</option> + <option value="no" selected="Yes">No</option> + </param> + </conditional> + <conditional name="condition3"> + <param name="tool_option3" type="select" label="Write output in bed format" help="Output to write IGV regions of interest"> + <option value="yes" selected="No">Yes</option> + <option value="no" selected="Yes">No</option> + </param> + </conditional> + </inputs> + <outputs> + <data format="sam" name="output1" /> + <data format="txt" name="output2" label="Samifier log file"> + <filter>condition2['tool_option2'] == "yes"</filter> + </data> + <data format="bed" name="output3" label="Samifier Bed"> + <filter>condition3['tool_option3'] == "yes"</filter> + </data> + </outputs> + <help> + </help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samifier/tar.py Tue Aug 06 20:43:24 2013 -0400 @@ -0,0 +1,30 @@ +from galaxy.datatypes import data +from galaxy.datatypes.metadata import MetadataElement +from galaxy.datatypes.binary import Binary +from galaxy.datatypes import metadata +from galaxy.datatypes.sniff import * +import tarfile + +class Tar( Binary ): + """Class describing a BAM binary file""" + file_ext = "tar" + def sniff( self, filename ): + try: + if tarfile.is_tarfile(filename): + return True + except: + return False + + def set_peek( self, dataset, is_multi_byte=False ): + if not dataset.dataset.purged: + dataset.peek = "Tar file" + dataset.blurb = data.nice_size( dataset.get_size() ) + else: + dataset.peek = 'file does not exist' + dataset.blurb = 'file purged from disk' + + def display_peek( self, dataset ): + try: + return dataset.peek + except: + return "Tar file" \ No newline at end of file