Skip to content

Commit fe569a8

Browse files
authored
Merge pull request #17 from eggzilla/jsonAlien
Json alien
2 parents 698263b + c3ca93d commit fe569a8

18 files changed

+627
-453
lines changed

.travis.yml

Lines changed: 22 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,28 @@
1-
#Copied as is from https://www.fpcomplete.com/blog/2016/02/updated-haskell-travis-config
2-
#Copy these contents into the root directory of your Github project in a file
3-
# named .travis.yml
1+
sudo: required
42

5-
# Use new container infrastructure to enable caching
6-
sudo: false
7-
8-
# Choose a lightweight base image; we provide our own build tools.
93
language: c
104

11-
# Caching so the next build will be fast too.
12-
cache:
13-
directories:
14-
- $HOME/.ghc
15-
- $HOME/.cabal
16-
- $HOME/.stack
17-
18-
# The different configurations we want to test. We have BUILD=cabal which uses
19-
# cabal-install, and BUILD=stack which uses Stack. More documentation on each
20-
# of those below.
21-
#
22-
# We set the compiler values here to tell Travis to use a different
23-
# cache file per set of arguments.
24-
#
25-
# If you need to have different apt packages for each combination in the
26-
# matrix, you can use a line such as:
27-
# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
28-
matrix:
29-
include:
30-
# We grab the appropriate GHC and cabal-install versions from hvr's PPA. See:
31-
# https://github.com/hvr/multi-ghc-travis
32-
- env: BUILD=cabal GHCVER=8.0.2 CABALVER=1.24
33-
compiler: ": #GHC 8.0.2"
34-
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2], sources: [hvr-ghc]}}
35-
36-
# The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
37-
# variable, such as using --stack-yaml to point to a different file.
38-
#- env: BUILD=stack ARGS="--resolver lts-6.22"
39-
# compiler: ": #stack 7.10.3"
40-
# addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
41-
42-
# Nightly builds are allowed to fail
43-
#- env: BUILD=stack ARGS="--resolver nightly"
44-
# compiler: ": #stack nightly"
45-
# addons: {apt: {packages: [libgmp-dev]}}
46-
47-
# Build on OS X in addition to Linux
48-
#- env: BUILD=stack ARGS="--resolver lts-6.22"
49-
# compiler: ": #stack 7.10.3 osx"
50-
# os: osx
51-
52-
#- env: BUILD=stack ARGS="--resolver nightly"
53-
# compiler: ": #stack nightly osx"
54-
# os: osx
55-
56-
allow_failures:
57-
- env: BUILD=cabal GHCVER=8.0.1 CABALVER=1.24
58-
- env: BUILD=stack ARGS="--resolver nightly"
59-
60-
before_install:
61-
# Using compiler above sets CC to an invalid value, so unset it
62-
- unset CC
63-
64-
# We want to always allow newer versions of packages when building on GHC HEAD
65-
- CABALARGS=""
66-
- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
67-
68-
# Download and unpack the stack executable
69-
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:$PATH
70-
- mkdir -p ~/.local/bin
71-
- |
72-
if [ `uname` = "Darwin" ]
73-
then
74-
curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
75-
else
76-
curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
77-
fi
5+
services:
6+
- docker
787

79-
install:
80-
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
81-
- if [ -f configure.ac ]; then autoreconf -i; fi
82-
- |
83-
case "$BUILD" in
84-
stack)
85-
stack --no-terminal --install-ghc $ARGS test --only-dependencies
86-
;;
87-
cabal)
88-
cabal --version
89-
travis_retry cabal update
90-
cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS
91-
;;
92-
esac
8+
before_script:
9+
- docker build --tag devel -f Dockerfile.dev .
9310

9411
script:
95-
- |
96-
case "$BUILD" in
97-
stack)
98-
stack --no-terminal $ARGS test --haddock --no-haddock-deps
99-
;;
100-
cabal)
101-
cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror"
102-
cabal build
103-
cabal check || [ "$CABALVER" == "1.16" ]
104-
cabal test
105-
cabal sdist
106-
cabal copy
107-
SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && \
108-
(cd dist && cabal install --force-reinstalls "$SRC_TGZ")
109-
;;
110-
esac
12+
- docker create --name develcontainer devel
13+
- mkdir RNAlien
14+
- docker cp develcontainer:/source/dist-newstyle/build/x86_64-linux/ghc-8.4.3/RNAlien-1.6.0/x/RNAlien/build/RNAlien/RNAlien RNAlien
15+
- docker cp develcontainer:/source/dist-newstyle/build/x86_64-linux/ghc-8.4.3/RNAlien-1.6.0/x/RNAlienStatistics/build/RNAlienStatistics/RNAlienStatistics RNAlien
16+
- docker cp develcontainer:/source/dist-newstyle/build/x86_64-linux/ghc-8.4.3/RNAlien-1.6.0/x/cmsearchToBed/build/cmsearchToBed/cmsearchToBed RNAlien
17+
- docker cp develcontainer:/source/dist-newstyle/build/x86_64-linux/ghc-8.4.3/RNAlien-1.6.0/x/RNAcentralHTTPRequest/build/RNAcentralHTTPRequest/RNAcentralHTTPRequest RNAlien
18+
- cp LICENSE RNAlien
19+
- tar -cvzf RNAlien.tar.gz RNAlien
20+
21+
22+
deploy:
23+
provider: releases
24+
skip_cleanup: true
25+
api_key: $GITHUB_TOKEN
26+
file: "RNAlien.tar.gz"
27+
on:
28+
tags: true

src/Bio/RNAcentralHTTPRequest.hs renamed to Biobase/RNAcentralHTTPRequest.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
module Main where
77

88
import System.Console.CmdArgs
9-
import Bio.RNAcentralHTTP
9+
import Biobase.RNAlien.RNAcentralHTTP
1010

1111
data Options = Options
1212
{ inputSequence :: String

src/Bio/RNAlien.hs renamed to Biobase/RNAlien.hs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33

44
-- | Unsupervized construction of RNA family models
55
-- For more information on RNA family models consult <http://>
6-
-- Testcommand: dist/build/RNAlien/RNAlien -i ~egg/initialfasta/RybB.fa -c 3 -o /scr/kronos/egg/temp/ > ~egg/Desktop/alieninitialtest
6+
-- Usage example: RNAlien -i /path/input.fa -c 5 -o /outdir/
7+
-- Usage example offline mode: RNAlien -i /path/input.fa -b /backup/blast/nt_v5 -o /outdir/ -c 5 -t 1396 -j
78
module Main where
89

910
import System.Console.CmdArgs
1011
import System.Directory
11-
import Bio.Sequence.Fasta
12-
import Bio.RNAlienData
13-
import Bio.RNAlienLibrary
12+
import Biobase.RNAlien.Types
13+
import Biobase.RNAlien.Library
1414
import Data.Maybe
1515
import Data.Either.Unwrap
1616
import Data.Time
1717
import qualified System.FilePath as FP
1818
import Paths_RNAlien (version)
1919
import Data.Version (showVersion)
20+
--import Biobase.Fasta.Streaming
2021

2122
data Options = Options
2223
{ inputFastaFilePath :: String,
@@ -35,7 +36,8 @@ data Options = Options
3536
taxonomyRestriction :: Maybe String,
3637
sessionIdentificator :: Maybe String,
3738
performEvaluation :: Bool,
38-
checkSetup :: Bool
39+
checkSetup :: Bool,
40+
offlineMode :: Bool
3941
} deriving (Show,Data,Typeable)
4042

4143
options :: Options
@@ -45,7 +47,7 @@ options = Options
4547
inputTaxId = Nothing &= name "t" &= help "NCBI taxonomy ID number of input RNA organism",
4648
inputnSCICutoff = Just (1 :: Double) &= name "z" &= help "Only candidate sequences with a normalized structure conservation index (nSCI) higher than this value are accepted. Default: 1",
4749
inputEvalueCutoff = Just (0.001 :: Double) &= name "e" &= help "Evalue cutoff for cmsearch filtering. Default: 0.001",
48-
inputBlastDatabase = Just "nt" &= name "b" &= help "Specify name of blast database to use. Default: nt",
50+
inputBlastDatabase = Just "nt" &= name "b" &= help "Specify name of blast database to use, in offline mode the filepath to the blast database (/home/user/nt_v5). Default: nt",
4951
lengthFilter = True &= name "l" &= help "Filter blast hits per genomic length. Default: True",
5052
coverageFilter = True &= name "a" &= help "Filter blast hits by coverage of at least 80%. Default: True",
5153
singleHitperTax = False &= name "s" &= help "Only the best blast hit per taxonomic entry is considered. Default: False",
@@ -56,8 +58,9 @@ options = Options
5658
taxonomyRestriction = Nothing &= name "r" &= help "Restrict search space to taxonomic kingdom (bacteria,archea,eukaryia). Default: not set",
5759
sessionIdentificator = Nothing &= name "d" &= help "Optional session id that is used instead of automatically generated one.",
5860
performEvaluation = True &= name "x" &= help "Perform evaluation step. Default: True",
59-
checkSetup = False &= name "g" &= help "Just prints installed tool versions and performs connection check. Default: False"
60-
} &= summary ("RNAlien " ++ alienVersion) &= help "Florian Eggenhofer, Ivo L. Hofacker, Christian Hoener zu Siederdissen - 2013 - 2017" &= verbosity
61+
checkSetup = False &= name "g" &= help "Just prints installed tool versions and performs connection check. Default: False",
62+
offlineMode = False &= name "j" &= help "Uses locally installed blast and databases. Default: False"
63+
} &= summary ("RNAlien " ++ alienVersion) &= help "Florian Eggenhofer, Ivo L. Hofacker, Christian Hoener zu Siederdissen - 2013 - 2019" &= verbosity
6164

6265
main :: IO ()
6366
main = do
@@ -91,7 +94,7 @@ main = do
9194
writeFile (temporaryDirectoryPath ++ "log/warnings") ("")
9295
logMessage ("Timestamp: " ++ (show timestamp) ++ "\n") temporaryDirectoryPath
9396
logMessage ("Temporary Directory: " ++ temporaryDirectoryPath ++ "\n") temporaryDirectoryPath
94-
inputFasta <- readFasta inputFastaFilePath
97+
inputFasta <- readFastaFile inputFastaFilePath
9598
if null inputFasta
9699
then do
97100
putStrLn "Error: Input fasta file is empty."
@@ -106,10 +109,10 @@ main = do
106109
else do
107110
logToolVersions inputQuerySelectionMethod temporaryDirectoryPath
108111
let inputSequence = reformatFasta (head inputFasta)
109-
initialTaxId <- setInitialTaxId inputBlastDatabase temporaryDirectoryPath inputTaxId inputSequence
112+
initialTaxId <- setInitialTaxId offlineMode threads inputBlastDatabase temporaryDirectoryPath inputTaxId inputSequence
110113
let checkedTaxonomyRestriction = checkTaxonomyRestriction taxonomyRestriction
111-
let staticOptions = StaticOptions temporaryDirectoryPath sessionId (fromJust inputnSCICutoff) inputTaxId singleHitperTax inputQuerySelectionMethod inputQueryNumber lengthFilter coverageFilter blastSoftmasking threads inputBlastDatabase checkedTaxonomyRestriction (setVerbose verboseLevel)
112-
let initialization = ModelConstruction iterationNumber inputSequence [] initialTaxId Nothing (fromJust inputEvalueCutoff) False [] []
114+
let staticOptions = StaticOptions temporaryDirectoryPath sessionId (fromJust inputnSCICutoff) inputTaxId singleHitperTax inputQuerySelectionMethod inputQueryNumber lengthFilter coverageFilter blastSoftmasking threads inputBlastDatabase checkedTaxonomyRestriction (setVerbose verboseLevel) offlineMode
115+
let initialization = ModelConstruction iterationNumber inputFasta [] initialTaxId Nothing (fromJust inputEvalueCutoff) False [] []
113116
logMessage (show initialization) temporaryDirectoryPath
114117
modelConstructionResults <- modelConstructer staticOptions initialization
115118
let resultTaxonomyRecordsCSVTable = constructTaxonomyRecordsCSVTable modelConstructionResults

src/Bio/InfernalParser.hs renamed to Biobase/RNAlien/InfernalParser.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- | This module contains parsing functions for Infernal programs
22

3-
module Bio.InfernalParser (
4-
module Bio.RNAlienData,
3+
module Biobase.RNAlien.InfernalParser (
4+
module Biobase.RNAlien.Types,
55
readCMSearch,
66
readCMSearches,
77
parseCMSearch,
@@ -12,8 +12,8 @@ module Bio.InfernalParser (
1212
where
1313

1414
import Text.ParserCombinators.Parsec
15-
import Bio.RNAlienData
16-
import qualified Data.ByteString.Lazy.Char8 as L
15+
import Biobase.RNAlien.Types
16+
import qualified Data.ByteString.Char8 as B
1717
import qualified Control.Exception.Base as CE
1818

1919
-- | parse from input filePath
@@ -240,7 +240,7 @@ genParserCMsearchHit = do
240240
newline
241241
optional (try (string " ------ inclusion threshold ------"))
242242
optional (try newline)
243-
return $ CMsearchHit (readInt hitRank') hitSignificant' (readDouble hitEValue') (readDouble hitScore') (readDouble hitBias') (L.pack hitSequenceHeader') (readInt hitStart') (readInt hitEnd') hitStrand' (L.pack hitModel') (L.pack hitTruncation') (readDouble hitGCcontent') (L.pack hitDescription')
243+
return $ CMsearchHit (readInt hitRank') hitSignificant' (readDouble hitEValue') (readDouble hitScore') (readDouble hitBias') (B.pack hitSequenceHeader') (readInt hitStart') (readInt hitEnd') hitStrand' (B.pack hitModel') (B.pack hitTruncation') (readDouble hitGCcontent') (B.pack hitDescription')
244244

245245
-- | parse from input filePath
246246
parseCMstat :: String -> Either ParseError CMstat

0 commit comments

Comments
 (0)