├── 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", 45 | "std::multimap" : "#include", 46 | "std::unordered_map" : "#include", 47 | "std::unordered_multimap" : "#include", 48 | "std::unique_ptr" : "#include", 49 | "std::shared_ptr" : "#include", 50 | "std::allocator" : "#include", 51 | "std::default_random_engine" : "#include", 52 | "std::normal_distribution" : "#include", 53 | "std::random_device" : "#include", 54 | "std::std::mt19937_64" : "#include", 55 | "std::std::mt19937" : "#include", 56 | "std::regex" : "#include", 57 | "std::smatch" : "#include", 58 | "std::set" : "#include", 59 | "std::multiset" : "#include", 60 | "std::unordered_set" : "#include ", 61 | "std::unordered_multiset" : "#include", 62 | "std::pair" : "#include ", 63 | "std::move" : "#include", 64 | "std::swap" : "#include", 65 | "std::vector" : "#include" 66 | } 67 | 68 | def parseForHeaders(args): 69 | headers = set() 70 | unknowns = [] 71 | 72 | for arg in args: 73 | if arg in objToHeader: 74 | headers.add(objToHeader[arg]) 75 | elif ("std::" + arg) in objToHeader: 76 | headers.add(objToHeader["std::" + arg]) 77 | else: 78 | unknowns.append(arg) 79 | print(CT.boldRed("Unknowns:")) 80 | for u in unknowns: 81 | print(CT.boldBlack("unknown which header file contains"), CT.boldRed(u)) 82 | 83 | if headers: 84 | print(CT.boldGreen("found headers:")) 85 | for h in sorted(headers): 86 | print(h) 87 | 88 | def printBashMatches(args): 89 | if not args: # show all available function names 90 | for k in [x[5:] for x in sorted(objToHeader.keys())]: 91 | print(k) 92 | return 93 | 94 | # we are completing a partial function name 95 | partial = args[0] 96 | def matchForBashAutocomplete(x): 97 | return x.startswith("std::" + partial) 98 | matches = list(filter(matchForBashAutocomplete, list(objToHeader.keys()))) 99 | for x in sorted(matches): 100 | print(x[5:]) # skip "std::" 101 | 102 | def parse_args(): 103 | parser = argparse.ArgumentParser() 104 | parser.add_argument('--bashAutoComplete', action="store_true", default=False) 105 | parser.add_argument('args', type=str, nargs='*') 106 | return parser.parse_args() 107 | 108 | def main(): 109 | args = parse_args() 110 | 111 | #warning(','.join(sys.argv)) 112 | 113 | if args.bashAutoComplete: 114 | printBashMatches(args.args) 115 | sys.exit(1) 116 | 117 | parseForHeaders(args.args) 118 | 119 | if __name__ == "__main__": 120 | main() 121 | -------------------------------------------------------------------------------- /src/SeekDeep/objects/TarAmpSetupUtils/PrimersAndMids.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* 4 | * PrimersAndMids.hpp 5 | * 6 | * Created on: Nov 27, 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 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "SeekDeep/objects/IlluminaUtils/PairedReadProcessor.hpp" 35 | 36 | namespace njhseq { 37 | 38 | class PrimersAndMids { 39 | public: 40 | 41 | struct InitPars{ 42 | InitPars(){ 43 | mPars_.allowableErrors_ = 1; 44 | } 45 | bfs::path idFile_; 46 | 47 | bfs::path lenCutOffFilename_ = ""; 48 | 49 | bfs::path comparisonSeqFnp_ = ""; 50 | uint32_t compKmerLen_ = 5; 51 | double compKmerSimCutOff_ = 0.50; 52 | 53 | MidDeterminator::MidDeterminePars mPars_; 54 | 55 | bfs::path overlapStatusFnp_ = ""; 56 | bool noOverlapProcessForNoOverlapStatusTargets_ = false; 57 | 58 | }; 59 | 60 | class Target { 61 | public: 62 | class lenCutOffs { 63 | public: 64 | lenCutOffs(uint32_t minLen, uint32_t maxLen, bool mark = true); 65 | ReadCheckerLenAbove minLenChecker_; 66 | ReadCheckerLenBelow maxLenChecker_; 67 | }; 68 | Target(const std::string & name, const std::string & forPrimer, const std::string & revPrimer); 69 | 70 | PrimerDeterminator::primerInfo info_; 71 | std::vector refs_; 72 | std::vector refKInfos_; 73 | 74 | std::shared_ptr lenCuts_; 75 | 76 | void addLenCutOff(uint32_t minLen, uint32_t maxLen, bool mark = true); 77 | 78 | void addSingleRef(const seqInfo & ref); 79 | void addMultileRef(const std::vector & refs); 80 | 81 | void setRefKInfos(uint32_t klen, bool setRevComp); 82 | 83 | std::vector overlapStatuses_ {PairedReadProcessor::ReadPairOverLapStatus::NONE}; 84 | 85 | }; 86 | 87 | PrimersAndMids(const bfs::path & idFileFnp); 88 | PrimersAndMids(const std::unordered_map & targets); 89 | 90 | 91 | void checkIfMIdsOrPrimersReadInThrow(const std::string & funcName) const; 92 | 93 | const bfs::path idFile_; 94 | 95 | std::unordered_map targets_; 96 | std::unordered_map mids_; 97 | 98 | std::unique_ptr mDeterminator_; 99 | std::unique_ptr pDeterminator_; 100 | 101 | void initAllAddLenCutsRefs(const InitPars & pars); 102 | 103 | void initMidDeterminator(const MidDeterminator::MidDeterminePars & midSearchPars); 104 | void initPrimerDeterminator(); 105 | 106 | bool hasTarget(const std::string & target) const; 107 | 108 | VecStr getTargets() const; 109 | 110 | VecStr getMids() const; 111 | 112 | bool hasMid(const std::string & mid) const; 113 | void addTarget(const std::string & primerName, const std::string & forPrimer, 114 | const std::string & revPrimer); 115 | 116 | void addMid(const std::string & midNmae, const std::string & barcode); 117 | void addMid(const std::string & midNmae, const std::string & forBarcode, const std::string & revBarcode); 118 | 119 | bool hasMultipleTargets() const; 120 | 121 | bool containsMids() const; 122 | bool containsTargets() const; 123 | bool screeningForPossibleContamination() const; 124 | 125 | void writeIdFile(const OutOptions & outOpts) const; 126 | void writeIdFile(const OutOptions & outOpts, const VecStr & targets) const; 127 | 128 | table genLenCutOffs(const VecStr & targets) const; 129 | table genOverlapStatuses(const VecStr & targets) const; 130 | 131 | 132 | 133 | std::vector getRefSeqs(const VecStr & targets) const; 134 | void checkMidNamesThrow() const; 135 | 136 | static std::map readInLenCutOffs( 137 | const bfs::path & lenCutOffsFnp); 138 | 139 | void addLenCutOffs(const bfs::path & lenCutOffsFnp); 140 | void addOverLapStatuses(const bfs::path & overlapStatuses); 141 | void addOverLapStatuses(const std::vector & allStatus); 142 | 143 | void addRefSeqs(const bfs::path & refDirectory); 144 | void setRefSeqsKInfos(uint32_t klen, bool setRevComp); 145 | 146 | void addDefaultLengthCutOffs(uint32_t minLength, uint32_t maxLength); 147 | 148 | 149 | uint32_t getMaxMIDSize() const; 150 | 151 | }; 152 | 153 | } // namespace njhseq 154 | 155 | -------------------------------------------------------------------------------- /etc/serverResources/pcv/js/utils.js: -------------------------------------------------------------------------------- 1 | // 2 | // SeekDeep - A library for analyzing amplicon sequence data 3 | // Copyright (C) 2012-2016 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 | function createProjectNavBarSkeleton(wrappingNavSelector, names){ 23 | //get rootName 24 | var rName = getRootName(); 25 | var projectName = names["projectName"]; 26 | addFixedTopNavSkeleton(wrappingNavSelector, "SeekDeep", "mainNav", "projectNav"); 27 | addNavLink("#mainNav", "Home", "/" + rName, "#siteHomeLink"); 28 | addNavDrop("#mainNav", "Projects", "projectDrop"); 29 | addNavLink("#mainNav", projectName, "/" + rName + "/mainProjectPage/"+ projectName, "projectHomeLink", true); 30 | addNavLink("#projectNav", "Extraction Info", "/" + rName + "/extractionInfo/" + projectName, "extractionLink"); 31 | addNavDrop("#projectNav", "Groups", "groupsDrop"); 32 | addNavDrop("#projectNav", "Samples", "samplesDrop"); 33 | } 34 | 35 | //names should have fields should have at least projectName and possibly groupName,sampName 36 | //names should also have array fields projectNames, groupNames, sampNames 37 | function populateProjectNavBar(wrappingNavSelector, names){ 38 | //get rootName 39 | var rName = getRootName(); 40 | //get project names 41 | var projectName = names["shortName"]; 42 | var projectsNames = names["projects"]; 43 | var projLinkPre = "/" + rName + "/mainProjectPage/"; 44 | //get group names 45 | var groupName = (names.hasOwnProperty("groupName")) ? names["groupName"] : ""; 46 | var groupNames = names["groups"]; 47 | var linkPreGroup = "/" + rName + "/groupInfoPage/" + projectName + "/"; 48 | //get sample names 49 | var sampName = (names.hasOwnProperty("sampleName")) ? names["sampleName"] : ""; 50 | var sampNames = names["samples"]; 51 | var linkPreSample = "/" + rName + "/sampleMainPage/" + projectName + "/"; 52 | 53 | d3.select("#projectDrop") 54 | .selectAll("li") 55 | .data(projectsNames) 56 | .enter() 57 | .append("li") 58 | .attr("class", function(d){ 59 | if(d == projectName){ 60 | return "active"; 61 | }else{ 62 | return ""; 63 | } 64 | }) 65 | .append("a") 66 | .attr("href", function(d){ return projLinkPre + d;}) 67 | .text(function(d){return d;}); 68 | 69 | d3.select("#groupsDrop") 70 | .selectAll("li") 71 | .data(groupNames) 72 | .enter() 73 | .append("li") 74 | .attr("class", function(d){ 75 | if(d == groupName){ 76 | return "active"; 77 | }else{ 78 | return ""; 79 | } 80 | }) 81 | .append("a") 82 | .attr("href",function(d){return linkPreGroup + d;} ) 83 | .text(function(d){return d;}); 84 | 85 | d3.select("#samplesDrop") 86 | .selectAll("li") 87 | .data(sampNames) 88 | .enter() 89 | .append("li") 90 | .attr("class", function(d){ 91 | if(d == sampName){ 92 | return "active"; 93 | }else{ 94 | return ""; 95 | } 96 | }) 97 | .append("a") 98 | .attr("href",function(d){return linkPreSample + d;} ) 99 | .text(function(d, i){return sampNames[i];}); 100 | } 101 | 102 | 103 | function createProjectNavBar(wrappingNavSelector, names){ 104 | createProjectNavBarSkeleton(wrappingNavSelector, names); 105 | populateProjectNavBar(wrappingNavSelector, names); 106 | } 107 | 108 | 109 | 110 | function createMainPageNavBarSkeleton(wrappingNavSelector){ 111 | var rName = getRootName(); 112 | addFixedTopNavSkeleton(wrappingNavSelector, "SeekDeep", "mainNav", "projectNav"); 113 | addNavLink("#mainNav", "Home", "/" + rName, "#siteHomeLink"); 114 | addNavDrop("#mainNav", "Projects", "projectDrop"); 115 | } 116 | 117 | function populateMainPageNavBar(wrappingNavSelector, projectsNames){ 118 | var rName = getRootName(); 119 | var projLinkPre = "/" + rName + "/mainProjectPage/"; 120 | d3.select("#projectDrop") 121 | .selectAll("li") 122 | .data(projectsNames) 123 | .enter() 124 | .append("li") 125 | .append("a") 126 | .attr("href", function(d){ return projLinkPre + d;}) 127 | .text(function(d){return d;}); 128 | } 129 | 130 | 131 | function createMainPageNavBar(wrappingNavSelector, projectsNames){ 132 | createMainPageNavBarSkeleton(wrappingNavSelector); 133 | populateMainPageNavBar(wrappingNavSelector, projectsNames); 134 | } 135 | 136 | function getNameUrls(projectName){ 137 | var rName = getRootName(); 138 | var infoUrls = ["/" + rName + "/projectsNames/"]; 139 | infoUrls.push("/" + rName + "/projectName/" + projectName); 140 | infoUrls.push("/" + rName + "/sampleNames/" + projectName); 141 | infoUrls.push("/" + rName + "/getGroupNames/" + projectName) 142 | return infoUrls; 143 | } 144 | 145 | 146 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | ROOT = $(realpath ./) 3 | ifdef CXXFLAGS 4 | ENV_CXXFLAGS := $(CXXFLAGS) 5 | endif 6 | ifdef LDFLAGS 7 | ENV_LDFLAGS := $(LDFLAGS) 8 | endif 9 | ifneq (,$(wildcard compfile.mk)) 10 | COMPFILE=compfile.mk 11 | endif 12 | include $(COMPFILE) 13 | #include 14 | include $(ROOT)/makefile-common.mk 15 | 16 | #define homebase 17 | HOMEBASEDIR=$(INSTALL_DIR) 18 | ifeq ($(HOMEBASEDIR),./$(CXXOUTNAME)) 19 | HOMEBASEDIR = $(realpath ./) 20 | endif 21 | 22 | #os name 23 | UNAME_S := $(shell uname -s) 24 | # header files 25 | HEADERS = $(call rwildcard, src/, *.h) \ 26 | $(call rwildcard, src/, *.hpp) 27 | ## Compile Object dir and files 28 | OBJ_DIR = $(addprefix build/, $(addsuffix Build, $(CXXOUTNAME))) 29 | OBJ = $(addprefix $(OBJ_DIR)/, $(patsubst %.cpp, %.o, $(call rwildcard, src/, *.cpp))) 30 | OBJNOMAIN = $(filter-out $(addsuffix /src/main.o, $(OBJ_DIR)), $(OBJ)) 31 | ## Out binary name 32 | BIN = $(addsuffix $(CXXOUTNAME), bin/) 33 | ## Library Names 34 | LIB_DIR=$(ROOT)/lib 35 | LIBNAME = $(addsuffix $(CXXOUTNAME), lib) 36 | DYLIB = $(addprefix $(addsuffix $(LIBNAME), $(LIB_DIR)/), .dylib) 37 | SOLIB = $(addprefix $(addsuffix $(LIBNAME), $(LIB_DIR)/), .so) 38 | ## Etc Directory 39 | ETC_DIR = etc 40 | ## Script dir 41 | ifneq (,$(wildcard cppSetupTools/scripts)) 42 | SCRIPTS_DIR = cppSetupTools/scripts 43 | else 44 | SCRIPTS_DIR = scripts 45 | endif 46 | 47 | 48 | ##Phony Targets 49 | .PHONY: all 50 | .PHONY: docs 51 | .PHONY: do_preReqs 52 | .SILENT: do_preReqs 53 | .PHONY: sharedLibrary 54 | .PHONY: dyLibrary 55 | .PHONY: clean 56 | .PHONY: installDirs 57 | .PHONY: install 58 | .PHONY: cpHeaders 59 | .PHONY: cpEtc 60 | .PHONY: unitTest 61 | .PHONY: printInstallDir 62 | 63 | ## unit tert dir 64 | TESTDIR=test 65 | 66 | ###compiler options, add in environmental 67 | CXXFLAGS += $(ENV_CXXFLAGS) 68 | LD_FLAGS += $(ENV_LDFLAGS) 69 | 70 | COMMON = $(CXXFLAGS) $(CXXOPT) $(COMLIBS) 71 | 72 | ##remove any object files that need to be removed due to updates to headers 73 | -include do_preReqs 74 | 75 | ############ default for calling make with no arguments 76 | all: do_preReqs $(OBJ_DIR) $(BIN) 77 | 78 | ######### docs 79 | docs: docs/Doxygen 80 | doxygen docs/Doxygen 81 | 82 | $(OBJ_DIR): 83 | mkdir -p $(OBJ_DIR) 84 | mkdir -p bin 85 | mkdir -p lib 86 | 87 | # using automatic variables $<: the name of the prerequisite of the rule and 88 | # $@: the name of the target of the rule 89 | $(OBJ_DIR)/%.o: %.cpp 90 | @mkdir -p $(OBJ_DIR)/$(shell dirname $<) 91 | $(CXX) $(COMMON) -fPIC -D$(CXXOUTNAME)_INSTALLDIR=\"$(HOMEBASEDIR)\" -c $< -o $@ 92 | 93 | $(BIN): $(OBJ) 94 | $(CXX) $(CXXFLAGS) $(CXXOPT) -o $@ $^ $(LD_FLAGS) 95 | 96 | ############ remove the objects that were dependant on any changed headers and check for compfile.mk 97 | do_preReqs: 98 | ifndef COMPFILE 99 | $(error compfile is not set, do either make COMPFILE=aCompfile.mk or create a file called compfile.mk) 100 | endif 101 | $(SCRIPTS_DIR)/setUpScripts/rmNeedToRecompile.py -obj $(OBJ_DIR) -src src/ 102 | 103 | 104 | ############ shared library 105 | sharedLibrary: do_preReqs $(OBJ_DIR) $(SOLIB) 106 | 107 | 108 | $(SOLIB): $(OBJNOMAIN) 109 | $(CXX) $(CXXFLAGS) $(CXXOPT) -shared -o $@ $^ $(LD_FLAGS) 110 | 111 | ############ dyLibrary 112 | dyLibrary: do_preReqs $(OBJ_DIR) $(DYLIB) 113 | 114 | $(DYLIB): $(OBJNOMAIN) 115 | $(CXX) $(CXXFLAGS) $(CXXOPT) -dynamiclib -o $@ $^ $(LD_FLAGS) 116 | 117 | 118 | ############ clean 119 | clean: 120 | @rm -f $(BIN) 121 | @rm -rf $(OBJ_DIR) 122 | 123 | ############ install 124 | INSTALL_OUTNAME=$(INSTALL_DIR)/bin/$(CXXOUTNAME) 125 | INSTALL_DYLIBNAME=$(INSTALL_DIR)/lib/$(LIBNAME).dylib 126 | INSTALL_SHAREDLIBNAME=$(OBJ_DIR) $(INSTALL_DIR)/lib/$(LIBNAME).so 127 | INSTALL_FILES=$(INSTALL_OUTNAME) $(INSTALL_DYLIBNAME) $(INSTALL_SHAREDLIBNAME) 128 | 129 | install: installDirs cpHeaders cpEtc do_preReqs $(INSTALL_FILES) 130 | 131 | installDirs: $(INSTALL_DIR) $(INSTALL_DIR)/include $(INSTALL_DIR)/bin $(INSTALL_DIR)/lib 132 | 133 | #### install directories set up 134 | $(INSTALL_DIR): 135 | @mkdir -p $(INSTALL_DIR) 136 | $(INSTALL_DIR)/include: 137 | @mkdir -p $(INSTALL_DIR)/include 138 | $(INSTALL_DIR)/bin: 139 | @mkdir -p $(INSTALL_DIR)/bin 140 | $(INSTALL_DIR)/lib: 141 | @mkdir -p $(INSTALL_DIR)/lib 142 | 143 | #### installing shared library 144 | $(INSTALL_DIR)/lib/$(LIBNAME).so: $(OBJNOMAIN) 145 | $(CXX) $(CXXFLAGS) $(CXXOPT) -shared -o $(realpath $(INSTALL_DIR))/lib/$(LIBNAME).so $^ $(LD_FLAGS) 146 | 147 | #### installing dynamic library 148 | $(INSTALL_DIR)/lib/$(LIBNAME).dylib: $(OBJNOMAIN) 149 | ifeq ($(UNAME_S), Darwin) 150 | $(CXX) $(CXXFLAGS) $(CXXOPT) -dynamiclib -o $(realpath $(INSTALL_DIR))/lib/$(LIBNAME).dylib $^ $(LD_FLAGS) 151 | endif 152 | 153 | 154 | $(INSTALL_DIR)/bin/$(CXXOUTNAME): $(OBJ) 155 | $(CXX) $(CXXFLAGS) $(CXXOPT) -o $(realpath $(INSTALL_DIR))/bin/$(CXXOUTNAME) $^ $(LD_FLAGS) 156 | 157 | ### Run the move headers script and remove the previous includes directory to get rid 158 | ### of any headers that were removed 159 | cpHeaders: $(INSTALL_DIR) 160 | $(SCRIPTS_DIR)/setUpScripts/installHeaders.py -src src/ -dest $(INSTALL_DIR)/include/ -rmDir 161 | 162 | ### Copy etc folder if it exists 163 | cpEtc: $(INSTALL_DIR) 164 | ifneq ("$(wildcard $(ETC_DIR))","") 165 | $(SCRIPTS_DIR)/setUpScripts/installEtc.py -etcFolder etc/ -dest $(INSTALL_DIR)/ -rmDir 166 | endif 167 | 168 | ### Run unit tests if available 169 | unitTest: 170 | $(SCRIPTS_DIR)/setUpScripts/runUnitTest.sh 171 | 172 | 173 | printInstallDir: 174 | @echo $(INSTALL_DIR) 175 | -------------------------------------------------------------------------------- /scripts/cppMakefiles/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ROOT = $(realpath ./) 3 | ifdef CXXFLAGS 4 | ENV_CXXFLAGS := $(CXXFLAGS) 5 | endif 6 | ifdef LDFLAGS 7 | ENV_LDFLAGS := $(LDFLAGS) 8 | endif 9 | ifneq (,$(wildcard compfile.mk)) 10 | COMPFILE=compfile.mk 11 | endif 12 | include $(COMPFILE) 13 | #include 14 | include $(ROOT)/makefile-common.mk 15 | 16 | #define homebase 17 | HOMEBASEDIR=$(INSTALL_DIR) 18 | ifeq ($(HOMEBASEDIR),./$(CXXOUTNAME)) 19 | HOMEBASEDIR = $(realpath ./) 20 | endif 21 | 22 | #os name 23 | UNAME_S := $(shell uname -s) 24 | # header files 25 | HEADERS = $(call rwildcard, src/, *.h) \ 26 | $(call rwildcard, src/, *.hpp) 27 | ## Compile Object dir and files 28 | OBJ_DIR = $(addprefix build/, $(addsuffix Build, $(CXXOUTNAME))) 29 | OBJ = $(addprefix $(OBJ_DIR)/, $(patsubst %.cpp, %.o, $(call rwildcard, src/, *.cpp))) 30 | OBJNOMAIN = $(filter-out $(addsuffix /src/main.o, $(OBJ_DIR)), $(OBJ)) 31 | ## Out binary name 32 | BIN = $(addsuffix $(CXXOUTNAME), bin/) 33 | ## Library Names 34 | LIB_DIR=$(ROOT)/lib 35 | LIBNAME = $(addsuffix $(CXXOUTNAME), lib) 36 | DYLIB = $(addprefix $(addsuffix $(LIBNAME), $(LIB_DIR)/), .dylib) 37 | SOLIB = $(addprefix $(addsuffix $(LIBNAME), $(LIB_DIR)/), .so) 38 | ## Etc Directory 39 | ETC_DIR = etc 40 | ## Script dir 41 | ifneq (,$(wildcard cppSetupTools/scripts)) 42 | SCRIPTS_DIR = cppSetupTools/scripts 43 | else 44 | SCRIPTS_DIR = scripts 45 | endif 46 | 47 | 48 | ##Phony Targets 49 | .PHONY: all 50 | .PHONY: docs 51 | .PHONY: do_preReqs 52 | .SILENT: do_preReqs 53 | .PHONY: sharedLibrary 54 | .PHONY: dyLibrary 55 | .PHONY: clean 56 | .PHONY: installDirs 57 | .PHONY: install 58 | .PHONY: cpHeaders 59 | .PHONY: cpEtc 60 | .PHONY: unitTest 61 | .PHONY: printInstallDir 62 | 63 | ## unit tert dir 64 | TESTDIR=test 65 | 66 | ###compiler options, add in environmental 67 | CXXFLAGS += $(ENV_CXXFLAGS) 68 | LD_FLAGS += $(ENV_LDFLAGS) 69 | 70 | COMMON = $(CXXFLAGS) $(CXXOPT) $(COMLIBS) 71 | 72 | ##remove any object files that need to be removed due to updates to headers 73 | -include do_preReqs 74 | 75 | ############ default for calling make with no arguments 76 | all: do_preReqs $(OBJ_DIR) $(BIN) 77 | 78 | ######### docs 79 | docs: docs/Doxygen 80 | doxygen docs/Doxygen 81 | 82 | $(OBJ_DIR): 83 | mkdir -p $(OBJ_DIR) 84 | mkdir -p bin 85 | mkdir -p lib 86 | 87 | # using automatic variables $<: the name of the prerequisite of the rule and 88 | # $@: the name of the target of the rule 89 | $(OBJ_DIR)/%.o: %.cpp 90 | @mkdir -p $(OBJ_DIR)/$(shell dirname $<) 91 | $(CXX) $(COMMON) -fPIC -D$(CXXOUTNAME)_INSTALLDIR=\"$(HOMEBASEDIR)\" -c $< -o $@ 92 | 93 | $(BIN): $(OBJ) 94 | $(CXX) $(CXXFLAGS) $(CXXOPT) -o $@ $^ $(LD_FLAGS) 95 | 96 | ############ remove the objects that were dependant on any changed headers and check for compfile.mk 97 | do_preReqs: 98 | ifndef COMPFILE 99 | $(error compfile is not set, do either make COMPFILE=aCompfile.mk or create a file called compfile.mk) 100 | endif 101 | $(SCRIPTS_DIR)/setUpScripts/rmNeedToRecompile.py -obj $(OBJ_DIR) -src src/ 102 | 103 | 104 | ############ shared library 105 | sharedLibrary: do_preReqs $(OBJ_DIR) $(SOLIB) 106 | 107 | 108 | $(SOLIB): $(OBJNOMAIN) 109 | $(CXX) $(CXXFLAGS) $(CXXOPT) -shared -o $@ $^ $(LD_FLAGS) 110 | 111 | ############ dyLibrary 112 | dyLibrary: do_preReqs $(OBJ_DIR) $(DYLIB) 113 | 114 | $(DYLIB): $(OBJNOMAIN) 115 | $(CXX) $(CXXFLAGS) $(CXXOPT) -dynamiclib -o $@ $^ $(LD_FLAGS) 116 | 117 | 118 | ############ clean 119 | clean: 120 | @rm -f $(BIN) 121 | @rm -rf $(OBJ_DIR) 122 | 123 | ############ install 124 | INSTALL_OUTNAME=$(INSTALL_DIR)/bin/$(CXXOUTNAME) 125 | INSTALL_DYLIBNAME=$(INSTALL_DIR)/lib/$(LIBNAME).dylib 126 | INSTALL_SHAREDLIBNAME=$(OBJ_DIR) $(INSTALL_DIR)/lib/$(LIBNAME).so 127 | INSTALL_FILES=$(INSTALL_OUTNAME) $(INSTALL_DYLIBNAME) $(INSTALL_SHAREDLIBNAME) 128 | 129 | install: installDirs cpHeaders cpEtc do_preReqs $(INSTALL_FILES) 130 | 131 | installDirs: $(INSTALL_DIR) $(INSTALL_DIR)/include $(INSTALL_DIR)/bin $(INSTALL_DIR)/lib 132 | 133 | #### install directories set up 134 | $(INSTALL_DIR): 135 | @mkdir -p $(INSTALL_DIR) 136 | $(INSTALL_DIR)/include: 137 | @mkdir -p $(INSTALL_DIR)/include 138 | $(INSTALL_DIR)/bin: 139 | @mkdir -p $(INSTALL_DIR)/bin 140 | $(INSTALL_DIR)/lib: 141 | @mkdir -p $(INSTALL_DIR)/lib 142 | 143 | #### installing shared library 144 | $(INSTALL_DIR)/lib/$(LIBNAME).so: $(OBJNOMAIN) 145 | $(CXX) $(CXXFLAGS) $(CXXOPT) -shared -o $(realpath $(INSTALL_DIR))/lib/$(LIBNAME).so $^ $(LD_FLAGS) 146 | 147 | #### installing dynamic library 148 | $(INSTALL_DIR)/lib/$(LIBNAME).dylib: $(OBJNOMAIN) 149 | ifeq ($(UNAME_S), Darwin) 150 | $(CXX) $(CXXFLAGS) $(CXXOPT) -dynamiclib -o $(realpath $(INSTALL_DIR))/lib/$(LIBNAME).dylib $^ $(LD_FLAGS) 151 | endif 152 | 153 | 154 | $(INSTALL_DIR)/bin/$(CXXOUTNAME): $(OBJ) 155 | $(CXX) $(CXXFLAGS) $(CXXOPT) -o $(realpath $(INSTALL_DIR))/bin/$(CXXOUTNAME) $^ $(LD_FLAGS) 156 | 157 | ### Run the move headers script and remove the previous includes directory to get rid 158 | ### of any headers that were removed 159 | cpHeaders: $(INSTALL_DIR) 160 | $(SCRIPTS_DIR)/setUpScripts/installHeaders.py -src src/ -dest $(INSTALL_DIR)/include/ -rmDir 161 | 162 | ### Copy etc folder if it exists 163 | cpEtc: $(INSTALL_DIR) 164 | ifneq ("$(wildcard $(ETC_DIR))","") 165 | $(SCRIPTS_DIR)/setUpScripts/installEtc.py -etcFolder etc/ -dest $(INSTALL_DIR)/ -rmDir 166 | endif 167 | 168 | ### Run unit tests if available 169 | unitTest: 170 | $(SCRIPTS_DIR)/setUpScripts/runUnitTest.sh 171 | 172 | 173 | printInstallDir: 174 | @echo $(INSTALL_DIR) 175 | -------------------------------------------------------------------------------- /src/SeekDeepPrograms/SeekDeepServer/SeekDeepServerRunner.cpp: -------------------------------------------------------------------------------- 1 | 2 | // ServerRunner.cpp 3 | // 4 | // Created by Nick Hathaway on 2015/06/24. 5 | // 6 | // SeekDeep - A library for analyzing amplicon sequence data 7 | // Copyright (C) 2012-2019 Nicholas Hathaway , 8 | // Jeffrey Bailey 9 | // 10 | // This file is part of SeekDeep. 11 | // 12 | // SeekDeep is free software: you can redistribute it and/or modify 13 | // it under the terms of the GNU General Public License as published by 14 | // the Free Software Foundation, either version 3 of the License, or 15 | // (at your option) any later version. 16 | // 17 | // SeekDeep is distributed in the hope that it will be useful, 18 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU General Public License 23 | // along with SeekDeep. If not, see . 24 | // 25 | 26 | #include "SeekDeepServerRunner.hpp" 27 | 28 | #include 29 | 30 | namespace njhseq { 31 | 32 | SeekDeepServerRunner::SeekDeepServerRunner() 33 | : njh::progutils::ProgramRunner( 34 | { 35 | addFunc("genProjectConfig", genProjectConfig, false), 36 | addFunc("popClusteringViewer", popClusteringViewer, false) 37 | },// 38 | "SeekDeepServer") {} 39 | 40 | 41 | 42 | 43 | 44 | 45 | void errorHandler(const int statusCode, const std::exception& exception, 46 | const std::shared_ptr& session) { 47 | std::cerr << "statusCode: " << statusCode << std::endl; 48 | std::cerr << exception.what() << std::endl; 49 | if(nullptr != session && session->is_open()){ 50 | session->close(statusCode, exception.what(), { { "Server", "Restbed" } }); 51 | } 52 | } 53 | 54 | 55 | int SeekDeepServerRunner::popClusteringViewer(const njh::progutils::CmdArgs & inputCommands){ 56 | njhseq::seqSetUp setUp(inputCommands); 57 | SeqAppCorePars corePars; 58 | corePars.port_ = 9881; 59 | corePars.name_ = "pcv"; 60 | bfs::path configDir = ""; 61 | bfs::path resourceDirName = njh::files::make_path(SeekDeep_INSTALLDIR, "etc/serverResources").string(); 62 | setUp.setOption(resourceDirName, "--resourceDirName", 63 | "Name of the resource Directory where the js and html is located", 64 | !bfs::exists(resourceDirName)); 65 | 66 | setUp.setOption(configDir, "--configDir", "Name of the Master Result Directory", true); 67 | 68 | setUp.processDebug(); 69 | setUp.processVerbose(); 70 | corePars.setCoreOptions(setUp); 71 | setUp.finishSetUp(std::cout); 72 | resourceDirName = njh::appendAsNeededRet(resourceDirName.string(), "/"); 73 | configDir = njh::appendAsNeededRet(configDir.string(), "/"); 74 | 75 | VecStr warnings; 76 | if(!bfs::exists(resourceDirName)){ 77 | std::stringstream ss; 78 | ss << __PRETTY_FUNCTION__ << ": error, resource directory " << resourceDirName << " doesn't exist"; 79 | warnings.emplace_back(ss.str()); 80 | } 81 | if(!bfs::exists(configDir)){ 82 | std::stringstream ss; 83 | ss << __PRETTY_FUNCTION__ << ": error, configuration directory " << configDir << " doesn't exist"; 84 | warnings.emplace_back(ss.str()); 85 | } 86 | if(!warnings.empty()){ 87 | throw std::runtime_error{njh::conToStr(warnings, "\n")}; 88 | } 89 | // 90 | Json::Value appConfig; 91 | corePars.addCoreOpts(appConfig); 92 | appConfig["configDir"] = njh::json::toJson(configDir); 93 | appConfig["resources"] = njh::json::toJson(resourceDirName); 94 | if(setUp.pars_.verbose_){ 95 | std::cout << corePars.getAddress() << std::endl; 96 | } 97 | pcv pcViewer(appConfig); 98 | auto resources = pcViewer.getAllResources(); 99 | auto settings = std::make_shared(); 100 | settings->set_port(corePars.port_); 101 | settings->set_default_header("Connection", "close"); 102 | settings->set_bind_address(corePars.bindAddress_); 103 | restbed::Service service; 104 | service.set_error_handler(errorHandler); 105 | for(const auto & resource : resources){ 106 | service.publish(resource); 107 | } 108 | try { 109 | service.start(settings); 110 | } catch (std::exception & e) { 111 | std::cerr << e.what() << std::endl; 112 | } 113 | 114 | 115 | return 0; 116 | } 117 | 118 | 119 | int SeekDeepServerRunner::genProjectConfig( 120 | const njh::progutils::CmdArgs & inputCommands) { 121 | njhseq::seqSetUp setUp(inputCommands); 122 | std::string mainDir = ""; 123 | std::string projectName = ""; 124 | std::string shortName = ""; 125 | bool debug = false; 126 | setUp.setOption(projectName, "--projectName", "Name of the Project", true); 127 | setUp.setOption(debug, "--debug", "Run In Debug Mode"); 128 | setUp.setOption(shortName, "--shortName", "Short Name for url for project, so only characters allowed in urls should bed used"); 129 | if ("" == shortName) { 130 | shortName = projectName; 131 | } 132 | setUp.setOption(mainDir, "--mainDir", "Name of the Master Result Directory created by SeekDeep processClusters", 133 | true); 134 | njh::appendAsNeeded(mainDir, "/"); 135 | OutOptions outOpts(shortName, ".config"); 136 | setUp.processWritingOptions(outOpts); 137 | setUp.finishSetUp(std::cout); 138 | // 139 | Json::Value config; 140 | config["mainDir"] = njh::appendAsNeededRet( 141 | njh::files::normalize(mainDir).string(), "/"); 142 | config["shortName"] = shortName; 143 | config["projectName"] = projectName; 144 | config["debug"] = debug; 145 | OutputStream out(outOpts); 146 | out << config << std::endl; 147 | return 0; 148 | } 149 | 150 | 151 | } // namespace njhseq 152 | -------------------------------------------------------------------------------- /scripts/setUpScripts/ProjectUpdater.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import shutil, os, argparse, sys, stat, time, platform 4 | sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyUtils")) 5 | from utils import Utils 6 | from color_text import ColorText as CT 7 | from shutil import ignore_patterns 8 | 9 | 10 | class ProjectUpdater(): 11 | def __init__(self, externalLoc, numCores, setupFrom, projectDir = "./"): 12 | self.numCores = numCores 13 | #make sure not to take all cores or more than the amount of cores available 14 | if not self.numCores or self.numCores > Utils.num_cores(): 15 | self.numCores = Utils.num_cores() 16 | if self.numCores == Utils.num_cores(): 17 | self.numCores -= 1 18 | self.externalLoc = os.path.abspath(externalLoc) 19 | self.projectDir = os.path.abspath(projectDir) 20 | self.setupFrom = os.path.abspath(setupFrom) 21 | 22 | def remakeNJHseqProject(self, subProjectDir): 23 | makeCmd = "" 24 | cmd = """ 25 | if [ -f .git ]; then git pull; fi 26 | && if [ -f .gitmodules ]; then git submodule init && git submodule update; fi 27 | && ./configure.py -externalLibDir {EXT_LOC} 28 | && ./setup.py --compfile compfile.mk --outMakefile makefile-common.mk --overWrite 29 | && make clean && make -j {NUMCORES} 30 | && if [ -d $(make printInstallDir) ]; then rm -rf $(make printInstallDir); fi 31 | && mkdir -p $(make printInstallDir) 32 | && make -j {NUMCORES} install""".format(EXT_LOC = self.externalLoc, NUMCORES = self.numCores) 33 | cmd = cmd + makeCmd 34 | cmd = " ".join(cmd.split()) 35 | Utils.run_in_dir(cmd, subProjectDir) 36 | 37 | def remakeNJHseqProjects(self, dirs): 38 | """ 39 | Remake dirs in the project directory 40 | """ 41 | installed = [] 42 | failed = [] 43 | nonExistent = [] 44 | for dir in dirs: 45 | dir = os.path.join(self.projectDir, dir) 46 | if os.path.exists(dir): 47 | try: 48 | self.remakeNJHseqProject(dir) 49 | installed.append(dir) 50 | except Exception as inst: 51 | print(inst) 52 | failed.append(dir) 53 | else: 54 | nonExistent.append(dir) 55 | #installed 56 | for d in installed: 57 | print(CT.green + "Updated " + d + CT.reset) 58 | #failed 59 | for d in failed: 60 | print(CT.red + "Failed to update " + d + CT.reset) 61 | #didn't exist 62 | for d in nonExistent: 63 | print(CT.cyan + os.path.basename(d) + " doesn't exist in " + self.projectDir + ", skipped" + CT.reset) 64 | 65 | def copyDir(self, src, dist, overWrite): 66 | if(os.path.exists(dist)): 67 | if(overWrite): 68 | shutil.rmtree(dist) 69 | else: 70 | raise Exception( "Error, directory " + str(dist) + " already exist, set overwrite to overwrite dir") 71 | shutil.copytree(src, dist, ignore=ignore_patterns('*.pyc', '*~', '.*')) 72 | 73 | def copySetUp(self, distDir, overWrite=False): 74 | if not os.path.exists(distDir): 75 | print(CT.boldGreen(distDir) + CT.boldRed(" doesn't exist skipping")) 76 | return 77 | if os.path.exists(os.path.join(distDir, "setup.py")) and not overWrite: 78 | raise Exception("Error, file " + os.path.join(distDir, "setup.py") + " already exist, use --overWrite overwrite setup.py") 79 | shutil.copy(os.path.join(self.setupFrom, "setup.py"), os.path.join(distDir, "setup.py")) 80 | self.copyDir(os.path.join(self.setupFrom ,"scripts"), os.path.join(distDir,"scripts"), overWrite) 81 | 82 | def copySetUpToSub(self, distDir, overWrite=False): 83 | distDir = os.path.join(self.projectDir, distDir) 84 | self.copySetUp(distDir, overWrite) 85 | 86 | def copySetUpToMain(self, overWrite=False): 87 | distDir = self.projectDir 88 | self.copySetUp(distDir, overWrite) 89 | 90 | def copyMakefile(self, distDir, overWrite=False): 91 | distDir = os.path.join(self.projectDir, distDir) 92 | if not os.path.exists(distDir): 93 | print(CT.boldGreen(distDir) + CT.boldRed(" doesn't exist skipping")) 94 | return 95 | if os.path.exists(os.path.join(distDir, "Makefile")) and not overWrite: 96 | raise Exception("Error, file " + os.path.join(distDir, "Makefile") + " already exist, use --overWrite overwrite Makefile") 97 | shutil.copy(os.path.join(self.setupFrom, "scripts/cppMakefiles/Makefile"), os.path.join(distDir, "Makefile")) 98 | 99 | def reatchHeadAndPull(self, subModuleDir, branch): 100 | cmds = "cd " + os.path.join(self.projectDir, subModuleDir) + " && git checkout " + branch + " && git pull" 101 | Utils.run(cmds) 102 | 103 | def reatchHeadCommitPush(self, subModuleDir, branch, commitMessage): 104 | try: 105 | self.reatchHeadAndPull(subModuleDir, branch) 106 | except Exception as excp: 107 | print("Failed to reatch head and pull for " + subModuleDir + ":" + branch) 108 | raise(excp) 109 | cmds = "cd " + os.path.join(self.projectDir, subModuleDir) + " && git commit -a -m \"" + commitMessage + "\" && git push" 110 | try: 111 | Utils.run(cmds) 112 | except Exception as pushExcep: 113 | print("Failed to commit and push for " + subModuleDir + ":" + branch) 114 | raise(pushExcep) 115 | 116 | -------------------------------------------------------------------------------- /src/SeekDeep/objects/ControlBenchmarking/ControlBencher.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* 4 | * ControlBencher.hpp 5 | * 6 | * Created on: May 6, 2019 7 | * Author: nicholashathaway 8 | */ 9 | 10 | 11 | #include 12 | #include 13 | 14 | #include "SeekDeep/objects/ControlBenchmarking/ControlMixSetUp.hpp" 15 | 16 | 17 | namespace njhseq { 18 | 19 | class ControlBencher { 20 | public: 21 | struct ControlBencherPars{ 22 | bfs::path mixSetUpFnp_; 23 | bfs::path samplesToMixFnp_; 24 | }; 25 | 26 | ControlBencher(const ControlBencherPars & pars); 27 | 28 | const ControlBencherPars pars_; 29 | 30 | std::unordered_map mixSetups_; 31 | std::unordered_map samplesToMix_; 32 | 33 | 34 | std::set getAllStrains() const; 35 | VecStr getSamples() const; 36 | 37 | 38 | void removeStrain(const std::string & name); 39 | void removeStrains(const VecStr & names); 40 | 41 | 42 | void checkForStrainsThrow(const std::set & names, 43 | const std::string & funcName) const; 44 | 45 | struct benchResults{ 46 | std::unordered_map resSeqToExpSeq_; 47 | uint32_t recoveredHaps_ = 0; 48 | uint32_t falseHaps_ = 0; 49 | uint32_t expectedHapCnt_ = 0; 50 | double sumOfSquares_ = 0; 51 | 52 | VecStr missingExpecteds_; 53 | 54 | double RMSE() const{ 55 | return 0 == sumOfSquares_ ? 0 : std::sqrt(sumOfSquares_/static_cast(recoveredHaps_)); 56 | } 57 | uint32_t totalHaps() const { 58 | return falseHaps_ + recoveredHaps_; 59 | } 60 | double falseHapRate() const{ 61 | return falseHaps_/static_cast(totalHaps()); 62 | } 63 | double hapRecoveryRate() const{ 64 | return recoveredHaps_/static_cast(expectedHapCnt_); 65 | } 66 | 67 | std::map> falseHapsCompsToExpected; 68 | std::map> falseHapsCompsToOthers; 69 | 70 | }; 71 | 72 | 73 | template 74 | static benchResults benchmark(const std::vector & resultSeqs, const std::vector & expectedSeqs, 75 | const std::unordered_map & expectedSeqFracs, 76 | const std::unordered_map & expectedSeqNameKey){ 77 | benchResults ret; 78 | ret.expectedHapCnt_ = expectedSeqs.size(); 79 | for(const auto & resultSeq : resultSeqs){ 80 | const auto & resSeq = getSeqBase(resultSeq); 81 | std::string matchingRef = ""; 82 | double expectedFrac = 0; 83 | for(const auto & expectedSeq : expectedSeqs){ 84 | const auto & expSeq = getSeqBase(expectedSeq); 85 | if(resSeq.seq_ == expSeq.seq_){ 86 | matchingRef = njh::mapAt(expectedSeqNameKey,expSeq.name_); 87 | expectedFrac = njh::mapAt(expectedSeqFracs,expSeq.name_); 88 | break; 89 | } 90 | } 91 | if("" != matchingRef){ 92 | ++ret.recoveredHaps_; 93 | ret.sumOfSquares_+= std::pow(resultSeq.frac_ - expectedFrac, 2.0); 94 | }else{ 95 | ++ret.falseHaps_; 96 | } 97 | ret.resSeqToExpSeq_[resSeq.name_] = matchingRef; 98 | } 99 | return ret; 100 | } 101 | 102 | template 103 | static benchResults benchmark(const std::vector & resultSeqs, const std::vector & expectedSeqs, 104 | const std::unordered_map & expectedSeqFracs, 105 | const std::unordered_map & expectedSeqNameKey, 106 | aligner & alignerObj, 107 | const comparison & allowableError = comparison{} ){ 108 | benchResults ret; 109 | ret.expectedHapCnt_ = expectedSeqs.size(); 110 | std::unordered_set matchingRefs; 111 | for(const auto & resultSeq : resultSeqs){ 112 | const auto & resSeq = getSeqBase(resultSeq); 113 | std::string matchingRef = ""; 114 | double expectedFrac = 0; 115 | for(const auto & expectedSeq : expectedSeqs){ 116 | const auto & expSeq = getSeqBase(expectedSeq); 117 | alignerObj.alignCacheGlobal(expSeq, resSeq); 118 | alignerObj.profileAlignment(expSeq, resSeq, false, false, false); 119 | //consider doing best matching reference 120 | if(allowableError.passErrorProfile(alignerObj.comp_)){ 121 | matchingRef = njh::mapAt(expectedSeqNameKey,expSeq.name_); 122 | expectedFrac = njh::mapAt(expectedSeqFracs,expSeq.name_); 123 | break; 124 | } 125 | } 126 | if("" != matchingRef){ 127 | ++ret.recoveredHaps_; 128 | ret.sumOfSquares_+= std::pow(resultSeq.frac_ - expectedFrac, 2.0); 129 | }else{ 130 | ++ret.falseHaps_; 131 | for(const auto & exp : expectedSeqs){ 132 | alignerObj.alignCacheGlobal(exp, resultSeq); 133 | alignerObj.profileAlignment(exp, resultSeq, false, false, false); 134 | ret.falseHapsCompsToExpected[resSeq.name_][getSeqBase(exp).name_] = alignerObj.comp_; 135 | } 136 | for(const auto & otherRes : resultSeqs){ 137 | if(getSeqBase(otherRes).name_ == getSeqBase(resultSeq).name_){ 138 | continue; 139 | } 140 | alignerObj.alignCacheGlobal(otherRes, resultSeq); 141 | alignerObj.profileAlignment(otherRes, resultSeq, false, false, false); 142 | ret.falseHapsCompsToOthers[resSeq.name_][getSeqBase(otherRes).name_] = alignerObj.comp_; 143 | } 144 | } 145 | matchingRefs.emplace(matchingRef); 146 | ret.resSeqToExpSeq_[resSeq.name_] = matchingRef; 147 | } 148 | std::set missing; 149 | for(const auto & expectedSeq : expectedSeqs){ 150 | const auto & expSeq = getSeqBase(expectedSeq); 151 | if(!njh::in(expSeq.name_, matchingRefs)){ 152 | missing.emplace(expSeq.name_); 153 | } 154 | } 155 | 156 | ret.missingExpecteds_ = VecStr(missing.begin(), missing.end()); 157 | 158 | return ret; 159 | } 160 | 161 | }; 162 | 163 | 164 | } // namespace njhseq 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /etc/serverResources/pcv/mainProjectPage.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 | 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["projectName"]); 16 | $("#jumboTitle").html(names["projectName"]); 17 | addPanelWithDiv("#mainContent","extractionLinkDiv", "See Extraction Stats"); 18 | d3.select("#extractionLinkDiv").append("a") 19 | .attr("id", "extractionLink") 20 | .text("See Extraction Info") 21 | .attr("href", function(){ return "/" + rName + "/extractionInfo/" + projectName;});; 22 | addPanelWithDiv("#mainContent", "groupLinks", "See Group Infos"); 23 | addPanelWithDiv("#mainContent", "sampLinks", "See Sample Infos"); 24 | addPanelOnlyHead("#mainContent", "Sample Info Table"); 25 | addDiv("#mainContent", "sampTable"); 26 | var sampHeader = addPanelOnlyHead("#mainContent", "Haplotypes Across Samples"); 27 | sampHeader.attr("id", "sampleHeader"); 28 | addDiv("#mainContent", "sampNameMenu"); 29 | addDiv("#mainContent", "sampleChartMaster"); 30 | addPanelOnlyHead("#mainContent", "Haplotypes Sequences"); 31 | addDiv("#mainContent", "dnaViewer"); 32 | addPanelOnlyHead("#mainContent", "Haplotype Information Table"); 33 | addDiv("#mainContent", "popTable"); 34 | addPanelOnlyHead("#mainContent", "Haplotype ID Table"); 35 | addDiv("#mainContent", "hapIdTab"); 36 | //get sample names and the table with the sample names 37 | //ajaxPost('/' + rName + '/sampInfo' + "/" + projectName, {"sampNames":sampNames}, function(tab){ mainPopInfoTab = tab; }); 38 | var cols = 10; 39 | var linkPre = "/" + rName + "/sampleMainPage/" + projectName + "/"; 40 | var mouseOverC = "#999"; 41 | var mouseLeaveC = "#FFF"; 42 | var addTo = "#sampLinks"; 43 | createLinksTable(addTo, linkPre, names["samples"],8, mouseOverC, mouseLeaveC); 44 | var linkPreGroup = "/" + rName + "/groupInfoPage/" + projectName + "/"; 45 | var addToGroup = "#groupLinks"; 46 | createLinksTable(addToGroup, linkPreGroup, names["groups"],cols, mouseOverC, mouseLeaveC); 47 | postJSON("/" + rName + "/sampInfo/" + projectName, {"sampNames":names["samples"]}).then(function(sampInfo){ 48 | //create sample table 49 | var sampleTable = new njhTable("#sampTable", sampInfo, names["projectName"] + "_sampInfo", false); 50 | var sampleChart = new njhSampleChart("#sampleChartMaster", sampInfo, names["projectName"] + "_sampChart","s_Sample", "c_AveragedFrac","h_popUID", ["s_Sample", "h_popUID", "c_clusterID", "c_AveragedFrac", "c_ReadCnt"]); 51 | var popUrls = ["/" + rName + "/popInfo/" + projectName] 52 | popUrls.push("/" + rName + "/popSeqData/" + projectName); 53 | popUrls.push("/" + rName + "/hapIdTable/" + projectName); 54 | Promise.all(popUrls.map(function(popUrl){ 55 | return postJSON(popUrl, {popUIDs:sampInfo["popUIDs"], samples:names["samples"]}); 56 | })).then(function(popData){ 57 | //0 is popIno, 1 is popSeqs 58 | var popInfoTab = popData[0]; 59 | var popSeqData = popData[1]; 60 | var hapIdTabInfo = popData[2]; 61 | //set up seqs 62 | var sesUid = popSeqData["sessionUID"]; 63 | var SeqViewer = new njhSeqView("#dnaViewer", popSeqData); 64 | setUpCloseSession(sesUid); 65 | var popTable = new njhTable("#popTable", popInfoTab, names["projectName"] + "_popInfo", true); 66 | var hapIdTab = new njhTable("#hapIdTab", hapIdTabInfo, names["projectName"] + "_hapIdTable", false); 67 | hapIdTab.enactPoorMansHeatMap(); 68 | function updateChartOnClick() { 69 | //get all currently checked sample boxes and then update the current samples 70 | var allVals = []; 71 | $('#sampNameMenu :checked').each(function() { 72 | allVals.push($(this).val()); 73 | }); 74 | var currentSampNames = _.intersection(names["samples"], allVals); 75 | var currentPopInfoTab = {}; 76 | var currentPopSeqData = {}; 77 | gifLoading = prsentDivGifLoading(); 78 | postJSON("/" + rName + "/sampInfo/" + projectName, 79 | {"sampNames":currentSampNames, sessionUID:sesUid}).then(function(sampInfo){ 80 | Promise.all(popUrls.map(function(popUrl){ 81 | return postJSON(popUrl, {popUIDs:sampInfo["popUIDs"], sessionUID:sesUid, samples:currentSampNames}); 82 | })).then(function(popData){ 83 | //for popData 0 is popIno, 1 is popSeqs 84 | sampleTable.updateWithData(sampInfo); 85 | sampleChart.updateWithData(sampInfo); 86 | popTable.updateWithData(popData[0]); 87 | SeqViewer.updateData(popData[1]); 88 | d34.select("#hapIdTab").selectAll("*").remove(); 89 | hapIdTab = new njhTable("#hapIdTab", popData[2], names["projectName"] + "_hapIdTable", false); 90 | hapIdTab.enactPoorMansHeatMap(); 91 | 92 | $("#sampleHeader").scrollView(60, 0); 93 | }).catch(logRequestError).then(function(){ 94 | //stop loading population info 95 | }); 96 | }).catch(logRequestError).then(function(){ 97 | //stop loading sample table info 98 | removeAllDivGifLoading(); 99 | }); 100 | }; 101 | //create samp menu 102 | var sampMenu = new njhCheckboxMenu("#sampNameMenu", names["samples"], updateChartOnClick); 103 | 104 | }).catch(logRequestError).then(function(){ 105 | //stop loading page 106 | }); 107 | }).catch(logRequestError).then(function(){ 108 | //stop loading page 109 | }); 110 | }).catch(logRequestError).then(function() { 111 | removeAllDivGifLoading(); 112 | //stop loading page 113 | }); 114 | }); 115 | -------------------------------------------------------------------------------- /etc/serverResources/pcv/groupMainPage.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 subGroupName = locSplit.pop(); 7 | var groupName = locSplit.pop(); 8 | 9 | var infoUrls = getNameUrls(projectName); 10 | infoUrls.push("/" + rName + "/groupSampleNames/" + projectName + "/" + groupName + "/" + subGroupName); 11 | var gifLoading = prsentDivGifLoading(); 12 | Promise.all(infoUrls.map(getJSON)).then(function(projNames) { 13 | addDiv("body", "topNav"); 14 | var names = {shortName:projectName, groupName:groupName}; 15 | projNames.map(function(name){$.extend(names,name);}); 16 | createProjectNavBar("#topNav", names); 17 | addMainDiv("body", true); 18 | setHeadTitle(names["shortName"] + "_" + groupName + "_" + subGroupName); 19 | $("#jumboTitle").html(names["projectName"] + " " + groupName + ":" + subGroupName); 20 | addPanelWithDiv("#mainContent", "sampLinks", "See Sample Infos"); 21 | addPanelOnlyHead("#mainContent", "Sample Info Table"); 22 | addDiv("#mainContent", "sampTable"); 23 | var sampHeader = addPanelOnlyHead("#mainContent", "Haplotypes Across Samples"); 24 | sampHeader.attr("id", "sampleHeader"); 25 | addDiv("#mainContent", "sampNameMenu"); 26 | addDiv("#mainContent", "sampleChartMaster"); 27 | addPanelOnlyHead("#mainContent", "Haplotypes Sequences"); 28 | addDiv("#mainContent", "dnaViewer"); 29 | addPanelOnlyHead("#mainContent", "Haplotype Information Table"); 30 | addDiv("#mainContent", "popTable"); 31 | addPanelOnlyHead("#mainContent", "Haplotype ID Table"); 32 | addDiv("#mainContent", "hapIdTab"); 33 | //get sample names and the table with the sample names 34 | //ajaxPost('/' + rName + '/sampInfo' + "/" + projectName, {"sampNames":sampNames}, function(tab){ mainPopInfoTab = tab; }); 35 | var cols = 10; 36 | var linkPre = "/" + rName + "/sampleMainPage/" + projectName + "/"; 37 | var mouseOverC = "#999"; 38 | var mouseLeaveC = "#FFF"; 39 | var addTo = "#sampLinks"; 40 | createLinksTable(addTo, linkPre, names["groupSamples"],8, mouseOverC, mouseLeaveC); 41 | postJSON("/" + rName + "/groupSampInfo/" + projectName + "/" + groupName + "/" + subGroupName, {"sampNames":names["groupSamples"]}).then(function(sampInfo){ 42 | //create sample table 43 | var sampleTable = new njhTable("#sampTable", sampInfo, names["projectName"] + "_sampInfo", false); 44 | var sampleChart = new njhSampleChart("#sampleChartMaster", sampInfo, names["projectName"] + "_" + groupName + "_" + subGroupName + "_sampChart","s_Sample", "c_AveragedFrac","h_popUID", ["s_Sample", "h_popUID", "c_clusterID", "c_AveragedFrac", "c_ReadCnt"]); 45 | var popUrls = ["/" + rName + "/groupPopInfo/" + projectName + "/" + groupName + "/" + subGroupName] 46 | popUrls.push("/" + rName + "/groupPopSeqData/" + projectName + "/" + groupName + "/" + subGroupName); 47 | popUrls.push("/" + rName + "/groupHapIdTable/" + projectName + "/" + groupName + "/" + subGroupName); 48 | Promise.all(popUrls.map(function(popUrl){ 49 | return postJSON(popUrl, {popUIDs:sampInfo["popUIDs"],"samples":names["groupSamples"]}); 50 | })).then(function(popData){ 51 | //0 is popIno, 1 is popSeqs 52 | var popInfoTab = popData[0]; 53 | var popSeqData = popData[1]; 54 | var hapIdTabInfo = popData[2]; 55 | //set up seqs 56 | var sesUid = popSeqData["sessionUID"]; 57 | var SeqViewer = new njhSeqView("#dnaViewer", popSeqData); 58 | setUpCloseSession(sesUid); 59 | var popTable = new njhTable("#popTable", popInfoTab, names["projectName"] + "_" + groupName + "_" + subGroupName + "_popInfo", true); 60 | var hapIdTab = new njhTable("#hapIdTab", hapIdTabInfo, names["projectName"] + "_" + groupName + "_" + subGroupName + "_hapIdTable", false); 61 | hapIdTab.enactPoorMansHeatMap(); 62 | function updateChartOnClick() { 63 | //get all currently checked sample boxes and then update the current samples 64 | var allVals = []; 65 | $('#sampNameMenu :checked').each(function() { 66 | allVals.push($(this).val()); 67 | }); 68 | var currentSampNames = _.intersection(names["groupSamples"], allVals); 69 | var currentPopInfoTab = {}; 70 | var currentPopSeqData = {}; 71 | gifLoading = prsentDivGifLoading(); 72 | postJSON("/" + rName + "/groupSampInfo/" + projectName + "/" + groupName + "/" + subGroupName, 73 | {"sampNames":currentSampNames, sessionUID:sesUid}).then(function(sampInfo){ 74 | Promise.all(popUrls.map(function(popUrl){ 75 | return postJSON(popUrl, {popUIDs:sampInfo["popUIDs"], sessionUID:sesUid,"samples":currentSampNames }); 76 | })).then(function(popData){ 77 | //for popData 0 is popIno, 1 is popSeqs 78 | sampleTable.updateWithData(sampInfo); 79 | sampleChart.updateWithData(sampInfo); 80 | popTable.updateWithData(popData[0]); 81 | SeqViewer.updateData(popData[1]); 82 | d34.select("#hapIdTab").selectAll("*").remove(); 83 | hapIdTab = new njhTable("#hapIdTab", popData[2], names["projectName"] + "_" + groupName + "_" + subGroupName + "_hapIdTable", false); 84 | hapIdTab.enactPoorMansHeatMap(); 85 | 86 | $("#sampleHeader").scrollView(60, 0); 87 | }).catch(logRequestError).then(function(){ 88 | //stop loading population info 89 | }); 90 | }).catch(logRequestError).then(function(){ 91 | //stop loading sample table info 92 | removeAllDivGifLoading(); 93 | }); 94 | }; 95 | //create samp menu 96 | var sampMenu = new njhCheckboxMenu("#sampNameMenu", names["groupSamples"], updateChartOnClick); 97 | 98 | }).catch(logRequestError).then(function(){ 99 | //stop loading page 100 | }); 101 | }).catch(logRequestError).then(function(){ 102 | //stop loading page 103 | }); 104 | }).catch(logRequestError).then(function() { 105 | removeAllDivGifLoading(); 106 | //stop loading page 107 | }); 108 | }); 109 | -------------------------------------------------------------------------------- /scripts/setUpScripts/genFuncs.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 | from utils import Utils 6 | 7 | class genHelper: 8 | @staticmethod 9 | def generateCompfileFull(outFileName, externalDirLoc, cc, cxx, outName, installDirName, installDirLoc, neededLibs,ldFlags = "", cxxFlags = "", private =False): 10 | availableLibs = ["CPPITERTOOLS","CPPPROGUTILS","ZI_LIB","BOOST", 11 | "R","BAMTOOLS","CPPCMS","MATHGL","ARMADILLO", 12 | "MLPACK","LIBLINEAR","CURL","GTKMM", "NJHSEQ", 13 | "NJHCPP", "SEEKDEEP", 14 | "NJHSEQDEV", "SEEKDEEPDEV", "CATCH", "JSONCPP", 15 | "TWOBIT", "SEQSERVER","NJHRINSIDE", "PSTREAMS", 16 | "MONGOC", "MONGOCXX", "SHAREDMUTEX", 17 | "MAGIC", "HTS", "RESTBED", "LIBPCA", "BOOST_FILESYSTEM","BOOST_MATH", 18 | "PATHWEAVER", "ELUCIDATOR", "ELUCIDATORLAB", "MIPWRANGLER", "EIGEN", 19 | "ZLIB", "ZLIB-NG", "UNQLITE"] 20 | neededLibraries = {} 21 | for lib in neededLibs: 22 | if ":" in lib: 23 | libSplit = lib.split(":") 24 | neededLibraries[libSplit[0].upper()] = ":".join(libSplit[1:]) 25 | else: 26 | neededLibraries[lib.upper()] = "" 27 | 28 | with open(outFileName, "w") as f: 29 | f.write("CC = {CC}\n".format(CC = cc)) 30 | f.write("CXX = {CXX}\n".format(CXX = cxx)) 31 | f.write("CXXOUTNAME = {NAME_OF_PROGRAM}\n".format(NAME_OF_PROGRAM = outName)) 32 | f.write("CXXFLAGS = -std=c++17\n") 33 | f.write("CXXFLAGS += -Wall -ftemplate-depth=1024 -Werror=uninitialized -Werror=return-type -Wno-missing-braces\n") 34 | if "" != cxxFlags: 35 | if cxxFlags.startswith("\\"): 36 | cxxFlags = cxxFlags[1:] 37 | f.write("CXXFLAGS += " + cxxFlags +"\n") 38 | if "" != ldFlags: 39 | f.write("LD_FLAGS = ") 40 | if not ldFlags.startswith("-"): 41 | f.write("-") 42 | f.write("{ld_flags}\n".format(ld_flags = " ".join(ldFlags.split(",")))) 43 | f.write("CXXOPT += -O2 -funroll-loops -DNDEBUG \n") 44 | f.write("\n") 45 | if private: 46 | f.write("PRIVATE = TRUE\n") 47 | f.write("#debug\n") 48 | f.write("CXXDEBUG = -g -gstabs+ \n") 49 | f.write("INSTALL_DIR={INSTALL_LOCATION}\n".format(INSTALL_LOCATION = os.path.join(installDirLoc,installDirName))) 50 | f.write("EXT_PATH=$(realpath {EXTERNAL})\n".format(EXTERNAL = externalDirLoc)) 51 | f.write("\n") 52 | for lib in availableLibs: 53 | if lib in neededLibraries: 54 | if neededLibraries[lib] == "": 55 | f.write("USE_{LIB} = 1\n".format(LIB = lib)) 56 | else: 57 | f.write("USE_{LIB} = 1#{BRANCH}\n".format(LIB = lib, BRANCH = neededLibraries[lib])) 58 | #else: 59 | # f.write("USE_{LIB} = 0\n".format(LIB = lib)) 60 | 61 | 62 | 63 | @staticmethod 64 | def determineCC(args, defaultCC = "gcc-9"): 65 | if Utils.isMac(): 66 | defaultCC = "clang" 67 | if not args.CC: 68 | eCC = os.getenv("CC") 69 | if(eCC): 70 | defaultCC = eCC 71 | else: 72 | defaultCC = Utils.getStrFromStrOrList(args.CC) 73 | return defaultCC 74 | 75 | @staticmethod 76 | def determineCXX(args, defaultCXX = "g++-9"): 77 | if Utils.isMac(): 78 | defaultCXX = "clang++" 79 | if not args.CXX: 80 | eCXX = os.getenv("CXX") 81 | if eCXX: 82 | defaultCXX = eCXX 83 | else: 84 | defaultCXX = Utils.getStrFromStrOrList(args.CXX) 85 | return defaultCXX 86 | 87 | @staticmethod 88 | def parseNjhConfigureArgs(): 89 | parser = argparse.ArgumentParser() 90 | parser.add_argument('-prefix', type=str, nargs=1) 91 | parser.add_argument('-externalLibDir', type=str, nargs=1) 92 | parser.add_argument('-CC', type=str, nargs=1) 93 | parser.add_argument('-CXX', type=str, nargs=1) 94 | return parser.parse_args() 95 | 96 | @staticmethod 97 | def mkConfigCmd(name,libs, argv, ldflags="", cxxFlags="", private = False): 98 | if libs == "": 99 | cmd = os.path.join(os.path.dirname(os.path.dirname(__file__)), "setUpScripts/njhConfigure.py") + " -name {name} ".format(name=name) 100 | else: 101 | cmd = os.path.join(os.path.dirname(os.path.dirname(__file__)), "setUpScripts/njhConfigure.py") + " -name {name} -libs {libs}".format(name=name, libs=libs) 102 | if "" != ldflags: 103 | if ldflags.startswith("-"): 104 | ldflags = ldflags[1:] 105 | cmd += " -ldFlags " + ldflags 106 | if "" != cxxFlags: 107 | addingFlags = " -cxxFlags \"" 108 | if cxxFlags.startswith("-"): 109 | addingFlags += "\\" 110 | cmd += addingFlags + cxxFlags + "\"" 111 | if len(sys.argv) > 1: 112 | cmd += " " + " ".join(sys.argv[1:]) 113 | if private: 114 | cmd += " -private " 115 | return cmd 116 | 117 | 118 | @staticmethod 119 | def mkConfigFileStr(name, libs): 120 | ret = """#!/usr/bin/env python2 121 | import shutil, os, argparse, sys, stat 122 | sys.path.append("scripts/pyUtils") 123 | sys.path.append("scripts/setUpScripts") 124 | from utils import Utils 125 | from genFuncs import genHelper 126 | 127 | def main(): 128 | name = "{name}" 129 | libs = "{libs}" 130 | args = genHelper.parseNjhConfigureArgs() 131 | cmd = genHelper.mkConfigCmd(name, libs, sys.argv) 132 | Utils.run(cmd) 133 | 134 | main() 135 | """.format(name = name, libs = libs) 136 | return ret 137 | 138 | -------------------------------------------------------------------------------- /scripts/pyUtils/headInGraph.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import fnmatch, subprocess, sys, os, argparse, re 4 | 5 | 6 | 7 | class fileNode(): 8 | headerColor = "#0571b0"; 9 | headToHeadColor = "#92c5de"; 10 | externalHeaderColor = "#af8dc3"; 11 | cppColor = "#ca0020"; 12 | cppToHeaderColor = "#f4a582"; 13 | modColor = "#d01c8b"; 14 | modEdgeColor = "#f1b6da"; 15 | unModColor = "#4dac26"; 16 | unModEdgeColor = "#b8e186"; 17 | 18 | def __init__(self, name, color, type, modTime, filesize): 19 | self.value_ = name 20 | self.modTime_ = modTime 21 | self.objectModTime_ = 0 22 | self.childrenEdges_ = [] 23 | self.color_ = color 24 | self.visited_ = False 25 | self.type_ = type 26 | self.filesize_ = filesize 27 | def changeObjectModTime(self, objModTime): 28 | self.objectModTime_ = objModTime 29 | 30 | class fileEdge(): 31 | 32 | def __init__(self, childPos, edgeColor): 33 | self.childPos_ = childPos; 34 | self.edgeColor_ = edgeColor; 35 | 36 | 37 | 38 | class headInGraph(): 39 | def __init__(self): 40 | self.nodes_ = [] 41 | self.nodePositions_ = {} 42 | 43 | def addNode(self, name, color,type, modTime, filesize): 44 | self.nodePositions_[name] = len(self.nodes_) 45 | self.nodes_.append(fileNode(name,color,type, modTime, filesize)) 46 | 47 | def addPair(self, including, beingIncluded, edgeColor): 48 | if beingIncluded not in self.nodePositions_: 49 | raise Exception("Header " + beingIncluded + " not found in source folder, being included by " + including) 50 | self.nodes_[self.nodePositions_[beingIncluded]].childrenEdges_.append(fileEdge(self.nodePositions_[including], edgeColor)) 51 | 52 | def setNodeColorAll(self, newColor): 53 | for e, node in enumerate(self.nodes_): 54 | self.nodes_[e].color_ = newColor 55 | 56 | def setEdgeColorAll(self, newColor): 57 | for e, node in enumerate(self.nodes_): 58 | for child, node in enumerate(self.nodes_[e].childrenEdges_): 59 | self.nodes_[e].childrenEdges_[child].edgeColor_ = newColor 60 | 61 | def modChildren(self, nodePos, modColor, modEdgeColor): 62 | if not self.nodes_[nodePos].visited_: 63 | self.nodes_[nodePos].visited_ = True; 64 | self.nodes_[nodePos].color_ = modColor; 65 | for childEdgePos, child in enumerate(self.nodes_[nodePos].childrenEdges_) : 66 | self.nodes_[nodePos].childrenEdges_[childEdgePos].edgeColor_ = modEdgeColor 67 | self.modChildren(child.childPos_, modColor, modEdgeColor); 68 | 69 | def getChildrenList(self, nodePos): 70 | allChildren = [] 71 | if not self.nodes_[nodePos].visited_: 72 | self.nodes_[nodePos].visited_ = True; 73 | allChildren.append(nodePos) 74 | for child in self.nodes_[nodePos].childrenEdges_: 75 | allChildren = allChildren + self.getChildrenList(child.childPos_) 76 | return allChildren 77 | 78 | def printInfo(self): 79 | for nPos in range(len(self.nodes_)): 80 | print(self.nodes_[nPos].value_) 81 | print(self.nodes_[nPos].visted_) 82 | if self.nodes_[nPos].visted_: 83 | print("\033[1;32mvisited true\033[0m") 84 | else: 85 | print("\033[1;31m visted is false\033[0m") 86 | 87 | def printChildren(self, nodePos, out): 88 | if not self.nodes_[nodePos].visited_: 89 | self.nodes_[nodePos].visited_ = True; 90 | out.write(self.nodes_[nodePos].value_ + " "); 91 | for child in self.nodes_[nodePos].childrenEdges_: 92 | self.printChildren(child.childPos_, out) 93 | 94 | def addObjecTime(self, name, objModTime): 95 | self.nodes_[self.nodePositions_[name]].objectModTime_ = objModTime 96 | 97 | def reset(self): 98 | for nPos in range(len(self.nodes_)): 99 | self.nodes_[nPos].visited_ = False 100 | 101 | def printGraphViz(self, out, title, outPutExternal, useFileSize =False): 102 | size = "1" 103 | if useFileSize: 104 | size = str( self.nodes_[nPos].filesize_) 105 | out.write("digraph G { \n") 106 | out.write("bgcolor =\"#000000\" \n") 107 | out.write("labelloc=\"t\" \n") 108 | out.write("fontcolor = \"#ffffff\"\n") 109 | out.write("fontsize = 20 \n") 110 | out.write("label = \"" + title + "\" \n") 111 | out.write("fixedsize = true; \n") 112 | for nPos in range(len(self.nodes_)): 113 | if(not outPutExternal and self.nodes_[nPos].type_ == "external"): 114 | continue 115 | out.write(self.nodes_[nPos].value_ + "[shape=circle,style=filled,fixedsize =false, color = \"#000000\", fillcolor =\"" + self.nodes_[nPos].color_ + "\", width = " + size + "]\n") 116 | for nPos in range(len(self.nodes_)): 117 | if(not outPutExternal and self.nodes_[nPos].type_ == "external"): 118 | continue 119 | for child in self.nodes_[nPos].childrenEdges_: 120 | out.write(self.nodes_[nPos].value_ + " -> " + self.nodes_[child.childPos_].value_ + "[penwidth=5, color=\"") 121 | out.write(child.edgeColor_); 122 | out.write("\"]\n") 123 | out.write("}\n") 124 | 125 | class fileCollection: 126 | @staticmethod 127 | def getCppFiles(searchDir): 128 | return [os.path.join(dirpath, f) 129 | for dirpath, dirnames, files in os.walk(searchDir) 130 | for f in fnmatch.filter(files, '*.c*')] 131 | @staticmethod 132 | def getHeaderFiles(searchDir): 133 | return [os.path.join(dirpath, f) 134 | for dirpath, dirnames, files in os.walk(searchDir) 135 | for f in fnmatch.filter(files, '*.h*')] 136 | @staticmethod 137 | def getObjectFiles(searchDir): 138 | return [os.path.join(dirpath, f) 139 | for dirpath, dirnames, files in os.walk(searchDir) 140 | for f in fnmatch.filter(files, '*.o')] 141 | @staticmethod 142 | def getAllSourceFiles(searchDir): 143 | return fileCollection.getCppFiles(searchDir) + fileCollection.getHeaderFiles(searchDir); --------------------------------------------------------------------------------