Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Next flow initial commit
- Loading branch information
0 parents
commit c080150
Showing
58 changed files
with
4,875 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,5 @@ | ||
.idea/** | ||
.gradle/** | ||
.nextflow.log* | ||
build/** | ||
out/** |
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,110 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright (c) 2012, the authors. | ||
# | ||
# This file is part of 'Nextflow'. | ||
# | ||
# Nextflow is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Nextflow is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Nextflow. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
#set -e | ||
#set -u | ||
#set -o errexit | ||
|
||
# the application 'base' folder | ||
bin_dir=`dirname "$0"` | ||
bin_dir=`cd "$bin_dir"; pwd` | ||
base_dir=`dirname $bin_dir` | ||
|
||
# define the java env | ||
java=java | ||
if test -n "$JAVA_HOME"; then | ||
java="$JAVA_HOME/bin/java" | ||
fi | ||
|
||
# | ||
# Variable definition | ||
# | ||
declare -a args=() | ||
DEBUG='' | ||
MAIN_CLASS='nextflow.script.CliRunner' | ||
JVM_ARGS+=" -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true" | ||
|
||
# | ||
# classpath when the application is compiled with gradle | ||
# | ||
if [ -e "$base_dir/build/classes/main" ]; then | ||
CLASSPATH="$base_dir/build/classes/main" | ||
CLASSPATH+=":$base_dir/build/classes/test" | ||
CLASSPATH+=":$base_dir/build/resources/main" | ||
for file in $base_dir/build/dependency-libs/*.jar; do | ||
CLASSPATH+=":$file"; | ||
done | ||
|
||
# | ||
# deployed application class -- only jar in the libs folder | ||
# | ||
#elif [ -e $base_dir/libs ]; then | ||
# CLASSPATH="$base_dir/conf" | ||
# for file in $base_dir/libs/*.jar; do | ||
# CLASSPATH+=":$file"; | ||
# done | ||
|
||
else | ||
echo "Missing application libraries -- Nextflow cannot start" | ||
exit 1 | ||
fi | ||
|
||
|
||
# | ||
# Handle special program cli options | ||
# | ||
while [ "$*" != "" ]; do | ||
if [[ "$1" == '--debug' || "$1" == '--trace' ]]; then | ||
args+=("$1") | ||
|
||
elif [ "$1" == '--with-jrebel' ]; then | ||
if [ "$JREBEL_HOME" ]; then | ||
JVM_ARGS+=" -javaagent:$JREBEL_HOME/jrebel.jar -Drebel.log.file=./jrebel-client.log" | ||
else | ||
echo "WARN: To use JReber define the JREBEL_HOME variable in environment" | ||
fi | ||
|
||
elif [ "$1" == '--remote-debugger' ]; then | ||
DEBUG='-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8010' | ||
|
||
else | ||
args+=("$1") | ||
fi | ||
# move to the next option | ||
shift | ||
done | ||
|
||
# Show some variable when in DEBUG mode | ||
if [ "$DEBUG" != '' ]; then | ||
echo Launch environment | ||
echo ------------------ | ||
echo base_dir: $base_dir | ||
echo jvmargs: $JVM_ARGS | ||
echo debug: $DEBUG | ||
echo classpath: | ||
echo $CLASSPATH | tr ":" "\n" | sort | ||
echo '' | ||
echo Launching it! | ||
echo ------------------ | ||
fi | ||
|
||
# Launch the APP | ||
exec java $JVM_ARGS $DEBUG -cp "$CLASSPATH" "$MAIN_CLASS" "${args[@]}" |
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,174 @@ | ||
/* | ||
* Copyright (c) 2012, the authors. | ||
* | ||
* This file is part of 'Nextflow'. | ||
* | ||
* Nextflow is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Nextflow is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Nextflow. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
apply plugin: 'groovy' | ||
version = '0.1' | ||
status = 'alpha' | ||
|
||
repositories { | ||
flatDir(dirs: file('lib')) | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
|
||
groovy module ('org.codehaus.groovy:groovy-all:2.1.1') { | ||
transitive = true | ||
} | ||
|
||
compile ( | ||
'org.codehaus.gpars:gpars:1.0.0', | ||
'org.slf4j:slf4j-api:1.7.2', | ||
'org.slf4j:jcl-over-slf4j:1.7.2', | ||
'org.slf4j:jul-to-slf4j:1.7.2', | ||
'org.slf4j:log4j-over-slf4j:1.7.2', | ||
'ch.qos.logback:logback-classic:1.0.9', | ||
'ch.qos.logback:logback-core:1.0.9', | ||
'commons-lang:commons-lang:2.6', | ||
'commons-io:commons-io:2.4', | ||
'com.google.guava:guava:13.0.1', | ||
'com.beust:jcommander:1.30', | ||
'jline:jline:2.9', | ||
'org.fusesource.jansi:jansi:1.9' | ||
) | ||
|
||
testCompile ('org.spockframework:spock-core:0.7-groovy-2.0') | ||
|
||
} | ||
|
||
|
||
|
||
/* | ||
* print out the runtime classpath | ||
*/ | ||
task classpathRuntime(dependsOn: configurations.runtime) << { | ||
|
||
String home = System.properties['user.home'] | ||
def libs = configurations.compile.collect {File file -> file.absolutePath ?.replace(home,'$HOME')} | ||
println libs.join(':') | ||
|
||
} | ||
|
||
/* | ||
* print out the compile classpath | ||
*/ | ||
task classpathCompile(dependsOn: configurations.compile) << { | ||
|
||
String home = System.properties['user.home'] | ||
def libs = configurations.compile.collect {File file -> file.absolutePath ?.replace(home,'$HOME')} | ||
println libs.join(':') | ||
|
||
} | ||
|
||
|
||
/* | ||
* Update the build timestamp in the source source file | ||
*/ | ||
task buildInfo << { | ||
|
||
def file = new File('./src/main/groovy/nextflow/Const.groovy') | ||
def buildNum = 0 | ||
def src = file.text | ||
src.find(/APP_BUILDNUM *= *([0-9]*)/) { buildNum = it[1]?.toInteger()+1 } | ||
src = src.replaceAll('APP_VER *= *"[0-9\\.]+"', "APP_VER = \"${version}\"" as String) | ||
src = src.replaceAll('APP_TIMESTAMP *= *[0-9]*', "APP_TIMESTAMP = ${System.currentTimeMillis()}" as String) | ||
if( buildNum ) { | ||
src = src.replaceAll('APP_BUILDNUM *= *[0-9]*', "APP_BUILDNUM = ${buildNum}" as String) | ||
} | ||
else { | ||
println "WARN: Unable to find current build number" | ||
} | ||
file.text = src | ||
|
||
|
||
} | ||
|
||
/* | ||
* Compile sources and copies all libs to target directory | ||
*/ | ||
task compile(type: Copy) { | ||
dependsOn buildInfo, compileJava, compileGroovy, processResources | ||
|
||
into "$buildDir/dependency-libs" | ||
from configurations.runtime | ||
} | ||
|
||
|
||
/* | ||
* Create the distribution stage folder i.e. creates a folder containing everythinh | ||
* have to be included in the distribution package | ||
*/ | ||
|
||
task stage( type: Copy ) { | ||
dependsOn jar, javadoc, groovydoc | ||
|
||
// clean the target directory before create | ||
def target = file("$buildDir/stage/nextflow-$version") | ||
target.parentFile.deleteDir() | ||
target.mkdirs() | ||
|
||
destinationDir target | ||
|
||
// // copy the bin scripts | ||
// into('bin') { | ||
// from ('./bin') { exclude 'circo' } | ||
// rename { String fileName -> fileName.replace('circo.sh', 'circo') } | ||
// } | ||
|
||
// copy application - and - runtime dependencies jars | ||
into('libs') { | ||
from "$buildDir/libs/nextflow-${version}.jar" | ||
from configurations.runtime | ||
} | ||
|
||
// still some stuff | ||
into('conf') { from './src/main/resources' } | ||
into('src') { from './src/main' } | ||
into('docs') { from '$buildDir/docs/groovydoc/'} | ||
|
||
} | ||
|
||
/* | ||
* Creates the Zip distribution file | ||
*/ | ||
task distZip(type: Zip) { | ||
dependsOn stage | ||
from "$buildDir/stage/" | ||
} | ||
|
||
/* | ||
* creates the Tar distribution file | ||
*/ | ||
task distTar(type: Tar) { | ||
dependsOn stage | ||
compression = Compression.GZIP | ||
from "$buildDir/stage/" | ||
} | ||
|
||
task dist() { | ||
dependsOn distZip, distTar | ||
} | ||
|
||
/* | ||
* Print the distribution file name when distXxx task completes | ||
*/ | ||
gradle.taskGraph.afterTask { Task task, TaskState state -> | ||
if (task == distTar && !state.failure) { println "\n** TAR: ${relativePath(distTar.archivePath)}\n\n"} | ||
if (task == distZip && !state.failure) { println "\n** ZIP: ${relativePath(distZip.archivePath)}\n\n"} | ||
} |
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,46 @@ | ||
def fasta='/Users/ptommaso/sample.fa' | ||
def DB='/Users/ptommaso/tools/blast-db/pdb/pdb' | ||
|
||
def sequences = task('split') { | ||
|
||
input fasta:[fasta] | ||
output 'seq_*' | ||
|
||
""" | ||
gcsplit $fasta '%^>%' '/^>/' '{*}' -f seq_ | ||
""" | ||
} | ||
|
||
|
||
def singleBlast = task('blast') { | ||
|
||
input seq: sequences | ||
output 'blast_result' | ||
|
||
""" | ||
blastp -db $DB -query $seq -outfmt 6 > blast_result | ||
""" | ||
|
||
} | ||
|
||
|
||
def allBlast = merge { | ||
|
||
input blast:singleBlast | ||
output 'allBlast' | ||
|
||
""" | ||
cat $blast >> allBlast | ||
""" | ||
|
||
} | ||
|
||
def result = task('sort') { | ||
input result:allBlast | ||
""" | ||
sort $result | ||
""" | ||
} | ||
|
||
|
||
println read(result) |
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,7 @@ | ||
env [ 'HELLO' ] = '1' | ||
|
||
task { | ||
echo true | ||
"env | sort" | ||
} | ||
|
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,5 @@ | ||
task { | ||
""" | ||
echo 'Hello world' | ||
""" | ||
} |
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,6 @@ | ||
x = 1 | ||
def y = 2 | ||
|
||
println "x: $x" | ||
println "y: $y" | ||
println "z: $z" |
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,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/groovy" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/groovy" isTestSource="true" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" exported="" name="jsr166y-1.7.0" level="project" /> | ||
<orderEntry type="library" exported="" name="gpars-1.0.0" level="project" /> | ||
<orderEntry type="library" exported="" name="logback-classic-1.0.9" level="project" /> | ||
<orderEntry type="library" exported="" name="commons-lang-2.6" level="project" /> | ||
<orderEntry type="library" exported="" name="jline-2.9" level="project" /> | ||
<orderEntry type="library" exported="" name="jul-to-slf4j-1.7.2" level="project" /> | ||
<orderEntry type="library" exported="" name="groovy-all-2.1.1" level="project" /> | ||
<orderEntry type="library" exported="" name="jansi-1.9" level="project" /> | ||
<orderEntry type="library" exported="" name="jcl-over-slf4j-1.7.2" level="project" /> | ||
<orderEntry type="library" exported="" name="slf4j-api-1.7.2" level="project" /> | ||
<orderEntry type="library" scope="TEST" name="junit-dep-4.10" level="project" /> | ||
<orderEntry type="library" exported="" name="log4j-over-slf4j-1.7.2" level="project" /> | ||
<orderEntry type="library" exported="" name="guava-13.0.1" level="project" /> | ||
<orderEntry type="library" scope="TEST" name="hamcrest-core-1.3" level="project" /> | ||
<orderEntry type="library" exported="" name="logback-core-1.0.9" level="project" /> | ||
<orderEntry type="library" scope="TEST" name="spock-core-0.7-groovy-2.0" level="project" /> | ||
<orderEntry type="library" exported="" name="jcommander-1.30" level="project" /> | ||
<orderEntry type="library" exported="" name="commons-io-2.4" level="project" /> | ||
</component> | ||
</module> | ||
|
Oops, something went wrong.