├── scripts
├── __init__.py
├── setUpScripts
│ ├── runUnitTest.sh
│ ├── installEtc.py
│ ├── installHeaders.py
│ ├── generateCompFile.py
│ ├── njhConfigure.py
│ ├── rmNeedToRecompile.py
│ ├── needToRecompile.py
│ ├── ProjectUpdater.py
│ └── genFuncs.py
├── etc
│ └── bash_completion.d
│ │ ├── whichHeaderBashCompletion
│ │ └── argParsePythons
├── checkForPackageUbuntu.sh
├── cppProjectScripts
│ ├── inProgress
│ │ ├── rewrite_includes.py
│ │ ├── split_hpp.py
│ │ ├── fix_pragma_once.py
│ │ ├── namespacer.py
│ │ └── createNewBibseqRing.py
│ ├── copySetUpFiles.py
│ ├── fileModAffect.py
│ ├── mapSrc.py
│ ├── createTestDir.py
│ └── whichHeader.py
├── parseHeader.py
├── cppMakefiles
│ ├── unitTest
│ │ └── Makefile
│ └── Makefile
├── genHelloWorld.py
└── pyUtils
│ ├── color_text.py
│ └── headInGraph.py
├── _config.yml
├── etc
├── SeekDeepParameterFiles
│ ├── otu_97
│ ├── otu_98
│ ├── otu_99
│ ├── strict_100
│ ├── strict_300
│ ├── strict_nothingAtAll
│ ├── otu_99_to_97
│ ├── strict_noErrors_onlyHruns
│ ├── 454_it_lkmer1
│ ├── 454_it_lkmer2
│ ├── 454_it_noKmer
│ ├── 454_it_lkmer1_hq1
│ ├── illumina_lkmer1
│ ├── illumina_lkmer1_hq1
│ ├── illumina_lkmer1_hq2
│ ├── illumina_lkmer1_hq3
│ ├── illumina_lkmer2
│ ├── illumina_noKmer
│ ├── 454_it_lkmer2_largeHpr
│ ├── 454_it_lkmer1_hq2
│ └── 454_it_lkmer1_hq3
├── bash_completion.d
│ ├── setup
│ └── SeekDeep
└── serverResources
│ └── pcv
│ ├── redirectPage.js
│ ├── css
│ └── common.css
│ ├── mainPage.js
│ ├── groupInfoPage.js
│ ├── extractionStats.js
│ ├── sampleMainPage.js
│ ├── extractionStats.html
│ ├── js
│ └── utils.js
│ ├── mainProjectPage.js
│ └── groupMainPage.js
├── src
├── SeekDeep
│ ├── utils.h
│ ├── objects
│ │ ├── ControlBenchmarking.h
│ │ ├── IlluminaUtils.h
│ │ ├── TarAmpSetupUtils.h
│ │ ├── IlluminaUtils
│ │ │ ├── IlluminaNameFormatDecoder.cpp
│ │ │ ├── ReadPairsOrganizer.hpp
│ │ │ └── IlluminaNameFormatDecoder.hpp
│ │ ├── ControlBenchmarking
│ │ │ ├── ControlMixSetUp.hpp
│ │ │ ├── ControlBencher.cpp
│ │ │ ├── ControlMixSetUp.cpp
│ │ │ └── ControlBencher.hpp
│ │ └── TarAmpSetupUtils
│ │ │ ├── SampleFileNameGenerator.hpp
│ │ │ ├── TarAmpSeqInvestigator.hpp
│ │ │ └── PrimersAndMids.hpp
│ ├── parameters.h
│ ├── server.h
│ ├── objects.h
│ ├── utils
│ │ └── extractTargetsFromGenomes.hpp
│ └── server
│ │ ├── PopClusProject.hpp
│ │ └── PopClusProject.cpp
├── SeekDeepPrograms
│ ├── SeekDeepProgram
│ │ ├── SeekDeepSetUp.cpp
│ │ ├── SeekDeepSetUp.hpp
│ │ ├── SeekDeepRunner.hpp
│ │ ├── SeekDeepRunner.cpp
│ │ └── makeSampleDirectories
│ │ │ ├── makeSampleDirectories.cpp
│ │ │ └── makeSampleDirectoriesSetUp.cpp
│ ├── SeekDeepServerRunner.h
│ ├── SeekDeepUtils
│ │ ├── SeekDeepUtilsSetUp.cpp
│ │ ├── SeekDeepUtilsSetUp.hpp
│ │ ├── SampleBarcodeFileToSeekDeepInput.cpp
│ │ ├── SeekDeepUtilsRunner.hpp
│ │ └── gatherInfoOnTargetedAmpliconSeqFile.cpp
│ ├── SeekDeepProgram.h
│ ├── SeekDeepServer
│ │ ├── SeekDeepServerSetUp.cpp
│ │ ├── SeekDeepServerSetUp.hpp
│ │ ├── SeekDeepServerRunner.hpp
│ │ └── SeekDeepServerRunner.cpp
│ └── SeekDeepUtils.h
├── SeekDeepPrograms.h
├── SeekDeep.h
└── main.cpp
├── install.sh
├── configure.py
├── upgradeMaster.sh
├── upgradeDevelop.sh
├── .gitignore
├── README.md
└── Makefile
/scripts/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/otu_97:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:id
2 | 100:3:.97
3 | 100:3:.97
4 | 100:0:.97
5 | 100:0:.97
6 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/otu_98:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:id
2 | 100:3:.98
3 | 100:3:.98
4 | 100:0:.98
5 | 100:0:.98
6 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/otu_99:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:id
2 | 100:3:.99
3 | 100:3:.99
4 | 100:0:.99
5 | 100:0:.99
6 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/strict_100:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:0
3 | 100:3:2:1:0:0:1:0
4 | 100:0:1:0:0:0:0:0
5 | 100:0:2:1:0:0:1:0
6 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/strict_300:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 300:3:1:0:0:0:0:0
3 | 300:3:2:1:0:0:1:0
4 | 300:0:1:0:0:0:0:0
5 | 300:0:2:1:0:0:1:0
6 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/strict_nothingAtAll:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:0:0:0:0:0:0
3 | 100:3:0:0:0:0:0:0
4 | 100:0:0:0:0:0:0:0
5 | 100:0:0:0:0:0:0:0
6 |
--------------------------------------------------------------------------------
/src/SeekDeep/utils.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | /*
3 | * utils.h
4 | *
5 | * Created on: Aug 29, 2018
6 | * Author: nick
7 | */
8 |
9 |
10 |
11 |
12 | #include "SeekDeep/utils/extractTargetsFromGenomes.hpp"
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/otu_99_to_97:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:id
2 | 100:3:.99
3 | 100:3:.99
4 | 100:3:.98
5 | 100:3:.98
6 | 100:3:.97
7 | 100:3:.97
8 | 100:0:.99
9 | 100:0:.99
10 | 100:0:.98
11 | 100:0:.98
12 | 100:0:.97
13 | 100:0:.97
14 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/strict_noErrors_onlyHruns:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:0.99:0.99:0.99:0:0:0
3 | 100:3:0.99:0.99:0.99:0:0:0
4 | 100:0:0.99:0.99:0.99:0:0:0
5 | 100:0:0.99:0.99:0.99:0:0:0
6 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | if [ $# -ne 1 ]; then
4 | echo "Need to supply number of CPUs to use, e.g. ./install.sh 7"
5 | exit
6 | fi
7 |
8 | ./configure.py
9 | ./setup.py --compfile compfile.mk --outMakefile makefile-common.mk
10 | make -j $1
11 |
--------------------------------------------------------------------------------
/scripts/setUpScripts/runUnitTest.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 |
4 | #check args
5 | if [ $# -ne 1 ]; then
6 | echo Need 1 argument
7 | echo "1) unit directory"
8 | echo "runUnitTest.sh [TEST_DIR]"
9 | exit
10 | fi
11 |
12 | cd $1
13 | make
14 | for f in bin/*
15 | do
16 | $f
17 | done
18 |
--------------------------------------------------------------------------------
/src/SeekDeep/objects/ControlBenchmarking.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | /*
4 | * ControlBenchmarking.h
5 | *
6 | * Created on: May 6, 2019
7 | * Author: nicholashathaway
8 | */
9 |
10 |
11 |
12 | #include "SeekDeep/objects/ControlBenchmarking/ControlMixSetUp.hpp"
13 | #include "SeekDeep/objects/ControlBenchmarking/ControlBencher.hpp"
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/scripts/etc/bash_completion.d/whichHeaderBashCompletion:
--------------------------------------------------------------------------------
1 | _whichHeader()
2 | {
3 | local cur prev opts
4 | COMPREPLY=()
5 | cur="${COMP_WORDS[COMP_CWORD]}"
6 | prev="${COMP_WORDS[COMP_CWORD-1]}"
7 | opts=$( ${COMP_WORDS[0]} --bashAutoComplete ${cur} )
8 | COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
9 | return 0
10 | }
11 |
12 | complete -F _whichHeader whichHeader.py
13 |
--------------------------------------------------------------------------------
/src/SeekDeep/objects/IlluminaUtils.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | /*
4 | * IlluminaUtils.h
5 | *
6 | * Created on: Jan 29, 2020
7 | * Author: nicholashathaway
8 | */
9 |
10 |
11 |
12 | #include "SeekDeep/objects/IlluminaUtils/IlluminaNameFormatDecoder.hpp"
13 | #include "SeekDeep/objects/IlluminaUtils/PairedReadProcessor.hpp"
14 | #include "SeekDeep/objects/IlluminaUtils/ReadPairsOrganizer.hpp"
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/configure.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import shutil, os, argparse, sys, stat
4 | sys.path.append("scripts/pyUtils")
5 | sys.path.append("scripts/setUpScripts")
6 | from utils import Utils
7 | from genFuncs import genHelper
8 | def main():
9 | name = "SeekDeep"
10 | libs = "seqServer:v3.0.1"
11 | args = genHelper.parseNjhConfigureArgs()
12 | cmd = genHelper.mkConfigCmd(name, libs, sys.argv)
13 | Utils.run(cmd)
14 |
15 | main()
16 |
--------------------------------------------------------------------------------
/etc/bash_completion.d/setup:
--------------------------------------------------------------------------------
1 | _setUpPys()
2 | {
3 | local cur prev opts base
4 | COMPREPLY=()
5 | cur="${COMP_WORDS[COMP_CWORD]}"
6 | prev="${COMP_WORDS[COMP_CWORD-1]}"
7 | if [[ ${cur} == -* ]]; then
8 | opts=$(for x in `${COMP_WORDS[0]} -h | grep " -" | sed "s/^. *-/-/g" | sed "s/ .*//g" | sed "s/, / /g"`; do echo ${x} ; done )
9 | COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
10 | else
11 | _filedir
12 | fi
13 | return 0
14 | }
15 |
16 | complete -F _setUpPys setup.py
17 |
--------------------------------------------------------------------------------
/src/SeekDeep/objects/TarAmpSetupUtils.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | /*
4 | * TarAmpSetupUtils.h
5 | *
6 | * Created on: Jan 29, 2020
7 | * Author: nicholashathaway
8 | */
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | #include "SeekDeep/objects/TarAmpSetupUtils/PrimersAndMids.hpp"
17 | #include "SeekDeep/objects/TarAmpSetupUtils/SampleFileNameGenerator.hpp"
18 | #include "SeekDeep/objects/TarAmpSetupUtils/TarAmpAnalysisSetup.hpp"
19 | #include "SeekDeep/objects/TarAmpSetupUtils/TarAmpSeqInvestigator.hpp"
20 |
21 |
--------------------------------------------------------------------------------
/etc/serverResources/pcv/redirectPage.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function(){
2 | var rName = getRootName();
3 | addDiv("body", "topNav");
4 | getJSON('/' + rName + '/projectsNames').then(function (projectsNames) {
5 | createMainPageNavBar("#topNav", projectsNames);
6 | addMainDiv("body", true);
7 | setHeadTitle(rName);
8 | $("#jumboTitle").html("Ruh Roh");
9 | $(".jumbotron", "#mainContent").append("
You attempted to go to a page that doesn't exist, or it could be there is no data for where you attempted to go.
");
10 | }).catch(logRequestError);
11 |
12 | });
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/454_it_lkmer1:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:1
3 | 100:3:2:0:0:0:0:1
4 | 100:3:3:0:0:0:1:1
5 | 100:3:4:0:0:0:2:1
6 | 100:3:5:0:0:0:3:1
7 | 100:3:6:0:0:0:4:1
8 | 100:3:7:1:0:0:5:1
9 | 100:3:7:2:0:0:5:1
10 | 100:3:7:3:0:0:5:1
11 | 100:3:7:4:0:0:5:1
12 | 100:3:7:5:0:0:5:1
13 | 100:0:1:0:0:0:0:1
14 | 100:0:2:0:0:0:0:1
15 | 100:0:3:0:0:0:1:1
16 | 100:0:4:0:0:0:2:1
17 | 100:0:5:0:0:0:3:1
18 | 100:0:6:0:0:0:4:1
19 | 100:0:7:1:0:0:5:1
20 | 100:0:7:2:0:0:5:1
21 | 100:0:7:3:0:0:5:1
22 | 100:0:7:4:0:0:5:1
23 | 100:0:7:5:0:0:5:1
24 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/454_it_lkmer2:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:1
3 | 100:3:2:0:0:0:0:1
4 | 100:3:3:0:0:0:1:1
5 | 100:3:4:0:0:0:2:1
6 | 100:3:5:0:0:0:3:1
7 | 100:3:6:0:0:0:4:1
8 | 100:3:7:1:0:0:5:1
9 | 100:3:7:2:0:0:5:1
10 | 100:3:7:3:0:0:5:2
11 | 100:3:7:4:0:0:5:2
12 | 100:3:7:5:0:0:5:2
13 | 100:0:1:0:0:0:0:1
14 | 100:0:2:0:0:0:0:1
15 | 100:0:3:0:0:0:1:1
16 | 100:0:4:0:0:0:2:1
17 | 100:0:5:0:0:0:3:1
18 | 100:0:6:0:0:0:4:1
19 | 100:0:7:1:0:0:5:1
20 | 100:0:7:2:0:0:5:1
21 | 100:0:7:3:0:0:5:2
22 | 100:0:7:4:0:0:5:2
23 | 100:0:7:5:0:0:5:2
24 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/454_it_noKmer:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:0
3 | 100:3:2:0:0:0:0:0
4 | 100:3:3:0:0:0:1:0
5 | 100:3:4:0:0:0:2:0
6 | 100:3:5:0:0:0:3:0
7 | 100:3:6:0:0:0:4:0
8 | 100:3:7:1:0:0:5:0
9 | 100:3:7:2:0:0:5:0
10 | 100:3:7:3:0:0:5:0
11 | 100:3:7:4:0:0:5:0
12 | 100:3:7:5:0:0:5:0
13 | 100:0:1:0:0:0:0:0
14 | 100:0:2:0:0:0:0:0
15 | 100:0:3:0:0:0:1:0
16 | 100:0:4:0:0:0:2:0
17 | 100:0:5:0:0:0:3:0
18 | 100:0:6:0:0:0:4:0
19 | 100:0:7:1:0:0:5:0
20 | 100:0:7:2:0:0:5:0
21 | 100:0:7:3:0:0:5:0
22 | 100:0:7:4:0:0:5:0
23 | 100:0:7:5:0:0:5:0
24 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/454_it_lkmer1_hq1:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:1
3 | 100:3:2:0:0:0:0:1
4 | 100:3:3:0:0:0:1:1
5 | 100:3:4:0:0:0:2:1
6 | 100:3:5:0:0:0:3:1
7 | 100:3:6:0:0:0:4:1
8 | 100:3:7:1:0:0:5:1
9 | 100:3:7:2:0:0:5:1
10 | 100:3:7:3:0:0:5:1
11 | 100:3:7:4:0:1:5:1
12 | 100:3:7:5:0:1:5:1
13 | 100:0:1:0:0:0:0:1
14 | 100:0:2:0:0:0:0:1
15 | 100:0:3:0:0:0:1:1
16 | 100:0:4:0:0:0:2:1
17 | 100:0:5:0:0:0:3:1
18 | 100:0:6:0:0:0:4:1
19 | 100:0:7:1:0:0:5:1
20 | 100:0:7:2:0:0:5:1
21 | 100:0:7:3:0:0:5:1
22 | 100:0:7:4:0:1:5:1
23 | 100:0:7:5:0:1:5:1
24 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/illumina_lkmer1:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:1
3 | 100:3:2:0:0:0:0:1
4 | 100:3:2:0:0:0:1:1
5 | 100:3:2:0:0:0:2:1
6 | 100:3:2:0:0:0:3:1
7 | 100:3:2:0:0:0:4:1
8 | 100:3:2:0:0:0:5:1
9 | 100:3:2:0:0:0:6:1
10 | 100:3:2:0:0:0:7:1
11 | 100:3:2:0:0:0:8:1
12 | 100:3:2:0:0:0:8:1
13 | 100:0:1:0:0:0:0:1
14 | 100:0:2:0:0:0:0:1
15 | 100:0:2:0:0:0:1:1
16 | 100:0:2:0:0:0:2:1
17 | 100:0:2:0:0:0:3:1
18 | 100:0:2:0:0:0:4:1
19 | 100:0:2:0:0:0:5:1
20 | 100:0:2:0:0:0:6:1
21 | 100:0:2:0:0:0:7:1
22 | 100:0:2:0:0:0:8:1
23 | 100:0:2:0:0:0:8:1
24 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/illumina_lkmer1_hq1:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:1
3 | 100:3:2:0:0:0:0:1
4 | 100:3:2:0:0:0:1:1
5 | 100:3:2:0:0:0:2:1
6 | 100:3:2:0:0:0:3:1
7 | 100:3:2:0:0:0:4:1
8 | 100:3:2:0:0:0:5:1
9 | 100:3:2:0:0:0:6:1
10 | 100:3:2:0:0:0:7:1
11 | 100:3:2:0:0:1:8:1
12 | 100:3:2:0:0:1:8:1
13 | 100:0:1:0:0:0:0:1
14 | 100:0:2:0:0:0:0:1
15 | 100:0:2:0:0:0:1:1
16 | 100:0:2:0:0:0:2:1
17 | 100:0:2:0:0:0:3:1
18 | 100:0:2:0:0:0:4:1
19 | 100:0:2:0:0:0:5:1
20 | 100:0:2:0:0:0:6:1
21 | 100:0:2:0:0:0:7:1
22 | 100:0:2:0:0:1:8:1
23 | 100:0:2:0:0:1:8:1
24 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/illumina_lkmer1_hq2:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:1
3 | 100:3:2:0:0:0:0:1
4 | 100:3:2:0:0:0:1:1
5 | 100:3:2:0:0:0:2:1
6 | 100:3:2:0:0:0:3:1
7 | 100:3:2:0:0:0:4:1
8 | 100:3:2:0:0:0:5:1
9 | 100:3:2:0:0:1:6:1
10 | 100:3:2:0:0:1:7:1
11 | 100:3:2:0:0:2:8:1
12 | 100:3:2:0:0:2:8:1
13 | 100:0:1:0:0:0:0:1
14 | 100:0:2:0:0:0:0:1
15 | 100:0:2:0:0:0:1:1
16 | 100:0:2:0:0:0:2:1
17 | 100:0:2:0:0:0:3:1
18 | 100:0:2:0:0:0:4:1
19 | 100:0:2:0:0:0:5:1
20 | 100:0:2:0:0:1:6:1
21 | 100:0:2:0:0:1:7:1
22 | 100:0:2:0:0:2:8:1
23 | 100:0:2:0:0:2:8:1
24 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/illumina_lkmer1_hq3:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:1
3 | 100:3:2:0:0:0:0:1
4 | 100:3:2:0:0:0:1:1
5 | 100:3:2:0:0:0:2:1
6 | 100:3:2:0:0:0:3:1
7 | 100:3:2:0:0:0:4:1
8 | 100:3:2:0:0:1:5:1
9 | 100:3:2:0:0:1:6:1
10 | 100:3:2:0:0:2:7:1
11 | 100:3:2:0:0:2:8:1
12 | 100:3:2:0:0:3:8:1
13 | 100:0:1:0:0:0:0:1
14 | 100:0:2:0:0:0:0:1
15 | 100:0:2:0:0:0:1:1
16 | 100:0:2:0:0:0:2:1
17 | 100:0:2:0:0:0:3:1
18 | 100:0:2:0:0:0:4:1
19 | 100:0:2:0:0:1:5:1
20 | 100:0:2:0:0:1:6:1
21 | 100:0:2:0:0:2:7:1
22 | 100:0:2:0:0:2:8:1
23 | 100:0:2:0:0:3:8:1
24 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/illumina_lkmer2:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:1
3 | 100:3:2:0:0:0:0:1
4 | 100:3:2:0:0:0:1:1
5 | 100:3:2:0:0:0:2:1
6 | 100:3:2:0:0:0:3:1
7 | 100:3:2:0:0:0:4:1
8 | 100:3:2:0:0:0:5:1
9 | 100:3:2:0:0:0:6:2
10 | 100:3:2:0:0:0:7:2
11 | 100:3:2:0:0:0:8:2
12 | 100:3:2:0:0:0:8:2
13 | 100:0:1:0:0:0:0:1
14 | 100:0:2:0:0:0:0:1
15 | 100:0:2:0:0:0:1:1
16 | 100:0:2:0:0:0:2:1
17 | 100:0:2:0:0:0:3:1
18 | 100:0:2:0:0:0:4:1
19 | 100:0:2:0:0:0:5:1
20 | 100:0:2:0:0:0:6:2
21 | 100:0:2:0:0:0:7:2
22 | 100:0:2:0:0:0:8:2
23 | 100:0:2:0:0:0:8:2
24 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/illumina_noKmer:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:0
3 | 100:3:2:0:0:0:0:0
4 | 100:3:2:0:0:0:1:0
5 | 100:3:2:0:0:0:2:0
6 | 100:3:2:0:0:0:3:0
7 | 100:3:2:0:0:0:4:0
8 | 100:3:2:0:0:0:5:0
9 | 100:3:2:0:0:0:6:0
10 | 100:3:2:0:0:0:7:0
11 | 100:3:2:0:0:0:8:0
12 | 100:3:2:0:0:0:8:0
13 | 100:0:1:0:0:0:0:0
14 | 100:0:2:0:0:0:0:0
15 | 100:0:2:0:0:0:1:0
16 | 100:0:2:0:0:0:2:0
17 | 100:0:2:0:0:0:3:0
18 | 100:0:2:0:0:0:4:0
19 | 100:0:2:0:0:0:5:0
20 | 100:0:2:0:0:0:6:0
21 | 100:0:2:0:0:0:7:0
22 | 100:0:2:0:0:0:8:0
23 | 100:0:2:0:0:0:8:0
24 |
--------------------------------------------------------------------------------
/etc/serverResources/pcv/css/common.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 70px;
3 | padding-bottom: 30px;
4 | }
5 |
6 | .theme-dropdown .dropdown-menu {
7 | position: static;
8 | display: block;
9 | margin-bottom: 20px;
10 | }
11 |
12 | .theme-showcase > p > .btn {
13 | margin: 5px 0;
14 | }
15 |
16 | .theme-showcase .navbar .container {
17 | width: auto;
18 | }
19 |
20 | .container {
21 | padding-right: 15px;
22 | padding-left: 15px;
23 | margin-right: auto;
24 | margin-left: 15px;
25 | }
26 |
27 | a:visited {
28 | color: #8844CC;
29 | }
30 |
31 | .scrollable-menu {
32 | height: auto;
33 | max-height: 400px;
34 | overflow-x: hidden;
35 | }
36 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/454_it_lkmer2_largeHpr:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:1
3 | 100:3:2:0:0:0:0:1
4 | 100:3:3:0:0:0:1:1
5 | 100:3:4:0:.99:0:2:1
6 | 100:3:5:0:.99:0:3:1
7 | 100:3:6:0:.99:0:4:1
8 | 100:3:7:1:.99:0:5:1
9 | 100:3:7:2:.99:0:5:1
10 | 100:3:7:3:.99:0:5:1
11 | 100:3:7:4:.99:0:5:2
12 | 100:3:7:5:.99:0:5:2
13 | 100:0:1:0:0:0:0:1
14 | 100:0:2:0:0:0:0:1
15 | 100:0:3:0:0:0:1:1
16 | 100:0:4:0:.99:0:2:1
17 | 100:0:5:0:.99:0:3:1
18 | 100:0:6:0:.99:0:4:1
19 | 100:0:7:1:.99:0:5:1
20 | 100:0:7:2:.99:0:5:1
21 | 100:0:7:3:.99:0:5:1
22 | 100:0:7:4:.99:0:5:2
23 | 100:0:7:5:.99:0:5:2
24 |
--------------------------------------------------------------------------------
/upgradeMaster.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | if [ $# -ne 1 ]; then
4 | echo "Need to supply number of CPUs to use, e.g. ./upgradeMaster.sh 7"
5 | exit
6 | fi
7 |
8 | #make sure on the master branch and then pull for any new commits
9 | git checkout master
10 | git pull
11 | #re-run install
12 | ./configure.py
13 |
14 | rm -fr external/build/bamtools/ external/build/jsoncpp/ external/build/restbed/
15 | rm -fr external/local/bamtools/ external/local/jsoncpp/ external/local/restbed/
16 | rm -fr external/local/njhseq/ external/local/seqServer/ external/local/TwoBit/ external/local/njhcpp/
17 |
18 | ./setup.py --compfile compfile.mk --outMakefile makefile-common.mk --overWrite
19 | make clean
20 | make -j $1
21 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/454_it_lkmer1_hq2:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:1
3 | 100:3:2:0:0:0:0:1
4 | 100:3:3:0:0:0:1:1
5 | 100:3:4:0:0:0:2:1
6 | 100:3:5:0:0:0:3:1
7 | 100:3:6:0:0:0:4:1
8 | 100:3:7:1:0:0:5:1
9 | 100:3:7:2:0:0:5:1
10 | 100:3:7:3:0:0:5:1
11 | 100:3:7:4:0:1:5:1
12 | 100:3:7:5:0:1:5:1
13 | 100:3:7:4:0:2:5:1
14 | 100:3:7:5:0:2:5:1
15 | 100:0:1:0:0:0:0:1
16 | 100:0:2:0:0:0:0:1
17 | 100:0:3:0:0:0:1:1
18 | 100:0:4:0:0:0:2:1
19 | 100:0:5:0:0:0:3:1
20 | 100:0:6:0:0:0:4:1
21 | 100:0:7:1:0:0:5:1
22 | 100:0:7:2:0:0:5:1
23 | 100:0:7:3:0:0:5:1
24 | 100:0:7:4:0:1:5:1
25 | 100:0:7:5:0:1:5:1
26 | 100:0:7:4:0:2:5:1
27 | 100:0:7:5:0:2:5:1
28 |
--------------------------------------------------------------------------------
/etc/SeekDeepParameterFiles/454_it_lkmer1_hq3:
--------------------------------------------------------------------------------
1 | stopCheck:smallCutoff:1baseIndel:2baseIndel:>2baseIndel:HQMismatches:LQMismatches:LKMismatches
2 | 100:3:1:0:0:0:0:1
3 | 100:3:2:0:0:0:0:1
4 | 100:3:3:0:0:0:1:1
5 | 100:3:4:0:0:0:2:1
6 | 100:3:5:0:0:0:3:1
7 | 100:3:6:0:0:0:4:1
8 | 100:3:7:1:0:0:5:1
9 | 100:3:7:2:0:0:5:1
10 | 100:3:7:3:0:0:5:1
11 | 100:3:7:4:0:1:5:1
12 | 100:3:7:5:0:2:5:1
13 | 100:3:7:4:0:3:5:1
14 | 100:3:7:5:0:3:5:1
15 | 100:0:1:0:0:0:0:1
16 | 100:0:2:0:0:0:0:1
17 | 100:0:3:0:0:0:1:1
18 | 100:0:4:0:0:0:2:1
19 | 100:0:5:0:0:0:3:1
20 | 100:0:6:0:0:0:4:1
21 | 100:0:7:1:0:0:5:1
22 | 100:0:7:2:0:0:5:1
23 | 100:0:7:3:0:0:5:1
24 | 100:0:7:4:0:1:5:1
25 | 100:0:7:5:0:2:5:1
26 | 100:0:7:4:0:3:5:1
27 | 100:0:7:5:0:3:5:1
28 |
--------------------------------------------------------------------------------
/upgradeDevelop.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | if [ $# -ne 1 ]; then
4 | echo "Need to supply number of CPUs to use, e.g. ./upgradeDevelop.sh 7"
5 | exit
6 | fi
7 |
8 | #make sure on the master branch and then pull for any new commits
9 | git checkout develop
10 | git pull
11 | #re-run install
12 | ./configure.py
13 | rm -fr external/build/bamtools/ external/build/jsoncpp/ external/build/restbed/
14 | rm -fr external/local/bamtools/ external/local/jsoncpp/ external/local/restbed/
15 | rm -fr external/local/njhseq/ external/local/seqServer/ external/local/TwoBit/ external/local/njhcpp/
16 |
17 | ./setup.py --compfile compfile.mk --outMakefile makefile-common.mk --overWrite
18 |
19 | make clean
20 |
21 | make -j $1
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 |
6 | # Compiled Dynamic libraries
7 | *.so
8 | *.dylib
9 |
10 | # Compiled Static libraries
11 | *.lai
12 | *.la
13 | *.a
14 |
15 | *~
16 | *.out
17 | external/
18 | *.pyc
19 | TAGS
20 | \#*
21 | .\#*
22 | *.core
23 | # Compiled Object files
24 | *.slo
25 | *.lo
26 | *.o
27 | *.obj
28 |
29 | # Compiled Dynamic libraries
30 | *.so
31 | *.dylib
32 | *.dll
33 |
34 | # Compiled Static libraries
35 | *.lai
36 | *.la
37 | *.a
38 | *.lib
39 |
40 | # Executables
41 | *.exe
42 | *.out
43 | *.app
44 |
45 | bin/*
46 | compfile.mk
47 | external/*
48 |
49 | # Python
50 | # Byte-compiled / optimized / DLL files
51 | __pycache__/
52 | *.py[cod]
53 | *.pyc
54 | docs/man
55 |
56 | dist/
57 |
--------------------------------------------------------------------------------
/scripts/checkForPackageUbuntu.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | checkPackage(){
3 | retval=""
4 | output=$(dpkg -l | grep -E '^ii' | cut -d' ' -f3 | grep '^'"$1"'$')
5 | if [ ! -z "$output" -a "$output" != " " ]; then
6 | retval="true"
7 | #echo "$(tput setaf 2)$(tput bold)Package $1 is installed$(tput sgr0)"
8 | else
9 | retval="false"
10 | #echo "$(tput setaf 1)$(tput bold)Package $1 is not installed$(tput sgr0)"
11 | fi
12 | echo "$retval"
13 | }
14 |
15 | pkgInstalled=$(checkPackage $1)
16 |
17 | if [ "$pkgInstalled" == "true" ]
18 | then
19 | echo "$(tput setaf 2)$(tput bold)Package $1 is installed$(tput sgr0)"
20 | else
21 | echo "$(tput setaf 1)$(tput bold)Package $1 is not installed$(tput sgr0)"
22 | fi
23 |
24 |
--------------------------------------------------------------------------------
/etc/serverResources/pcv/mainPage.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function(){
2 | //get current name from window location
3 | var rName = getRootName();
4 | addDiv("body", "topNav");
5 | addMainDiv("body", false);
6 | setHeadTitle(rName);
7 | addPanelWithDiv("#mainContent","projectsLinks", "All Projects");
8 | getJSON('/' + rName + '/projectsNames').then(function (projectsNames) {
9 | createMainPageNavBar("#topNav", projectsNames["projects"]);
10 | var cols = 10;
11 | var linkPre = "/" + rName + "/mainProjectPage/";
12 | var mouseOverC = "#999";
13 | var mouseLeaveC = "#FFF";
14 | var addTo = "#projectsLinks";
15 | createLinksTable(addTo, linkPre, projectsNames["projects"],8, mouseOverC, mouseLeaveC);
16 | }).catch(logRequestError);
17 |
18 | });
19 |
20 |
--------------------------------------------------------------------------------
/src/SeekDeep/objects/IlluminaUtils/IlluminaNameFormatDecoder.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * IlluminaNameFormatDecoder.cpp
3 | *
4 | * Created on: Jul 8, 2019
5 | * Author: nicholashathaway
6 | */
7 |
8 |
9 |
10 |
11 | #include "IlluminaNameFormatDecoder.hpp"
12 |
13 | namespace njhseq {
14 | //std::regex IlluminaNameFormatDecoder::NameRegPatStr_{""};
15 | std::string IlluminaNameFormatDecoder::DefaultNameRegPatStr_{"([A-Za-z0-9_]+):([0-9]+):([A-Za-z0-9-]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+) ([12]):([NY]):([0-9]):([AGCTN+]+)"};
16 | //std::regex IlluminaNameFormatDecoder::NameRegPatStr_{"([A-Za-z0-9_]+):([0-9]+):([A-Za-z0-9-]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+) ([12]):([NY]):([0-9]):([AGCTN+]+))"};
17 | uint32_t IlluminaNameFormatDecoder::DefaultSampleNumberPos_{11};
18 | } // namespace njhseq
19 |
--------------------------------------------------------------------------------
/scripts/etc/bash_completion.d/argParsePythons:
--------------------------------------------------------------------------------
1 | _setUpPys()
2 | {
3 | local cur prev opts base
4 | COMPREPLY=()
5 | cur="${COMP_WORDS[COMP_CWORD]}"
6 | prev="${COMP_WORDS[COMP_CWORD-1]}"
7 | if [[ ${cur} == -* ]]; then
8 | opts=$(for x in `${COMP_WORDS[0]} -h | grep " -" | sed "s/^. *-/-/g" | sed "s/ .*//g" | sed "s/, / /g"`; do echo ${x} ; done )
9 | COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
10 | else
11 | _filedir
12 | fi
13 | return 0
14 | }
15 |
16 | complete -F _setUpPys setup.py
17 | complete -F _setUpPys configure.py
18 | complete -F _setUpPys genHelloWorld.py
19 | complete -F _setUpPys parseHeader.py
20 | complete -F _setUpPys mapSrc.py
21 | complete -F _setUpPys genCppProject.py
22 | complete -F _setUpPys fileModAffect.py
23 | complete -F _setUpPys copySetUpFiles.py
24 |
--------------------------------------------------------------------------------
/src/SeekDeep/objects/ControlBenchmarking/ControlMixSetUp.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | /*
4 | * ControlMixSetUp.hpp
5 | *
6 | * Created on: May 6, 2019
7 | * Author: nicholashathaway
8 | */
9 |
10 | #include
11 |
12 | #include
13 |
14 | namespace njhseq {
15 |
16 | class ControlMixSetUp {
17 | public:
18 | ControlMixSetUp(const std::string & name,
19 | const std::unordered_map & relativeAbundances);
20 |
21 |
22 | std::string name_;
23 | std::unordered_map rawRelativeAbundances_;
24 | std::unordered_map relativeAbundances_;
25 |
26 | MetaDataInName meta_;
27 |
28 | VecStr getStrains() const;
29 |
30 | void removeStrain(const std::string & name);
31 |
32 |
33 | static std::unordered_map readInSetUps(const bfs::path & mixtureSetUpFnp);
34 |
35 |
36 |
37 | };
38 |
39 | } // namespace njhseq
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/scripts/cppProjectScripts/inProgress/rewrite_includes.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import os, glob, sys
4 |
5 | def fixFile(fnp):
6 | q = open(fnp).read()
7 | with open(fnp, "w") as f:
8 | for line in q.split("\n"):
9 | if line.startswith("#include ",'"')
11 | f.write(line + "\n")
12 |
13 | #d = os.path.dirname(os.path.abspath(__file__))
14 | #d = os.path.join(d, "../")
15 | d = "/home/mjp/njh-cpp/"
16 | src_folders = glob.glob("{d}/src".format(d=d))
17 |
18 | for path in src_folders:
19 | for root, dirs, files in os.walk(path):
20 | for fn in files:
21 | if fn == "main.cpp":
22 | continue
23 | fnp = os.path.join(root, fn)
24 | fnp = os.path.abspath(fnp)
25 | if fnp.endswith(".h") or fnp.endswith(".hpp") or fnp.endswith(".cpp"):
26 | fixFile(fnp)
27 | else:
28 | continue
29 |
--------------------------------------------------------------------------------
/scripts/setUpScripts/installEtc.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import shutil, os, argparse, sys, stat, fnmatch
4 |
5 | def parse_args():
6 | parser = argparse.ArgumentParser()
7 | parser.add_argument('-etcFolder', type=str, required =True)
8 | parser.add_argument('-dest', type=str, required =True)
9 | parser.add_argument('-rmDir', action = "store_true", help = "Remove directory first")
10 | return parser.parse_args()
11 |
12 | def main():
13 | args = parse_args()
14 | allDirs = [x for x in os.walk(args.etcFolder)]
15 | installEtcDest = os.path.join(args.dest,"etc");
16 | for dInfo in allDirs:
17 | newDirName = dInfo[0].replace(args.etcFolder.rstrip('/'), installEtcDest.rstrip('/'))
18 | #print newDirName
19 | if not os.path.exists(newDirName):
20 | os.mkdir(newDirName)
21 | elif args.rmDir:
22 | shutil.rmtree(newDirName)
23 | os.mkdir(newDirName)
24 | for f in dInfo[2]:
25 | shutil.copy(os.path.join(dInfo[0], f), os.path.join(newDirName, f))
26 | main()
27 |
--------------------------------------------------------------------------------
/scripts/setUpScripts/installHeaders.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import shutil, os, argparse, sys, stat, fnmatch
4 |
5 | def parse_args():
6 | parser = argparse.ArgumentParser()
7 | parser.add_argument('-src', type=str, nargs=1, required =True)
8 | parser.add_argument('-dest', type=str, nargs=1, required =True)
9 | parser.add_argument('-rmDir', action = "store_true", help = "Remove directory first")
10 | return parser.parse_args()
11 |
12 | def main():
13 | args = parse_args()
14 | allDirs = [x for x in os.walk(args.src[0])]
15 | for dInfo in allDirs:
16 | newDirName = dInfo[0].replace(args.src[0].rstrip('/'), args.dest[0].rstrip('/'))
17 | #print newDirName
18 | if not os.path.exists(newDirName):
19 | os.mkdir(newDirName)
20 | elif args.rmDir:
21 | shutil.rmtree(newDirName)
22 | os.mkdir(newDirName)
23 | for f in dInfo[2]:
24 | if fnmatch.fnmatch(f, '*.h*'):
25 | shutil.copy(os.path.join(dInfo[0], f), os.path.join(newDirName, f))
26 |
27 | main()
28 |
--------------------------------------------------------------------------------
/scripts/cppProjectScripts/inProgress/split_hpp.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import os, glob, sys, re
4 |
5 | def process(fnp):
6 | fn, ext = os.path.splitext(fnp)
7 | fn_cpp = os.path.basename(fn) + ".cpp"
8 |
9 | s = open(fnp, 'r').read()
10 | match = re.search(r"""(?s)(.*
11 | class.*\};)
12 | (.*)""", s)
13 | if match:
14 | header = match.group(1)
15 | cpp = match.group(2)
16 | else:
17 | return
18 |
19 | with open(fnp, 'w') as f:
20 | f.write(header)
21 | with open(fn + ".cpp", 'w') as f:
22 | f.write('#include "' + os.path.basename(fnp) + '"\n')
23 | f.write(cpp)
24 |
25 | #d = os.path.dirname(os.path.abspath(__file__))
26 | #d = os.path.join(d, "../")
27 | d = "/home/mjp//njh-cpp"
28 | src_folders = glob.glob("{d}/src".format(d=d))
29 |
30 | for path in src_folders:
31 | for root, dirs, files in os.walk(path):
32 | for fn in files:
33 | fnp = os.path.join(root, fn)
34 | fnp = os.path.abspath(fnp)
35 | if fnp.endswith(".h") or fnp.endswith(".hpp"):
36 | print(fnp)
37 | process(fnp)
38 |
--------------------------------------------------------------------------------
/src/SeekDeep/objects/TarAmpSetupUtils/SampleFileNameGenerator.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | /*
4 | * SampleFileNameGenerator.hpp
5 | *
6 | * Created on: Jan 16, 2020
7 | * Author: nicholashathaway
8 | */
9 |
10 |
11 |
12 | #include
13 |
14 | #include "SeekDeep/objects/TarAmpSetupUtils/PrimersAndMids.hpp"
15 |
16 |
17 | namespace njhseq {
18 |
19 |
20 |
21 | class SampleFileNameGenerator{
22 | public:
23 |
24 | SampleFileNameGenerator(const bfs::path & idFnp, const bfs::path sampleFnp, bool noBarcodes = false);
25 |
26 | bfs::path idFnp_;
27 | bfs::path sampleFnp_;
28 | std::shared_ptr ids_;
29 |
30 | bool noBarcodes_;
31 | bool hasRBarcode_{false};
32 | std::map> barcodesByNamePerLibraryPerSample_;
33 | std::map> namesToBarcodes_;
34 | std::map libraryFilesForSample_;
35 |
36 |
37 | void writeSampleNameFile(const OutOptions & sampleNamesOutOpts);
38 | void writeBarcodePrimerFile(const OutOptions & idFileOutOpts);
39 |
40 | };
41 |
42 |
43 |
44 |
45 | } // namespace njhseq
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepProgram/SeekDeepSetUp.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // SeekDeep - A library for analyzing amplicon sequence data
3 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
4 | // Jeffrey Bailey
5 | //
6 | // This file is part of SeekDeep.
7 | //
8 | // SeekDeep is free software: you can redistribute it and/or modify
9 | // it under the terms of the GNU General Public License as published by
10 | // the Free Software Foundation, either version 3 of the License, or
11 | // (at your option) any later version.
12 | //
13 | // SeekDeep is distributed in the hope that it will be useful,
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | // GNU General Public License for more details.
17 | //
18 | // You should have received a copy of the GNU General Public License
19 | // along with SeekDeep. If not, see .
20 | //
21 | //
22 | #include "SeekDeepSetUp.hpp"
23 | #include
24 | namespace njhseq {
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | } // namespace njhseq
36 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | /*
3 | * programs.h
4 | *
5 | * Created on: Jan 28, 2015
6 | * Author: nickhathaway
7 | */
8 | //
9 | // SeekDeep - A library for analyzing amplicon sequence data
10 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
11 | // Jeffrey Bailey
12 | //
13 | // This file is part of SeekDeep.
14 | //
15 | // SeekDeep is free software: you can redistribute it and/or modify
16 | // it under the terms of the GNU General Public License as published by
17 | // the Free Software Foundation, either version 3 of the License, or
18 | // (at your option) any later version.
19 | //
20 | // SeekDeep is distributed in the hope that it will be useful,
21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | // GNU General Public License for more details.
24 | //
25 | // You should have received a copy of the GNU General Public License
26 | // along with SeekDeep. If not, see .
27 | //
28 |
29 |
30 | #include "SeekDeepPrograms/SeekDeepProgram.h"
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/SeekDeep/parameters.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | /*
4 | * parameters.h
5 | *
6 | * Created on: Nov 25, 2016
7 | * Author: nick
8 | */
9 |
10 | //
11 | // SeekDeep - A library for analyzing amplicon sequence data
12 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
13 | // Jeffrey Bailey
14 | //
15 | // This file is part of SeekDeep.
16 | //
17 | // SeekDeep is free software: you can redistribute it and/or modify
18 | // it under the terms of the GNU General Public License as published by
19 | // the Free Software Foundation, either version 3 of the License, or
20 | // (at your option) any later version.
21 | //
22 | // SeekDeep is distributed in the hope that it will be useful,
23 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | // GNU General Public License for more details.
26 | //
27 | // You should have received a copy of the GNU General Public License
28 | // along with SeekDeep. If not, see .
29 | //
30 |
31 |
32 |
33 |
34 |
35 | #include "SeekDeep/parameters/setUpPars.hpp"
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/SeekDeep/server.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | /*
3 | * server.hpp
4 | *
5 | * Created on: Jun 24, 2015
6 | * Author: nick
7 | */
8 | //
9 | // SeekDeep - A library for analyzing amplicon sequence data
10 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
11 | // Jeffrey Bailey
12 | //
13 | // This file is part of SeekDeep.
14 | //
15 | // SeekDeep is free software: you can redistribute it and/or modify
16 | // it under the terms of the GNU General Public License as published by
17 | // the Free Software Foundation, either version 3 of the License, or
18 | // (at your option) any later version.
19 | //
20 | // SeekDeep is distributed in the hope that it will be useful,
21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | // GNU General Public License for more details.
24 | //
25 | // You should have received a copy of the GNU General Public License
26 | // along with SeekDeep. If not, see .
27 | //
28 |
29 |
30 | #include "SeekDeep/server/PopClusProject.hpp"
31 | #include "SeekDeep/server/pcv.hpp"
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepServerRunner.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | /*
4 | * ServerRunner.h
5 | *
6 | * Created on: Nov 25, 2016
7 | * Author: nick
8 | */
9 | //
10 | // SeekDeep - A library for analyzing amplicon sequence data
11 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
12 | // Jeffrey Bailey
13 | //
14 | // This file is part of SeekDeep.
15 | //
16 | // SeekDeep is free software: you can redistribute it and/or modify
17 | // it under the terms of the GNU General Public License as published by
18 | // the Free Software Foundation, either version 3 of the License, or
19 | // (at your option) any later version.
20 | //
21 | // SeekDeep is distributed in the hope that it will be useful,
22 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | // GNU General Public License for more details.
25 | //
26 | // You should have received a copy of the GNU General Public License
27 | // along with SeekDeep. If not, see .
28 | //
29 |
30 |
31 |
32 | #include "SeekDeepPrograms/SeekDeepServer/SeekDeepServerRunner.hpp"
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepUtils/SeekDeepUtilsSetUp.cpp:
--------------------------------------------------------------------------------
1 |
2 | // SeekDeepUtilsSetUp.cpp
3 | //
4 | // Created by Nick Hathaway on 2015/06/24.
5 | //
6 | //
7 | // SeekDeep - A library for analyzing amplicon sequence data
8 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
9 | // Jeffrey Bailey
10 | //
11 | // This file is part of SeekDeep.
12 | //
13 | // SeekDeep is free software: you can redistribute it and/or modify
14 | // it under the terms of the GNU General Public License as published by
15 | // the Free Software Foundation, either version 3 of the License, or
16 | // (at your option) any later version.
17 | //
18 | // SeekDeep is distributed in the hope that it will be useful,
19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | // GNU General Public License for more details.
22 | //
23 | // You should have received a copy of the GNU General Public License
24 | // along with SeekDeep. If not, see .
25 | //
26 | //
27 | #include "SeekDeepUtilsSetUp.hpp"
28 |
29 |
30 | namespace njhseq {
31 |
32 | } // namespace njhseq
33 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepProgram.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 | // SeekDeep.h
4 | //
5 | // Created by Nicholas Hathaway on 10/24/13.
6 | //
7 | //
8 | // SeekDeep - A library for analyzing amplicon sequence data
9 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
10 | // Jeffrey Bailey
11 | //
12 | // This file is part of SeekDeep.
13 | //
14 | // SeekDeep is free software: you can redistribute it and/or modify
15 | // it under the terms of the GNU General Public License as published by
16 | // the Free Software Foundation, either version 3 of the License, or
17 | // (at your option) any later version.
18 | //
19 | // SeekDeep is distributed in the hope that it will be useful,
20 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | // GNU General Public License for more details.
23 | //
24 | // You should have received a copy of the GNU General Public License
25 | // along with SeekDeep. If not, see .
26 | //
27 | //
28 | #include "SeekDeepPrograms/SeekDeepProgram/SeekDeepSetUp.hpp"
29 | #include "SeekDeepPrograms/SeekDeepProgram/SeekDeepRunner.hpp"
30 |
--------------------------------------------------------------------------------
/src/SeekDeep.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | /*
3 | * SeekDeep.h
4 | *
5 | * Created on: Jan 28, 2015
6 | * Author: nickhathaway
7 | */
8 | //
9 | // SeekDeep - A library for analyzing amplicon sequence data
10 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
11 | // Jeffrey Bailey
12 | //
13 | // This file is part of SeekDeep.
14 | //
15 | // SeekDeep is free software: you can redistribute it and/or modify
16 | // it under the terms of the GNU General Public License as published by
17 | // the Free Software Foundation, either version 3 of the License, or
18 | // (at your option) any later version.
19 | //
20 | // SeekDeep is distributed in the hope that it will be useful,
21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | // GNU General Public License for more details.
24 | //
25 | // You should have received a copy of the GNU General Public License
26 | // along with SeekDeep. If not, see .
27 | //
28 |
29 |
30 | #include "SeekDeep/server.h"
31 | #include "SeekDeep/parameters.h"
32 | #include "SeekDeep/objects.h"
33 | #include "SeekDeep/utils.h"
34 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepServer/SeekDeepServerSetUp.cpp:
--------------------------------------------------------------------------------
1 |
2 | // ServerRunnerSetUp.cpp
3 | //
4 | // Created by Nick Hathaway on 2015/06/24.
5 | //
6 | //
7 | // SeekDeep - A library for analyzing amplicon sequence data
8 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
9 | // Jeffrey Bailey
10 | //
11 | // This file is part of SeekDeep.
12 | //
13 | // SeekDeep is free software: you can redistribute it and/or modify
14 | // it under the terms of the GNU General Public License as published by
15 | // the Free Software Foundation, either version 3 of the License, or
16 | // (at your option) any later version.
17 | //
18 | // SeekDeep is distributed in the hope that it will be useful,
19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | // GNU General Public License for more details.
22 | //
23 | // You should have received a copy of the GNU General Public License
24 | // along with SeekDeep. If not, see .
25 | //
26 | #include "../SeekDeepServer/SeekDeepServerSetUp.hpp"
27 |
28 |
29 | namespace njhseq {
30 |
31 | } // namespace njhseq
32 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepUtils.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 |
4 | // SeekDeepUtils.h
5 | //
6 | // Created by Nick Hathaway on 2015/06/24.
7 | //
8 | //
9 | // SeekDeep - A library for analyzing amplicon sequence data
10 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
11 | // Jeffrey Bailey
12 | //
13 | // This file is part of SeekDeep.
14 | //
15 | // SeekDeep is free software: you can redistribute it and/or modify
16 | // it under the terms of the GNU General Public License as published by
17 | // the Free Software Foundation, either version 3 of the License, or
18 | // (at your option) any later version.
19 | //
20 | // SeekDeep is distributed in the hope that it will be useful,
21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | // GNU General Public License for more details.
24 | //
25 | // You should have received a copy of the GNU General Public License
26 | // along with SeekDeep. If not, see .
27 | //
28 | #include "SeekDeepPrograms/SeekDeepUtils/SeekDeepUtilsSetUp.hpp"
29 | #include "SeekDeepPrograms/SeekDeepUtils/SeekDeepUtilsRunner.hpp"
30 |
--------------------------------------------------------------------------------
/src/SeekDeep/objects.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | /*
4 | * objects.h
5 | *
6 | * Created on: Nov 25, 2016
7 | * Author: nick
8 | */
9 | //
10 | // SeekDeep - A library for analyzing amplicon sequence data
11 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
12 | // Jeffrey Bailey
13 | //
14 | // This file is part of SeekDeep.
15 | //
16 | // SeekDeep is free software: you can redistribute it and/or modify
17 | // it under the terms of the GNU General Public License as published by
18 | // the Free Software Foundation, either version 3 of the License, or
19 | // (at your option) any later version.
20 | //
21 | // SeekDeep is distributed in the hope that it will be useful,
22 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | // GNU General Public License for more details.
25 | //
26 | // You should have received a copy of the GNU General Public License
27 | // along with SeekDeep. If not, see .
28 | //
29 |
30 |
31 |
32 | #include "SeekDeep/objects/ControlBenchmarking.h"
33 | #include "SeekDeep/objects/TarAmpSetupUtils.h"
34 | #include "SeekDeep/objects/IlluminaUtils.h"
35 |
36 |
--------------------------------------------------------------------------------
/etc/bash_completion.d/SeekDeep:
--------------------------------------------------------------------------------
1 | _bibCppTools()
2 | {
3 | local cur prev opts base
4 | COMPREPLY=()
5 | cur="${COMP_WORDS[COMP_CWORD]}"
6 | prev="${COMP_WORDS[COMP_CWORD-1]}"
7 | if [[ $COMP_CWORD -lt 2 ]] ; then
8 | opts=$(for x in `${COMP_WORDS[0]} | grep ")" | sed "s/.*) //g"`; do echo ${x} ; done )
9 | COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
10 | elif [[ ${cur} == -* ]]; then
11 | if [[ ${COMP_WORDS[1]} == batch* ]]; then
12 | rest="${COMP_WORDS[@]:1:${#COMP_WORDS[@]} }"
13 | if [[ $rest != *"-getFlags"* ]]; then
14 | rest="$rest -getFlags"
15 | fi
16 | newopts=$(${COMP_WORDS[0]} $rest | column -t | cut -f 1 -d " " | cut -f 1 -d ,)
17 | COMPREPLY=( $(compgen -W "${newopts}" -- ${cur}) )
18 | else
19 | newopts=$(${COMP_WORDS[0]} ${COMP_WORDS[1]} -getFlags | column -t | cut -f 1 -d " " | cut -f 1 -d ,)
20 | COMPREPLY=( $(compgen -W "${newopts}" -- ${cur}) )
21 | fi
22 | else
23 | if [[ ${prev} == -run ]]; then
24 | opts=$(for x in `${COMP_WORDS[0]} | grep ")" | sed "s/.*) //g"`; do echo ${x} ; done )
25 | COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
26 | else
27 | _filedir
28 | fi
29 | fi
30 | return 0
31 | }
32 |
33 | complete -F _bibCppTools SeekDeep
34 | complete -F _bibCppTools SeekDeepDev
35 |
36 |
37 |
--------------------------------------------------------------------------------
/scripts/cppProjectScripts/inProgress/fix_pragma_once.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python2
2 |
3 | import os, glob, sys
4 |
5 | po = "#pragma once"
6 |
7 | def is_header(fn):
8 | fn = fn.lower()
9 | if fn.endswith(".h") or fn.endswith(".hpp"):
10 | return True
11 | return False
12 |
13 | def fixFile(fnp):
14 | q = open(fnp).read()
15 | with open(fnp, "w") as f:
16 | f.write(po + "\n")
17 | for line in q.split("\n"):
18 | if line.startswith("#define") or line.startswith("#ifndef"):
19 | print line
20 | continue
21 | if line.startswith("#endif"):
22 | print line
23 | continue
24 | f.write(line + "\n")
25 |
26 | d = os.path.dirname(os.path.abspath(__file__))
27 | d = os.path.join(d, "../")
28 | src_folders = glob.glob("{d}/src".format(d=d))
29 |
30 | for path in src_folders:
31 | for root, dirs, files in os.walk(path):
32 | for fn in files:
33 | if not is_header(fn):
34 | continue
35 | fnp = os.path.join(root, fn)
36 | fnp = os.path.abspath(fnp)
37 | firstline = open(fnp).readline().rstrip()
38 | if po != firstline:
39 | print "fixing", fnp
40 | fixFile(fnp)
41 |
42 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepUtils/SeekDeepUtilsSetUp.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 |
4 | // SeekDeepUtilsSetUp.hpp
5 | //
6 | // Created by Nick Hathaway on 2015/06/24.
7 | //
8 | // SeekDeep - A library for analyzing amplicon sequence data
9 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
10 | // Jeffrey Bailey
11 | //
12 | // This file is part of SeekDeep.
13 | //
14 | // SeekDeep is free software: you can redistribute it and/or modify
15 | // it under the terms of the GNU General Public License as published by
16 | // the Free Software Foundation, either version 3 of the License, or
17 | // (at your option) any later version.
18 | //
19 | // SeekDeep is distributed in the hope that it will be useful,
20 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | // GNU General Public License for more details.
23 | //
24 | // You should have received a copy of the GNU General Public License
25 | // along with SeekDeep. If not, see .
26 | //
27 | //
28 | #include
29 | #include
30 | //#include
31 | namespace njhseq {
32 |
33 | class SeekDeepUtilsSetUp : public seqSetUp {
34 |
35 | public:
36 | using seqSetUp::seqSetUp;
37 | };
38 | } // namespace njhseq
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepServer/SeekDeepServerSetUp.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 |
4 | // ServerRunnerSetUp.hpp
5 | //
6 | // Created by Nick Hathaway on 2015/06/24.
7 | //
8 | //
9 | // SeekDeep - A library for analyzing amplicon sequence data
10 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
11 | // Jeffrey Bailey
12 | //
13 | // This file is part of SeekDeep.
14 | //
15 | // SeekDeep is free software: you can redistribute it and/or modify
16 | // it under the terms of the GNU General Public License as published by
17 | // the Free Software Foundation, either version 3 of the License, or
18 | // (at your option) any later version.
19 | //
20 | // SeekDeep is distributed in the hope that it will be useful,
21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | // GNU General Public License for more details.
24 | //
25 | // You should have received a copy of the GNU General Public License
26 | // along with SeekDeep. If not, see .
27 | //
28 | //
29 | #include
30 | #include
31 | #include
32 | namespace njhseq {
33 |
34 | class SeekDeepServerSetUp : public seqSetUp {
35 |
36 | public:
37 | using seqSetUp::seqSetUp;
38 | };
39 | } // namespace njhseq
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/SeekDeep/utils/extractTargetsFromGenomes.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | /*
3 | * extractTargetsFromGenomes.hpp
4 | *
5 | * Created on: Aug 29, 2018
6 | * Author: nick
7 | */
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #include "SeekDeep/objects/TarAmpSetupUtils/PrimersAndMids.hpp"
14 |
15 |
16 | namespace njhseq {
17 |
18 | struct extractBetweenSeqsPars{
19 | MultiGenomeMapper::inputParameters pars;
20 | std::string gffExtraAttributesStr = "description";
21 | bfs::path primersFile = "";
22 | std::string forwardPrimer = "";
23 | std::string reversePrimer = "";
24 | std::string targetName = "";
25 | uint32_t errors = 0;
26 | uint32_t sizeLimit = 1000;
27 | uint32_t lenCutOffSizeExpand = 20;
28 | uint32_t pairedEndLength = std::numeric_limits::max();
29 | uint32_t barcodeSize = 0;
30 |
31 | bool shortNames = false;
32 | std::string selectedGenomesStr = "";
33 | bool writeOutAllSeqsFile = false;
34 | bool removeRefAlignments = false;
35 | njh::files::MkdirPar outputDirPars{"extractedRegions_TODAY"};
36 | bool verbose_ = false;
37 | bool debug_ = false;
38 |
39 | void setUpCoreOptions(seqSetUp & setUp, bool needReadLength = false);
40 |
41 | };
42 |
43 | void extractBetweenSeqs(const PrimersAndMids & ids,
44 | const extractBetweenSeqsPars & extractPars);
45 |
46 | } // namespace njhseq
47 |
48 |
49 |
--------------------------------------------------------------------------------
/scripts/parseHeader.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import shutil, os, argparse, sys, stat
4 | import CppHeaderParser
5 | sys.path.append(os.path.join(os.path.dirname(__file__), "pyUtils"))
6 | from color_text import ColorText as CT
7 |
8 | def parse_args():
9 | parser = argparse.ArgumentParser()
10 | parser.add_argument('--file', type=str, required = True)
11 | return parser.parse_args()
12 |
13 | def main():
14 | args = parse_args()
15 | try:
16 | cppHeader = CppHeaderParser.CppHeader(args.file)
17 | except CppHeaderParser.CppParseError as e:
18 | print(e)
19 | sys.exit(1)
20 |
21 | print(CT.boldBlack("Class public methods"))
22 | for k in list(cppHeader.classes.keys()):
23 | print(CT.boldBlack(k))
24 | for i in range(len(cppHeader.classes[k]["methods"]["public"])):
25 | print("\t",cppHeader.classes[k]["methods"]["public"][i]["name"])
26 | print("")
27 | print(CT.boldBlack("Includes"))
28 | for include in cppHeader.includes:
29 | if "//" in include:
30 | print("\t" + include[0:include.find("//")].strip())
31 | elif "/*" in include:
32 | print("\t" + include[0:include.find("/*")].strip())
33 | else:
34 | print("\t" + include)
35 |
36 | print(("\n" + CT.boldBlack("Free functions are:")))
37 | for func in cppHeader.functions:
38 | print(("\t%s"%func["name"]))
39 | main()
40 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepServer/SeekDeepServerRunner.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 |
4 | // ServerRunner.hpp
5 | //
6 | // Created by Nick Hathaway on 2015/06/24.
7 | //
8 | //
9 | // SeekDeep - A library for analyzing amplicon sequence data
10 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
11 | // Jeffrey Bailey
12 | //
13 | // This file is part of SeekDeep.
14 | //
15 | // SeekDeep is free software: you can redistribute it and/or modify
16 | // it under the terms of the GNU General Public License as published by
17 | // the Free Software Foundation, either version 3 of the License, or
18 | // (at your option) any later version.
19 | //
20 | // SeekDeep is distributed in the hope that it will be useful,
21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | // GNU General Public License for more details.
24 | //
25 | // You should have received a copy of the GNU General Public License
26 | // along with SeekDeep. If not, see .
27 | //
28 | //
29 | #include "SeekDeepServerSetUp.hpp"
30 | #include "SeekDeep/server.h"
31 |
32 |
33 | namespace njhseq {
34 |
35 | class SeekDeepServerRunner : public njh::progutils::ProgramRunner {
36 | public:
37 | SeekDeepServerRunner();
38 |
39 | static int genProjectConfig(const njh::progutils::CmdArgs & inputCommands);
40 | static int popClusteringViewer(const njh::progutils::CmdArgs & inputCommands);
41 |
42 |
43 | };
44 |
45 | } // namespace njhseq
46 |
--------------------------------------------------------------------------------
/scripts/cppProjectScripts/copySetUpFiles.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 |
4 | import shutil, os, argparse, sys
5 | from shutil import ignore_patterns
6 |
7 |
8 |
9 | def copyDir(src, dist, overWrite):
10 | if(os.path.isdir(dist)):
11 | if(overWrite):
12 | shutil.rmtree(dist)
13 | else:
14 | print("Error, directory " + str(dist) + " already exist, set overwrite to overwrite dir")
15 | exit(1)
16 | shutil.copytree(src, dist, ignore=ignore_patterns('*.pyc', '*~', '.*'))
17 |
18 |
19 | def copySetUp(cwDir, distDir, overWrite=False):
20 | if(os.path.isfile(os.path.join(distDir, "setup.py"))):
21 | if(overWrite):
22 | shutil.copy(os.path.join(cwDir, "setup.py"), os.path.join(distDir, "setup.py"))
23 | else:
24 | print("Error, file " + os.path.join(distDir, "setup.py") + " already exist, set overwrite to overwrite setup.py")
25 | exit(1)
26 | else:
27 | shutil.copy(os.path.join(cwDir, "setup.py"), os.path.join(distDir, "setup.py"))
28 | copyDir(os.path.join(cwDir + "scripts"), os.path.join(distDir,"scripts"), overWrite)
29 |
30 |
31 | def parse_args():
32 | parser = argparse.ArgumentParser()
33 | parser.add_argument('-from',dest = "fromDir", type=str, nargs=1, required =True)
34 | parser.add_argument('-to', type=str, nargs=1, required =True)
35 | parser.add_argument('-overWrite', dest = 'overWrite', action = 'store_true' )
36 | return parser.parse_args()
37 |
38 | def main():
39 | args = parse_args()
40 | for t in args.to[0].split(","):
41 | copySetUp(args.fromDir[0],t, args.overWrite)
42 |
43 | main()
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepProgram/SeekDeepSetUp.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 | // SeekDeepSetUp.hpp
4 | //
5 | // Created by Nicholas Hathaway on 10/24/13.
6 | //
7 | // SeekDeep - A library for analyzing amplicon sequence data
8 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
9 | // Jeffrey Bailey
10 | //
11 | // This file is part of SeekDeep.
12 | //
13 | // SeekDeep is free software: you can redistribute it and/or modify
14 | // it under the terms of the GNU General Public License as published by
15 | // the Free Software Foundation, either version 3 of the License, or
16 | // (at your option) any later version.
17 | //
18 | // SeekDeep is distributed in the hope that it will be useful,
19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | // GNU General Public License for more details.
22 | //
23 | // You should have received a copy of the GNU General Public License
24 | // along with SeekDeep. If not, see .
25 | //
26 | #include
27 | #include
28 |
29 | #include "SeekDeep.h"
30 |
31 | namespace njhseq {
32 |
33 |
34 |
35 | class SeekDeepSetUp : public seqSetUp {
36 |
37 | public:
38 | using seqSetUp::seqSetUp;
39 |
40 | void setUpExtractorPairedEnd(ExtractorPairedEndPars & pars);
41 | void setUpExtractor(extractorPars & pars);
42 | void setUpClusterDown(clusterDownPars & pars);
43 | void setUpMultipleSampleCluster(processClustersPars & pars);
44 | void setUpMakeSampleDirectories(makeSampleDirectoriesPars & pars);
45 |
46 | };
47 | } // namespace njhseq
48 |
49 |
50 |
--------------------------------------------------------------------------------
/src/SeekDeep/objects/IlluminaUtils/ReadPairsOrganizer.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | /*
3 | * ReadPairsOrganizer.hpp
4 | *
5 | * Created on: Jan 23, 2017
6 | * Author: nick
7 | */
8 | //
9 | // SeekDeep - A library for analyzing amplicon sequence data
10 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
11 | // Jeffrey Bailey
12 | //
13 | // This file is part of SeekDeep.
14 | //
15 | // SeekDeep is free software: you can redistribute it and/or modify
16 | // it under the terms of the GNU General Public License as published by
17 | // the Free Software Foundation, either version 3 of the License, or
18 | // (at your option) any later version.
19 | //
20 | // SeekDeep is distributed in the hope that it will be useful,
21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | // GNU General Public License for more details.
24 | //
25 | // You should have received a copy of the GNU General Public License
26 | // along with SeekDeep. If not, see .
27 | //
28 |
29 |
30 | #include
31 |
32 |
33 | namespace njhseq {
34 |
35 |
36 |
37 | class ReadPairsOrganizer {
38 | public:
39 | ReadPairsOrganizer(const VecStr & expectedSamples);
40 |
41 | VecStr expectedSamples_;
42 | bool doNotGuessSampleNames_{false};
43 | static std::regex illuminaPat_;
44 |
45 | std::map readPairs_;
46 | std::map readPairsUnrecognized_;
47 |
48 | void processFiles(const std::map & files);
49 | std::map> processReadPairs();
50 | };
51 |
52 |
53 | } // namespace njhseq
54 |
--------------------------------------------------------------------------------
/etc/serverResources/pcv/groupInfoPage.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function(){
2 | //get current name from window location
3 | var locSplit = window.location.toString().split(/[\/]+/);
4 | var rName = locSplit[2];
5 | var projectName = locSplit[4];
6 | var groupName = locSplit.pop();
7 | var infoUrls = getNameUrls(projectName);
8 | var gifLoading = prsentDivGifLoading();
9 | Promise.all(infoUrls.map(getJSON)).then(function(projNames) {
10 | addDiv("body", "topNav");
11 | var names = {shortName:projectName};
12 | projNames.map(function(name){$.extend(names,name);});
13 | createProjectNavBar("#topNav", names);
14 | addMainDiv("body", true);
15 | setHeadTitle(names["shortName"] + " " + groupName);
16 | $("#jumboTitle").html(names["projectName"] + " " + groupName);
17 | addPanelWithDiv("#mainContent","sampLinks", "See Group");
18 | addPanelOnlyHead("#mainContent", "Population Infomation Table");
19 | addDiv("#mainContent", "popTable");
20 | //get group names
21 |
22 | getJSON("/" + rName + "/groupsPopInfos/" + projectName + "/" + groupName).then(function(groupInfo){
23 | var cols = 10;
24 | var linkPre = "/" + rName + "/groupMainPage/" + projectName + "/" + groupName + "/";
25 | var mouseOverC = "#999";
26 | var mouseLeaveC = "#FFF";
27 | var addTo = "#sampLinks";
28 | createLinksTable(addTo, linkPre, groupInfo["groupNames"],cols, mouseOverC, mouseLeaveC);
29 | //create the population table and populate it
30 | var popTable = new njhTable("#popTable", groupInfo["popInfo"], names["projectName"] + "_" + groupName + "_popInfo", true);
31 | }).catch(logRequestError).then(function() {
32 | //stop loading info
33 | });
34 | }).catch(logRequestError).then(function() {
35 | removeAllDivGifLoading();
36 | //stop loading page
37 | });
38 | });
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepProgram/SeekDeepRunner.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 | // SeekDeep - A library for analyzing amplicon sequence data
4 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
5 | // Jeffrey Bailey
6 | //
7 | // This file is part of SeekDeep.
8 | //
9 | // SeekDeep is free software: you can redistribute it and/or modify
10 | // it under the terms of the GNU General Public License as published by
11 | // the Free Software Foundation, either version 3 of the License, or
12 | // (at your option) any later version.
13 | //
14 | // SeekDeep is distributed in the hope that it will be useful,
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | // GNU General Public License for more details.
18 | //
19 | // You should have received a copy of the GNU General Public License
20 | // along with SeekDeep. If not, see .
21 | //
22 | //
23 | //
24 | // SeekDeepRunner.hpp
25 | //
26 | // Created by Nicholas Hathaway on 10/24/14.
27 | //
28 |
29 |
30 |
31 | //#include
32 | #include "SeekDeepPrograms/SeekDeepProgram/SeekDeepSetUp.hpp"
33 |
34 | namespace njhseq {
35 |
36 | class SeekDeepRunner : public njh::progutils::OneRing {
37 |
38 | public:
39 | SeekDeepRunner();
40 | static int extractor(const njh::progutils::CmdArgs & inputCommands);
41 | static int extractorPairedEnd(const njh::progutils::CmdArgs & inputCommands);
42 | static int clusterDown(const njh::progutils::CmdArgs & inputCommands);
43 | //.cpp
44 | static int processClusters(const njh::progutils::CmdArgs & inputCommands);
45 | static int makeSampleDirectories(const njh::progutils::CmdArgs & inputCommands);
46 | };
47 | } // namespace njhseq
48 |
49 |
--------------------------------------------------------------------------------
/scripts/setUpScripts/generateCompFile.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import shutil, os, argparse, sys, stat
4 | from genFuncs import genHelper
5 |
6 |
7 | def parse_args():
8 | parser = argparse.ArgumentParser()
9 | parser.add_argument('-CC', type=str)
10 | parser.add_argument('-CXX', type=str)
11 | parser.add_argument('-outname', type=str)
12 | parser.add_argument('-outFilename', type=str, required = True)
13 | parser.add_argument('-externalLoc', type=str)
14 | parser.add_argument('-prefix', type=str)
15 | parser.add_argument('-installName', type=str)
16 | parser.add_argument('-neededLibs', type=str)
17 | parser.add_argument('-ldFlags', type=str)
18 | parser.add_argument('-cxxFlags', type=str)
19 | parser.add_argument('-private', action = "store_true", help="Use private repos")
20 | return parser.parse_args()
21 |
22 | def main():
23 | args = parse_args()
24 | CC = genHelper.determineCC(args)
25 | CXX = genHelper.determineCXX(args)
26 | external = "external"
27 | outname = "out"
28 | prefix = "./"
29 | installName = "out"
30 | neededLibs = "none"
31 | ldFlags = ""
32 | cxxFlags = ""
33 | if args.ldFlags and "" != args.ldFlags:
34 | ldFlags = args.ldFlags
35 | if args.cxxFlags and "" != args.cxxFlags:
36 | cxxFlags = args.cxxFlags
37 | if args.externalLoc:
38 | external = args.externalLoc
39 | if args.outname:
40 | outname = args.outname
41 | if args.installName:
42 | installName = args.installName
43 | if args.prefix:
44 | prefix = args.prefix
45 | if args.neededLibs:
46 | neededLibs = args.neededLibs.split(",")
47 | genHelper.generateCompfileFull(args.outFilename, external, CC, CXX, outname, installName, prefix, neededLibs, ldFlags, cxxFlags, args.private)
48 |
49 | main()
50 |
--------------------------------------------------------------------------------
/etc/serverResources/pcv/extractionStats.js:
--------------------------------------------------------------------------------
1 |
2 | $(document).ready(function(){
3 | //get current name from window location
4 | var locSplit = window.location.toString().split(/[\/]+/);
5 | var rName = locSplit[2];
6 | var projectName = locSplit[4];
7 |
8 | var infoUrls = getNameUrls(projectName);
9 | var gifLoading = prsentDivGifLoading();
10 | Promise.all(infoUrls.map(getJSON)).then(function(projNames) {
11 | addDiv("body", "topNav");
12 | var names = {shortName:projectName};
13 | projNames.map(function(name){$.extend(names,name);});
14 | createProjectNavBar("#topNav", names);
15 | addMainDiv("body", true);
16 | setHeadTitle(names["projectName"]);
17 | $("#jumboTitle").html(names["projectName"] + ": Extraction");
18 | //change title to current name
19 | addPanelOnlyHead("#mainContent", "Sample Extraction Information");
20 | addDiv("#mainContent", "profileTable");
21 | //addDiv("#mainContent", "sampNameMenu");
22 | addPanelOnlyHead("#mainContent", "Extraction By File");
23 | addDiv("#mainContent", "statsTable");
24 | var extractionTabsUrl = ["/" + rName + "/getExtractionProfileInfo/" + projectName,
25 | "/" + rName + "/getExtractionStatsInfo/" + projectName];
26 | Promise.all(extractionTabsUrl.map(getJSON)).then(function(extractionTabs) {
27 | var mainProfileInfoTab = extractionTabs[0];
28 | var mainStatsInfoTab = extractionTabs[1];
29 | if(mainProfileInfoTab !== null){
30 | var sampleTable = new njhTable("#profileTable", mainProfileInfoTab, names["projectName"] + "_extractionProfileInfo", true);
31 | var popTable = new njhTable("#statsTable", mainStatsInfoTab, names["projectName"] + "_extractionStatsInfo", true);
32 | }
33 | }).catch(logRequestError).then(function() {
34 | //stop loading
35 | });
36 | }).catch(logRequestError).then(function() {
37 | removeAllDivGifLoading();
38 | //stop loading page
39 | });
40 | });
41 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepProgram/SeekDeepRunner.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // SeekDeep - A library for analyzing amplicon sequence data
3 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
4 | // Jeffrey Bailey
5 | //
6 | // This file is part of SeekDeep.
7 | //
8 | // SeekDeep is free software: you can redistribute it and/or modify
9 | // it under the terms of the GNU General Public License as published by
10 | // the Free Software Foundation, either version 3 of the License, or
11 | // (at your option) any later version.
12 | //
13 | // SeekDeep is distributed in the hope that it will be useful,
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | // GNU General Public License for more details.
17 | //
18 | // You should have received a copy of the GNU General Public License
19 | // along with SeekDeep. If not, see .
20 | //
21 | //
22 | // main.cpp
23 | // SeekDeep
24 | //
25 | // Created by Nicholas Hathaway on 8/11/13.
26 | //
27 | #include "SeekDeepRunner.hpp"
28 | #include
29 | #include
30 | #include "SeekDeepPrograms/SeekDeepUtils.h"
31 |
32 | namespace njhseq {
33 |
34 | SeekDeepRunner::SeekDeepRunner() :
35 | njh::progutils::OneRing(
36 | { addRing(),
37 | addRing()
38 | },
39 | {
40 | addFunc("extractor", extractor, false),
41 | addFunc("extractorPairedEnd", extractorPairedEnd, false),
42 | addFunc("processClusters", processClusters,false),
43 | addFunc("qluster", clusterDown, false),
44 | addFunc("clusterDown",clusterDown, true),
45 | addFunc("makeSampleDirectories", makeSampleDirectories, false)
46 | }, "SeekDeep", "3", "0", "1") {
47 | }
48 |
49 | //
50 |
51 | } // namespace njhseq
52 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepUtils/SampleBarcodeFileToSeekDeepInput.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * SampleBarcodeFileToSeekDeepInput.cpp
3 | *
4 | * Created on: Jan 14, 2020
5 | * Author: nicholashathaway
6 | */
7 |
8 |
9 | #include "SeekDeepUtilsRunner.hpp"
10 |
11 | #include "SeekDeep/objects.h"
12 | #include "SeekDeep/parameters.h"
13 |
14 |
15 |
16 | namespace njhseq {
17 |
18 |
19 | int SeekDeepUtilsRunner::SampleBarcodeFileToSeekDeepInput(
20 | const njh::progutils::CmdArgs & inputCommands) {
21 | bfs::path idFnp = "";
22 | bfs::path sampleFnp = "";
23 | OutOptions outStub(bfs::path("out"));
24 | seqSetUp setUp(inputCommands);
25 | setUp.setOption(idFnp, "--id", "SeekDeep primers file, 3 columns 1)target,2)forward,3)reverse", true);
26 | setUp.setOption(sampleFnp, "--sampleFnp", "Sample file 3 or 4 required columns 1)library,2)sample,3)fbarcode,4(optional))rbarcode."
27 | "\n\t\t\t1) name of input file without extension/illumina info e.g. Sample1 for Sample1_S2_R1_001.fastq.gz"
28 | "\n\t\t\t2) sample name to be given to this barcode in this sample"
29 | "\n\t\t\t3) barcode sequence associated with forward primer"
30 | "\n\t\t\t4) if sample is dual barcoded, barcode associated with reverse primer", true);
31 | setUp.processWritingOptions(outStub);
32 | setUp.finishSetUp(std::cout);
33 | setUp.startARunLog(setUp.pars_.directoryName_);
34 |
35 | //
36 | SampleFileNameGenerator fileGen(idFnp, sampleFnp);
37 |
38 | //sample name file
39 | OutOptions sampleNamesOutOpts(outStub.outFilename_.string(), "_sampleNames.tab.txt");
40 | sampleNamesOutOpts.transferOverwriteOpts(outStub);
41 | fileGen.writeSampleNameFile(sampleNamesOutOpts);
42 |
43 | //barcode/primer file
44 | OutOptions idFileOutOpts(outStub.outFilename_.string(), "_ids.tab.txt");
45 | idFileOutOpts.transferOverwriteOpts(outStub);
46 | fileGen.writeBarcodePrimerFile(idFileOutOpts);
47 |
48 |
49 | return 0;
50 | }
51 |
52 | } // namespace njhseq
53 |
54 |
--------------------------------------------------------------------------------
/src/SeekDeep/objects/IlluminaUtils/IlluminaNameFormatDecoder.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | /*
4 | * IlluminaNameFormatDecoder.hpp
5 | *
6 | * Created on: Jul 8, 2019
7 | * Author: nicholashathaway
8 | */
9 |
10 |
11 | #include
12 | namespace njhseq {
13 |
14 | class IlluminaNameFormatDecoder{
15 | public:
16 |
17 | IlluminaNameFormatDecoder(const std::string & name,
18 | const std::string nameRegPat, const uint32_t sampleNumberPos) : name_(name) ,
19 | nameRegPat_(nameRegPat), sampleNumberPos_(sampleNumberPos) {
20 | std::regex_match(name_, match_, nameRegPat_);
21 | }
22 |
23 | IlluminaNameFormatDecoder(const std::string & name):
24 | IlluminaNameFormatDecoder(name, DefaultNameRegPatStr_,
25 | DefaultSampleNumberPos_) {
26 | }
27 |
28 | IlluminaNameFormatDecoder(const IlluminaNameFormatDecoder & other): name_(other.name_) ,
29 | nameRegPat_(other.nameRegPat_), sampleNumberPos_(other.sampleNumberPos_) {
30 | std::regex_match(name_, match_, nameRegPat_);
31 | }
32 |
33 | static std::string DefaultNameRegPatStr_;
34 | static uint32_t DefaultSampleNumberPos_;
35 |
36 | const std::string name_;
37 | std::regex nameRegPat_;
38 | uint32_t sampleNumberPos_;
39 |
40 | std::smatch match_;
41 |
42 | /** index in match to what value in the illumina
43 | * 0 full name
44 | * 1
45 | * 2
46 | * 3
47 | * 4
48 | * 5
49 | * 6
50 | * 7
51 | * space
52 | * 8 (1 or 2 for first mate or second match)
53 | * 9 Y or N for yes or no
54 | *10
55 | *11 barcode normally eg AGGCGT
56 | */
57 |
58 | std::string getIndexValue(uint32_t idx) const{
59 | if(idx ,
4 | // Jeffrey Bailey
5 | //
6 | // This file is part of SeekDeep.
7 | //
8 | // SeekDeep is free software: you can redistribute it and/or modify
9 | // it under the terms of the GNU General Public License as published by
10 | // the Free Software Foundation, either version 3 of the License, or
11 | // (at your option) any later version.
12 | //
13 | // SeekDeep is distributed in the hope that it will be useful,
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | // GNU General Public License for more details.
17 | //
18 | // You should have received a copy of the GNU General Public License
19 | // along with SeekDeep. If not, see .
20 | //
21 | //
22 | // main.cpp
23 | // SeekDeep
24 | //
25 | // Created by Nicholas Hathaway on 8/11/13.
26 | //
27 | #include "SeekDeepPrograms/SeekDeepProgram/SeekDeepRunner.hpp"
28 |
29 |
30 | namespace njhseq {
31 |
32 | int SeekDeepRunner::makeSampleDirectories(const njh::progutils::CmdArgs & inputCommands) {
33 | SeekDeepSetUp setUp(inputCommands);
34 | makeSampleDirectoriesPars pars;
35 |
36 | setUp.setUpMakeSampleDirectories(pars);
37 | setUp.startARunLog(setUp.pars_.directoryName_);
38 |
39 | setUpSampleDirs(pars.sampleNameFilename.string(), setUp.pars_.directoryName_, pars.separatedDirs);
40 | auto inputInfoDirPath = njh::files::make_path(setUp.pars_.directoryName_, "inputInfo");
41 | njh::files::makeDir(njh::files::MkdirPar(inputInfoDirPath.string()));
42 | bfs::copy_file(pars.sampleNameFilename, njh::files::make_path(inputInfoDirPath, "inputSampleNames.tab.txt"));
43 |
44 | if(setUp.pars_.verbose_){
45 | setUp.logRunTime(std::cout);
46 | }
47 | return 0;
48 | }
49 |
50 | } // namespace njhseq
51 |
--------------------------------------------------------------------------------
/scripts/setUpScripts/njhConfigure.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import shutil, os, argparse, sys, stat
4 | sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyUtils"))
5 |
6 | from utils import Utils
7 | from genFuncs import genHelper
8 |
9 | def parse_args():
10 | parser = argparse.ArgumentParser()
11 | parser.add_argument('-prefix', type=str)
12 | parser.add_argument('-externalLibDir', type=str)
13 | parser.add_argument('-CC', type=str, nargs = 1)
14 | parser.add_argument('-CXX', type=str, nargs = 1)
15 | parser.add_argument('-libs', type=str)
16 | parser.add_argument('-ldFlags', type=str)
17 | parser.add_argument('-cxxFlags', type=str)
18 | parser.add_argument('-private', action = "store_true", help="Use private repos")
19 | parser.add_argument('-name', type=str, required = True)
20 | return parser.parse_args()
21 |
22 | def main():
23 | args = parse_args()
24 | prefix = "";
25 | external = "external";
26 | CC = genHelper.determineCC(args)
27 | CXX = genHelper.determineCXX(args)
28 | if(args.externalLibDir):
29 | external = args.externalLibDir;
30 | cmd = os.path.join(os.path.dirname(os.path.dirname(__file__)), "setUpScripts/generateCompFile.py") + """ -installName {name}
31 | -outFilename compfile.mk -externalLoc {external} -CC {CC} -CXX {CXX}
32 | -neededLibs {libs} -outname {name}"""
33 | if args.private:
34 | cmd += " -private ";
35 | if args.prefix and args.prefix != "":
36 | prefix = args.prefix;
37 | cmd += " -prefix {prefix}"
38 | if args.ldFlags and "" != args.ldFlags:
39 | cmd += " -ldFlags " + args.ldFlags
40 | if args.cxxFlags and "" != args.cxxFlags:
41 | addingFlags = " -cxxFlags \""
42 | if args.cxxFlags.startswith("-"):
43 | addingFlags += "\\"
44 | cmd += addingFlags + args.cxxFlags + "\""
45 | cmd = " ".join(cmd.split())
46 | cmd = cmd.format(name = args.name, external = external, CC=CC, CXX=CXX, libs = args.libs, prefix = prefix)
47 | Utils.run(cmd)
48 |
49 | main()
50 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepUtils/SeekDeepUtilsRunner.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 |
4 | // SeekDeepUtilsRunner.hpp
5 | //
6 | // Created by Nick Hathaway on 2015/06/24.
7 | //
8 | // SeekDeep - A library for analyzing amplicon sequence data
9 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
10 | // Jeffrey Bailey
11 | //
12 | // This file is part of SeekDeep.
13 | //
14 | // SeekDeep is free software: you can redistribute it and/or modify
15 | // it under the terms of the GNU General Public License as published by
16 | // the Free Software Foundation, either version 3 of the License, or
17 | // (at your option) any later version.
18 | //
19 | // SeekDeep is distributed in the hope that it will be useful,
20 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | // GNU General Public License for more details.
23 | //
24 | // You should have received a copy of the GNU General Public License
25 | // along with SeekDeep. If not, see .
26 | //
27 | //
28 | #include "SeekDeepUtilsSetUp.hpp"
29 | #include "SeekDeep/server.h"
30 | #include "SeekDeep/objects.h"
31 |
32 | namespace njhseq {
33 |
34 | class SeekDeepUtilsRunner : public njh::progutils::ProgramRunner {
35 | public:
36 | SeekDeepUtilsRunner();
37 |
38 | static int dryRunQualityFiltering(const njh::progutils::CmdArgs & inputCommands);
39 | static int runMultipleCommands(const njh::progutils::CmdArgs & inputCommands);
40 |
41 | static int setupTarAmpAnalysis(const njh::progutils::CmdArgs & inputCommands);
42 | static int replaceUnderscores(const njh::progutils::CmdArgs & inputCommands);
43 |
44 | static int genTargetInfoFromGenomes(const njh::progutils::CmdArgs & inputCommands);
45 |
46 |
47 | static int benchmarkControlMixtures(const njh::progutils::CmdArgs & inputCommands);
48 |
49 | static int gatherInfoOnTargetedAmpliconSeqFile(const njh::progutils::CmdArgs & inputCommands);
50 |
51 | static int getPossibleSampleNamesFromRawInput(const njh::progutils::CmdArgs & inputCommands);
52 | static int SampleBarcodeFileToSeekDeepInput(const njh::progutils::CmdArgs & inputCommands);
53 |
54 | static int primersToFasta(const njh::progutils::CmdArgs & inputCommands);
55 |
56 |
57 | };
58 |
59 | } // namespace njhseq
60 |
--------------------------------------------------------------------------------
/etc/serverResources/pcv/sampleMainPage.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function(){
2 | //get current name from window location
3 | var locSplit = window.location.toString().split(/[\/]+/);
4 | var rName = locSplit[2];
5 | var projectName = locSplit[4];
6 | var sampName = locSplit.pop();
7 |
8 | var infoUrls = getNameUrls(projectName);
9 | var gifLoading = prsentDivGifLoading();
10 | Promise.all(infoUrls.map(getJSON)).then(function(projNames) {
11 | addDiv("body", "topNav");
12 | var names = {shortName:projectName, sampleName:sampName};
13 | projNames.map(function(name){$.extend(names,name);});
14 | createProjectNavBar("#topNav", names);
15 | addMainDiv("body", true);
16 | setHeadTitle(sampName);
17 | $("#jumboTitle").html(sampName);
18 | addPanelOnlyHead("#mainContent", "Sample Info Table");
19 | addDiv("#mainContent", "sampTable");
20 | addPanelOnlyHead("#mainContent", "Haplotypes Relative Abundances");
21 | addDiv("#mainContent", "sampNameMenu");
22 | addDiv("#mainContent", "sampleChartMaster");
23 | addPanelOnlyHead("#mainContent", "Haplotypes Sequences");
24 | addDiv("#mainContent", "dnaViewer");
25 | var sampNames = [sampName];
26 | var mainPopInfoTab;
27 | postJSON("/" + rName + "/sampInfo/" + projectName, {"sampNames":sampNames}).then(function(sampInfo){
28 | //create sample table
29 | var sampleTable = new njhTable("#sampTable", sampInfo, names["projectName"] + "_" + sampName + "_sampInfo", false);
30 | var sampleChart = new njhSampleChart("#sampleChartMaster", sampInfo, names["projectName"] + "_" + sampName + "_sampChart","s_Sample", "c_AveragedFrac","h_popUID", ["s_Sample", "h_popUID", "c_clusterID", "c_AveragedFrac", "c_ReadCnt"]);
31 | //get the seq and color data for the sequence view of the population sequences
32 | postJSON("/" + rName + "/sampSeqData/" + projectName, {"sampleName":sampName}).then(function(sampSeqData){
33 | //create SeqViewer for the population final sequences
34 | var sesUid = sampSeqData["sessionUID"];
35 | var SeqViewer = new njhSeqView("#dnaViewer", sampSeqData);
36 | setUpCloseSession(sesUid);
37 | }).catch(logRequestError).then(function(){
38 | //stop loading page
39 | });
40 | }).catch(logRequestError).then(function(){
41 | //stop loading page
42 | });
43 | }).catch(logRequestError).then(function() {
44 | removeAllDivGifLoading();
45 | //stop loading page
46 | });
47 | });
48 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | SeekDeep
2 | ========
3 | Version 3.0.1
4 |
5 | Bioinformatic Tools for analyzing targeted amplicon sequencing developed by the UMASS Med Bailey Lab
6 |
7 | Checkout the website bellow for more details
8 | [http://seekdeep.brown.edu/](http://seekdeep.brown.edu/)
9 |
10 | Please cite the following citation: Hathaway, Nicholas J., Christian M. Parobek, Jonathan J. Juliano, and Jeffrey A. Bailey. 2017. “SeekDeep: Single-Base Resolution de Novo Clustering for Amplicon Deep Sequencing.” Nucleic Acids Research, November. https://doi.org/10.1093/nar/gkx1201.
11 |
12 | # Installing
13 |
14 | See installing tab on [http://seekdeep.brown.edu/](http://seekdeep.brown.edu/) for full details for installing for each operating system.
15 |
16 | ## Dependecnies
17 | Need to have at least g++-7, or clang++-3.8 compiler, the default assumption is g++-7, can change what compilier is used by giving -CC and -CXX to ./congifure.py
18 | Examples
19 |
20 | For g++-7
21 |
22 | ```bash
23 | ./configure.py -CC gcc-7 -CXX g++-7
24 | ```
25 | For clang
26 | For Mac OsX make sure clang version is 7.0 or greater
27 |
28 | ```bash
29 | ./configure.py -CC clang -CXX clang++
30 | ```
31 |
32 | Also though SeekDeep does not use cmake, several of the libraries it uses do depend on cmake so it needs to be present.
33 |
34 | ## To Install latest version (defaults to g++-7 or defaults to clang on Mac)
35 | ```bash
36 | git clone https://github.com/bailey-lab/SeekDeep.git
37 | cd SeekDeep
38 | git checkout master
39 | ./configure.py
40 | ./setup.py --compfile compfile.mk --outMakefile makefile-common.mk
41 | make
42 | ```
43 |
44 |
45 |
46 |
47 | # Bash Completion
48 |
49 | SeekDeep tends to have long flags so that they can be clear what they do but it's somewhat annoying to type them out so bash completion has been added. Put the content of the file at bashCompletion/SeekDeep into a file ~/.bash_completion and it will be source on your next login or use the bellow command while in the SeekDeep directory
50 |
51 | ```bash
52 | ./setup.py --addBashCompletion
53 | ```
54 |
55 | Which will actually do exactly described above, afterwards while typing flags use the tab key to complete them
56 |
57 |
58 | # Tutorials
59 |
60 | Tutorials and detailed usages located at [http://seekdeep.brown.edu](http://seekdeep.brown.edu) or email nicholas.hathaway@umassmed.edu for more information
61 |
--------------------------------------------------------------------------------
/scripts/cppMakefiles/unitTest/Makefile:
--------------------------------------------------------------------------------
1 | ROOT = $(realpath ../)
2 | ifdef CXXFLAGS
3 | ENV_CXXFLAGS := $(CXXFLAGS)
4 | endif
5 | ### compfile should be be in the make command e.g. make COMPFILE=../compfile.mk
6 | ### or it is assumed to be
7 | ifneq (,$(wildcard ../compfile.mk))
8 | COMPFILE=../compfile.mk
9 | endif
10 | include $(COMPFILE)
11 | #make sure catch is included
12 | USE_CATCH=1
13 | include $(ROOT)/makefile-common.mk
14 |
15 | #### File targets
16 | BIN = bin/tester
17 | OBJ_DIR = build
18 | TESTSRC = $(realpath ./src)
19 | SRCSRC = $(realpath ../src)
20 | OBJTEST = $(addprefix $(OBJ_DIR)/, $(patsubst %.cpp, %.o, $(call rwildcard, $(TESTSRC), *.cpp)))
21 | OBJSRC = $(addprefix $(OBJ_DIR)/, $(patsubst %.cpp, %.o, $(call rwildcard, $(SRCSRC), *.cpp)))
22 | OBJSRCNOMAIN = $(filter-out $(addsuffix $(SRCSRC)/main.o, $(OBJ_DIR)/), $(OBJSRC))
23 | #OBJSRCNOMAIN = $(filter-out build//Users/nick/hathaway/external/build/TwoBit/src/main.o, $(OBJSRC))
24 | #
25 | OBJALL = $(OBJTEST) $(OBJSRCNOMAIN)
26 |
27 | HEADERS = $(call rwildcard, $(SRCSRC), *.h) \
28 | $(call rwildcard, $(SRCSRC), *.hpp)
29 | #### Phony targets
30 | .PHONY: all
31 | .PHONY: clean
32 | .PHONY: do_preReqs
33 |
34 |
35 | #compiler options
36 | CXXFLAGS += $(ENV_CXXFLAGS)
37 | COMMON = -I$(SRCSRC) $(CXXFLAGS) $(CXXOPT) $(COMLIBS)
38 |
39 |
40 | ############ main
41 |
42 | all: do_preReqs $(OBJ_DIR) $(BIN)
43 | ifeq ($(UNAME_S), Darwin)
44 | ../scripts/setUpScripts/fixDyLinking_mac.sh bin $(EXT_PATH)
45 | endif
46 |
47 |
48 | $(OBJ_DIR):
49 | mkdir -p $(OBJ_DIR)
50 | mkdir -p bin
51 |
52 | # using automatic variables $<: the name of the prerequisite of the rule and
53 | # $@: the name of the target of the rule
54 | $(OBJ_DIR)/%.o: %.cpp $(HEADERS)
55 | @mkdir -p $(OBJ_DIR)/$(shell dirname $<)
56 | $(CXX) $(COMMON) -fpic -c $< -o $@
57 |
58 |
59 | ############ remove the objects that were dependant on any changed headers and check for compfile.mk
60 | do_preReqs:
61 | ifndef COMPFILE
62 | $(error COMPFILE is not set, do either make COMPFILE=aCompfile.mk or create a file called compfile.mk)
63 | endif
64 | #../scripts/setUpScripts/rmNeedToRecompile.py -obj $(OBJ_DIR) -src $(SRCSRC)
65 | #../scripts/setUpScripts/rmNeedToRecompile.py -obj $(OBJ_DIR) -src $(TESTSRC)
66 |
67 |
68 | $(BIN): $(OBJALL)
69 | $(CXX) $(CXXFLAGS) $(CXXOPT) -o $@ $^ $(LD_FLAGS)
70 |
71 |
72 | clean:
73 | @rm -f $(BIN)
74 | @rm -rf $(OBJ_DIR)
75 |
--------------------------------------------------------------------------------
/scripts/cppProjectScripts/fileModAffect.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import fnmatch, subprocess, sys, os, argparse, re, copy
4 | sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyUtils"))
5 | from headInGraph import fileCollection
6 | from headInGraph import fileNode
7 | from headInGraph import headInGraph
8 |
9 |
10 |
11 |
12 |
13 | '''
14 | #print "source files"
15 | for f in allFiles:
16 | statbuf = os.stat(f)
17 | #print f + " " + str(statbuf.st_mtime)
18 | #print "Object files: "
19 | for f in objectFiles:
20 | statbuf = os.stat(f)
21 | #print f + " " + str(statbuf.st_mtime)
22 | '''
23 | def parse_args():
24 | parser = argparse.ArgumentParser()
25 | parser.add_argument('-src', type=str, nargs=1, required =True);
26 | parser.add_argument('-header', type=str, nargs=1, required =True);
27 | parser.add_argument('-outMod', type=str, nargs=1, required = True);
28 | return parser.parse_args()
29 | def main():
30 | args = parse_args()
31 | allFiles = fileCollection.getAllSourceFiles(args.src[0])
32 |
33 | graph = headInGraph();
34 | allFileSize = []
35 | for file in allFiles:
36 | allFileSize.append(os.path.getsize(file))
37 | statbuf = os.stat(file)
38 | if(".h" not in file):
39 | graph.addNode(os.path.basename(file).replace(".", "_"), fileNode.cppColor, "internal", statbuf.st_mtime, max(1, 50 * (os.path.getsize(file) /float(max(allFileSize)) ) ) )
40 | else:
41 | graph.addNode(os.path.basename(file).replace(".", "_"), fileNode.headerColor, "internal", statbuf.st_mtime, max(1, 50 * (os.path.getsize(file) /float(max(allFileSize)) ) ) )
42 | pattern = re.compile("^[\w]*#include.*\".*\.h")
43 | for file in allFiles:
44 | for i, line in enumerate(open(file)):
45 | for match in re.finditer(pattern, line):
46 | if(".h" in file):
47 | graph.addPair(os.path.basename(file).replace(".", "_"), os.path.basename(re.findall('"([^"]*)"', line)[0]).replace(".", "_"), fileNode.headToHeadColor)
48 | else:
49 | graph.addPair(os.path.basename(file).replace(".", "_"), os.path.basename(re.findall('"([^"]*)"', line)[0]).replace(".", "_"), fileNode.cppToHeaderColor)
50 | graph.setNodeColorAll(fileNode.unModColor)
51 | graph.setEdgeColorAll(fileNode.unModEdgeColor)
52 | outFileTest = open(args.outMod[0], "w")
53 | graph.modChildren(graph.nodePositions_[args.header[0]], fileNode.modColor, fileNode.modEdgeColor)
54 | graph.nodes_[graph.nodePositions_[args.header[0]]].color_ = "#ff0000"
55 | graph.printGraphViz(outFileTest, args.header[0], False)
56 |
57 | main()
--------------------------------------------------------------------------------
/src/SeekDeep/objects/ControlBenchmarking/ControlBencher.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * ControlBencher.cpp
3 | *
4 | * Created on: May 6, 2019
5 | * Author: nicholashathaway
6 | */
7 |
8 |
9 |
10 | #include "ControlBencher.hpp"
11 |
12 | #include
13 |
14 | namespace njhseq {
15 | ControlBencher::ControlBencher(const ControlBencherPars & pars):pars_(pars){
16 | //read in mixture set ups
17 | mixSetups_ = ControlMixSetUp::readInSetUps(pars_.mixSetUpFnp_);
18 |
19 | //read in samples to mixture
20 | table sampleToMixtureTab(pars_.samplesToMixFnp_, "\t", true);
21 | sampleToMixtureTab.checkForColumnsThrow(VecStr{"sample", "MixName"}, __PRETTY_FUNCTION__);
22 | if(sampleToMixtureTab.empty()){
23 | std::stringstream ss;
24 | ss << __PRETTY_FUNCTION__ << ", error " << pars_.samplesToMixFnp_ << " is empty " << "\n";
25 | throw std::runtime_error{ss.str()};
26 | }
27 | for(const auto & row : sampleToMixtureTab){
28 | samplesToMix_[row[sampleToMixtureTab.getColPos("sample")]] = row[sampleToMixtureTab.getColPos("MixName")];
29 | }
30 | VecStr missingMixs;
31 | for(const auto & sampToMix : samplesToMix_){
32 | if(!njh::in(sampToMix.second, mixSetups_)){
33 | missingMixs.emplace_back(sampToMix.second);
34 | }
35 | }
36 | if(!missingMixs.empty()){
37 | std::stringstream ss;
38 | ss << __PRETTY_FUNCTION__ << ", error " << " error missing the following mixture information " << njh::conToStr(missingMixs, ",") << " from " << pars_.mixSetUpFnp_ << "\n";
39 | throw std::runtime_error{ss.str()};
40 | }
41 | }
42 |
43 | VecStr ControlBencher::getSamples() const {
44 | auto ret = getVectorOfMapKeys(samplesToMix_);
45 | njh::sort(ret);
46 | return ret;
47 | }
48 |
49 |
50 | void ControlBencher::removeStrain(const std::string & name){
51 | for(auto & mix : mixSetups_){
52 | if(njh::in(name, mix.second.getStrains())){
53 | mix.second.removeStrain(name);
54 | }
55 | }
56 | }
57 |
58 | void ControlBencher::removeStrains(const VecStr & names){
59 | for(const auto & name : names){
60 | removeStrain(name);
61 | }
62 | }
63 |
64 | void ControlBencher::checkForStrainsThrow(const std::set & names,
65 | const std::string & funcName) const {
66 | VecStr missingStrains;
67 | auto allStrains = getAllStrains();
68 | for (const auto & strain : allStrains) {
69 | if (!njh::in(strain, names)) {
70 | missingStrains.emplace_back(strain);
71 | }
72 | }
73 | if (!missingStrains.empty()) {
74 | std::stringstream ss;
75 | ss << funcName << ", error "
76 | << "the following strains are missing from expected seqs: "
77 | << njh::conToStrEndSpecial(missingStrains, ", ", " and ") << "\n";
78 | throw std::runtime_error { ss.str() };
79 | }
80 | }
81 |
82 | std::set ControlBencher::getAllStrains() const {
83 | std::set < std::string > allStrains;
84 | for (const auto & mixSetup : mixSetups_) {
85 | auto strains = mixSetup.second.getStrains();
86 | allStrains.insert(strains.begin(), strains.end());
87 | }
88 | return allStrains;
89 | }
90 |
91 |
92 | } // namespace njhseq
93 |
94 |
--------------------------------------------------------------------------------
/scripts/cppProjectScripts/inProgress/namespacer.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import os, glob, sys
4 |
5 |
6 | '''@todo not yet functioning'''
7 |
8 | def fixHeader(fnp,namespace):
9 | q = open(fnp).read()
10 | with open(fnp, "w") as f:
11 | dump = False
12 | inc = False
13 | opened = False
14 | closed = False
15 | for line in q.split("\n"):
16 | if dump and inc:
17 | f.write(line + "\n")
18 | continue
19 | if dump:
20 | if line.startswith("#"):
21 | f.write("\n} // namespace " + namespace + "\n\n")
22 | closed = True
23 | f.write(line + "\n")
24 | inc = True
25 | continue
26 | f.write(line + "\n")
27 | continue
28 | if line.startswith("#") or line.startswith("//") or line.strip() == "":
29 | f.write(line + "\n")
30 | continue
31 | dump = True
32 | f.write("namespace " + namespace + " {\n\n")
33 | opened = True
34 | f.write(line + "\n")
35 | if opened and not closed:
36 | f.write("\n} // namespace " + namespace + "\n")
37 |
38 | def fixCPP(fnp, namespace):
39 | q = open(fnp).read()
40 | with open(fnp, "w") as f:
41 | dump = False
42 | opened = False
43 | for line in q.split("\n"):
44 | if dump:
45 | f.write(line + "\n")
46 | continue
47 | if line.startswith("#") or line.startswith("/") or line.strip() == "":
48 | f.write(line + "\n")
49 | continue
50 | dump = True
51 | f.write("namespace " + namespace + " {\n\n")
52 | opened = True
53 | f.write(line + "\n")
54 | if opened:
55 | f.write("\n} // namespace " + namespace + "\n")
56 |
57 | #d = os.path.dirname(os.path.abspath(__file__))
58 | #d = os.path.join(d, "../")
59 | #d = "/home/mjp/njh-cpp/"
60 | #src_folders = glob.glob("{d}/src".format(d=d))
61 |
62 | def checkN(fnp):
63 | s = open(fnp, "r").read()
64 | c = s.count("namespace")
65 | if 2 != c and 0 != c and 3 != c:
66 | print fnp, "bad count", c
67 | raise Exception(fnp)
68 |
69 | def namepsaceSrcTree(sourceFolder,namespace):
70 | for root, dirs, files in os.walk(sourceFolder):
71 | for fn in files:
72 | if fn == "main.cpp":
73 | continue
74 | fnp = os.path.join(root, fn)
75 | fnp = os.path.abspath(fnp)
76 | if fnp.endswith(".h") or fnp.endswith(".hpp"):
77 | fixHeader(fnp, namespace)
78 | elif fnp.endswith(".cpp"):
79 | fixCPP(fnp, namespace)
80 | else:
81 | continue
82 | checkN(fnp)
83 |
84 | if __name__ == "__main__":
85 | if(len(sys.argv) < 3):
86 | print "usage: " + "./namespace.py src namespace"
87 | else:
88 | namepsaceSrcTree(sys.argv[1],sys.argv[2])
89 |
90 |
--------------------------------------------------------------------------------
/src/SeekDeep/server/PopClusProject.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | /*
3 | * PopClusProject.hpp
4 | *
5 | * Created on: Sep 19, 2016
6 | * Author: nick
7 | */
8 | //
9 | // SeekDeep - A library for analyzing amplicon sequence data
10 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
11 | // Jeffrey Bailey
12 | //
13 | // This file is part of SeekDeep.
14 | //
15 | // SeekDeep is free software: you can redistribute it and/or modify
16 | // it under the terms of the GNU General Public License as published by
17 | // the Free Software Foundation, either version 3 of the License, or
18 | // (at your option) any later version.
19 | //
20 | // SeekDeep is distributed in the hope that it will be useful,
21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | // GNU General Public License for more details.
24 | //
25 | // You should have received a copy of the GNU General Public License
26 | // along with SeekDeep. If not, see .
27 | //
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 | namespace njhseq {
35 |
36 | /**@brief struct to hold a pointer to table caches for sample and population information
37 | *
38 | */
39 | struct ClusInfoTabs{
40 | std::unique_ptr sampInfo_;
41 | std::unique_ptr popInfo_;
42 | std::unique_ptr hapIdTab_;
43 | };
44 |
45 | /**@brief class to hold information on a clustering project to help in serving it's infomration
46 | *
47 | */
48 | class PopClusProject {
49 | public:
50 |
51 | /**@brief construct with json configuration file
52 | *
53 | * should have at least the following fields, "shortName", "projectName", "mainDir"
54 | *
55 | * @param configJson
56 | */
57 | PopClusProject(const Json::Value & configJson);
58 |
59 | std::string shortName_;/**< short name for url viewer */
60 | std::string projectName_;/**< full length nmae of project*/
61 |
62 | Json::Value config_; /**< the configuration used to create project class*/
63 | std::unique_ptr collection_;/**< the collection class that holds info on the clustering */
64 |
65 | std::unique_ptr extractionProfileTab_;
66 | std::unique_ptr extractionStatsTab_;
67 |
68 | ClusInfoTabs tabs_; /**< holds pointers to caches for the pop and samp data*/
69 |
70 | std::unordered_map> subGroupTabs_;/**< holds the sub groups population tables*/
71 |
72 | std::unordered_map> topGroupTabs_;/**< holds the top group summarized info tabes*/
73 |
74 | /**@brief Register all the sequences paths to the SeqCache being used by the viewer for serving
75 | *
76 | * @param cache the cache to add seq files to
77 | */
78 | void registerSeqFiles(SeqCache & cache);
79 |
80 | };
81 |
82 | } // namespace njhseq
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/scripts/cppProjectScripts/mapSrc.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import fnmatch, subprocess, sys, os, argparse, re, copy
4 | sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyUtils"))
5 | from headInGraph import fileCollection
6 | from headInGraph import fileNode
7 | from headInGraph import headInGraph
8 |
9 |
10 |
11 |
12 |
13 | '''
14 | #print "source files"
15 | for f in allFiles:
16 | statbuf = os.stat(f)
17 | #print f + " " + str(statbuf.st_mtime)
18 | #print "Object files: "
19 | for f in objectFiles:
20 | statbuf = os.stat(f)
21 | #print f + " " + str(statbuf.st_mtime)
22 | '''
23 | def parse_args():
24 | parser = argparse.ArgumentParser()
25 | parser.add_argument('-src', type=str, nargs=1, required =True);
26 | parser.add_argument('-outMain', type=str, nargs=1, required = True);
27 | parser.add_argument('-addSystem', dest = 'addSystem', action = 'store_true' );
28 | return parser.parse_args()
29 | def main():
30 | args = parse_args()
31 | allFiles = fileCollection.getAllSourceFiles(args.src[0])
32 |
33 | graph = headInGraph();
34 | sizes = []
35 | for file in allFiles:
36 | sizes.append(os.path.getsize(file))
37 | # for s in sizes:
38 | #print max(1, int(float(s)/max(sizes) * 100))
39 |
40 | for file in allFiles:
41 | #print os.path.getsize(file)
42 | statbuf = os.stat(file)
43 | #print int(float(os.path.getsize(file))/max(sizes) * 100)
44 | if(".h" not in file):
45 | graph.addNode(os.path.basename(file).replace(".", "_"), fileNode.cppColor, "internal", statbuf.st_mtime, max(1, int(float(os.path.getsize(file))/max(sizes) * 50) ))
46 | else:
47 | graph.addNode(os.path.basename(file).replace(".", "_"), fileNode.headerColor, "internal", statbuf.st_mtime, max(1, int(float(os.path.getsize(file))/max(sizes) * 50)) )
48 | pattern = re.compile("^[\w]*#include.*\".*\.h")
49 | patternSystem = re.compile("^[\w]*#include.*\<.*\>")
50 | for file in allFiles:
51 | for i, line in enumerate(open(file)):
52 | for match in re.finditer(pattern, line):
53 | if(".h" in file):
54 | graph.addPair(os.path.basename(file).replace(".", "_"), os.path.basename(re.findall('"([^"]*)"', line)[0]).replace(".", "_"), fileNode.headToHeadColor)
55 | else:
56 | graph.addPair(os.path.basename(file).replace(".", "_"), os.path.basename(re.findall('"([^"]*)"', line)[0]).replace(".", "_"), fileNode.cppToHeaderColor)
57 | if args.addSystem:
58 | for match in re.finditer(patternSystem, line):
59 | modifiedHeaderName = ((line[(line.find("<") + 1):line.find(">")]).replace(".", "_")).replace("/", "__");
60 | if modifiedHeaderName not in list(graph.nodePositions_.keys()):
61 | graph.addNode(modifiedHeaderName, fileNode.externalHeaderColor, "external", 0, 1)
62 | if(".h" in file):
63 | graph.addPair(os.path.basename(file).replace(".", "_"), modifiedHeaderName, fileNode.headToHeadColor)
64 | else:
65 | graph.addPair(os.path.basename(file).replace(".", "_"), modifiedHeaderName, fileNode.cppToHeaderColor)
66 |
67 | outMainFile = open(args.outMain[0], "w");
68 | graph.printGraphViz(outMainFile, "all", args.addSystem)
69 |
70 | main()
--------------------------------------------------------------------------------
/scripts/genHelloWorld.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import shutil, os, argparse, sys
4 | sys.path.append(os.path.join(os.path.dirname(__file__), "pyUtils"))
5 | from utils import Utils
6 | from color_text import ColorText as CT
7 |
8 |
9 | def genPyHello(outFileName):
10 | with open(outFileName, "w") as f:
11 | f.write("""#!/usr/bin/env python2
12 | import shutil, os, argparse, sys, stat
13 |
14 | def parse_args_hello():
15 | parser = argparse.ArgumentParser()
16 | parser.add_argument('-n','--name', type=str)
17 | return parser.parse_args()
18 |
19 | def hello():
20 | args = parse_args_hello()
21 | if(args.name):
22 | print "Hello " + args.name + "!"
23 | else:
24 | print "Hello World!"
25 |
26 | if __name__ == "__main__":
27 | hello()
28 |
29 | """)
30 |
31 |
32 |
33 | def genCppHello(outFileName):
34 | with open(outFileName, "w") as f:
35 | f.write("""#include
36 | #include
37 | #include
38 | #include
39 | #include
40 | #include
41 | #include
42 | #include
43 |
44 | int main(int argc, char* argv[])
45 | {
46 | std::cout << \"Hello World!\" << std::endl;
47 | return 0;
48 | }""")
49 |
50 | def parse_args_genHello():
51 | parser = argparse.ArgumentParser()
52 | parser.add_argument('-o', '--outFilename',type=str, required = True)
53 | parser.add_argument('--overWrite', action = "store_true", help = "Over write file if it exists")
54 | parser.add_argument('-p','--python', action = "store_true", help = "Generate a python hello world script, default is a cpp hello world")
55 | return parser.parse_args()
56 |
57 | def genHellos(outFilename, overWrite = False, python = False):
58 | if python:
59 | if not outFilename.endswith(".py"):
60 | outFilename = outFilename + ".py"
61 | if os.path.exists(outFilename) and not overWrite:
62 | raise Exception(CT.boldRed("File ") + CT.boldBlack(outFilename) + CT.boldRed(" already exists, use --overWrite to over write it"))
63 | genPyHello(outFilename)
64 | #rwx to user and group, r-x to everyone
65 | fd = os.open( outFilename, os.O_RDONLY )
66 | os.fchmod( fd, 0o775)
67 | os.close( fd )
68 | print((CT.boldGreen("Now run")))
69 | print(("./" + outFilename + " "))
70 | print((CT.boldGreen("or")))
71 | print(("./" + outFilename + " --name Nick"))
72 | else:
73 | if not outFilename.endswith(".cpp"):
74 | outFilename = outFilename + ".cpp"
75 | if os.path.exists(outFilename) and not overWrite:
76 | raise Exception("File " + outFilename + " already exists, use --overWrite to over write it")
77 | genCppHello(outFilename)
78 | print((CT.boldGreen("Now run")))
79 | print(("g++ -std=c++11 " + outFilename + " -o hello #-std=c++11 needed for cstdint include in libstdc++"))
80 | print ("./hello")
81 | print((CT.boldGreen("or run")))
82 | #mac
83 | if Utils.isMac():
84 | print(("clang++ " + outFilename + " -o hello"))
85 | else:
86 | print(("clang++-3.6 -std=c++11 " + outFilename + " -o hello #-std=c++11 needed for cstdint include in libstdc++"))
87 | print ("./hello")
88 | if __name__ == '__main__':
89 | args = parse_args_genHello()
90 | genHellos(args.outFilename, args.overWrite, args.python)
91 |
92 |
--------------------------------------------------------------------------------
/etc/serverResources/pcv/extractionStats.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Population Info
6 |
7 |
17 |
18 |
19 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/scripts/pyUtils/color_text.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | class ColorText:
4 |
5 | # Reset
6 | reset = '\033[0m' # Text Reset
7 |
8 | # Regular Colors
9 | black = '\033[30m' # black
10 | red = '\033[31m' # red
11 | green = '\033[32m' # green
12 | yellow = '\033[33m' # yellow
13 | blue = '\033[34m' # blue
14 | purple = '\033[35m' # purple
15 | cyan = '\033[36m' # cyan
16 | white = '\033[37m' # white
17 |
18 | # affecting by adding bold, underline, or flashing text
19 | bold = '\033[1m'
20 | underline = '\033[4m'
21 | flashing = '\033[5m'
22 | # affect the color of the text by decreasing saturation or by inverting/switching background and text colors
23 | lighten = '\033[2m'
24 | invert = '\033[7m'
25 |
26 | # Background
27 | on_Black = '\033[40m' # Black
28 | on_Red = '\033[41m' # Red
29 | on_Green = '\033[42m' # Green
30 | on_Yellow = '\033[43m' # Yellow
31 | on_Blue = '\033[44m' # Blue
32 | on_Purple = '\033[45m' # Purple
33 | on_Cyan = '\033[46m' # Cyan
34 | on_White = '\033[47m' # White
35 |
36 | # High Intensity
37 | iBlack = '\033[90m' # Black
38 | iRed = '\033[91m' # Red
39 | iGreen = '\033[92m' # Green
40 | iYellow = '\033[93m' # Yellow
41 | iBlue = '\033[94m' # Blue
42 | iPurple = '\033[95m' # Purple
43 | iCyan = '\033[96m' # Cyan
44 | iWhite = '\033[97m' # White
45 |
46 |
47 | # High Intensity backgrounds
48 | on_IBlack = '\033[100m' # Black
49 | on_IRed = '\033[101m' # Red
50 | on_IGreen = '\033[102m' # Green
51 | on_IYellow = '\033[103m' # Yellow
52 | on_IBlue = '\033[104m' # Blue
53 | on_IPurple = '\033[105m' # Purple
54 | on_ICyan = '\033[106m' # Cyan
55 | on_IWhite = '\033[107m' # White
56 |
57 | @staticmethod
58 | def boldText(t):
59 | return ColorText.bold + t + ColorText.reset
60 |
61 | @staticmethod
62 | def boldRed(t):
63 | return ColorText.red + ColorText.bold + t + ColorText.reset
64 |
65 | @staticmethod
66 | def boldGreen(t):
67 | return ColorText.green + ColorText.bold + t + ColorText.reset
68 |
69 | @staticmethod
70 | def boldBlue(t):
71 | return ColorText.blue + ColorText.bold + t + ColorText.reset
72 |
73 | @staticmethod
74 | def boldWhite(t):
75 | return ColorText.white + ColorText.bold + t + ColorText.reset
76 |
77 | @staticmethod
78 | def boldBlack(t):
79 | return ColorText.black + ColorText.bold + t + ColorText.reset
80 |
81 | @staticmethod
82 | def addColor(colorCode):
83 | """Takes a number between 16 and 231 to change text color, gives a bigger range of colors than the regular offered ones
84 | @todo: Put a check to make sure it's a number between 16 and 231"""
85 | return "\033[38;5;" + str(colorCode) + "m"
86 |
87 | @staticmethod
88 | def addBGColor(colorCode):
89 | """Takes a number between 16 and 231 to change background color, gives a bigger range of colors than the regular offered ones
90 | @todo: Put a check to make sure it's a number between 16 and 231"""
91 | return "\033[48;5;" + str(colorCode) + "m"
92 |
93 | @staticmethod
94 | def outputColors():
95 | for i in range(16,232):
96 | print(ColorText.addBGColor(i) + str(i) + ColorText.reset)
97 |
98 |
--------------------------------------------------------------------------------
/scripts/setUpScripts/rmNeedToRecompile.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import fnmatch, subprocess, sys, os, argparse, re, copy
4 | sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyUtils"))
5 | from headInGraph import fileCollection
6 | from headInGraph import fileNode
7 | from headInGraph import headInGraph
8 |
9 |
10 |
11 |
12 |
13 | '''
14 | #print "source files"
15 | for f in allFiles:
16 | statbuf = os.stat(f)
17 | #print f + " " + str(statbuf.st_mtime)
18 | #print "Object files: "
19 | for f in objectFiles:
20 | statbuf = os.stat(f)
21 | #print f + " " + str(statbuf.st_mtime)
22 | '''
23 | def parse_args():
24 | parser = argparse.ArgumentParser()
25 | parser.add_argument('-src', type=str, nargs=1, required =True);
26 | parser.add_argument('-obj', type=str, nargs=1, required =True);
27 | return parser.parse_args()
28 | def main():
29 | args = parse_args()
30 | allFiles = fileCollection.getAllSourceFiles(args.src[0])
31 | objectFiles = fileCollection.getObjectFiles(args.obj[0])
32 | srcFileDict = {}
33 | graph = headInGraph();
34 | objectFilesTrimedDic = {}
35 | for obj in objectFiles:
36 | srcName = obj.find(args.src[0])
37 | objectFilesTrimedDic[obj[srcName:]] = obj
38 | srcFileDict[os.path.basename(obj).replace(".o", "_cpp")] = obj
39 |
40 | for file in allFiles:
41 |
42 | statbuf = os.stat(file)
43 | if(".h" not in file):
44 | graph.addNode(os.path.basename(file).replace(".", "_"), fileNode.cppColor, "internal", statbuf.st_mtime,os.path.getsize(file))
45 | lastPeriod = file.rfind(".c")
46 | objNameFile = file[:lastPeriod] + ".o"
47 | if objNameFile in list(objectFilesTrimedDic.keys()):
48 | statbuf = os.stat(objectFilesTrimedDic[objNameFile])
49 | graph.addObjecTime(os.path.basename(file).replace(".", "_"), statbuf.st_mtime)
50 | else:
51 | graph.addNode(os.path.basename(file).replace(".", "_"), fileNode.headerColor, "internal", statbuf.st_mtime, os.path.getsize(file))
52 |
53 | pattern = re.compile("^[\w]*#include.*\".*\.h")
54 | for file in allFiles:
55 | for i, line in enumerate(open(file, 'rt', encoding = 'utf-8')):
56 | for match in re.finditer(pattern, line):
57 | if(".h" in file):
58 | graph.addPair(os.path.basename(file).replace(".", "_"), os.path.basename(re.findall('"([^"]*)"', line)[0]).replace(".", "_"), fileNode.headToHeadColor)
59 | else:
60 | graph.addPair(os.path.basename(file).replace(".", "_"), os.path.basename(re.findall('"([^"]*)"', line)[0]).replace(".", "_"), fileNode.cppToHeaderColor)
61 | graph.reset()
62 | needToRecompile = [];
63 | for nPos in range(len(graph.nodes_)):
64 | if not (graph.nodes_[nPos].value_.endswith("_c") or graph.nodes_[nPos].value_.endswith("_cpp")):
65 | for child in graph.getChildrenList(nPos):
66 | if not (graph.nodes_[child].value_.endswith("_h") or graph.nodes_[child].value_.endswith("_hpp") or child == nPos):
67 | if graph.nodes_[nPos].modTime_ > graph.nodes_[child].objectModTime_:
68 | needToRecompile.append(graph.nodes_[child].value_)
69 | else:
70 | graph.nodes_[child].visited_ = False
71 | else:
72 | graph.nodes_[child].visited_ = False
73 |
74 | for need in needToRecompile:
75 | if(need in list(srcFileDict.keys())):
76 | os.remove(srcFileDict[need]);
77 |
78 | main()
--------------------------------------------------------------------------------
/scripts/setUpScripts/needToRecompile.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import fnmatch, subprocess, sys, os, argparse, re, copy
4 | sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyUtils"))
5 | from headInGraph import fileCollection
6 | from headInGraph import fileNode
7 | from headInGraph import headInGraph
8 |
9 |
10 |
11 |
12 |
13 | '''
14 | #print "source files"
15 | for f in allFiles:
16 | statbuf = os.stat(f)
17 | #print f + " " + str(statbuf.st_mtime)
18 | #print "Object files: "
19 | for f in objectFiles:
20 | statbuf = os.stat(f)
21 | #print f + " " + str(statbuf.st_mtime)
22 | '''
23 | def parse_args():
24 | parser = argparse.ArgumentParser()
25 | parser.add_argument('-src', type=str, nargs=1, required =True);
26 | parser.add_argument('-obj', type=str, nargs=1, required =True);
27 | return parser.parse_args()
28 | def main():
29 | args = parse_args()
30 | allFiles = fileCollection.getAllSourceFiles(args.src[0])
31 | objectFiles = fileCollection.getObjectFiles(args.obj[0])
32 | srcFileDict = {}
33 | graph = headInGraph();
34 | objectFilesTrimedDic = {}
35 | for obj in objectFiles:
36 | srcName = obj.find(args.src[0])
37 | objectFilesTrimedDic[obj[srcName:]] = obj
38 | srcFileDict[os.path.basename(obj).replace(".o", "_cpp")] = obj
39 |
40 | for file in allFiles:
41 | statbuf = os.stat(file)
42 | if(".h" not in file):
43 | graph.addNode(os.path.basename(file).replace(".", "_"), fileNode.cppColor, "internal", statbuf.st_mtime, os.path.getsize(file))
44 | lastPeriod = file.rfind(".c")
45 | objNameFile = file[:lastPeriod] + ".o"
46 | if objNameFile in list(objectFilesTrimedDic.keys()):
47 | statbuf = os.stat(objectFilesTrimedDic[objNameFile])
48 | graph.addObjecTime(os.path.basename(file).replace(".", "_"), statbuf.st_mtime)
49 | else:
50 | graph.addNode(os.path.basename(file).replace(".", "_"), fileNode.headerColor, "internal", statbuf.st_mtime, os.path.getsize(file))
51 |
52 | pattern = re.compile("^[\w]*#include.*\".*\.h")
53 | for file in allFiles:
54 | for i, line in enumerate(open(file)):
55 | for match in re.finditer(pattern, line):
56 | if(".h" in file):
57 | graph.addPair(os.path.basename(file).replace(".", "_"), os.path.basename(re.findall('"([^"]*)"', line)[0]).replace(".", "_"), fileNode.headToHeadColor)
58 | else:
59 | graph.addPair(os.path.basename(file).replace(".", "_"), os.path.basename(re.findall('"([^"]*)"', line)[0]).replace(".", "_"), fileNode.cppToHeaderColor)
60 | graph.reset()
61 | needToRecompile = [];
62 | for nPos in range(len(graph.nodes_)):
63 | if not (graph.nodes_[nPos].value_.endswith("_c") or graph.nodes_[nPos].value_.endswith("_cpp")):
64 | for child in graph.getChildrenList(nPos):
65 | if not (graph.nodes_[child].value_.endswith("_h") or graph.nodes_[child].value_.endswith("_hpp") or child == nPos):
66 | if graph.nodes_[nPos].modTime_ > graph.nodes_[child].objectModTime_:
67 | needToRecompile.append(graph.nodes_[child].value_)
68 | else:
69 | graph.nodes_[child].visited_ = False
70 | else:
71 | graph.nodes_[child].visited_ = False
72 |
73 | #print needToRecompile;
74 | #print srcFileDict.keys()
75 | out = ""
76 | for need in needToRecompile:
77 | if(need in list(srcFileDict.keys())):
78 | out += " " + srcFileDict[need]
79 | print(out)
80 |
81 | main()
--------------------------------------------------------------------------------
/scripts/cppProjectScripts/inProgress/createNewBibseqRing.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python2
2 |
3 | import shutil, os, argparse, sys, stat,time
4 |
5 |
6 | def parse_args():
7 | parser = argparse.ArgumentParser()
8 | parser.add_argument('-name', type=str, required = True)
9 | parser.add_argument('-author', type=str, required = True)
10 | parser.add_argument('-prepath', type=str, required = True)
11 | return parser.parse_args()
12 |
13 |
14 | def fileInfoHeader(headerName, author):
15 |
16 | return """
17 | // {headerName}
18 | //
19 | // Created by {author} on {date}.
20 | // Copyright (c) {year} {author}. All rights reserved.
21 | //
22 | """.format(headerName=headerName, author=author,year=time.strftime("%Y"),date=time.strftime("%Y/%m/%d"))
23 |
24 | def startHeader(headerName, author):
25 |
26 | return """#pragma once
27 | //
28 | """ + fileInfoHeader(headerName, author)
29 |
30 | def startCpp(nameStub, author):
31 | return fileInfoHeader(nameStub + ".cpp", author) + """
32 |
33 | #include "{name}.hpp"
34 |
35 | """.format(name = nameStub)
36 |
37 |
38 |
39 | def main():
40 | args = parse_args()
41 | name = args.name
42 | prepath = args.prepath
43 | if not prepath.endswith("/"):
44 | prepath += "/"
45 | if os.path.exists(name) or os.path.exists(name + ".h"):
46 | print "Error, " + name + " already exists"
47 | exit(1)
48 | #create main dir
49 | os.mkdir(name)
50 | #create main header to include the ring
51 | with open(name + ".h", "w") as f:
52 | mainHeaderOut = startHeader( name + ".h", args.author) + """
53 | #include "{prepath}{name}/{name}SetUp.hpp"
54 | #include "{prepath}{name}/{name}Runner.hpp"
55 | """.format(name=args.name,prepath = prepath)
56 | f.write(mainHeaderOut)
57 | #create setUp header
58 | with open(os.path.join(name,name + "SetUp.hpp"), "w") as f:
59 | defaultHeader = startHeader(name + "SetUp.hpp", args.author)
60 | defaultHeader += """
61 | #include
62 | #include
63 | #include
64 | namespace njhseq {{
65 |
66 | class {name}SetUp : public seqSetUp {{
67 |
68 | public:
69 | using seqSetUp::seqSetUp;
70 | }};
71 | }} // namespace njhseq
72 | """.format(name =name)
73 | f.write(defaultHeader)
74 | #create setUp cpp
75 | with open(os.path.join(name,name + "SetUp.cpp"), "w") as f:
76 | infoHeader = startCpp(name + "SetUp", args.author)
77 | infoHeader +="""
78 | namespace njhseq {
79 |
80 | } // namespace njhseq
81 | """
82 | f.write(infoHeader)
83 | #create runner header
84 | with open(os.path.join(name,name + "Runner.hpp"), "w") as f:
85 | infoHeader = startHeader(name + "Runner.hpp", args.author)
86 | infoHeader +="""
87 | #include "{name}SetUp.hpp"
88 |
89 | namespace njhseq {{
90 |
91 | class {name}Runner : public njh::progutils::programRunner {{
92 | public:
93 | {name}Runner();
94 |
95 | static int placeHolder(MapStrStr inputCommands);
96 |
97 | }};
98 | }} // namespace njhseq
99 | """.format(name = name)
100 | f.write(infoHeader)
101 | #create runner cpp
102 | with open(os.path.join(name,name + "Runner.cpp"), "w") as f:
103 | infoHeader = startCpp(name + "Runner", args.author)
104 | infoHeader +="""
105 | namespace njhseq {{
106 |
107 | {name}Runner::{name}Runner()
108 | : njh::progutils::programRunner({{addFunc("placeHolder", placeHolder, false)}},
109 | "{name}") {{}}
110 |
111 | int {name}Runner::placeHolder(MapStrStr inputCommands) {{
112 | {name}SetUp setUp(inputCommands);
113 | setUp.finishSetUp(std::cout);
114 | return 0;
115 | }}
116 |
117 | }} // namespace njhseq
118 | """.format(name = name)
119 | f.write(infoHeader)
120 |
121 |
122 | main()
123 |
--------------------------------------------------------------------------------
/src/main.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // main.cpp
3 | //
4 | // Created by Nicholas Hathaway on 8/11/13.
5 | //
6 |
7 | //
8 | // SeekDeep - A library for analyzing amplicon sequence data
9 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
10 | // Jeffrey Bailey
11 | //
12 | // This file is part of SeekDeep.
13 | //
14 | // SeekDeep is free software: you can redistribute it and/or modify
15 | // it under the terms of the GNU General Public License as published by
16 | // the Free Software Foundation, either version 3 of the License, or
17 | // (at your option) any later version.
18 | //
19 | // SeekDeep is distributed in the hope that it will be useful,
20 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | // GNU General Public License for more details.
23 | //
24 | // You should have received a copy of the GNU General Public License
25 | // along with SeekDeep. If not, see .
26 | //
27 |
28 | #include "SeekDeepPrograms.h"
29 |
30 | int main(int argc, char* argv[]) {
31 |
32 | // {
33 | // std::string name = "M01380:70:000000000-B9CJY:1:2118:15005:24494 1:N:0:hu136 AGGAGTCC|0|TAGATCGC|0";
34 | // //std::string BackUpIlluminaSampleRegPatStr_ = "([A-Za-z0-9_]+):([0-9]+):([A-Za-z0-9-]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+) ([12]):([NY]):([0-9]):([A-z0-9_-+]+):([A-z0-9_-+]+) ([A-z0-9_|+-]+)( .*)?";
35 | // uint32_t BackUpIlluminaSampleNumberPos_ = 12;
36 | // // std::string BackUpIlluminaSampleRegPatStr_ = "([A-Za-z0-9_]+):([0-9]+):([A-Za-z0-9-]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+) ([12]):([NY]):([0-9]):([A-Za-z0-9_-+]+):([A-Za-z0-9_-+]+) ([A-Za-z0-9_|+-]+)";
37 | // //std::string BackUpIlluminaSampleRegPatStr_ = "([A-Za-z0-9_]+):([0-9]+):([A-Za-z0-9-]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+) ([12]):([NY]):([0-9]):([A-Za-z0-9_-+:]+) ([A-z0-9_|+-]+)( .*)?";
38 | // std::string BackUpIlluminaSampleRegPatStr_ = "([A-Za-z0-9_]+):([0-9]+):([A-Za-z0-9-]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+) ([12]):([NY]):([0-9]):([A-Za-z0-9_+:-]+) ([A-z0-9_|+-]+)( .*)?";
39 | //
40 | // std::cout << "name: " << name << std::endl;
41 | //
42 | // std::smatch mat;
43 | // std::cout << njh::colorBool(std::regex_match(name,mat,std::regex{BackUpIlluminaSampleRegPatStr_} )) << std::endl;
44 | // std::cout << "mat.size(): " << mat.size() << std::endl;
45 | // if(std::regex_match(name,mat,std::regex{BackUpIlluminaSampleRegPatStr_} )){
46 | // std::cout << mat[BackUpIlluminaSampleNumberPos_] << std::endl;
47 | // for( uint32_t pos = 0; pos < mat.size(); ++pos){
48 | // std::cout << "pos: " << pos << " " << mat[pos] << std::endl;
49 | // }
50 | // }
51 | // }
52 | // {
53 | // std::string name = "M01380:109:000000000-BJD3T:1:1102:23389:3505 1:N:0:hu99b:5_target_multiplex TTCTGGGT|1|TGTTCTCT|0 Pf_ama1d1_fwd|0|24|";
54 | // //std::string BackUpIlluminaSampleRegPatStr_ = "([A-Za-z0-9_]+):([0-9]+):([A-Za-z0-9-]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+) ([12]):([NY]):([0-9]):([A-z0-9_-+]+):([A-z0-9_-+]+) ([A-z0-9_|+-]+)( .*)?";
55 | // // std::string BackUpIlluminaSampleRegPatStr_ = "([A-Za-z0-9_]+):([0-9]+):([A-Za-z0-9-]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+) ([12]):([NY]):([0-9]):([A-Za-z0-9_-+]+):([A-Za-z0-9_-+]+) ([A-Za-z0-9_|+-]+)";
56 | // std::string BackUpIlluminaSampleRegPatStr_ = "([A-Za-z0-9_]+):([0-9]+):([A-Za-z0-9-]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+) ([12]):([NY]):([0-9]):([A-Za-z0-9_+:-]+) ([A-z0-9_|+-]+)( .*)?";
57 | // uint32_t BackUpIlluminaSampleNumberPos_ = 12;
58 | //
59 | // std::cout << "name: " << name << std::endl;
60 | // std::smatch mat;
61 | // std::cout << njh::colorBool(std::regex_match(name,mat,std::regex{BackUpIlluminaSampleRegPatStr_} )) << std::endl;
62 | // std::cout << "mat.size(): " << mat.size() << std::endl;
63 | // if(std::regex_match(name,mat,std::regex{BackUpIlluminaSampleRegPatStr_} )){
64 | // std::cout << mat[BackUpIlluminaSampleNumberPos_] << std::endl;
65 | // for(uint32_t pos = 0; pos < mat.size(); ++pos){
66 | // std::cout << "pos: " << pos << " " << mat[pos] << std::endl;
67 | // }
68 | // }
69 | // }
70 | //
71 | //
72 | // return 0;
73 | try {
74 | njhseq::SeekDeepRunner seqRunner;
75 | return seqRunner.run(argc, argv);
76 | } catch (std::exception & e) {
77 | std::cerr << e.what() << std::endl;
78 | return 1;
79 | }
80 | }
81 |
82 |
83 |
--------------------------------------------------------------------------------
/src/SeekDeep/objects/TarAmpSetupUtils/TarAmpSeqInvestigator.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | /*
4 | * TarAmpSeqInvestigator.hpp
5 | *
6 | * Created on: Jan 31, 2020
7 | * Author: nicholashathaway
8 | */
9 |
10 |
11 |
12 |
13 |
14 | #include "SeekDeep/objects.h"
15 | #include "SeekDeep/parameters.h"
16 |
17 |
18 |
19 | namespace njhseq {
20 |
21 |
22 |
23 | class TarAmpSeqInvestigator{
24 | public:
25 |
26 | struct TarAmpSeqInvestigatorPars{
27 | uint32_t unrecogBaseSampling = 20;
28 | uint32_t precdingBaseFreqCutOff = 5;
29 | bfs::path idFnp = "";
30 | bool dontCollapsePossibleMIDs = false;
31 | ExtractorPairedEndPars pars;
32 | MidDeterminator::MidDeterminePars midPars;
33 | uint32_t testNumber = std::numeric_limits::max();
34 |
35 | gapScoringParameters gapInfo_;
36 |
37 | TarAmpSeqInvestigatorPars();
38 |
39 | };
40 |
41 | TarAmpSeqInvestigator(const TarAmpSeqInvestigatorPars & pars);
42 |
43 | TarAmpSeqInvestigatorPars pars_;
44 | PrimersAndMids ids_;
45 |
46 | //key = forward primer name, reverse primer name, count
47 | std::unordered_map> primerPairCountsTot_;
48 | std::unordered_map> primerPairCountsFor_;
49 | std::unordered_map> primerPairCountsComp_;
50 |
51 | //key = primer name, forward primer bases, reverse primer bases, counts
52 | std::unordered_map>> precedingBasesCounts_;
53 | std::unordered_map>> precedingBasesCountsComp_;
54 | //key1 = forward seq, key2 = reverse seq, value = count
55 | std::unordered_map> unrecognizedCounts_;
56 |
57 | uint32_t totalReadCount_{0};
58 |
59 | void addOtherCounts(const TarAmpSeqInvestigator & other);
60 |
61 | //primer pairing counts
62 | table primerCountsTab_{VecStr{"ForwardPrimer", "ReversePrimer", "ForwardCount", "ReverseCount", "ReverseFraction", "Total", "Fraction"}};
63 | //preceding number of bases counts
64 | table precedingBasesCountsTab_{VecStr{"PrimerPair", "BasesPrecedingPrimerCase", "NumOfBases", "Count"}};
65 | //preceding bases counts, to determine possible mids
66 | table possibleMidCounts_{VecStr{"PrimerPair", "ForwardMID", "ReverseMID", "InForDirCount", "InRevDirCount", "TotalCount"}};
67 | table possibleMidCountsMostCommonTab_{VecStr{"PrimerPair", "ForwardMID", "ReverseMID", "InForDirCount", "InRevDirCount", "TotalCount"}};
68 | //unrecognized counts
69 | table unrecoginzedCountsTab_{VecStr{"forward", "reverse", "count", "fraction"}};
70 | // table onePrimerUnrecoginzedCountsTab_{VecStr{"recognizedPrimer", "", "count", "fraction"}};
71 |
72 | void investigateSeq(const seqInfo & forwardSeq, const seqInfo & revCompSeq, aligner & alignObj);
73 | void processCounts();
74 | void writeOutTables(const bfs::path & directory, bool overWrite);
75 |
76 |
77 |
78 | struct prepareForInvestiagteFileRes{
79 | uint64_t maxReadSize = 0;
80 | uint32_t readCount = 0;
81 | };
82 |
83 | prepareForInvestiagteFileRes prepareForInvestiagteFile(const SeqIOOptions & opts, bool verbose);
84 | void investigateFile(const SeqIOOptions & opts, const prepareForInvestiagteFileRes & counts, bool verbose);
85 | void investigateFile(const SeqIOOptions & opts, bool verbose);
86 |
87 | bool reverseComplementLikely(uint32_t minReadAmount = 250,
88 | double cutOff = 0.2) const;
89 | bool hasPossibleRandomPrecedingBases(uint32_t midSize,
90 | uint32_t minReadAmount = 250, double cutOff = 0.1) const;
91 |
92 | bool hasPossibleRandomPrecedingBasesForwardPrimer(uint32_t midSize,
93 | uint32_t minReadAmount = 250, double cutOff = 0.1) const;
94 |
95 | bool hasPossibleRandomPrecedingBasesReversePrimer(uint32_t midSize,
96 | uint32_t minReadAmount = 250, double cutOff = 0.1) const;
97 |
98 | uint32_t maxPrecedingBases() const;
99 | uint32_t maxPrecedingReversePrimerBases() const;
100 | uint32_t maxPrecedingForwardPrimerBases() const;
101 | VecStr recommendSeekDeepExtractorFlags() const;
102 |
103 | };
104 |
105 |
106 |
107 |
108 | } // namespace njhseq
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepProgram/makeSampleDirectories/makeSampleDirectoriesSetUp.cpp:
--------------------------------------------------------------------------------
1 |
2 |
3 | //
4 | // SeekDeep - A library for analyzing amplicon sequence data
5 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
6 | // Jeffrey Bailey
7 | //
8 | // This file is part of SeekDeep.
9 | //
10 | // SeekDeep is free software: you can redistribute it and/or modify
11 | // it under the terms of the GNU General Public License as published by
12 | // the Free Software Foundation, either version 3 of the License, or
13 | // (at your option) any later version.
14 | //
15 | // SeekDeep is distributed in the hope that it will be useful,
16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | // GNU General Public License for more details.
19 | //
20 | // You should have received a copy of the GNU General Public License
21 | // along with SeekDeep. If not, see .
22 | //
23 | //
24 | #include "SeekDeepPrograms/SeekDeepProgram/SeekDeepSetUp.hpp"
25 | #include
26 |
27 | namespace njhseq {
28 |
29 | void SeekDeepSetUp::setUpMakeSampleDirectories(
30 | makeSampleDirectoriesPars & pars) {
31 | if (needsHelp()) {
32 | std::stringstream tempStream;
33 | tempStream << "makeSampleDirectoires" << std::endl;
34 | tempStream << "Set up a directory tree for processClusters" << std::endl;
35 | tempStream << "Commands, order not necessary, flags are case insensitive"
36 | << std::endl;
37 | tempStream << "Required commands" << std::endl;
38 | tempStream << "--file [option], name of the file of sample names to read in"
39 | << std::endl;
40 | tempStream << "--dout [option], name of the main directory to create"
41 | << std::endl;
42 | tempStream << "File should be tab delimited and a few examples are below"
43 | << std::endl;
44 | tempStream << "File should have at least three columns" << std::endl;
45 | tempStream << "Where first column is the name of the index or sff file "
46 | "used, second column is the sample names, and all following "
47 | "columns are the MIDs for that samples " << std::endl;
48 | std::cout << cleanOut(tempStream.str(), width_, indent_);
49 | tempStream.str(std::string());
50 | std::cout << "Example with two replicates and two separate master indexes"
51 | << std::endl;
52 | std::cout << "1\t090-00\tMID01\tMID02" << std::endl;
53 | std::cout << "1\t090-24\tMID03\tMID04" << std::endl;
54 | std::cout << "1\t090-48\tMID05\tMID06" << std::endl;
55 | std::cout << "1\t090-72\tMID07\tMID08" << std::endl;
56 | std::cout << "2\t095-00\tMID01\tMID02" << std::endl;
57 | std::cout << "2\t095-24\tMID03\tMID04" << std::endl;
58 | std::cout << "2\t095-48\tMID05\tMID06" << std::endl;
59 | std::cout << "2\t095-72\tMID07\tMID08" << std::endl;
60 | std::cout << std::endl;
61 | std::cout << "Example with one replicate" << std::endl;
62 | std::cout << "1\t090-00\tMID01" << std::endl;
63 | std::cout << "1\t090-24\tMID02" << std::endl;
64 | std::cout << "2\t095-00\tMID01" << std::endl;
65 | std::cout << "2\t095-24\tMID02" << std::endl;
66 | std::cout << std::endl;
67 | std::cout << "Example with with mix amount of replicates" << std::endl;
68 | std::cout << "1\t090-00\tMID01" << std::endl;
69 | std::cout << "1\t090-24\tMID02" << std::endl;
70 | std::cout << "2\t095-00\tMID01\tMID02" << std::endl;
71 | std::cout << "2\t095-24\tMID03\tMID04" << std::endl;
72 |
73 | std::cout << "examples, SeekDeep makesampleDirectories --file "
74 | "names.tab.txt --dout clustering" << std::endl;
75 | exit(0);
76 | }
77 | processVerbose();
78 | setOption(pars.separatedDirs, "--separatedDirs",
79 | "Create a separate directory for each index");
80 | setOption(pars.sampleNameFilename, "--file", "Sample Names Filename", true);
81 | setOption(pars_.directoryName_, "--dout", "Main Out Directory Name", true);
82 | setOption(pars_.overWriteDir_, "--overWriteDir",
83 | "If the directory already exists over write it");
84 | if (!failed_) {
85 | std::string newDirectoryName = "./"
86 | + njh::replaceString(njh::replaceString(pars_.directoryName_, "./", ""), "TODAY",
87 | getCurrentDate()) + "/";
88 | pars_.directoryName_ = njh::files::makeDir("./",
89 | njh::files::MkdirPar(njh::replaceString(pars_.directoryName_, "./", ""),
90 | pars_.overWriteDir_)).string();
91 | }
92 | finishSetUp(std::cout);
93 | }
94 |
95 | } // namespace njhseq
96 |
97 |
--------------------------------------------------------------------------------
/src/SeekDeepPrograms/SeekDeepUtils/gatherInfoOnTargetedAmpliconSeqFile.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * gatherInfoOnTargetedAmpliconSeqFile.cpp
3 | *
4 | * Created on: Oct 16, 2019
5 | * Author: nicholashathaway
6 | */
7 |
8 |
9 | #include "SeekDeepUtilsRunner.hpp"
10 |
11 | #include "SeekDeep/objects.h"
12 | #include "SeekDeep/parameters.h"
13 |
14 |
15 | namespace njhseq {
16 |
17 |
18 |
19 | int SeekDeepUtilsRunner::gatherInfoOnTargetedAmpliconSeqFile(
20 | const njh::progutils::CmdArgs & inputCommands) {
21 |
22 | TarAmpSeqInvestigator::TarAmpSeqInvestigatorPars investPars;
23 | seqSetUp setUp(inputCommands);
24 | setUp.processVerbose();
25 | setUp.processDebug();
26 | setUp.setOption(investPars.testNumber, "--testNumber", "Just use this number of reads of the top of the file");
27 | setUp.setOption(investPars.dontCollapsePossibleMIDs, "--dontCollapsePossibleMIDs",
28 | "Don't Collapse Possible MIDs", false);
29 | setUp.setOption(investPars.unrecogBaseSampling, "--unrecogBaseSampling",
30 | "Number of bases to sample from file for unrecognized sequences", false);
31 |
32 | setUp.setOption(investPars.precdingBaseFreqCutOff, "--precdingBaseFreqCutOff", "Preceding Base Freq Cut Off", false);
33 |
34 | investPars.pars.corePars_.pDetPars.primerWithin_ = 30;
35 | setUp.setOption(investPars.pars.corePars_.pDetPars.primerWithin_, "--primerWithin", "Primer Within bases search", false, "Primer");
36 |
37 |
38 | bool primerToUpperCase = false;
39 | setUp.setOption(primerToUpperCase, "--primerUpper",
40 | "Leave primers in upper case", false, "Primer");
41 | investPars.pars.corePars_.pDetPars.primerToLowerCase_ = !primerToUpperCase;
42 | setUp.setOption(investPars.pars.corePars_.pDetPars.allowable_.distances_.query_.coverage_, "--primerCoverage",
43 | "Amount of primers found", false, "Primer");
44 | setUp.setOption(investPars.pars.corePars_.pDetPars.allowable_.hqMismatches_, "--primerNumOfMismatches",
45 | "Number of Mismatches to allow in primers", false, "Primer");
46 | setUp.setOption(investPars.pars.corePars_.pDetPars.allowable_.oneBaseIndel_, "--primerOneBaseIndels",
47 | "Number Of One base indels to allow in primers", false, "Primer");
48 | setUp.setOption(investPars.pars.corePars_.pDetPars.allowable_.twoBaseIndel_, "--primerTwoBaseIndels",
49 | "Number Of Two base indels to allow in primers", false, "Primer");
50 |
51 | setUp.pars_.gapInfo_.gapOpen_ = 5;
52 | setUp.pars_.gapInfo_.gapExtend_ = 1;
53 | setUp.pars_.gap_ = "5,1";
54 | setUp.pars_.gapInfo_.gapRightQueryOpen_ = 0;
55 | setUp.pars_.gapInfo_.gapRightQueryExtend_ = 0;
56 | setUp.pars_.gapInfo_.gapRightRefOpen_ = 0;
57 | setUp.pars_.gapInfo_.gapRightRefExtend_ = 0;
58 | setUp.pars_.gapRight_ = "0,0";
59 | setUp.pars_.gapInfo_.gapLeftQueryOpen_ = 0;
60 | setUp.pars_.gapInfo_.gapLeftQueryExtend_ = 0;
61 | setUp.pars_.gapInfo_.gapLeftRefOpen_ = 0;
62 | setUp.pars_.gapInfo_.gapLeftRefExtend_ = 0;
63 | setUp.pars_.gapLeft_ = "0,0";
64 | setUp.processGap();
65 | investPars.gapInfo_ = setUp.pars_.gapInfo_;
66 | setUp.setOption(investPars.idFnp, "--id", "SeekDeep primers file", true);
67 | setUp.processReadInNames(VecStr{"--fastq1", "--fastq", "--fasta", "--fastq1gz", "--fastqgz", "--fastagz"});
68 | setUp.processDirectoryOutputName(true);
69 | setUp.finishSetUp(std::cout);
70 |
71 | setUp.startARunLog(setUp.pars_.directoryName_);
72 |
73 |
74 |
75 | TarAmpSeqInvestigator investigator(investPars);
76 | investigator.investigateFile(setUp.pars_.ioOptions_, setUp.pars_.verbose_);
77 | investigator.processCounts();
78 | investigator.writeOutTables(setUp.pars_.directoryName_, true);
79 |
80 |
81 | std::stringstream ss;
82 | auto possibleRevComp = investigator.reverseComplementLikely();
83 | auto possiblePrecedingRandomeBases = investigator.hasPossibleRandomPrecedingBases(investigator.ids_.getMaxMIDSize());
84 | ss << "Has Possible Reverse Complement directed reads: " << njh::boolToStr(possibleRevComp) << std::endl;
85 | ss << "Has Possible Random Preceding bases: " << njh::boolToStr(possiblePrecedingRandomeBases) << std::endl;
86 | auto recFlags = investigator.recommendSeekDeepExtractorFlags();
87 | if(!recFlags.empty()){
88 | ss << "Recommended SeekDeep extractor additional flags: " << std::endl;
89 | ss << njh::conToStr(recFlags, " ")<< std::endl;
90 | } else {
91 | ss << "No additional recommended SeekDeep extractor flags" << std::endl;
92 | }
93 |
94 | OutputStream seekdeepFlagRecs(njh::files::make_path(setUp.pars_.directoryName_, "message.txt"));
95 | seekdeepFlagRecs << ss.str();
96 | if(setUp.pars_.verbose_){
97 | std::cout << ss.str();
98 | }
99 | return 0;
100 |
101 | }
102 |
103 |
104 |
105 |
106 | } // namespace njhseq
107 |
108 |
--------------------------------------------------------------------------------
/scripts/cppProjectScripts/createTestDir.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import shutil, os, argparse, sys, stat,errno
4 | import CppHeaderParser
5 | from string import replace
6 | from argparse import Action
7 | sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyUtils"))
8 | from color_text import ColorText as CT
9 | from headInGraph import *
10 |
11 | testerBodyTemplate = """
12 | /*
13 | TEST_CASE("Basic tests for {REPLACETHIS}", "[{REPLACETHIS_DETAILED}]" ){{
14 | SECTION("GIVE SECTION NAME"){{
15 | YOUR CODE GOES HERE
16 | NORMALLY END WITH A REQUIRE STATEMENT e.g.
17 | REQUIRE(TESTVAL1 == YOURVAL);
18 | }}
19 | }}
20 | */
21 | """
22 |
23 | def mkdir_p(path):
24 | try:
25 | os.makedirs(path)
26 | except OSError as exc: # Python >2.5
27 | if exc.errno == errno.EEXIST and os.path.isdir(path):
28 | pass
29 | else: raise
30 |
31 | def mkdir_p_forFile(path):
32 | mkdir_p(os.path.dirname(path))
33 |
34 | def parse_args():
35 | parser = argparse.ArgumentParser()
36 | parser.add_argument('--src', type=str, required = True)
37 | parser.add_argument('--outDir', type=str, required = True)
38 | parser.add_argument("--overWrite", action = 'store_true')
39 | #parser.add_argument("--update", action = 'store_true')
40 | return parser.parse_args()
41 |
42 | def getFuncDetailed(func):
43 | ret = ""
44 | ret = ret + (func["rtnType"] + " ")
45 | ret = ret + (func["name"] + " (")
46 | count = 0
47 | for par in func["parameters"]:
48 | if(count != 0):
49 | ret = ret + (",")
50 | count +=1
51 | ret = ret + (par["raw_type"])
52 | if(par["reference"]):
53 | ret = ret + ("&")
54 | elif par["pointer"]:
55 | ret = ret + ("*")
56 | ret = ret + (" " + par["name"])
57 | ret = ret + ")"
58 | return ret
59 |
60 | def createTestMain(path, overWrite):
61 | mainBody = """
62 | // based off https://github.com/philsquared/Catch/blob/master/docs/tutorial.md
63 |
64 | #define CATCH_CONFIG_MAIN // This tells Catch to provide a main()
65 | #include
66 |
67 | """
68 | mainPath = os.path.join(path, "main.cpp")
69 | if os.path.exists(mainPath):
70 | if overWrite:
71 | os.remove(mainPath)
72 | else:
73 | print(mainPath, "already exists, use --overWrite to remove current")
74 | return
75 | with open(mainPath, "w") as mainFile:
76 | mainFile.write(mainBody)
77 | def copyMakefile(fromLoc, dest, overWrite):
78 | if os.path.exists(dest):
79 | if overWrite:
80 | os.remove(dest)
81 | else:
82 | print(dest, "already exists, use --overWrite to replace it")
83 | return
84 | shutil.copy(fromLoc, dest)
85 |
86 | def main():
87 | args = parse_args()
88 | headers = fileCollection.getHeaderFiles(args.src)
89 |
90 | for head in headers:
91 | try:
92 | cppHeader = CppHeaderParser.CppHeader(head)
93 | except CppHeaderParser.CppParseError as e:
94 | print(e)
95 | sys.exit(1)
96 | print(CT.boldBlack("Class public methods"))
97 |
98 | if(len(cppHeader.classes) + len(cppHeader.functions) > 0):
99 | testerCppPath = os.path.join(args.outDir,head.replace(".hpp", "Tester.cpp"))
100 | mkdir_p_forFile(testerCppPath)
101 | if os.path.exists(testerCppPath):
102 | if args.overWrite:
103 | os.remove(testerCppPath)
104 | else:
105 | print("Skipping", testerCppPath, "it already exist, use --overWrite to replace")
106 | continue
107 | with open(testerCppPath, "w") as testerFile:
108 | testerFile.write("#include \n")
109 | testerFile.write("#include \"" + "../" + head + "\"\n")
110 | for func in cppHeader.functions:
111 | testerFile.write(testerBodyTemplate.format(REPLACETHIS=func["name"], REPLACETHIS_DETAILED = getFuncDetailed(func)))
112 | for k in list(cppHeader.classes.keys()):
113 | for i in range(len(cppHeader.classes[k]["methods"]["public"])):
114 | testerFile.write(testerBodyTemplate.format(REPLACETHIS=cppHeader.classes[k]["methods"]["public"][i]["name"], REPLACETHIS_DETAILED = getFuncDetailed(cppHeader.classes[k]["methods"]["public"][i])))
115 | createTestMain(os.path.join(args.outDir, args.src), args.overWrite)
116 | copyMakefile("scripts/cppMakefiles/unitTest/Makefile", os.path.join(args.outDir, "Makefile"), args.overWrite)
117 | return 0
118 |
119 | main()
120 |
--------------------------------------------------------------------------------
/src/SeekDeep/objects/ControlBenchmarking/ControlMixSetUp.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * ControlMixSetUp.cpp
3 | *
4 | * Created on: May 6, 2019
5 | * Author: nicholashathaway
6 | */
7 |
8 |
9 | #include "ControlMixSetUp.hpp"
10 | #include
11 | namespace njhseq {
12 |
13 | ControlMixSetUp::ControlMixSetUp(const std::string & name,
14 | const std::unordered_map & relativeAbundances) :
15 | name_(name), rawRelativeAbundances_(relativeAbundances) {
16 | if (relativeAbundances.empty()) {
17 | std::stringstream ss;
18 | ss << __PRETTY_FUNCTION__ << ", error "
19 | << " relativeAbundances can't be empty" << "\n";
20 | throw std::runtime_error { ss.str() };
21 | }
22 |
23 | double total = 0;
24 | for (const auto & relAbund : rawRelativeAbundances_) {
25 | if (relAbund.second <= 0) {
26 | std::stringstream ss;
27 | ss << __PRETTY_FUNCTION__ << ", error "
28 | << " abundances need to be greater than zero, " << relAbund.first
29 | << ": " << relAbund.second << "\n";
30 | throw std::runtime_error { ss.str() };
31 | }
32 | total += relAbund.second;
33 | }
34 | for (const auto & relAbund : rawRelativeAbundances_) {
35 | relativeAbundances_[relAbund.first] = relAbund.second/total;
36 | }
37 |
38 | }
39 |
40 | void ControlMixSetUp::removeStrain(const std::string & name){
41 | if(!njh::in(name, rawRelativeAbundances_) || !njh::in(name, relativeAbundances_)){
42 | std::stringstream ss;
43 | ss << __PRETTY_FUNCTION__ << ", error " << "no strain named: " << name << " options are: " << njh::conToStr(njh::getVecOfMapKeys(rawRelativeAbundances_), ",")<< "\n";
44 | throw std::runtime_error{ss.str()};
45 | }
46 | rawRelativeAbundances_.erase(name);
47 | relativeAbundances_.erase(name);
48 |
49 | double total = 0;
50 | for (const auto & relAbund : rawRelativeAbundances_) {
51 | if (relAbund.second <= 0) {
52 | std::stringstream ss;
53 | ss << __PRETTY_FUNCTION__ << ", error "
54 | << " abundances need to be greater than zero, " << relAbund.first
55 | << ": " << relAbund.second << "\n";
56 | throw std::runtime_error { ss.str() };
57 | }
58 | total += relAbund.second;
59 | }
60 | for (const auto & relAbund : rawRelativeAbundances_) {
61 | relativeAbundances_[relAbund.first] = relAbund.second/total;
62 | }
63 | }
64 |
65 | VecStr ControlMixSetUp::getStrains() const {
66 | return njh::getVecOfMapKeys(rawRelativeAbundances_);
67 | }
68 |
69 | std::unordered_map ControlMixSetUp::readInSetUps(
70 | const bfs::path & mixtureSetUpFnp) {
71 | //read in mixture setup
72 | table mixtureSetupTab(mixtureSetUpFnp, "\t", true);
73 | mixtureSetupTab.checkForColumnsThrow(VecStr { "MixName", "strain", "relative_abundance" }, __PRETTY_FUNCTION__);
74 |
75 | if (mixtureSetupTab.empty()) {
76 | std::stringstream ss;
77 | ss << __PRETTY_FUNCTION__ << ", error " << mixtureSetUpFnp << " is empty "
78 | << "\n";
79 | throw std::runtime_error { ss.str() };
80 | }
81 |
82 | std::unordered_map mixSetups;
83 | std::unordered_map> mixInfos;
84 | std::unordered_map> mixInfosWithZeros;
85 |
86 | for (const auto & row : mixtureSetupTab) {
87 | std::string mixname = row[mixtureSetupTab.getColPos("MixName")];
88 | std::string strain = row[mixtureSetupTab.getColPos("strain")];
89 | double relative_abundance = njh::StrToNumConverter::stoToNum(
90 | row[mixtureSetupTab.getColPos("relative_abundance")]);
91 | if (njh::in(strain, mixInfos[mixname])) {
92 | std::stringstream ss;
93 | ss << __PRETTY_FUNCTION__ << ", error " << " already have " << strain
94 | << " for mixture " << mixname << "\n";
95 | throw std::runtime_error { ss.str() };
96 | }
97 | if (0 != relative_abundance) {
98 | mixInfos[mixname][strain] = relative_abundance;
99 | } else {
100 | mixInfosWithZeros[mixname][strain] = relative_abundance;
101 | }
102 | }
103 | std::set mixturesNamesWithAllZeros;
104 | for (const auto & mixInfo : mixInfosWithZeros) {
105 | if (!njh::in(mixInfo.first, mixInfos)) {
106 | mixturesNamesWithAllZeros.emplace(mixInfo.first);
107 | }
108 | }
109 | if (!mixturesNamesWithAllZeros.empty()) {
110 | std::stringstream ss;
111 | ss << __PRETTY_FUNCTION__ << ", error "
112 | << "the following mixtures had strains all with relative abundances of 0: "
113 | << njh::conToStrEndSpecial(mixturesNamesWithAllZeros, ", ", " and ")
114 | << "\n";
115 | throw std::runtime_error { ss.str() };
116 | }
117 | for (const auto & mixInfo : mixInfos) {
118 | mixSetups.emplace(mixInfo.first,
119 | ControlMixSetUp(mixInfo.first, mixInfo.second));
120 | }
121 | return mixSetups;
122 | }
123 |
124 | } // namespace njhseq
125 |
126 |
127 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/src/SeekDeep/server/PopClusProject.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * PopClusProject.cpp
3 | *
4 | * Created on: Sep 19, 2016
5 | * Author: nick
6 | */
7 |
8 | //
9 | // SeekDeep - A library for analyzing amplicon sequence data
10 | // Copyright (C) 2012-2019 Nicholas Hathaway ,
11 | // Jeffrey Bailey
12 | //
13 | // This file is part of SeekDeep.
14 | //
15 | // SeekDeep is free software: you can redistribute it and/or modify
16 | // it under the terms of the GNU General Public License as published by
17 | // the Free Software Foundation, either version 3 of the License, or
18 | // (at your option) any later version.
19 | //
20 | // SeekDeep is distributed in the hope that it will be useful,
21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | // GNU General Public License for more details.
24 | //
25 | // You should have received a copy of the GNU General Public License
26 | // along with SeekDeep. If not, see .
27 | //
28 |
29 |
30 | #include "PopClusProject.hpp"
31 | #include
32 |
33 | namespace njhseq {
34 |
35 | PopClusProject::PopClusProject(const Json::Value & configJson) :
36 | config_(configJson) {
37 | njh::json::MemberChecker checker(configJson);
38 | checker.failMemberCheckThrow( { "shortName", "projectName", "mainDir" },
39 | __PRETTY_FUNCTION__);
40 | auto coreJsonFnp = njh::files::make_path(configJson["mainDir"],
41 | "coreInfo.json");
42 | if (!bfs::exists(coreJsonFnp)) {
43 | std::stringstream ss;
44 | ss << __PRETTY_FUNCTION__ << ": Error, project "
45 | << configJson["projectName"] << "configuration "
46 | << " main directory doesn't contain coreInfo.json file" << "\n";
47 | ss << coreJsonFnp << " doesn't exist" << "\n";
48 | throw std::runtime_error { ss.str() };
49 | }
50 | collection_ = std::make_unique(
51 | njh::json::parseFile(coreJsonFnp.string()));
52 | shortName_ = config_["shortName"].asString();
53 | projectName_ = config_["projectName"].asString();
54 |
55 | tabs_.popInfo_ = std::make_unique(TableIOOpts(InOptions(collection_->getPopInfoPath()), "\t", true));
56 | tabs_.sampInfo_ = std::make_unique(TableIOOpts(InOptions(collection_->getSampInfoPath()), "\t", true));
57 | tabs_.hapIdTab_ = std::make_unique(TableIOOpts(InOptions(collection_->getHapIdTabPath()), "\t", true));
58 |
59 | //set up group meta data
60 | if(nullptr != collection_->groupDataPaths_){
61 | for(const auto & group : collection_->groupDataPaths_->allGroupPaths_){
62 | topGroupTabs_[group.first] = std::make_unique(TableIOOpts(InOptions(group.second.groupInfoFnp_), "\t", true));
63 | for(const auto & subGroup : group.second.groupPaths_){
64 | subGroupTabs_[group.first][subGroup.first].popInfo_ = std::make_unique(TableIOOpts(InOptions(subGroup.second.popFileFnp_), "\t", true));
65 | subGroupTabs_[group.first][subGroup.first].sampInfo_ = std::make_unique(TableIOOpts(InOptions(subGroup.second.sampFileFnp_), "\t", true));
66 | subGroupTabs_[group.first][subGroup.first].hapIdTab_ = std::make_unique(TableIOOpts(InOptions(subGroup.second.hapIdTabFnp_), "\t", true));
67 | }
68 | }
69 | }
70 |
71 | auto extractionProfileFnp = njh::files::make_path(configJson["mainDir"].asString(), "extractionInfo", "extractionProfile.tab.txt");
72 | auto extractionStatsFnp = njh::files::make_path(configJson["mainDir"].asString(), "extractionInfo", "extractionStats.tab.txt");
73 |
74 | if(bfs::exists(extractionProfileFnp)){
75 | extractionProfileTab_ = std::make_unique(TableIOOpts(InOptions(extractionProfileFnp), "\t", true));
76 | }
77 |
78 | if(bfs::exists(extractionStatsFnp)){
79 | extractionStatsTab_ = std::make_unique(TableIOOpts(InOptions(extractionStatsFnp), "\t", true));
80 | }
81 |
82 | }
83 |
84 |
85 | void PopClusProject::registerSeqFiles(SeqCache & cache) {
86 | auto getSeqFormat = [](const bfs::path & seqFnp){
87 | auto ret = njh::files::getExtension(seqFnp);
88 | if("gz" == ret){
89 | if (njh::endsWith(seqFnp.string(), ".fasta.gz")) {
90 | ret = ".fasta.gz";
91 | } else if (njh::endsWith(seqFnp.string(), ".fastq.gz")) {
92 | ret = ".fastq.gz";
93 | }
94 | }
95 | return ret;
96 | };
97 | auto popHapFile = collection_->getPopFinalHapsPath().string();
98 | cache.updateAddCache(shortName_,
99 | SeqIOOptions(popHapFile,
100 | SeqIOOptions::getInFormat(getSeqFormat(popHapFile)),
101 | true));
102 | for(const auto & samp : collection_->popNames_.samples_){
103 | auto sampHapFile = collection_->getSampleFinalHapsPath(samp).string();
104 | if(bfs::exists(sampHapFile)){
105 | cache.updateAddCache(shortName_ + "_" + samp,
106 | SeqIOOptions(sampHapFile,
107 | SeqIOOptions::getInFormat(getSeqFormat(sampHapFile)),
108 | true));
109 | }
110 | }
111 | }
112 |
113 | } // namespace njhseq
114 |
--------------------------------------------------------------------------------
/scripts/cppProjectScripts/whichHeader.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 |
4 | import sys, os, argparse
5 | from sets import Set
6 | sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyUtils"))
7 | from color_text import ColorText as CT
8 |
9 | def warning(*objs):
10 | # from http://stackoverflow.com/a/14981125
11 | print("\nWARNING: ", *objs, file=sys.stderr)
12 |
13 | objToHeader = {
14 | "std::string": "#include",
15 | "std::basic_string": "#include",
16 | "std::copy" : "#include",
17 | "std::find" : "#include",
18 | "std::sort" : "#include",
19 | "std::copy" : "#include",
20 | "std::find" : "#include",
21 | "std::sort" : "#include",
22 | "std::array" : "#include",
23 | "std::duration" : "#include",
24 | "std::time_point" : "#include",
25 | "std::sqrt" : "#include",
26 | "std::pow" : "#include",
27 | "std::fstream" : "#include",
28 | "std::ifstream" : "#include",
29 | "std::ofstream" : "#include",
30 | "std::future" : "#include",
31 | "std::promise" : "#include",
32 | "std::thread" : "#include",
33 | "std::mutex" : "#include",
34 | "std::lock" : "#include",
35 | "std::shared_timed_mutex" : "#include",
36 | "std::condition_variable" : "#include",
37 | "std::istream" : "#include",
38 | "std::ostream" : "#include",
39 | "std::cin" : "#include",
40 | "std::cout" : "#include",
41 | "std::istrstream" : "#include",
42 | "std::ostrstream" : "#include",
43 | "std::stringstream" : "#include",
44 | "std::map" : "#include