-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #248 from plantinformatics/develop
Master Release v2.8.0
- Loading branch information
Showing
52 changed files
with
2,673 additions
and
486 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
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,33 @@ | ||
let flatCache = require('flat-cache'); | ||
|
||
|
||
/* global require */ | ||
|
||
/* global exports */ | ||
|
||
/*----------------------------------------------------------------------------*/ | ||
|
||
|
||
let cache = flatCache.load('resultsCache'); | ||
|
||
/*----------------------------------------------------------------------------*/ | ||
|
||
|
||
/** Expose the same API as memory-cache, to enable an easy substitution. | ||
*/ | ||
|
||
exports.get = (key) => { | ||
let cacheContent = cache.getKey(key); | ||
return cacheContent; | ||
}; | ||
|
||
exports.put = (key, body) => { | ||
cache.setKey(key, body); | ||
/** https://github.com/royriojas/flat-cache#readme : "Non visited | ||
* keys are removed when cache.save() is called" if noPrune is not | ||
* true | ||
*/ | ||
cache.save(/*noPrune*/ true); | ||
}; | ||
|
||
/*----------------------------------------------------------------------------*/ |
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,54 @@ | ||
/* global require */ | ||
|
||
/* global exports */ | ||
|
||
/*----------------------------------------------------------------------------*/ | ||
|
||
/* | ||
* Blast Output Columns : | ||
query ID, subject ID, % identity, length of HSP (hit), # mismatches, # gaps, query start, query end, subject start, subject end, e-value, score, query length, subject length | ||
* column names : | ||
0 name | ||
1 chr | ||
2 pcIdentity | ||
3 lengthOfHspHit | ||
4 numMismatches | ||
5 numGaps | ||
6 queryStart | ||
7 queryEnd | ||
8 pos | ||
9 end | ||
10 eValue | ||
11 score | ||
12 queryLength | ||
13 subjectLength | ||
*/ | ||
|
||
/** Identify the columns of blast output result | ||
*/ | ||
const | ||
c_name = 0, c_chr = 1, c_pcIdentity = 2, c_lengthOfHspHit = 3, | ||
c_pos = 8, c_end = 9, | ||
c_queryLength = 12; | ||
|
||
|
||
/** Filter Blast Search output results. | ||
* | ||
* coverage = length of HSP/query length *100 | ||
*/ | ||
exports.filterBlastResults = ( | ||
minLengthOfHit, minPercentIdentity, minPercentCoverage, line) => { | ||
let ok, | ||
cols = line.split('\t'); | ||
if (cols && cols.length > c_end) { | ||
ok = (+cols[c_pcIdentity] >= +minPercentIdentity) && | ||
(+cols[c_lengthOfHspHit] >= +minLengthOfHit) && | ||
(+cols[c_queryLength] && (100 * +cols[c_lengthOfHspHit] / +cols[c_queryLength] >= +minPercentCoverage)); | ||
} | ||
console.log('filterBlastResults', ok, minLengthOfHit, minPercentIdentity, minPercentCoverage, line, cols); | ||
return ok; | ||
}; | ||
|
||
|
||
|
||
|
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,35 @@ | ||
from flask import Flask | ||
from flask_executor import Executor | ||
from flask_shell2http import Shell2HTTP | ||
|
||
|
||
import sys | ||
|
||
|
||
# python's inbuilt logging module | ||
import logging | ||
# get the flask_shell2http logger | ||
logger = logging.getLogger("flask_shell2http") | ||
# create new handler | ||
handler = logging.StreamHandler(sys.stdout) | ||
logger.addHandler(handler) | ||
# log messages of severity DEBUG or lower to the console | ||
logger.setLevel(logging.DEBUG) # this is really important! | ||
|
||
|
||
|
||
# Flask application instance | ||
app = Flask(__name__) | ||
|
||
executor = Executor(app) | ||
executor.init_app(app) | ||
shell2http = Shell2HTTP(app=app, executor=executor, base_url_prefix="/commands/") | ||
shell2http.init_app(app, executor) | ||
|
||
def my_callback_fn(context, future): | ||
# optional user-defined callback function | ||
print(context, future.result()) | ||
|
||
# callback_fn=my_callback_fn, | ||
shell2http.register_command(endpoint="blastn", command_name="/home/ec2-user/scripts/blastn_cont.bash", callback_fn=my_callback_fn, decorators=[]) | ||
|
Oops, something went wrong.