├── docs ├── images │ ├── example_plots.png │ ├── ILLUMINA_LOGO_RGB_new.png │ ├── MiSeqDemo_q-heat-map.png │ ├── MiSeqDemo_q-histogram.png │ ├── ILLUMINA_LOGO_RGB_new_200_45.png │ ├── MiSeqDemo_flowcell-Intensity.png │ ├── MiSeqDemo_ClusterCount-by-lane.png │ └── MiSeqDemo_Intensity-by-cycle_Intensity.png ├── theme │ ├── bootstrap3 │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── js │ │ │ └── npm.js │ │ └── css │ │ │ └── sticky-footer-navbar.css │ └── footer.html ├── src │ ├── example4.md │ ├── example3.md │ ├── example2.md │ ├── example1.md │ ├── calculated_metrics.md │ ├── j_example.md │ ├── example_summary.md │ ├── example_imaging.md │ ├── apps.md │ ├── performance.md │ └── binary_formats.md └── CMakeLists.txt ├── cmake ├── ConfigureFile.cmake ├── Modules │ ├── csharp │ │ ├── packages.config.in │ │ ├── FindDotNetStandard.cmake │ │ ├── dotnetStandard.csproj.in │ │ ├── FindDotNet.cmake │ │ ├── msbuild.csproj.in │ │ └── FindMono.cmake │ ├── CheckStdInt.cmake │ ├── CheckIsNaN.cmake │ ├── UseGMock.cmake │ ├── UseGTest.cmake │ └── UseGitVersion.cmake ├── CheckSWIGVersion.cmake ├── CopyListOfFiles.cmake ├── version.rc.in └── DependencyManager.cmake ├── .gitattributes ├── tools ├── teamcity │ └── pull_request │ │ ├── msvc_2015_py27_dotnet.bat │ │ ├── msvc_2017_py27_dotnet.bat │ │ ├── msvc_2019_py27_dotnet.bat │ │ ├── msvc_2017_py34_dotnet.bat │ │ ├── msvc_2017_py35_dotnet.bat │ │ ├── msvc_2017_py36_dotnet.bat │ │ ├── msvc_2017_py37_dotnet.bat │ │ ├── msvc_2017_py38_dotnet.bat │ │ ├── msvc_2017_py27_dotnetstandard.bat │ │ ├── centos7_gcc-485-debug.sh │ │ ├── centos7_gcc-485-ppc.sh │ │ └── msvc.bat ├── hooks │ ├── pre-push.sh │ └── pre-commit.sh ├── package_docker.bat ├── docker │ ├── DockerFile_Centos6 │ ├── DockerFile_Centos7 │ └── DockerFile_Centos5 ├── build_docs.sh ├── prereqs │ ├── travis-osx-install.sh │ ├── travis-linux-install.sh │ └── utility.sh ├── package_docker.sh ├── patches │ └── mono_patch.txt └── build_cov_test.sh ├── src ├── ext │ ├── swig │ │ ├── arrays │ │ │ ├── arrays_impl.i │ │ │ └── arrays_numpy_impl.i │ │ └── exceptions │ │ │ └── exceptions_impl.i │ ├── csharp │ │ ├── package.targets │ │ ├── AssemblyInfo.cs.in │ │ └── package.nuspec.in │ └── python │ │ ├── __init__.py.in │ │ ├── __main__.py.in │ │ └── setup.py.in ├── CMakeLists.txt ├── tests │ ├── csharp │ │ ├── TestSuite.cs │ │ ├── logic │ │ │ ├── DependencyTest.cs │ │ │ ├── PlotQScoreHistogram.cs │ │ │ ├── PlotQScoreHeatmap.cs │ │ │ ├── PlotFlowcellMap.cs │ │ │ └── PlotDataByLaneTest.cs │ │ └── metrics │ │ │ ├── RunMetricsTest.cs │ │ │ └── ExtendedTileMetricsTest.cs │ ├── interop │ │ ├── io │ │ │ └── csv_format.cpp │ │ ├── logic │ │ │ └── metric_type_ext_test.cpp │ │ ├── metrics │ │ │ └── inc │ │ │ │ ├── summary_run_metrics_test.h │ │ │ │ └── metric_format_fixtures.h │ │ ├── unit_tests.cpp │ │ └── util │ │ │ └── option_parser_test.cpp │ ├── python │ │ ├── DepTests.py │ │ └── CMakeLists.txt │ └── CMakeLists.txt ├── examples │ ├── csharp │ │ ├── SummaryExample.cs │ │ ├── Example1.cs │ │ ├── Example3.cs │ │ ├── CMakeLists.txt │ │ ├── Example2.cs │ │ └── ImagingExample.cs │ ├── CMakeLists.txt │ ├── example1.cpp │ ├── example_populate_qmetricset.cpp │ ├── example_q_metric.cpp │ └── example3.cpp ├── interop │ └── logic │ │ ├── metric │ │ ├── extraction_metric.cpp │ │ └── extended_tile_metric.cpp │ │ └── plot │ │ └── plot_metric_list.cpp └── apps │ └── CMakeLists.txt ├── interop ├── config.h.in ├── util │ ├── exception_specification.h │ ├── timer.h │ ├── base_exception.h │ ├── self_registration.h │ ├── static_assert.h │ ├── map.h │ ├── assert.h │ ├── length_of.h │ ├── exception.h │ ├── math.h │ ├── cstdint.h │ ├── filesystem.h │ └── unique_ptr.h ├── logic │ ├── metric │ │ ├── index_metric.h │ │ ├── extended_tile_metric.h │ │ ├── extraction_metric.h │ │ └── dynamic_phasing_metric.h │ ├── plot │ │ ├── plot_sample_qc.h │ │ ├── plot_metric_list.h │ │ ├── plot_qscore_histogram.h │ │ ├── plot_qscore_heatmap.h │ │ └── plot_point.h │ ├── logic.h │ ├── summary │ │ ├── run_summary.h │ │ └── index_summary.h │ └── table │ │ ├── create_imaging_table_columns.h │ │ ├── create_imaging_table.h │ │ └── table_util.h ├── interop.h ├── model │ ├── table │ │ └── table_exceptions.h │ ├── plot │ │ └── plot_exceptions.h │ ├── metric_base │ │ ├── metric_exceptions.h │ │ └── point2d.h │ ├── run │ │ ├── image_dimensions.h │ │ └── run_exceptions.h │ ├── summary │ │ ├── metric_average.h │ │ └── surface_summary.h │ └── model_exceptions.h ├── constants │ ├── typedefs.h │ └── enum_description.h └── io │ └── format │ ├── generic_layout.h │ ├── stream_membuf.h │ ├── abstract_text_format.h │ └── default_layout.h └── .github └── workflows └── docs.yaml /docs/images/example_plots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/images/example_plots.png -------------------------------------------------------------------------------- /docs/images/ILLUMINA_LOGO_RGB_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/images/ILLUMINA_LOGO_RGB_new.png -------------------------------------------------------------------------------- /docs/images/MiSeqDemo_q-heat-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/images/MiSeqDemo_q-heat-map.png -------------------------------------------------------------------------------- /docs/images/MiSeqDemo_q-histogram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/images/MiSeqDemo_q-histogram.png -------------------------------------------------------------------------------- /docs/images/ILLUMINA_LOGO_RGB_new_200_45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/images/ILLUMINA_LOGO_RGB_new_200_45.png -------------------------------------------------------------------------------- /docs/images/MiSeqDemo_flowcell-Intensity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/images/MiSeqDemo_flowcell-Intensity.png -------------------------------------------------------------------------------- /docs/images/MiSeqDemo_ClusterCount-by-lane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/images/MiSeqDemo_ClusterCount-by-lane.png -------------------------------------------------------------------------------- /cmake/ConfigureFile.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Configure a file as a build step 3 | # 4 | 5 | 6 | configure_file(${CONFIG_INPUT_FILE} ${CONFIG_OUTPUT_FILE} @ONLY) 7 | -------------------------------------------------------------------------------- /cmake/Modules/csharp/packages.config.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | @CSHARP_PACKAGE_REFERENCES@ 4 | 5 | 6 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # InterOp Git Normalization 2 | 3 | # Ensure Bash Scripts are runnable on Windows 4 | *.sh text eol=lf whitespace=blank-at-eol,-blank-at-eof -------------------------------------------------------------------------------- /docs/images/MiSeqDemo_Intensity-by-cycle_Intensity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/images/MiSeqDemo_Intensity-by-cycle_Intensity.png -------------------------------------------------------------------------------- /docs/theme/bootstrap3/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/theme/bootstrap3/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /docs/theme/bootstrap3/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/theme/bootstrap3/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /docs/theme/bootstrap3/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/theme/bootstrap3/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /docs/theme/bootstrap3/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Illumina/interop/HEAD/docs/theme/bootstrap3/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /tools/teamcity/pull_request/msvc_2015_py27_dotnet.bat: -------------------------------------------------------------------------------- 1 | set build_number=%1% 2 | call tools\teamcity\pull_request\msvc.bat %build_number% "Visual Studio 14 2015" DotNet 2.7 3 | -------------------------------------------------------------------------------- /tools/teamcity/pull_request/msvc_2017_py27_dotnet.bat: -------------------------------------------------------------------------------- 1 | set build_number=%1% 2 | call tools\teamcity\pull_request\msvc.bat %build_number% "Visual Studio 15 2017" DotNet 2.7 3 | -------------------------------------------------------------------------------- /tools/teamcity/pull_request/msvc_2019_py27_dotnet.bat: -------------------------------------------------------------------------------- 1 | set build_number=%1% 2 | call tools\teamcity\pull_request\msvc.bat %build_number% "Visual Studio 16 2019" DotNet 3.8 3 | -------------------------------------------------------------------------------- /tools/teamcity/pull_request/msvc_2017_py34_dotnet.bat: -------------------------------------------------------------------------------- 1 | set build_number=%1% 2 | call tools\teamcity\pull_request\msvc.bat %build_number% "Visual Studio 15 2017" DotNet 3.4 package_wheel 3 | -------------------------------------------------------------------------------- /tools/teamcity/pull_request/msvc_2017_py35_dotnet.bat: -------------------------------------------------------------------------------- 1 | set build_number=%1% 2 | call tools\teamcity\pull_request\msvc.bat %build_number% "Visual Studio 15 2017" DotNet 3.5 package_wheel 3 | -------------------------------------------------------------------------------- /tools/teamcity/pull_request/msvc_2017_py36_dotnet.bat: -------------------------------------------------------------------------------- 1 | set build_number=%1% 2 | call tools\teamcity\pull_request\msvc.bat %build_number% "Visual Studio 15 2017" DotNet 3.6 package_wheel 3 | -------------------------------------------------------------------------------- /tools/teamcity/pull_request/msvc_2017_py37_dotnet.bat: -------------------------------------------------------------------------------- 1 | set build_number=%1% 2 | call tools\teamcity\pull_request\msvc.bat %build_number% "Visual Studio 15 2017" DotNet 3.7 package_wheel 3 | -------------------------------------------------------------------------------- /tools/teamcity/pull_request/msvc_2017_py38_dotnet.bat: -------------------------------------------------------------------------------- 1 | set build_number=%1% 2 | call tools\teamcity\pull_request\msvc.bat %build_number% "Visual Studio 15 2017" DotNet 3.8 package_wheel 3 | -------------------------------------------------------------------------------- /tools/teamcity/pull_request/msvc_2017_py27_dotnetstandard.bat: -------------------------------------------------------------------------------- 1 | set build_number=%1% 2 | call tools\teamcity\pull_request\msvc.bat %build_number% "Visual Studio 15 2017" DotNetStandard 2.7 3 | -------------------------------------------------------------------------------- /tools/teamcity/pull_request/centos7_gcc-485-debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | build_number=$1 4 | sh ./tools/package_docker.sh docker-bioinformatics.dockerhub.illumina.com/interop_centos7 "${build_number}" "-DENABLE_VERACODE=ON" Debug 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/ext/swig/arrays/arrays_impl.i: -------------------------------------------------------------------------------- 1 | 2 | #if defined(SWIGCSHARP) 3 | %include "arrays_csharp_impl.i" 4 | #elif defined(SWIGJAVA) 5 | %include "arrays_java_impl.i" 6 | #elif defined(SWIGPYTHON) 7 | %include "arrays_numpy_impl.i" 8 | #endif 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory("interop") 3 | 4 | if(ENABLE_SWIG) 5 | add_subdirectory("ext") 6 | endif() 7 | 8 | add_subdirectory("apps") 9 | add_subdirectory("examples") 10 | 11 | if(ENABLE_TEST) 12 | add_subdirectory("tests") 13 | endif() 14 | -------------------------------------------------------------------------------- /tools/hooks/pre-push.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | version=`git describe --tags --dirty=-src | cut - -f1` 5 | 6 | grep -q $version CMakeLists.txt 7 | ret=$? 8 | if [ "$?" -eq "1" ] ; then 9 | echo "Incorrect archive version, update to $version" 10 | exit 1 11 | fi 12 | 13 | -------------------------------------------------------------------------------- /docs/src/example4.md: -------------------------------------------------------------------------------- 1 | Reporting simple statistics {#simple_stats} 2 | ============================ 3 | 4 | Now, let us consider how to summarize the data using simple statistics. 5 | 6 | C++ 7 | --- 8 | 9 | @snippet src/examples/example4.cpp Calculating simple statistics 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/ext/csharp/package.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %(FileName)%(Extension) 6 | PreserveNewest 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /interop/config.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef HAVE_STDINT_H 3 | #cmakedefine HAVE_STDINT_H 4 | #endif 5 | #ifndef HAVE_SYS_TYPES_H 6 | #cmakedefine HAVE_SYS_TYPES_H 7 | #endif 8 | #cmakedefine HAVE_UNORDERED_MAP_IN_STD 9 | #cmakedefine HAVE_NO_STD_ISNAN 10 | #ifndef HAVE_ISNAN 11 | #cmakedefine HAVE_ISNAN 12 | #endif 13 | #cmakedefine HAVE___ISNAN 14 | #cmakedefine HAVE_FLOAT_H_ISNAN 15 | #cmakedefine HAVE_UNIQUE_PTR 16 | -------------------------------------------------------------------------------- /src/ext/csharp/AssemblyInfo.cs.in: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("Illumina.InterOp with @CMAKE_CXX_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@")] 4 | [assembly: AssemblyCompany("Illumina")] 5 | [assembly: AssemblyProduct("Illumina.InterOp - @VERSION@ ")] 6 | [assembly: AssemblyCopyright("Copyright © Illumina 2015")] 7 | [assembly: AssemblyVersion("@VERSION_SHORT@")] 8 | [assembly: AssemblyFileVersion("@VERSION_SHORT@")] 9 | 10 | -------------------------------------------------------------------------------- /tools/package_docker.bat: -------------------------------------------------------------------------------- 1 | rem Build InterOp in Docker 2 | 3 | 4 | 5 | set image=ezralanglois/interop 6 | set dist_dir=dist 7 | 8 | if exist %dist_dir% rd /s /q %dist_dir% 9 | mkdir %dist_dir% 10 | 11 | docker pull %image% 12 | if %errorlevel% neq 0 exit /b %errorlevel% 13 | docker run --rm -v %cd%:/src:ro -v %cd%/dist:/dist:rw %image% sh /src/tools/package.sh /src /dist teamcity OFF Release 14 | if %errorlevel% neq 0 exit /b %errorlevel% 15 | 16 | -------------------------------------------------------------------------------- /interop/util/exception_specification.h: -------------------------------------------------------------------------------- 1 | /** Exception utilities 2 | * 3 | * The header provides a macro to throw more informative exceptions 4 | * 5 | * @file 6 | * @date 6/25/18 7 | * @version 1.0 8 | * @copyright GNU Public License. 9 | */ 10 | #pragma once 11 | 12 | #if (!defined(__cplusplus) || __cplusplus < 201700L) && 0 13 | #define INTEROP_THROW_SPEC(SPEC) throw SPEC 14 | #else 15 | #define INTEROP_THROW_SPEC(SPEC) 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /docs/src/example3.md: -------------------------------------------------------------------------------- 1 | Reporting Extraction Metrics {#extraction_report} 2 | ============================ 3 | 4 | Now, let us consider how to summarize the data into useful reporting metrics. This example continues with extraction 5 | metrics. 6 | 7 | C# 8 | -- 9 | 10 | @snippet src/examples/csharp/Example3.cs Reporting Extraction Metrics in CSharp 11 | 12 | C++ 13 | --- 14 | 15 | @snippet src/examples/example3.cpp Reporting Extraction Metrics 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/tests/csharp/TestSuite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using NUnitLite; 4 | using System.Reflection; 5 | 6 | namespace Illumina.InterOp.Interop.UnitTest 7 | { 8 | /// 9 | /// Test C# Swig Wrapping 10 | /// 11 | public class Program 12 | { 13 | public static int Main(string[] args) 14 | { 15 | return new AutoRun(Assembly.GetCallingAssembly()).Execute(args); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /tools/docker/DockerFile_Centos6: -------------------------------------------------------------------------------- 1 | # sudo docker build --rm -t docker-bioinformatics.dockerhub.illumina.com/interop_centos6 -f ./tools/docker/DockerFile_Centos6 tools 2 | 3 | FROM quay.io/pypa/manylinux2010_x86_64 4 | 5 | ENV JAVA_HOME /usr/java/jdk1.8.0_131 6 | ENV JUNIT_HOME /opt/junit 7 | ENV NUNIT_DIR /opt/nunit/NUnit-2.6.4 8 | 9 | COPY prereqs/docker-centos6-install.sh /docker-centos6-install.sh 10 | RUN bash docker-centos6-install.sh && rm -fr docker-centos6-install.sh 11 | 12 | -------------------------------------------------------------------------------- /tools/docker/DockerFile_Centos7: -------------------------------------------------------------------------------- 1 | # docker build --rm -t ezralanglois/interop_centos7 -f ./tools/docker/DockerFile_Centos7 tools 2 | 3 | FROM docker-bioinformatics.dockerhub.illumina.com/manylinux2014_x86_64 4 | 5 | ENV JAVA_HOME /usr/java/jdk1.8.0_131 6 | ENV JUNIT_HOME /opt/junit 7 | ENV NUNIT_DIR /opt/nunit/NUnit-2.6.4 8 | ENV PATH="/opt/dotnet:${PATH}" 9 | 10 | COPY prereqs/docker-centos7-install.sh /docker-centos7-install.sh 11 | RUN bash docker-centos7-install.sh && rm -fr docker-centos7-install.sh 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/src/example2.md: -------------------------------------------------------------------------------- 1 | Reporting Tile Metrics {#tile_report} 2 | ====================== 3 | 4 | Now, let us consider how to summarize the data into useful reporting metrics. This example continues with tile 5 | metrics, which can be used to report cluster PF on a per lane basis (similar to SAV, except we do not consider 6 | reads in this example). 7 | 8 | C# 9 | -- 10 | 11 | @snippet src/examples/csharp/Example2.cs Reporting Tile Metrics in CSharp 12 | 13 | C++ 14 | --- 15 | 16 | @snippet src/examples/example2.cpp Reporting Tile Metrics 17 | 18 | -------------------------------------------------------------------------------- /src/ext/python/__init__.py.in: -------------------------------------------------------------------------------- 1 | __project__ = "Illumina InterOp" 2 | __license__ = "GPL" 3 | __copyright__ = "Copyright (C) 2015-2017, Illumina, inc." 4 | __description__ = "Set of common routines used for reading and writing Illumina InterOp metric files" 5 | __url__ = "https://github.com/Illumina/interop" 6 | __doc_url__ = "http://illumina.github.io/interop/index.html" 7 | __version__ = "@INTEROP_VERSION@" 8 | __maintainer__ = "Illumina, inc." 9 | __contact__ = "https://github.com/Illumina/interop/issues" 10 | 11 | from interop.core import * 12 | 13 | -------------------------------------------------------------------------------- /docs/theme/bootstrap3/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /docs/theme/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /cmake/Modules/CheckStdInt.cmake: -------------------------------------------------------------------------------- 1 | # Functions to test implementation of stdint.h 2 | # 3 | # Functions: 4 | # 1. check_int64_long - test whether stdint.h int64_t is long type 5 | # 6 | # 7 | 8 | function(check_int64_long _flag) 9 | file(WRITE ${CMAKE_BINARY_DIR}/test_int64_long.cpp 10 | "\#include 11 | \#include 12 | std::vector* test(){return (std::vector*)0;} 13 | int main(){test();return 0;} 14 | ") 15 | try_compile(${_flag} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/test_int64_long.cpp) 16 | endfunction() 17 | 18 | -------------------------------------------------------------------------------- /tools/docker/DockerFile_Centos5: -------------------------------------------------------------------------------- 1 | # sudo docker build --rm -t docker-bioinformatics.dockerhub.illumina.com/interop_centos5 -f ./tools/docker/DockerFile_Centos5 tools 2 | # sudo docker build --rm -t ezralanglois/interop -f ./tools/docker/DockerFile_Centos5 ./tools 3 | 4 | FROM quay.io/pypa/manylinux1_x86_64 5 | 6 | ENV JAVA_HOME /usr/java/jdk1.8.0_131 7 | ENV JUNIT_HOME /opt/junit 8 | ENV NUNIT_DIR /opt/nunit/NUnit-2.6.4 9 | 10 | COPY prereqs/docker-centos5-install.sh /docker-centos5-install.sh 11 | COPY patches/mono_patch.txt /mono_patch.txt 12 | RUN bash docker-centos5-install.sh && rm -fr docker-centos5-install.sh 13 | 14 | 15 | -------------------------------------------------------------------------------- /interop/util/timer.h: -------------------------------------------------------------------------------- 1 | /** Scopped timer 2 | * 3 | * @file 4 | * @date 11/7/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | 9 | #pragma once 10 | #include 11 | 12 | namespace illumina { namespace interop { namespace util 13 | { 14 | 15 | class scoped_timer 16 | { 17 | public: 18 | scoped_timer(double& duration) : m_start(std::clock()), m_duration(duration){} 19 | ~scoped_timer(){m_duration = (std::clock()-m_start) / static_cast(CLOCKS_PER_SEC);} 20 | private: 21 | std::clock_t m_start; 22 | double& m_duration; 23 | 24 | }; 25 | 26 | }}} 27 | -------------------------------------------------------------------------------- /src/tests/csharp/logic/DependencyTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using Illumina.InterOp.RunMetrics; 4 | 5 | namespace Illumina.InterOp.Interop.UnitTest 6 | { 7 | /// 8 | /// Test C# dependencies 9 | /// 10 | public class DependencyTests 11 | { 12 | /// 13 | /// Test FileNotFoundException 14 | /// 15 | [Test] 16 | public void TestFileNotFoundException() 17 | { 18 | run_metrics metrics = new run_metrics(); 19 | try{ 20 | metrics.read("/NO/FILE/EXISTS"); 21 | } 22 | catch(Exception){} 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /cmake/CheckSWIGVersion.cmake: -------------------------------------------------------------------------------- 1 | # Get SWIG major version 2 | function(check_swig_version _major_ver) 3 | execute_process( 4 | COMMAND ${SWIG_EXECUTABLE} -version 5 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 6 | RESULT_VARIABLE 7 | res 8 | OUTPUT_VARIABLE 9 | VERSION 10 | OUTPUT_STRIP_TRAILING_WHITESPACE 11 | ) 12 | message(STATUS "SWIG version output: ${VERSION}") 13 | string(REGEX REPLACE "SWIG Version ([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" swig_major_ver "${VERSION}") 14 | string(STRIP ${swig_major_ver} swig_major_ver) 15 | set(${_major_ver} ${swig_major_ver} PARENT_SCOPE) 16 | endfunction() 17 | -------------------------------------------------------------------------------- /tools/build_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################################################################################## 3 | # 1. Copy into source directory 4 | # 2. Run: sh build_docs.sh 5 | ######################################################################################################################## 6 | 7 | set -ex 8 | 9 | rm -fr interop_docs 10 | git clone https://${GITHUB_TOKEN}@git.illumina.com/Bioinformatics/interop.git interop_docs 11 | cd interop_docs 12 | 13 | git checkout gh-pages 14 | git reset GH_PAGES_ROOT --hard 15 | 16 | mv ../dist/html/* ./ 17 | 18 | git add . 19 | git commit -am "Added documentation" 20 | git push origin +HEAD 21 | git checkout @{-1} 22 | cd - 23 | rm -fr interop_docs 24 | -------------------------------------------------------------------------------- /tools/teamcity/pull_request/centos7_gcc-485-ppc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | branch=$1 5 | build_num=$2 6 | docker_image="multiarch/qemu-user-static:register" 7 | 8 | docker ps 1>/dev/null 2>&1 || prefix=sudo; 9 | 10 | ${prefix} docker pull ${docker_image} 11 | if [ "$?" != "0" ] ; then 12 | yes | ${prefix} docker system prune -a 13 | fi 14 | 15 | ${prefix} docker run --rm --privileged ${docker_image} --reset 16 | if [ "$?" != "0" ] ; then 17 | exit 1 18 | fi 19 | 20 | sh ./tools/package_docker.sh docker-bioinformatics.dockerhub.illumina.com/ppc64le/interop_centos7 ${build_num} "-DDISABLE_DYNAMIC_ARRAY=ON -DENABLE_FLOAT_COMPRESSION=OFF -DENABLE_DOCS=OFF -DENABLE_SWIG=OFF -DBUILD_SAMPLE_SHEET_ONLY=ON -DENABLE_EXAMPLES=OFF -DENABLE_APPS=OFF" 21 | if [ "$?" != "0" ] ; then 22 | exit 1 23 | fi 24 | -------------------------------------------------------------------------------- /tools/hooks/pre-commit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | BRANCH=`git rev-parse --abbrev-ref HEAD` 5 | 6 | if [[ "$BRANCH" == "master" ]]; then 7 | echo "You are on branch $BRANCH. Are you sure you want to commit to this branch?" 8 | echo "If so, commit with -n to bypass this pre-commit hook." 9 | exit 1 10 | fi 11 | 12 | # This is old code, which did not work for Git versions later than 1.7 for updating a version file using 13 | # the pre-commit hook 14 | # 15 | # The code was moved to the pre-push hook 16 | # 17 | # This tests whether there are any stashed changes waiting to be added 18 | #git diff --cached --exit-code --quiet 19 | #status1=$? 20 | # This tests whether there are any changes waiting to be added 21 | #git diff --exit-code --quiet 22 | #status2=$? 23 | #if [ "$status1" == "1" ] || ["$status2" == "1"] ; then 24 | #fi 25 | -------------------------------------------------------------------------------- /interop/util/base_exception.h: -------------------------------------------------------------------------------- 1 | /** Base exception class from which all other InterOp exceptions are derived 2 | * 3 | * @file 4 | * @date 4/1/17 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include 10 | #include 11 | 12 | #ifdef _MSC_VER 13 | #pragma warning(disable:4290) // MSVC warns that it ignores the exception specification. 14 | #endif 15 | 16 | namespace illumina { namespace interop { namespace util 17 | { 18 | 19 | /** Base exception for all format errors 20 | */ 21 | struct base_exception : public std::runtime_error 22 | { 23 | /** Constructor 24 | * 25 | * @param mesg error message 26 | */ 27 | base_exception(const std::string &mesg) : std::runtime_error(mesg) 28 | { } 29 | }; 30 | 31 | }}} 32 | 33 | -------------------------------------------------------------------------------- /interop/logic/metric/index_metric.h: -------------------------------------------------------------------------------- 1 | /** Logic for index metrics 2 | * 3 | * @file 4 | * @date 5/26/17 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include "interop/model/metrics/index_metric.h" 10 | #include "interop/logic/metric/tile_metric.h" 11 | #include "interop/model/metric_base/metric_set.h" 12 | 13 | 14 | namespace illumina { namespace interop { namespace logic { namespace metric 15 | { 16 | 17 | 18 | /** Populate the unique index sequences while maintaining the order 19 | * 20 | * @param tile_metrics tile metric set 21 | * @param metrics index metric set 22 | */ 23 | void populate_indices(const model::metric_base::metric_set& tile_metrics, 24 | model::metric_base::metric_set& metrics); 25 | 26 | 27 | }}}} 28 | -------------------------------------------------------------------------------- /tools/prereqs/travis-osx-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Install requirements using HomeBrew" 4 | export HOMEBREW_NO_INSTALL_CLEANUP=1 5 | export HOMEBREW_NO_AUTO_UPDATE=1 # Fix 6 | 7 | set -x 8 | 9 | brew list swig@3 || brew install swig@3 10 | brew unlink swig || true 11 | brew link swig@3 --force 12 | brew install doxygen 13 | brew install nuget 14 | 15 | brew tap isen-ng/dotnet-sdk-versions 16 | brew cask list dotnet-sdk || brew cask install dotnet-sdk2-2-400 17 | 18 | brew list miniconda 19 | 20 | set +x 21 | echo "Install Anaconda" 22 | set -x 23 | time curl -o miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh 24 | time bash miniconda.sh -b -p $HOME/miniconda 25 | source $HOME/miniconda/etc/profile.d/conda.sh 26 | 27 | which conda 28 | dotnet --version 29 | 30 | set +x 31 | echo "Finished requirements" 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /interop/logic/metric/extended_tile_metric.h: -------------------------------------------------------------------------------- 1 | /** Logic for extended tile metrics 2 | * 3 | * @file 4 | * @date 7/31/2017 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include "interop/model/metrics/extended_tile_metric.h" 10 | #include "interop/model/metrics/tile_metric.h" 11 | 12 | namespace illumina { namespace interop { namespace logic { namespace metric 13 | { 14 | /** Populate percent occupied in extended tile metrics 15 | * 16 | * @param tile_metrics tile metric set 17 | * @param extended_tile_metrics destination extended tile metric set 18 | */ 19 | void populate_percent_occupied(const model::metric_base::metric_set& tile_metrics, 20 | model::metric_base::metric_set& extended_tile_metrics); 21 | }}}} 22 | 23 | -------------------------------------------------------------------------------- /interop/util/self_registration.h: -------------------------------------------------------------------------------- 1 | /** Ensure self registration classes properly link 2 | * 3 | * @file 4 | * @date 12/19/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | 10 | /** Ensure that static libraries are properly linked 11 | * This must be used in a function that will definitely be linked. 12 | * 13 | * Tested for Microsoft Visual C++, GCC and CLang 14 | */ 15 | #define INTEROP_FORCE_LINK_USE(X) void force_link_metric_format(X*); force_link_metric_format(0); 16 | /** Ensure that static libraries are properly linked 17 | * This must be used in a file that may not be linked. 18 | * 19 | * Tested for Microsoft Visual C++, GCC and CLang 20 | */ 21 | #define INTEROP_FORCE_LINK_DEF(X) namespace illumina{namespace interop{namespace io{ void force_link_metric_format(X*){} }}} \ 22 | void force_link_metric_format(X*){} // For Microsoft Visual C++ 23 | -------------------------------------------------------------------------------- /interop/util/static_assert.h: -------------------------------------------------------------------------------- 1 | /** Back port of static assert 2 | * 3 | * This is a compile time check for debugging purposes. 4 | * 5 | * @file 6 | * @date 9/26/15 7 | * @version 1.0 8 | * @copyright GNU Public License. 9 | */ 10 | 11 | #pragma once 12 | #if (!defined(__cplusplus) || __cplusplus < 201103L) && (!defined(_MSC_VER) || _MSC_VER < 1600) 13 | #if !defined(static_assert) 14 | /** Define a broken static_assert_ class for the false condition */ 15 | template struct static_assert_; 16 | /** Define a working static_assert_ class for the true condition */ 17 | template <> struct static_assert_ {}; 18 | /** Test condition and print message 19 | * 20 | * @param x condition 21 | * @param m message 22 | */ 23 | #define static_assert(x, m) static_assert_<(x)>() 24 | #endif 25 | #endif 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/tests/interop/io/csv_format.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** Unit tests for CSV format parsing and wirting 3 | * 4 | * @file 5 | * @date 9/12/2017 6 | * @version 1.0 7 | * @copyright GNU Public License 8 | */ 9 | #include 10 | #include 11 | #include "interop/io/table/csv_format.h" 12 | #include "src/tests/interop/inc/generic_fixture.h" 13 | 14 | using namespace illumina::interop; 15 | 16 | 17 | TEST(csv_format_test, read_value) 18 | { 19 | std::string line = "3.0,-inf,1.0"; 20 | //void read_csv_line(std::istream& in, std::vector& values, const T missing=T()) 21 | std::vector vals; 22 | std::istringstream sin(line); 23 | io::table::read_csv_line(sin, vals); 24 | const float eps = 1e-3f; 25 | INTEROP_EXPECT_NEAR(3.0f, vals[0], eps); 26 | INTEROP_EXPECT_NEAR(std::numeric_limits::infinity(), vals[1], eps); 27 | INTEROP_EXPECT_NEAR(1.0f, vals[2], eps); 28 | } -------------------------------------------------------------------------------- /src/examples/csharp/SummaryExample.cs: -------------------------------------------------------------------------------- 1 | 2 | // @ [Reporting Summary Metrics in CSharp] 3 | using System; 4 | using Illumina.InterOp.Run; 5 | using Illumina.InterOp.Metrics; 6 | using Illumina.InterOp.RunMetrics; 7 | using Illumina.InterOp.Comm; 8 | using Illumina.InterOp.Summary; 9 | 10 | class SummaryExample 11 | { 12 | static int Main(string[] args) 13 | { 14 | if (args.Length != 1) 15 | { 16 | if (args.Length < 1) 17 | Console.WriteLine ("No run folder"); 18 | else 19 | Console.WriteLine ("Too many arguments"); 20 | return 1; 21 | } 22 | 23 | run_metrics metrics = new run_metrics(); 24 | metrics.read(args[0]); 25 | 26 | 27 | run_summary summary = new run_summary(); 28 | c_csharp_summary.summarize_run_metrics(metrics, summary); 29 | 30 | 31 | Console.WriteLine("Yield: {0}", summary.total_summary().yield_g()); 32 | return 0; 33 | } 34 | } 35 | // @ [Reporting Summary Metrics in CSharp] 36 | -------------------------------------------------------------------------------- /interop/interop.h: -------------------------------------------------------------------------------- 1 | /** InterOp Library 2 | * 3 | * This header file provides an interface to the primary InterOp functionality 4 | * 5 | * @file 6 | * @date 6/8/16 7 | * @version 1.0 8 | * @copyright GNU Public License. 9 | */ 10 | #pragma once 11 | #include "interop/version.h" 12 | #include "interop/model/run_metrics.h" 13 | #include "interop/logic/plot/plot_by_cycle.h" 14 | #include "interop/logic/plot/plot_by_lane.h" 15 | #include "interop/logic/plot/plot_flowcell_map.h" 16 | #include "interop/logic/plot/plot_qscore_heatmap.h" 17 | #include "interop/logic/plot/plot_qscore_histogram.h" 18 | #include "interop/logic/summary/index_summary.h" 19 | #include "interop/logic/summary/run_summary.h" 20 | 21 | namespace illumina { namespace interop 22 | { 23 | /** Get the version of the library 24 | * 25 | * @return library version 26 | */ 27 | inline const char* library_version(){return INTEROP_VERSION;} 28 | }} 29 | 30 | -------------------------------------------------------------------------------- /tools/package_docker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | image=ezralanglois/interop 6 | pyver="None" 7 | 8 | if [ ! -z $1 ] ; then 9 | image=$1 10 | fi 11 | 12 | if [ ! -z "$2" ] ; then 13 | build_number=$2 14 | fi 15 | 16 | if [ ! -z "$3" ] ; then 17 | extra=$3 18 | fi 19 | 20 | if [ ! -e `pwd`/dist ] ; then 21 | mkdir `pwd`/dist 22 | fi 23 | 24 | sudo systemctl status docker || sudo systemctl start docker || true 25 | 26 | docker ps 1>/dev/null 2>&1 || prefix=sudo; 27 | #${prefix} docker rmi $(${prefix} docker images --filter "dangling=true") >/dev/null 2>&1 || true 28 | ${prefix} docker rmi $(${prefix} docker images) >/dev/null 2>&1 || true 29 | ${prefix} docker system prune -f >/dev/null 2>&1 || true 30 | ${prefix} docker pull $image 31 | ${prefix} docker run --rm -w /tmp --user `id -u`:`id -g` -v `pwd`:/src:ro -v `pwd`/dist:/dist:rw $image bash /src/tools/package.sh /src /dist teamcity OFF Release $pyver "$build_number" "$extra" 32 | -------------------------------------------------------------------------------- /.github/workflows/docs.yaml: -------------------------------------------------------------------------------- 1 | name: HTML Documentation on Github Pages 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | tags: [ "*" ] 7 | pull_request: 8 | branches: [ "*" ] 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | with: 16 | fetch-depth: 0 17 | - name: Build Documentation 18 | run: docker run --rm -v ${{github.workspace}}/:/io ezralanglois/interop bash -c "cmake /io -Bbuild -DDOCS_OUTPUT_PATH=/io/dist && cmake --build build --target doc" 19 | - name: Test Documentation 20 | run: ls dist/html 21 | - name: Deploy 22 | uses: JamesIves/github-pages-deploy-action@v4.3.3 23 | if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') 24 | with: 25 | branch: gh-pages # The branch the action should deploy to. 26 | folder: dist/html # The folder the action should deploy. 27 | 28 | -------------------------------------------------------------------------------- /interop/model/table/table_exceptions.h: -------------------------------------------------------------------------------- 1 | /** Exceptions used by the table namespace 2 | * 3 | * 4 | * @file 5 | * @date 4/2/17 6 | * @version 1.0 7 | * @copyright GNU Public License. 8 | */ 9 | 10 | #pragma once 11 | #include "interop/util/base_exception.h" 12 | 13 | namespace illumina { namespace interop { namespace model 14 | { 15 | /** @defgroup table_exceptions Table Exceptions 16 | * 17 | * Exceptions that can be thrown if a problem occurs while using the run model 18 | * 19 | * @ingroup interop_exceptions 20 | * @{ 21 | */ 22 | 23 | 24 | /** Exception raised if the column type is invalid 25 | */ 26 | struct invalid_column_type : public util::base_exception 27 | { 28 | /** Constructor 29 | * 30 | * @param mesg error message 31 | */ 32 | invalid_column_type(const std::string &mesg) : util::base_exception(mesg) 33 | { } 34 | }; 35 | /** @} */ 36 | }}} 37 | 38 | 39 | -------------------------------------------------------------------------------- /interop/model/plot/plot_exceptions.h: -------------------------------------------------------------------------------- 1 | /** Exceptions used by the plot namespace 2 | * 3 | * 4 | * @file 5 | * @date 4/2/17 6 | * @version 1.0 7 | * @copyright GNU Public License. 8 | */ 9 | 10 | #pragma once 11 | #include "interop/util/base_exception.h" 12 | 13 | namespace illumina { namespace interop { namespace model 14 | { 15 | /** @defgroup plot_exceptions Plot Exceptions 16 | * 17 | * Exceptions that can be thrown if a problem occurs while using the run model 18 | * 19 | * @ingroup interop_exceptions 20 | * @{ 21 | */ 22 | 23 | 24 | /** Exception raised if the filter options are invalid 25 | */ 26 | struct invalid_filter_option : public util::base_exception 27 | { 28 | /** Constructor 29 | * 30 | * @param mesg error message 31 | */ 32 | invalid_filter_option(const std::string &mesg) : util::base_exception(mesg) 33 | { } 34 | }; 35 | /** @} */ 36 | }}} 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/ext/python/__main__.py.in: -------------------------------------------------------------------------------- 1 | import interop 2 | import interop.core 3 | import unittest 4 | import argparse 5 | from interop import @PY_MOD_NAME_LIST@ 6 | from interop.CoreTests import CoreTests 7 | 8 | def execute_from_commandline(): 9 | """ Provide a command line interface to a general test script 10 | """ 11 | 12 | parser = argparse.ArgumentParser(prog='interop_check', description='Test script for the InterOp Library Python Interface') 13 | parser.add_argument('--version', action='version', version=interop.__version__) 14 | parser.add_argument('--test', action='store_true', help='Run the unit tests') 15 | parser.set_defaults(test=False) 16 | param = parser.parse_args() 17 | if param.test: 18 | testsuite = unittest.defaultTestLoader.loadTestsFromTestCase(CoreTests) 19 | unittest.TextTestRunner(verbosity=1).run(testsuite) 20 | interop.core._run_doctests() 21 | 22 | if __name__ == "__main__": 23 | execute_from_commandline(); 24 | 25 | -------------------------------------------------------------------------------- /docs/src/example1.md: -------------------------------------------------------------------------------- 1 | Reading a binary InterOp file {#reading} 2 | ============================= 3 | 4 | Reading a binary Interop file is really just two lines of code, but all sorts of unexpected situations may arise. This 5 | example shows you how to write bullet proof code to read an Illumina InterOp file. 6 | 7 | ## Simple method 8 | 9 | C++ 10 | --- 11 | 12 | Shows how to read a single metric set using run_metrics 13 | 14 | @snippet src/examples/example_populate_qmetricset.cpp Reading a single metric set using run_metrics 15 | 16 | C# 17 | -- 18 | 19 | Shows how to read all metrics required by the imaging tab in SAV 20 | 21 | @snippet src/examples/csharp/ImagingExample.cs Reading only metrics required by the Imaging Tab 22 | 23 | ## Advanced method 24 | 25 | Not recommneded for most users. 26 | 27 | ### C++ 28 | 29 | @snippet src/examples/example1.cpp Reading a binary InterOp file 30 | 31 | ### C# 32 | 33 | @snippet src/examples/csharp/Example1.cs Reading a binary InterOp file in CSharp 34 | -------------------------------------------------------------------------------- /interop/model/metric_base/metric_exceptions.h: -------------------------------------------------------------------------------- 1 | /** Exceptions used by the metrics namespace 2 | * 3 | * 4 | * @file 5 | * @date 4/1/17 6 | * @version 1.0 7 | * @copyright GNU Public License. 8 | */ 9 | 10 | #pragma once 11 | #include "interop/util/base_exception.h" 12 | 13 | namespace illumina { namespace interop { namespace model 14 | { 15 | /** @defgroup metric_exceptions Metric Exceptions 16 | * 17 | * Exceptions that can be thrown if a problem occurs while using the run model 18 | * 19 | * @ingroup interop_exceptions 20 | * @{ 21 | */ 22 | 23 | /** Exception raised if an index goes out of bounds 24 | */ 25 | struct index_out_of_bounds_exception : public util::base_exception 26 | { 27 | /** Constructor 28 | * 29 | * @param mesg error message 30 | */ 31 | index_out_of_bounds_exception(const std::string &mesg) : util::base_exception(mesg) 32 | { } 33 | }; 34 | /** @} */ 35 | 36 | }}} 37 | 38 | -------------------------------------------------------------------------------- /interop/constants/typedefs.h: -------------------------------------------------------------------------------- 1 | /** Common typedefs used throughout InterOp 2 | * 3 | * @file 4 | * @date 4/28/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | 9 | #pragma once 10 | #include "interop/util/type_traits.h" 11 | #include "interop/constants/enums.h" 12 | 13 | 14 | namespace illumina { namespace interop { namespace constants 15 | { 16 | 17 | /** Define base type for tile metrics */ 18 | typedef constant_type base_tile_t; 19 | /** Define base type for cycle metrics */ 20 | typedef constant_type base_cycle_t; 21 | /** Define base type for read metrics */ 22 | typedef constant_type base_read_t; 23 | /** Define base type for lane metrics */ 24 | typedef constant_type base_lane_t; 25 | /** Define base type for lane metrics */ 26 | typedef constant_type base_run_t; 27 | 28 | }}} 29 | 30 | -------------------------------------------------------------------------------- /interop/io/format/generic_layout.h: -------------------------------------------------------------------------------- 1 | /** Generic layout defined for a specific metric and version 2 | * 3 | * This file defines a generic layout for all metric formats. This class will be specialized for a specific InterOp 4 | * interface class. 5 | * 6 | * @file 7 | * @date 8/15/15 8 | * @version 1.0 9 | * @copyright GNU Public License. 10 | */ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | namespace illumina { namespace interop { namespace io 17 | { 18 | /** A POD-struct that defines the layout of a binary InterOp record 19 | * 20 | * The MetricType is the class that holds the actual record data. 21 | * The Version is the version of the format. 22 | */ 23 | template 24 | struct generic_layout; 25 | 26 | /** Define a text layout of the metric 27 | * 28 | * This is currently only used for writing metrics 29 | */ 30 | template 31 | struct text_layout; 32 | 33 | 34 | }}} 35 | 36 | 37 | -------------------------------------------------------------------------------- /cmake/CopyListOfFiles.cmake: -------------------------------------------------------------------------------- 1 | # Used by the UseCSharp.cmake to copy a list of files to a destination directory 2 | # 3 | # This is called by add_custom_command as follows: 4 | # COMMAND ${CMAKE_COMMAND} -DFILES_TO_COPY="${sources}" -DDESTINATION_DIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/CopyListOfFiles.cmake 5 | # 6 | # It takes two input variables: 7 | # - FILES_TO_COPY - list of files to copy (may have regular expressions supported by glob) 8 | # - DESTINATION_DIR - the destination directory path 9 | # 10 | # 11 | string (REPLACE "," ";" FILES_TO_COPY "${FILES_TO_COPY}") 12 | set(FILES_TO_COPY_EX) 13 | foreach(filename ${FILES_TO_COPY}) 14 | file(GLOB GLOB_FILES ${filename}) 15 | list(APPEND FILES_TO_COPY_EX ${GLOB_FILES}) 16 | endforeach() 17 | 18 | list(LENGTH "${FILES_TO_COPY}" FILES_LEN) 19 | if(${FILES_LEN} EQUAL 1) 20 | get_filename_component(FILE_EXPR ${FILES_TO_COPY} NAME) 21 | file(REMOVE ${DESTINATION_DIR}/${FILE_EXPR}) 22 | endif() 23 | 24 | file(COPY ${FILES_TO_COPY_EX} DESTINATION ${DESTINATION_DIR}) 25 | 26 | -------------------------------------------------------------------------------- /interop/logic/plot/plot_sample_qc.h: -------------------------------------------------------------------------------- 1 | /** Plot reads identified versus index 2 | * 3 | * @file 4 | * @date 5/10/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | 10 | #include "interop/constants/enums.h" 11 | #include "interop/model/run_metrics.h" 12 | #include "interop/model/plot/bar_point.h" 13 | #include "interop/logic/plot/plot_data.h" 14 | #include "interop/logic/utils/metrics_to_load.h" 15 | 16 | namespace illumina { namespace interop { namespace logic { namespace plot 17 | { 18 | 19 | 20 | /** Plot reads identified versus index 21 | * 22 | * @ingroup plot_logic 23 | * @param metrics run metrics 24 | * @param lane lane number 25 | * @param data output plot data 26 | */ 27 | void plot_sample_qc(model::metrics::run_metrics &metrics, 28 | const size_t lane, 29 | model::plot::plot_data &data) 30 | INTEROP_THROW_SPEC((model::index_out_of_bounds_exception, std::bad_alloc)); 31 | 32 | 33 | }}}} 34 | 35 | -------------------------------------------------------------------------------- /tools/prereqs/travis-linux-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | lsb_release -a 4 | 5 | # http://stackoverflow.com/questions/33196136/travis-ci-update-cmake-using-the-packages-cache 6 | CMAKE_URL="http://www.cmake.org/files/v3.4/cmake-3.4.3-Linux-x86_64.tar.gz" 7 | if [ ! -e ${HOME}/cmake/bin/cmake ]; then 8 | if [ ! -e ${HOME}/cmake ]; then 9 | mkdir $HOME/cmake 10 | fi 11 | travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C $HOME/cmake 12 | else 13 | echo "Using cached cmake" 14 | fi 15 | export PATH="$HOME/cmake/bin:${PATH}" 16 | 17 | python --version 18 | python -c "import sys; opts={1114111: 'ucs4', 65535: 'ucs2'}; print opts.get(sys.maxunicode)" 19 | pip install wheel --user 20 | pip install numpy --user 21 | 22 | if [ ! -e $HOME/NUnit-2.6.4/bin/nunit.framework.dll ]; then 23 | travis_retry wget https://github.com/nunit/nunitv2/releases/download/2.6.4/NUnit-2.6.4.zip 24 | unzip NUnit-2.6.4.zip -d $HOME 25 | else 26 | echo "Using cached NUnit" 27 | fi 28 | 29 | export NUNIT_DIR=$HOME/NUnit-2.6.4 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/tests/python/DepTests.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unit tests to ensure the dependent SWIG wrapped modules are properly imported 3 | """ 4 | import unittest 5 | import os 6 | try: 7 | from interop import py_interop_run_metrics 8 | except: 9 | import sys 10 | sys.path.append(".") 11 | from interop import py_interop_run_metrics 12 | 13 | class DependencyTests(unittest.TestCase): 14 | """ Unit tests to ensure the dependent SWIG wrapped modules are properly imported 15 | """ 16 | 17 | def test_xml_file_not_found_exception(self): 18 | """ 19 | Test whether xml_file_not_found_exception in py_interop_run can be used 20 | """ 21 | 22 | run = py_interop_run_metrics.run_metrics() 23 | try: 24 | run.read('file/not/found') 25 | self.fail("xml_file_not_found_exception should have been thrown") 26 | except Exception as ex: 27 | self.assertEqual(str(ex).split('\n')[0], "cannot open file " + os.path.join("file/not/found", "RunInfo.xml")) 28 | 29 | if __name__ == '__main__': 30 | unittest.main() 31 | -------------------------------------------------------------------------------- /src/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | add_custom_target(check) 4 | set_target_properties(check PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) 5 | 6 | add_subdirectory("interop") 7 | 8 | 9 | add_custom_target(check_gtest) 10 | set_target_properties(check_gtest PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) 11 | 12 | add_custom_command(TARGET check_gtest POST_BUILD COMMAND $) 13 | add_dependencies(check check_gtest) 14 | 15 | if(NOT ENABLE_SWIG) 16 | return() 17 | endif() 18 | 19 | find_package(SWIG 4.0) 20 | if(NOT SWIG_FOUND) 21 | return() 22 | endif() 23 | include(${PROJECT_SOURCE_DIR}/cmake/CheckSWIGVersion.cmake) 24 | 25 | if(NOT ENABLE_SWIG) 26 | return() 27 | endif() 28 | 29 | if(ENABLE_CSHARP) 30 | add_subdirectory("csharp") 31 | if(CSHARP_TEST_ENABLED) 32 | add_dependencies(check check_csharp) 33 | endif() 34 | endif() 35 | 36 | if(ENABLE_PYTHON) 37 | add_subdirectory("python") 38 | if(PYTHON_TEST_ENABLED) 39 | add_dependencies(check check_python) 40 | endif() 41 | endif() 42 | -------------------------------------------------------------------------------- /src/examples/csharp/Example1.cs: -------------------------------------------------------------------------------- 1 | 2 | // @ [Reading a binary InterOp file in CSharp] 3 | using System; 4 | using Illumina.InterOp.Run; 5 | using Illumina.InterOp.Metrics; 6 | using Illumina.InterOp.Comm; 7 | 8 | class Example1 9 | { 10 | static int Main(string[] args) 11 | { 12 | if (args.Length != 1) 13 | { 14 | if (args.Length < 1) 15 | Console.WriteLine ("No run folder"); 16 | else 17 | Console.WriteLine ("Too many arguments"); 18 | return 1; 19 | } 20 | 21 | 22 | base_tile_metrics tile_metric_set = new base_tile_metrics (); 23 | try 24 | { 25 | c_csharp_comm.read_interop (args [0], tile_metric_set); 26 | } 27 | catch(incomplete_file_exception){} 28 | catch(file_not_found_exception ex) 29 | { 30 | 31 | Console.WriteLine("File not found: "+args [0]); 32 | Console.WriteLine (ex); 33 | return 1; 34 | } 35 | catch(bad_format_exception ex) 36 | { 37 | Console.WriteLine (ex); 38 | return 1; 39 | } 40 | Console.Write ("Tile metric set contains {0} metrics", tile_metric_set.size()); 41 | return 0; 42 | } 43 | } 44 | // @ [Reading a binary InterOp file in CSharp] 45 | 46 | -------------------------------------------------------------------------------- /interop/io/format/stream_membuf.h: -------------------------------------------------------------------------------- 1 | /** Stream membuf class 2 | * 3 | * @file 4 | * @date 9/3/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | #include "interop/util/exception.h" 15 | #include "interop/io/stream_exceptions.h" 16 | #include "interop/util/lexical_cast.h" 17 | #include "interop/util/cstdint.h" 18 | 19 | namespace illumina { namespace interop { namespace io 20 | { 21 | namespace detail 22 | { 23 | /** Memory buffer for a stream 24 | * 25 | * This class is used to turn a binary byte buffer into an input stream for reading. 26 | */ 27 | struct membuf : std::streambuf 28 | { 29 | /** Constructor 30 | * 31 | * @param begin start iterator for a char buffer 32 | * @param end end iterator for a char buffer 33 | */ 34 | membuf(char *begin, char *end) 35 | { 36 | this->setg(begin, begin, end); 37 | } 38 | }; 39 | } 40 | }}} 41 | 42 | -------------------------------------------------------------------------------- /docs/theme/bootstrap3/css/sticky-footer-navbar.css: -------------------------------------------------------------------------------- 1 | /* Sticky footer styles 2 | -------------------------------------------------- */ 3 | 4 | html, 5 | body { 6 | height: 100%; 7 | /* The html and body elements cannot have any padding or margin. */ 8 | } 9 | 10 | /* Wrapper for page content to push down footer */ 11 | #wrap { 12 | min-height: 100%; 13 | height: auto; 14 | /* Negative indent footer by its height */ 15 | margin: 0 auto -60px; 16 | /* Pad bottom by footer height */ 17 | padding: 0 0 60px; 18 | } 19 | 20 | /* Set the fixed height of the footer here */ 21 | #footer { 22 | /*height: 60px;*/ 23 | padding: 8px 0px; 24 | background-color: #f5f5f5; 25 | } 26 | 27 | 28 | /* Custom page CSS 29 | -------------------------------------------------- */ 30 | /* Not required for template or sticky footer method. */ 31 | 32 | .footer-row { 33 | line-height: 44px; 34 | } 35 | 36 | #wrap > .container { 37 | padding: 60px 15px 0; 38 | } 39 | .container .text-muted { 40 | 41 | } 42 | 43 | #footer > .container { 44 | padding-left: 15px; 45 | padding-right: 15px; 46 | } 47 | 48 | code { 49 | font-size: 80%; 50 | } -------------------------------------------------------------------------------- /interop/util/map.h: -------------------------------------------------------------------------------- 1 | /** Define generic ordered and unordered maps for both C++11 and C++98 2 | * 3 | * @todo include this everywhere isnan is used 4 | * 5 | * @file 6 | * @date 11/7/16 7 | * @version 1.0 8 | * @copyright GNU Public License. 9 | */ 10 | #pragma once 11 | #include "interop/config.h" 12 | 13 | #ifdef HAVE_UNORDERED_MAP_IN_STD 14 | # define INTEROP_HAS_UNORDERED_MAP 1 15 | # include 16 | # include 17 | # define INTEROP_ORDERED_MAP(key_t, value_t) std::map 18 | # define INTEROP_UNORDERED_MAP(key_t, value_t) std::unordered_map 19 | # define INTEROP_UNORDERED_HASHMAP(key_t, value_t, hash_t) std::unordered_map 20 | # define INTEROP_CLEAR_MAP(map_ins) offset_map_t empty_map_to_clear;std::swap(map_ins, empty_map_to_clear); 21 | #else 22 | # include 23 | # define INTEROP_ORDERED_MAP(key_t, value_t) std::map 24 | # define INTEROP_UNORDERED_MAP(key_t, value_t) std::map 25 | # define INTEROP_UNORDERED_HASHMAP(key_t, value_t, hash_t) std::map 26 | # define INTEROP_CLEAR_MAP(map_ins) map_ins.clear(); 27 | #endif 28 | -------------------------------------------------------------------------------- /src/tests/interop/logic/metric_type_ext_test.cpp: -------------------------------------------------------------------------------- 1 | /** Unit tests for enum parsing 2 | * 3 | * @file 4 | * @date 4/27/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #include 9 | #include "interop/logic/utils/metric_type_ext.h" 10 | 11 | 12 | using namespace illumina::interop; 13 | 14 | 15 | TEST(metric_type_ext, is_base_type) 16 | { 17 | EXPECT_TRUE(logic::utils::is_base_metric(constants::CalledIntensity)); 18 | EXPECT_FALSE(logic::utils::is_base_metric(constants::Intensity)); 19 | } 20 | 21 | TEST(metric_type_ext, is_channel_metric) 22 | { 23 | EXPECT_TRUE(logic::utils::is_channel_metric(constants::Intensity)); 24 | EXPECT_FALSE(logic::utils::is_channel_metric(constants::CalledIntensity)); 25 | } 26 | 27 | TEST(metric_type_ext, is_read_metric) 28 | { 29 | EXPECT_TRUE(logic::utils::is_read_metric(constants::PercentAligned)); 30 | EXPECT_FALSE(logic::utils::is_read_metric(constants::CalledIntensity)); 31 | } 32 | 33 | TEST(metric_type_ext, is_cycle_metric) 34 | { 35 | EXPECT_TRUE(logic::utils::is_cycle_metric(constants::Intensity)); 36 | EXPECT_FALSE(logic::utils::is_cycle_metric(constants::PercentAligned)); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /interop/logic/plot/plot_metric_list.h: -------------------------------------------------------------------------------- 1 | /** List all metrics for plotting 2 | * 3 | * @file 4 | * @date 5/8/17 5 | * @version 1.0 6 | * @copyright GNU Public License 7 | */ 8 | #pragma once 9 | #include "interop/model/run_metrics.h" 10 | #include "interop/constants/enums.h" 11 | #include "interop/logic/utils/enums.h" 12 | #include "interop/logic/utils/metric_type_ext.h" 13 | #include "interop/logic/utils/metrics_to_load.h" 14 | 15 | namespace illumina { namespace interop { namespace logic { namespace plot 16 | { 17 | /** List metric types available for all plots 18 | * 19 | * @param types destination vector to fill with metric types 20 | */ 21 | void list_plot_metrics(std::vector< logic::utils::metric_type_description_t > &types); 22 | 23 | /** List all available metric types for all plots 24 | * 25 | * That is, the metric must be populated 26 | * 27 | * @param metrics run metrics object 28 | * @param types destination vector to fill with metric types 29 | */ 30 | void list_available_plot_metrics(const model::metrics::run_metrics& metrics, 31 | std::vector< logic::utils::metric_type_description_t > &types); 32 | }}}} 33 | 34 | -------------------------------------------------------------------------------- /docs/src/calculated_metrics.md: -------------------------------------------------------------------------------- 1 | # InterOp Calculations {#calculated_metrics} 2 | 3 | This page describes the derived metrics calculated from the InterOp files. 4 | 5 | ## Summary Tab 6 | 7 | This section describes each metric shown in the SAV summary tab. 8 | 9 | - @subpage q_metrics_requirement_q30 "% >= Q30" 10 | - @subpage q_metrics_requirement_yield "Yield (G)" 11 | - @subpage q_metrics_requirement_projected_yield "Projected Yield (G)" 12 | - @subpage error_metrics_requirement "% Error" 13 | 14 | ### A note on usable cycles. 15 | 16 | Metrics that average over all cycles in the summary tab, actually average over all "usable cycles". We define a usable 17 | cycle as one that is fully corrected in terms of phasing/prephasing. For this reason, we don’t consider the last cycle 18 | of a run as usable because it is not fully corrected. So, we don’t count this cycle toward yield or q30 or error rate. 19 | Many aligners drop the last cycle for this reason. 20 | 21 | ### A note on phasing weights 22 | 23 | The phasing weights have a factor of 100x baked in. This means the actual phasing weight can be derived by dividing by 24 | 100. The phasing rate, slope and offset all have this factor baked into the calculation. 25 | -------------------------------------------------------------------------------- /interop/logic/metric/extraction_metric.h: -------------------------------------------------------------------------------- 1 | /** Logic for extraction metrics 2 | * 3 | * @file 4 | * @date 7/7/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include 10 | #include 11 | #include "interop/model/metrics/extraction_metric.h" 12 | #include "interop/model/metric_base/metric_set.h" 13 | #include "interop/model/model_exceptions.h" 14 | 15 | 16 | namespace illumina { namespace interop { namespace logic { namespace metric 17 | { 18 | 19 | 20 | /** Example used for the performance test in C# 21 | * 22 | * This shows a simple way to speed up analysis of data using the C# binding. 23 | * 24 | * @param metrics extraction metric set 25 | * @param focus_scores array of focus scores 26 | * @param channel channel for focus 27 | * @param n size of array 28 | */ 29 | void copy_focus(const model::metric_base::metric_set& metrics, 30 | float *focus_scores, 31 | const size_t channel, 32 | const size_t n) INTEROP_THROW_SPEC((model::invalid_parameter, model::index_out_of_bounds_exception)); 33 | 34 | 35 | }}}} 36 | 37 | -------------------------------------------------------------------------------- /src/interop/logic/metric/extraction_metric.cpp: -------------------------------------------------------------------------------- 1 | /** Logic for extraction metrics 2 | * 3 | * @file 4 | * @date 7/7/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #include "interop/logic/metric/extraction_metric.h" 9 | 10 | namespace illumina { namespace interop { namespace logic { namespace metric 11 | { 12 | 13 | void copy_focus(const model::metric_base::metric_set& metrics, 14 | float *focus_scores, 15 | const size_t channel, 16 | const size_t n) INTEROP_THROW_SPEC((model::invalid_parameter, model::index_out_of_bounds_exception)) 17 | { 18 | typedef model::metric_base::metric_set::const_iterator const_iterator; 19 | if(metrics.size()==0)return; 20 | if(n < metrics.size()) INTEROP_THROW(model::invalid_parameter, "Buffer size too small for metric set"); 21 | if(channel >= metrics[0].channel_count()) 22 | INTEROP_THROW(model::invalid_parameter, "Channel exceeds channel count"); 23 | for (const_iterator it = metrics.begin(); it != metrics.end(); ++it, ++focus_scores) 24 | *focus_scores = it->focus_score(channel); 25 | } 26 | 27 | 28 | }}}} 29 | 30 | -------------------------------------------------------------------------------- /src/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | function(add_example _target _source_files) 2 | add_executable(${_target} ${_source_files}) 3 | target_link_libraries(${_target} ${INTEROP_LIB}) 4 | 5 | if(COMPILER_IS_GNUCC_OR_CLANG) 6 | set_target_properties(${_target} PROPERTIES COMPILE_FLAGS "${CXX_PEDANTIC_FLAG}" ) 7 | endif() 8 | 9 | if(NOT ENABLE_EXAMPLES) 10 | set_target_properties(${_target} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) 11 | else() 12 | install(TARGETS ${_target} 13 | RUNTIME DESTINATION share/illumina/interop/examples 14 | ) 15 | endif() 16 | 17 | if(NOT ENABLE_STATIC) 18 | add_custom_command(TARGET ${_target} POST_BUILD 19 | COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${CMAKE_CURRENT_BINARY_DIR}) 20 | endif() 21 | endfunction() 22 | 23 | add_example(example1 example1.cpp) 24 | add_example(example2 example2.cpp) 25 | add_example(example3 example3.cpp) 26 | add_example(example4 example4.cpp) 27 | add_example(example_q_metric example_q_metric.cpp) 28 | add_example(example_populate_qmetricset example_populate_qmetricset.cpp) 29 | 30 | if(ENABLE_SWIG AND ENABLE_CSHARP) 31 | add_subdirectory("csharp") 32 | endif() 33 | -------------------------------------------------------------------------------- /interop/logic/logic.h: -------------------------------------------------------------------------------- 1 | /** Include all logic functions 2 | * 3 | * @file 4 | * @date 6/1/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include "interop/logic/table/populate_imaging_table.h" 10 | #include "interop/logic/summary/run_summary.h" 11 | #include "interop/logic/summary/index_summary.h" 12 | #include "interop/logic/plot/plot_by_cycle.h" 13 | #include "interop/logic/plot/plot_by_lane.h" 14 | #include "interop/logic/plot/plot_flowcell_map.h" 15 | #include "interop/logic/plot/plot_qscore_heatmap.h" 16 | #include "interop/logic/plot/plot_qscore_histogram.h" 17 | #include "interop/logic/plot/plot_sample_qc.h" 18 | 19 | 20 | /** @defgroup logic Logic for populating tables and plots 21 | * 22 | * This group defines the interface functions for computing the SAV: 23 | * 1. Summary tab 24 | * 2. Analysis tab 25 | * 3. Imaging tab 26 | * 4. Indexing tab 27 | */ 28 | 29 | /** @defgroup plot_logic Logic for populating plots in the SAV Analysis and Indexing tabs 30 | * 31 | * @ingroup logic 32 | */ 33 | 34 | /** @defgroup summary_logic Logic for populating tables in the SAV Summary and Indexing tabs 35 | * 36 | * @ingroup logic 37 | */ 38 | 39 | /** @defgroup table_logic Logic for populating the table in the SAV Imaging tab 40 | * 41 | * @ingroup logic 42 | */ 43 | 44 | -------------------------------------------------------------------------------- /interop/logic/summary/run_summary.h: -------------------------------------------------------------------------------- 1 | /** Summary logic for run metrics 2 | * 3 | * @file 4 | * @date 3/10/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include "interop/model/model_exceptions.h" 10 | #include "interop/model/summary/run_summary.h" 11 | #include "interop/model/run_metrics.h" 12 | #include "interop/logic/utils/metrics_to_load.h" 13 | 14 | 15 | namespace illumina { namespace interop { namespace logic { namespace summary 16 | { 17 | 18 | /** Summarize a collection run metrics 19 | * 20 | * TODO speed up calculation by adding no_median flag 21 | * 22 | * @ingroup summary_logic 23 | * @param metrics source collection of all metrics 24 | * @param summary destination run summary 25 | * @param skip_median skip the median calculation 26 | * @param trim flag indicating whether to trim the summary model (default: true) 27 | */ 28 | void summarize_run_metrics(model::metrics::run_metrics& metrics, 29 | model::summary::run_summary& summary, 30 | const bool skip_median=false, 31 | const bool trim=true) 32 | INTEROP_THROW_SPEC(( model::index_out_of_bounds_exception, 33 | model::invalid_channel_exception, 34 | model::invalid_run_info_exception )); 35 | 36 | 37 | }}}} 38 | 39 | -------------------------------------------------------------------------------- /docs/src/j_example.md: -------------------------------------------------------------------------------- 1 | Examples {#examples} 2 | ===================== 3 | 4 | ## Application Examples 5 | 6 | This section will introduce you to applications that allow you to mimic 7 | SAV functionality from the command line. 8 | 9 | - [SAV Analysis Tab](@ref example_sav_analysis_example) 10 | 11 | ## API Examples 12 | 13 | If you are like us, then you will like to look at some example code. The `src/examples` folder contains commented 14 | sample code showing how to use a variety of Illumina InterOp features in both C++ and C#. This section displays each 15 | of the examples in that folder with additional commentary. 16 | 17 | - @subpage reading "Reading a binary InterOp file" 18 | - @subpage tile_report "Reporting Tile Metrics" 19 | - @subpage extraction_report "Reporting Extraction Metrics" 20 | - @subpage simple_stats "Reporting simple statistics" 21 | - @subpage example_summary "Calculating an SAV-like Summary Table" 22 | - @subpage example_imaging "Calculating an SAV-like Imaging Table" 23 | 24 | ## Python Interactive Tutorials 25 | 26 | - [SAV Summary Table](https://github.com/Illumina/interop/blob/master/docs/src/Tutorial_01_Intro.ipynb) 27 | - [Q-Score Histogram](https://github.com/Illumina/interop/blob/master/docs/src/Tutorial_02_Plot_Bar.ipynb) 28 | - [Low-level Extraction](https://github.com/Illumina/interop/blob/master/docs/src/Tutorial_03_Low_Level.ipynb) -------------------------------------------------------------------------------- /interop/logic/plot/plot_qscore_histogram.h: -------------------------------------------------------------------------------- 1 | /** Plot the Q-score histogram 2 | * 3 | * @file 4 | * @date 5/5/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | 10 | #include "interop/model/run_metrics.h" 11 | #include "interop/model/plot/filter_options.h" 12 | #include "interop/model/plot/bar_point.h" 13 | #include "interop/logic/plot/plot_data.h" 14 | #include "interop/logic/utils/metrics_to_load.h" 15 | 16 | namespace illumina { namespace interop { namespace logic { namespace plot { 17 | 18 | 19 | /** Plot a histogram of q-scores 20 | * 21 | * @ingroup plot_logic 22 | * @param metrics run metrics 23 | * @param options options to filter the data 24 | * @param data output plot data 25 | * @param boundary index of bin to create the boundary sub plots (0 means do nothing) 26 | */ 27 | void plot_qscore_histogram(model::metrics::run_metrics& metrics, 28 | const model::plot::filter_options& options, 29 | model::plot::plot_data& data, 30 | const size_t boundary=0) 31 | INTEROP_THROW_SPEC(( model::invalid_read_exception, 32 | model::index_out_of_bounds_exception, 33 | model::invalid_filter_option)); 34 | 35 | }}}} 36 | 37 | -------------------------------------------------------------------------------- /docs/src/example_summary.md: -------------------------------------------------------------------------------- 1 | Summary {#example_summary} 2 | ========================== 3 | 4 | This section introduces the way SAV calculates the summary tab. This introduces a limited set of functions. The key 5 | classes used below are: 6 | 7 | - `run_metrics`: model holding the binary InterOp data 8 | - `run_summary`: model holding the derived summary metrics 9 | - `valid_to_load`: byte array (`std::vector` or `uchar_vector`) indicating which InterOp files to load 10 | 11 | The primary functions used below are: 12 | 13 | - `run_metrics::read`: read the InterOp files from disk 14 | - `summarize_run_metrics`: summarize the SAV run metrics 15 | 16 | C# 17 | --- 18 | 19 | If you have not installed InterOp, see [Install InterOp From NuGet](@ref install) 20 | 21 | @snippet src/examples/csharp/SummaryExample.cs Reporting Summary Metrics in CSharp 22 | 23 | 24 | Python 25 | ------ 26 | 27 | 28 | If you have not installed InterOp, see [Install InterOp From a Wheel](@ref install) 29 | 30 | See new [interop.core](namespacecore.html) 31 | 32 | C++ 33 | --- 34 | 35 | The following shows how to calculate the summary metrics: 36 | 37 | @snippet src/apps/summary.cpp Reporting Summary Metrics in C++ 38 | 39 | The following shows the implementation of `read_run_metrics` above and how to read the InterOp data from disk: 40 | 41 | @snippet src/apps/inc/application.h Reading a subset of run metrics in C++ 42 | -------------------------------------------------------------------------------- /cmake/Modules/CheckIsNaN.cmake: -------------------------------------------------------------------------------- 1 | # Ensure best isnan function is available 2 | # Adpoted from: https://github.com/soonhokong/fp-test/blob/master/src/cmake_modules/CheckIsNaN.cmake 3 | 4 | include(CheckCXXSourceCompiles) 5 | include(CheckCXXSourceRuns) 6 | 7 | 8 | CHECK_CXX_SOURCE_COMPILES( 9 | "#include \nint main() { bool a = std::isnan(0e0); return 0; }\n" 10 | HAVE_STD_ISNAN) 11 | 12 | if(NOT HAVE_STD_ISNAN) 13 | return() 14 | endif() 15 | 16 | 17 | CHECK_CXX_SOURCE_COMPILES( 18 | "#include \nint main() { bool a = isnan(0e0); return 0; }\n" 19 | HAVE_ISNAN) 20 | 21 | if(HAVE_ISNAN) 22 | return() 23 | endif() 24 | 25 | CHECK_CXX_SOURCE_COMPILES( 26 | "#include \nint main() { bool a = _isnan(0e0); return 0; }\n" 27 | HAVE___ISNAN) 28 | 29 | if(HAVE___ISNAN) 30 | return() 31 | endif() 32 | 33 | CHECK_CXX_SOURCE_COMPILES( 34 | "# include \nint main() { bool a = _isnan(0e0); return 0; }\n" 35 | HAVE_FLOAT_H_ISNAN) 36 | 37 | 38 | if(HAVE_FLOAT_H_ISNAN) 39 | return() 40 | endif() 41 | 42 | 43 | CHECK_CXX_SOURCE_RUNS( 44 | "#include \nint main() { const float NaN=std::numeric_limits::quiet_NaN();return NaN!=NaN; }\n" 45 | IS_NAN_CHECK_WORKING) 46 | 47 | if(NOT IS_NAN_CHECK_WORKING) 48 | message(FATAL_ERROR "NaN checking is not working in your current configuration") 49 | endif() 50 | -------------------------------------------------------------------------------- /cmake/Modules/csharp/FindDotNetStandard.cmake: -------------------------------------------------------------------------------- 1 | # Find the msbuild tool 2 | # 3 | # DotNetStandard_FOUND System has msbuild 4 | # DotNetStandard_EXECUTABLE Where to find csc 5 | # DotNetStandard_VERSION The version number of the DotNet framework 6 | 7 | set(DotNetStandard_ROOT "" CACHE PATH "Set the location of the .NET root directory") 8 | set(DotNetStandard_VERSION "" CACHE STRING "C# .NET compiler version" ) 9 | 10 | if(DotNetStandard_ROOT AND EXISTS "${DotNetStandard_ROOT}") 11 | find_program(DotNetStandard_EXECUTABLE dotnet dotnet.exe 12 | PATHS ${DotNetStandard_ROOT} 13 | PATH_SUFFIXES . bin 14 | NO_DEFAULT_PATH) 15 | endif() 16 | 17 | 18 | find_program(DotNetStandard_EXECUTABLE dotnet dotnet.exe) 19 | 20 | if(EXISTS "${DotNetStandard_EXECUTABLE}") 21 | execute_process( 22 | COMMAND ${DotNetStandard_EXECUTABLE} --version 23 | OUTPUT_VARIABLE DotNetStandard_version_string 24 | OUTPUT_STRIP_TRAILING_WHITESPACE 25 | ) 26 | string( REGEX MATCH "([0-9]*)([.])([0-9]*)([.]*)([0-9]*)" DotNetStandard_version_string "${DotNetStandard_version_string}" ) 27 | set(DotNetStandard_VERSION ${DotNetStandard_version_string} CACHE STRING ".NET standard clr version" FORCE ) 28 | endif() 29 | 30 | include(FindPackageHandleStandardArgs) 31 | find_package_handle_standard_args(DotNetStandard DEFAULT_MSG DotNetStandard_EXECUTABLE) 32 | mark_as_advanced(DotNetStandard_EXECUTABLE DotNetStandard_VERSION) 33 | 34 | -------------------------------------------------------------------------------- /src/tests/python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(SWIG 4.0) 2 | if(NOT SWIG_FOUND) 3 | return() 4 | endif() 5 | 6 | check_swig_version(swig_major_ver) 7 | if(swig_major_ver LESS "4") 8 | return() 9 | endif() 10 | 11 | find_package (Python COMPONENTS Interpreter Development.Module NumPy) 12 | 13 | if(NOT Python_Interpreter_FOUND) 14 | message(WARNING "Cannot find Python Interpreter, unit tests will not be run") 15 | return() 16 | endif() 17 | 18 | if(NOT Python_Development.Module_FOUND) 19 | message(WARNING "Cannot find Python Development, unit tests will not be run") 20 | return() 21 | endif() 22 | 23 | if(NOT Python_NumPy_FOUND) 24 | message(WARNING "Cannot find Python NumPy, unit tests will not be run") 25 | return() 26 | endif() 27 | 28 | set(PYTHON_TEST_ENABLED ON PARENT_SCOPE) 29 | 30 | add_custom_target(check_python 31 | COMMENT "Running Python Unit tests" 32 | COMMAND ${CMAKE_COMMAND} -E copy_directory $ ${CMAKE_CURRENT_BINARY_DIR}/interop 33 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/DepTests.py ${CMAKE_CURRENT_BINARY_DIR}/interop 34 | COMMAND ${Python_EXECUTABLE} -m interop --test 35 | COMMAND ${Python_EXECUTABLE} interop/DepTests.py 36 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 37 | ) 38 | 39 | add_dependencies(check_python python_lib) 40 | set_target_properties(check_python PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) 41 | -------------------------------------------------------------------------------- /docs/src/example_imaging.md: -------------------------------------------------------------------------------- 1 | Imaging {#example_imaging} 2 | ========================== 3 | 4 | This section introduces the way SAV calculates the Imaging tab. This introduces a limited set of functions. The key 5 | classes used below are: 6 | 7 | - `run_metrics`: model holding the binary InterOp data 8 | - `imaging_column_vector`: Vector of columns for the imaging table 9 | - `map_id_offset`: map row ID to the offset in the float array 10 | - `valid_to_load`: byte array (`std::vector` or `uchar_vector`) indicating which InterOp files to load 11 | 12 | The primary functions used below are: 13 | 14 | - `run_metrics::read`: read the InterOp files from disk 15 | - `create_imaging_table_columns`: Generate the available column groups from the metric set 16 | - `count_table_rows`: Count the number of necessary rows from the metric set 17 | - `count_table_columns`: Count the number of subcolumns for the table 18 | - `populate_imaging_table_data`: Populate the array of data for the table 19 | - `list_imaging_table_metrics_to_load`: list which imaging metrics will be loaded 20 | 21 | C# 22 | -- 23 | 24 | @snippet src/examples/csharp/ImagingExample.cs Create Imaging Table from a Run Folder 25 | 26 | C++ 27 | --- 28 | 29 | The following shows how to calculate the Imaging metrics: 30 | 31 | @snippet src/apps/imaging_table.cpp Reporting Imaging Metrics in C++ 32 | 33 | The following shows the implementation of `read_run_metrics` above and how to read the InterOp data from disk: 34 | 35 | @snippet src/apps/inc/application.h Reading a subset of run metrics in C++ 36 | -------------------------------------------------------------------------------- /interop/logic/metric/dynamic_phasing_metric.h: -------------------------------------------------------------------------------- 1 | /** Logic for dynamic phasing metrics 2 | * 3 | * @file 4 | * @date 7/7/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include 10 | #include 11 | #include "interop/model/run/info.h" 12 | #include "interop/model/metrics/dynamic_phasing_metric.h" 13 | #include "interop/model/metrics/tile_metric.h" 14 | #include "interop/model/metrics/phasing_metric.h" 15 | #include "interop/model/metric_base/metric_set.h" 16 | #include "interop/logic/summary/map_cycle_to_read.h" 17 | 18 | 19 | namespace illumina { namespace interop { namespace logic { namespace metric 20 | { 21 | 22 | /** Populate the dynamic phasing metrics (slope & offset for phasing & prephasing) data structure given the phasing metrics data 23 | * 24 | * @param phasing_metrics phasing metric set 25 | * @param cycle_to_read map of cycle to read information 26 | * @param dynamic_phasing_metrics dynamic phasing metric set (to be populated) 27 | * @param tile_metrics tile metric set (to be populated) 28 | */ 29 | void populate_dynamic_phasing_metrics(model::metric_base::metric_set& phasing_metrics, 30 | const logic::summary::read_cycle_vector_t& cycle_to_read, 31 | model::metric_base::metric_set& dynamic_phasing_metrics, 32 | model::metric_base::metric_set& tile_metrics); 33 | 34 | }}}} 35 | -------------------------------------------------------------------------------- /interop/model/run/image_dimensions.h: -------------------------------------------------------------------------------- 1 | /** Image Dimensions 2 | * 3 | * 4 | * @file 5 | * @date 11/7/15 6 | * @version 1.0 7 | * @copyright GNU Public License. 8 | */ 9 | #pragma once 10 | 11 | #include 12 | #include 13 | 14 | namespace illumina { namespace interop { namespace model { namespace run 15 | { 16 | /** Dimenions of the image 17 | * 18 | */ 19 | class image_dimensions 20 | { 21 | public: 22 | /**Constructor 23 | * 24 | * @param width width of the image 25 | * @param height height of the image 26 | */ 27 | image_dimensions(size_t width = 0, size_t height = 0) : m_width(width), m_height(height) 28 | {} 29 | 30 | public: 31 | /** @defgroup image_dimensions Image Dimensions 32 | * 33 | * Information describing the dimensions of the tile image 34 | * 35 | * @ingroup run_info 36 | * @ref illumina::interop::model::run::image_dimensions "See full class description" 37 | * @{ 38 | */ 39 | /** Get the width of the image 40 | * 41 | * @return image width 42 | */ 43 | size_t width() const 44 | { return m_width; } 45 | 46 | /** Get the height of the image 47 | * 48 | * @return image height 49 | */ 50 | size_t height() const 51 | { return m_height; } 52 | /** @} */ 53 | private: 54 | size_t m_width; 55 | size_t m_height; 56 | 57 | friend class info; 58 | }; 59 | 60 | }}}} 61 | 62 | 63 | -------------------------------------------------------------------------------- /cmake/version.rc.in: -------------------------------------------------------------------------------- 1 | /* Illumina InterOp Library 2 | * 3 | * Version information for MSVC DLLs 4 | */ 5 | 6 | #define VS_FF_DEBUG 0x1L 7 | #define VS_VERSION_INFO 0x1L 8 | #define VS_FFI_FILEFLAGSMASK 0x17L 9 | #define VER_PRIVATEBUILD 0x0L 10 | #define VER_PRERELEASE 0x0L 11 | #define VOS__WINDOWS32 0x4L 12 | #define VFT_DLL 0x2L 13 | #define VFT2_UNKNOWN 0x0L 14 | 15 | #ifndef DEBUG 16 | #define VER_DEBUG 0 17 | #else 18 | #define VER_DEBUG VS_FF_DEBUG 19 | #endif 20 | 21 | 22 | VS_VERSION_INFO VERSIONINFO 23 | FILEVERSION @VERSION_LIST@,0 24 | PRODUCTVERSION @VERSION_LIST@,0 25 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 26 | FILEFLAGS VER_DEBUG 27 | FILEOS VOS__WINDOWS32 28 | FILETYPE VFT_DLL 29 | BEGIN 30 | BLOCK "StringFileInfo" 31 | BEGIN 32 | BLOCK "040904b0" 33 | BEGIN 34 | VALUE "FileDescription", "@LIB_NAME@ - Illumina InterOp with @CMAKE_CXX_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@\0" 35 | VALUE "ProductVersion", "@VERSION@\0" 36 | VALUE "FileVersion", "@VERSION@\0" 37 | VALUE "InternalName", "@LIB_NAME@\0" 38 | VALUE "ProductName", "Illumina InterOp Library: @LIB_NAME@\0" 39 | VALUE "CompanyName", "Illumina, Inc.\0" 40 | VALUE "LegalCopyright", "Copyright (C) 2015-2016\0" 41 | VALUE "Licence", "GPL v3\0" 42 | VALUE "Info", "https://github.com/Illumina/interop\0" 43 | END 44 | END 45 | BLOCK "VarFileInfo" 46 | BEGIN 47 | VALUE "Translation", 0x409, 1200 48 | END 49 | END 50 | 51 | -------------------------------------------------------------------------------- /tools/patches/mono_patch.txt: -------------------------------------------------------------------------------- 1 | diff -Naur mono_clean/mono/profiler/mono-profiler-log.c mono_working/mono/profiler/mono-profiler-log.c 2 | --- mono_clean/mono/profiler/mono-profiler-log.c 2017-04-12 03:51:21.000000000 -0700 3 | +++ mono_working/mono/profiler/mono-profiler-log.c 2017-04-14 15:54:18.145707359 -0700 4 | @@ -54,7 +54,19 @@ 5 | #if defined (HAVE_SYS_ZLIB) 6 | #include 7 | #endif 8 | - 9 | +#ifdef HAVE_SCHED_GETAFFINITY 10 | +#ifndef CPU_COUNT 11 | +#define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int)) 12 | +static int _CPU_COUNT(unsigned int *set, size_t len) { 13 | + int cnt; 14 | + cnt = 0; 15 | + while (len--) 16 | + cnt += __builtin_popcount(*set++); 17 | + return cnt; 18 | +} 19 | +#endif 20 | + 21 | +#endif 22 | #define BUFFER_SIZE (4096 * 16) 23 | 24 | /* Worst-case size in bytes of a 64-bit value encoded with LEB128. */ 25 | diff -Naur mono_clean/mono/utils/mono-proclib.c mono_working/mono/utils/mono-proclib.c 26 | --- mono_clean/mono/utils/mono-proclib.c 2017-04-12 03:51:21.000000000 -0700 27 | +++ mono_working/mono/utils/mono-proclib.c 2017-04-14 15:53:52.620739849 -0700 28 | @@ -17,6 +17,16 @@ 29 | #endif 30 | #ifdef HAVE_SCHED_GETAFFINITY 31 | #include 32 | +#ifndef CPU_COUNT 33 | +#define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int)) 34 | +static int _CPU_COUNT(unsigned int *set, size_t len) { 35 | + int cnt; 36 | + cnt = 0; 37 | + while (len--) 38 | + cnt += __builtin_popcount(*set++); 39 | + return cnt; 40 | +} 41 | +#endif 42 | #endif 43 | 44 | #ifdef HOST_WIN32 45 | -------------------------------------------------------------------------------- /src/examples/csharp/Example3.cs: -------------------------------------------------------------------------------- 1 | /// @ [Reporting Extraction Metrics in CSharp] 2 | using System; 3 | using System.Collections.Generic; 4 | using Illumina.InterOp.Run; 5 | using Illumina.InterOp.Metrics; 6 | using Illumina.InterOp.Comm; 7 | 8 | 9 | class Example3 10 | { 11 | static int Main(string[] args) 12 | { 13 | 14 | int ret; 15 | if((ret = Helper.CheckArguments(args)) != 0) return ret; 16 | 17 | base_extraction_metrics extraction_metric_set = new base_extraction_metrics (); 18 | if ((ret = Helper.ReadInterop (args [0], extraction_metric_set)) != 0) 19 | return ret; 20 | 21 | Console.WriteLine("Time: {0}", DateTime.FromBinary((Int64)extraction_metric_set.at(0).date_time_csharp().value)); 22 | return 0; 23 | } 24 | } 25 | /// @ [Reporting Extraction Metrics in CSharp] 26 | 27 | class Helper 28 | { 29 | public static int CheckArguments (string[] args) 30 | { 31 | if (args.Length != 1) { 32 | if (args.Length < 1) 33 | Console.WriteLine ("No run folder"); 34 | else 35 | Console.WriteLine ("Too many arguments"); 36 | return 1; 37 | } 38 | return 0; 39 | } 40 | public static int ReadInterop(string filename, base_extraction_metrics extraction_metric_set) 41 | { 42 | try 43 | { 44 | c_csharp_comm.read_interop (filename, extraction_metric_set); 45 | } 46 | catch(incomplete_file_exception){} 47 | catch(file_not_found_exception ex) 48 | { 49 | 50 | Console.WriteLine("File not found: "+filename); 51 | Console.WriteLine (ex); 52 | return 1; 53 | } 54 | catch(bad_format_exception ex) 55 | { 56 | Console.WriteLine (ex); 57 | return 1; 58 | } 59 | return 0; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /interop/model/summary/metric_average.h: -------------------------------------------------------------------------------- 1 | /** Keep a running average of a metric 2 | * 3 | * @file 4 | * @date 1/4/17 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include "interop/util/math.h" 10 | 11 | namespace illumina { namespace interop { namespace model { namespace summary 12 | { 13 | /** Keep a running average of a metric */ 14 | class metric_average // TODO: Use this everywhere to clean up summary logic! 15 | { 16 | public: 17 | /** Constructor */ 18 | metric_average() : m_sum(0), m_count(0){} 19 | 20 | public: 21 | /** Add another value to the average 22 | * 23 | * @param val source value for average 24 | * @return reference to this object 25 | */ 26 | metric_average& operator+=(const float val) 27 | { 28 | if(!std::isnan(val)) 29 | { 30 | m_sum += val; 31 | m_count += 1; 32 | } 33 | return *this; 34 | } 35 | /** Compute current average 36 | * 37 | * @return current average 38 | */ 39 | operator float()const 40 | { 41 | return average(); 42 | } 43 | /** Compute current average 44 | * 45 | * @return current average 46 | */ 47 | float average()const 48 | { 49 | if(m_count == 0) return std::numeric_limits::quiet_NaN(); 50 | return m_sum / static_cast(m_count); 51 | } 52 | 53 | private: 54 | float m_sum; 55 | size_t m_count; 56 | }; 57 | 58 | 59 | }}}} 60 | 61 | -------------------------------------------------------------------------------- /tools/prereqs/utility.sh: -------------------------------------------------------------------------------- 1 | # Setup conditional printing for build servers 2 | 3 | TRAVIS_BEG='travis_fold:start' 4 | TRAVIS_END='travis_fold:end' 5 | if [[ "$BUILD_SERVER" == "travis" ]]; then 6 | function run(){ 7 | mesg=$1 8 | tag=${mesg// /_} 9 | shift 10 | echo "$mesg" && echo -en "${TRAVIS_BEG}:${tag}\r" 11 | $@ 12 | echo -en "${TRAVIS_END}:${tag}\r" 13 | } 14 | elif [[ "$BUILD_SERVER" == "teamcity" ]]; then 15 | function run(){ 16 | mesg=$1 17 | shift 18 | echo "##teamcity[blockOpened name='$mesg']" 19 | $@ 20 | echo "##teamcity[blockClosed name='$mesg']" 21 | } 22 | else 23 | function run(){ 24 | mesg=$1 25 | shift 26 | $@ 27 | } 28 | fi 29 | 30 | # Modified from https://stackoverflow.com/questions/27925006/using-host-environment-variables-with-dockerfile 31 | 32 | setuser() { 33 | if [ -z "$1" ]; then 34 | echo "Usage: $0 " 35 | return 36 | fi 37 | if [ -z "$2" ]; then 38 | echo "Usage: $0 " 39 | return 40 | fi 41 | if hash gstat 2> /dev/null; then 42 | stat="gstat" 43 | else 44 | stat="stat" 45 | fi 46 | CURRENT_UID=`id -u` 47 | DEST_UID=`$stat -c "%u" $1` 48 | if [ $CURRENT_UID = $DEST_UID ]; then 49 | return 50 | fi 51 | DEST_GID=`stat -c "%g" $1` 52 | if [ -e /home/$DEST_UID ]; then 53 | return 54 | fi 55 | groupadd -g $DEST_GID $DEST_GID 56 | useradd -u $DEST_UID -g $DEST_GID $DEST_UID 57 | echo "--User: $DEST_UID" 58 | echo "--Group: $DEST_GID" 59 | echo "--Target Path: $2" 60 | chown -R $DEST_UID:$DEST_GID $2 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/interop/logic/plot/plot_metric_list.cpp: -------------------------------------------------------------------------------- 1 | /** List all metrics for plotting 2 | * 3 | * @file 4 | * @date 5/8/17 5 | * @version 1.0 6 | * @copyright GNU Public License 7 | */ 8 | #include "interop/logic/plot/plot_metric_list.h" 9 | // 10 | #include "interop/logic/plot/plot_metric_proxy.h" 11 | 12 | 13 | namespace illumina { namespace interop { namespace logic { namespace plot 14 | { 15 | /** List metric types available for all plots 16 | * 17 | * @param types destination vector to fill with metric types 18 | */ 19 | void list_plot_metrics(std::vector &types) 20 | { 21 | utils::list_descriptions(types); 22 | } 23 | 24 | /** List all available metric types for all plots 25 | * 26 | * That is, the metric must be populated 27 | * 28 | * @param types destination vector to fill with metric types 29 | */ 30 | void list_available_plot_metrics(const model::metrics::run_metrics &metrics, 31 | std::vector &types) 32 | { 33 | if(types.empty()) utils::list_descriptions(types); 34 | std::vector< logic::utils::metric_type_description_t >::iterator dst = types.begin(); 35 | for(std::vector< logic::utils::metric_type_description_t >::iterator src = types.begin();src != types.end();++src) 36 | { 37 | const constants::metric_type type = *src; 38 | if(!plot_metric_proxy::is_present(metrics, type))continue; 39 | if(src != dst) std::swap(*src, *dst); 40 | ++dst; 41 | } 42 | types.resize(std::distance(types.begin(), dst)); 43 | } 44 | }}}} 45 | -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | find_package(Doxygen) 4 | if(DOXYGEN_FOUND) 5 | 6 | execute_process( 7 | COMMAND ${DOXYGEN_EXECUTABLE} --version 8 | RESULT_VARIABLE 9 | res 10 | OUTPUT_VARIABLE 11 | doxygen_ver 12 | OUTPUT_STRIP_TRAILING_WHITESPACE 13 | ) 14 | if(NOT doxygen_ver VERSION_EQUAL "1.8.10") 15 | message(WARNING "Only doxygen version 1.8.10 is currently supported - not found version: ${doxygen_ver}\nDocumentation target will be disabled") 16 | return() 17 | endif() 18 | 19 | 20 | message(STATUS "Build documentation") 21 | add_custom_target(doc ALL 22 | COMMAND ${CMAKE_COMMAND} -DCURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DINTEROP_VERSION=${INTEROP_VERSION} -DCONFIG_INPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in -DCONFIG_OUTPUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/Doxyfile -P ${CMAKE_SOURCE_DIR}/cmake/ConfigureFile.cmake 23 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 24 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/theme/bootstrap3 ${CMAKE_CURRENT_BINARY_DIR}/html/bootstrap3 25 | COMMENT "Generating API documentation with Doxygen" VERBATIM 26 | ) 27 | if(DOCS_OUTPUT_PATH) 28 | add_custom_command(TARGET doc POST_BUILD 29 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/html ${DOCS_OUTPUT_PATH}/html 30 | ) 31 | endif() 32 | add_dependencies(doc version) 33 | 34 | else() 35 | message(WARNING "Doxygen not found, documentation generation is disabled") 36 | endif(DOXYGEN_FOUND) 37 | 38 | -------------------------------------------------------------------------------- /cmake/Modules/UseGMock.cmake: -------------------------------------------------------------------------------- 1 | # A CMake Module for using Google Mock 2 | # 3 | # This file adds the following static library targets: 4 | # - gmock 5 | # - gest_main 6 | # 7 | # This file adds the Google Mock headers to the include path 8 | # 9 | # This enables or disables (depending on the platform) a built-in version of tr1/tuple using a definition of a 10 | # preprocessor macro. 11 | # 12 | # This file setups the target to, optionally, auto-download Google Mock. 13 | # 14 | # 15 | 16 | if(MSVC) 17 | set(USE_OWN_TR1_TUPLE 0) 18 | else() 19 | set(USE_OWN_TR1_TUPLE 1) 20 | endif() 21 | 22 | if(MSVC) 23 | set(USE_OWN_TR1_TUPLE 0) 24 | else() 25 | set(USE_OWN_TR1_TUPLE 1) 26 | endif() 27 | 28 | if(NOT GMOCK_LIBRARY) 29 | set(GMOCK_LIBRARY gmock) 30 | add_library(${GMOCK_LIBRARY} STATIC IMPORTED) 31 | set_property(TARGET ${GMOCK_LIBRARY} PROPERTY IMPORTED_LOCATION ${GMOCK_LIBRARY_FILE}) 32 | if(GMOCK_TARGET) 33 | add_dependencies(${GMOCK_LIBRARY} ${GMOCK_TARGET}) 34 | endif() 35 | set_target_properties(${GMOCK_LIBRARY} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) 36 | endif() 37 | 38 | 39 | if(NOT GMOCK_MAIN_LIBRARY) 40 | set(GMOCK_MAIN_LIBRARY gmock_main) 41 | add_library(${GMOCK_MAIN_LIBRARY} STATIC IMPORTED) 42 | set_property(TARGET ${GMOCK_MAIN_LIBRARY} PROPERTY IMPORTED_LOCATION ${GMOCK_MAIN_LIBRARY_FILE}) 43 | if(GMOCK_TARGET) 44 | add_dependencies(${GMOCK_MAIN_LIBRARY} ${GMOCK_TARGET}) 45 | endif() 46 | set_target_properties(${GMOCK_MAIN_LIBRARY} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) 47 | endif() 48 | 49 | 50 | include_directories(${GMOCK_INCLUDE_DIR}) 51 | add_definitions(-DGMOCK_USE_OWN_TR1_TUPLE=${USE_OWN_TR1_TUPLE}) 52 | -------------------------------------------------------------------------------- /cmake/Modules/UseGTest.cmake: -------------------------------------------------------------------------------- 1 | # A CMake Module for using Google Test 2 | # 3 | # This file adds the following static library targets: 4 | # - gtest 5 | # - gest_main 6 | # 7 | # This file adds the Google Test headers to the include path 8 | # 9 | # This enables or disables (depending on the platform) a built-in version of tr1/tuple using a definition of a 10 | # preprocessor macro. 11 | # 12 | # This file setups the target to, optionally, auto-download Google Test. 13 | # 14 | # 15 | 16 | if(MSVC) 17 | set(USE_OWN_TR1_TUPLE 0) 18 | else() 19 | set(USE_OWN_TR1_TUPLE 1) 20 | endif() 21 | 22 | if(MSVC) 23 | set(USE_OWN_TR1_TUPLE 0) 24 | else() 25 | set(USE_OWN_TR1_TUPLE 1) 26 | endif() 27 | 28 | if(NOT GTEST_LIBRARY) 29 | set(GTEST_LIBRARY libgtest) 30 | add_library(${GTEST_LIBRARY} STATIC IMPORTED) 31 | set_property(TARGET ${GTEST_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_LIBRARY_FILE}) 32 | if(GTEST_TARGET) 33 | add_dependencies(${GTEST_LIBRARY} ${GTEST_TARGET}) 34 | endif() 35 | set_target_properties(${GTEST_LIBRARY} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) 36 | endif() 37 | 38 | 39 | if(NOT GTEST_MAIN_LIBRARY) 40 | set(GTEST_MAIN_LIBRARY gtest_main) 41 | add_library(${GTEST_MAIN_LIBRARY} STATIC IMPORTED) 42 | set_property(TARGET ${GTEST_MAIN_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_MAIN_LIBRARY_FILE}) 43 | if(GTEST_TARGET) 44 | add_dependencies(${GTEST_MAIN_LIBRARY} ${GTEST_TARGET}) 45 | endif() 46 | set_target_properties(${GTEST_MAIN_LIBRARY} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) 47 | endif() 48 | 49 | 50 | include_directories(${GTEST_INCLUDE_DIR}) 51 | add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=${USE_OWN_TR1_TUPLE}) 52 | -------------------------------------------------------------------------------- /interop/util/assert.h: -------------------------------------------------------------------------------- 1 | /** Assert macros 2 | * 3 | * This header file provides enhanced assert macros to make debugging easier. 4 | * 5 | * @file 6 | * @date 10/28/15 7 | * @version 1.0 8 | * @copyright GNU Public License. 9 | */ 10 | #pragma once 11 | 12 | #if !defined(NDEBUG) || defined(DEBUG) || defined(_DEBUG) 13 | #include 14 | #include 15 | 16 | /** Assert if test is true 17 | * 18 | * If the test fails, then print the file, function and number number along with the test and call abort. 19 | * @note Do nothing in release mode. 20 | */ 21 | #define INTEROP_ASSERT(TST) \ 22 | if(!(TST)) {\ 23 | std::cerr << __FILE__<< "::" << __FUNCTION__<< " (" << __LINE__ << ")" << " " #TST << std::endl;\ 24 | std::abort();\ 25 | } 26 | /** Assert if test is true 27 | * 28 | * If the test fails, then print the file, function and number number along with the test and a 29 | * message; then call abort. 30 | * @note Do nothing in release mode. 31 | */ 32 | #define INTEROP_ASSERTMSG(TST, MSG) \ 33 | if(!(TST)) {\ 34 | std::cerr << __FILE__<< "::" << __FUNCTION__<< " (" << __LINE__ << ")" << " " #TST << " " << MSG << std::endl;\ 35 | std::abort();\ 36 | } 37 | 38 | #else 39 | 40 | /** Assert if test is true 41 | * 42 | * If the test fails, then print the file, function and number number along with the test and call abort. 43 | * @note Do nothing in release mode. 44 | */ 45 | #define INTEROP_ASSERT(TST) (void)0; 46 | /** Assert if test is true 47 | * 48 | * If the test fails, then print the file, function and number number along with the test and a 49 | * message; then call abort. 50 | * @note Do nothing in release mode. 51 | */ 52 | #define INTEROP_ASSERTMSG(TST,MSG) (void)0; 53 | 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /interop/model/model_exceptions.h: -------------------------------------------------------------------------------- 1 | /** Exceptions thrown by the model 2 | * 3 | * @file 4 | * @date 3/21/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | 10 | #include "interop/util/base_exception.h" 11 | #include "interop/model/metric_base/metric_exceptions.h" 12 | 13 | namespace illumina { namespace interop { namespace model 14 | { 15 | 16 | /** @defgroup model_exceptions Model Exceptions 17 | * 18 | * Exceptions that can be thrown if a problem occurs while using the model 19 | * 20 | * @ingroup interop_exceptions 21 | * @{ 22 | */ 23 | 24 | /** Exception raised if the channel names are invalid 25 | */ 26 | struct invalid_channel_exception : public util::base_exception 27 | { 28 | /** Constructor 29 | * 30 | * @param mesg error message 31 | */ 32 | invalid_channel_exception(const std::string &mesg) : util::base_exception(mesg) 33 | { } 34 | }; 35 | 36 | /** Exception raised if the metric type is invalid 37 | */ 38 | struct invalid_metric_type : public util::base_exception 39 | { 40 | /** Constructor 41 | * 42 | * @param mesg error message 43 | */ 44 | invalid_metric_type(const std::string &mesg) : util::base_exception(mesg) 45 | { } 46 | }; 47 | 48 | /** Exception raised if a function is given an invalid parameter 49 | */ 50 | struct invalid_parameter : public util::base_exception 51 | { 52 | /** Constructor 53 | * 54 | * @param mesg error message 55 | */ 56 | invalid_parameter(const std::string &mesg) : util::base_exception(mesg) 57 | { } 58 | }; 59 | 60 | /** @} */ 61 | }}} 62 | 63 | 64 | -------------------------------------------------------------------------------- /src/examples/example1.cpp: -------------------------------------------------------------------------------- 1 | /** Example 1: Reading from an InterOp file 2 | * 3 | * 4 | * @file 5 | * @date 11/6/15 6 | * @version 1.0 7 | * @copyright GNU Public License. 8 | */ 9 | 10 | // @ [Reading a binary InterOp file] 11 | #include 12 | #include "interop/model/metric_base/metric_set.h" 13 | #include "interop/model/metrics/tile_metric.h" 14 | #include "interop/io/metric_file_stream.h" 15 | 16 | using namespace illumina::interop::model::metric_base; 17 | using namespace illumina::interop::model::metrics; 18 | using namespace illumina::interop::io; 19 | 20 | int check_args(int argc); 21 | 22 | int main(int argc, char** argv) 23 | { 24 | int ret; 25 | if((ret = check_args(argc)) != 0) return ret; 26 | metric_set tile_metric_set; 27 | 28 | try { 29 | read_interop(argv[1], tile_metric_set); 30 | } 31 | catch(const incomplete_file_exception&){}// Ignore incomplete files 32 | catch(const bad_format_exception& ex) // Something catastrophic happened to the file 33 | { 34 | std::cerr << "InterOp did not have the expected format: " << ex.what() << std::endl; 35 | return 1; 36 | } 37 | catch(const file_not_found_exception& ex) 38 | { 39 | std::cerr << "Count not find InterOp file: " << ex.what() << std::endl; 40 | return 1; 41 | } 42 | 43 | std::cout << "Tile metric set contains " << tile_metric_set.size() << " metrics" << std::endl; 44 | 45 | return 0; 46 | } 47 | 48 | // @ [Reading a binary InterOp file] 49 | 50 | int check_args(int argc) 51 | { 52 | if (argc != 2) 53 | { 54 | if (argc < 2) std::cerr << "No run folder" << std::endl; 55 | else std::cerr << "Too many arguments" << std::endl; 56 | return 1; 57 | } 58 | return 0; 59 | } 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/tests/interop/metrics/inc/summary_run_metrics_test.h: -------------------------------------------------------------------------------- 1 | /** Unit tests for the summary run metrics 2 | * 3 | * @file 4 | * @date 7/8/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include 10 | #include "metric_test.h" 11 | #include "interop/model/metrics/summary_run_metric.h" 12 | #include "interop/model/summary/run_summary.h" 13 | 14 | namespace illumina{ namespace interop { namespace unittest 15 | { 16 | 17 | /** This test writes three records of an InterOp files, then reads them back in and compares 18 | * each value to ensure they did not change. 19 | * 20 | * @see model::metrics::summary_run_metric 21 | * @note Version 1 22 | */ 23 | struct summary_run_v1 : metric_test 24 | { 25 | /** Create the expected metric set 26 | * 27 | * @param metrics destination metric set 28 | */ 29 | static void create_expected(metric_set_t &metrics, const model::run::info& =model::run::info()) 30 | { 31 | metrics = metric_set_t(header_t(), VERSION); 32 | metrics.insert(metric_t(1.0f, 2.0f, 3.0f, 4.0f));// Only supports single metric! 33 | } 34 | /** Get the expected binary data 35 | * 36 | * @param buffer binary data string 37 | */ 38 | template 39 | static void create_binary_data(Collection &buffer) 40 | { 41 | const signed char tmp[] = 42 | { 43 | 1 44 | ,34,0,0,0,0,0,0,0,0,0,0,0,-16,63,0,0,0,0,0,0 45 | ,0,64,0,0,0,0,0,0,8,64,0,0,0,0,0,0,16,64 46 | }; 47 | buffer.assign(tmp, tmp+util::length_of(tmp)); 48 | } 49 | }; 50 | 51 | }}} 52 | 53 | -------------------------------------------------------------------------------- /cmake/DependencyManager.cmake: -------------------------------------------------------------------------------- 1 | # Download 2 | function(update_dependencies dep_url dep_dir output_var) 3 | 4 | string(REGEX REPLACE ".*[^/]+/(.*)\\.[^0-9.]*" "\\1" DEP_FILENAME ${dep_url}) 5 | 6 | if(INTEROP_CACHE_DIR) 7 | set(HOME_DIR "${INTEROP_CACHE_DIR}/${dep_dir}") 8 | else() 9 | set(HOME_DIR ${CMAKE_SOURCE_DIR}/../${dep_dir}) 10 | endif() 11 | get_filename_component(HOME_DIR "${HOME_DIR}" ABSOLUTE ) 12 | set(${output_var} ${HOME_DIR} PARENT_SCOPE) 13 | 14 | if(EXISTS "${HOME_DIR}/${DEP_FILENAME}.txt") 15 | file(READ "${HOME_DIR}/${DEP_FILENAME}.txt" CONTENTS) 16 | if(CONTENTS) 17 | message(STATUS "Found dep marker: ${HOME_DIR}/${DEP_FILENAME}.txt -- ${CONTENTS}") 18 | return() 19 | endif() 20 | endif() 21 | message(STATUS "Dependencies not found") 22 | 23 | file(WRITE ${CMAKE_BINARY_DIR}/deps/CMakeLists.txt 24 | " cmake_minimum_required(VERSION 3.13) 25 | include(ExternalProject) 26 | ExternalProject_Add( 27 | update_deps 28 | URL ${dep_url} 29 | SOURCE_DIR ${HOME_DIR} 30 | UPDATE_COMMAND \"\" 31 | CONFIGURE_COMMAND \"\" 32 | BUILD_COMMAND \"\" 33 | INSTALL_COMMAND \"\") 34 | " 35 | ) 36 | execute_process( 37 | COMMAND ${CMAKE_COMMAND} . 38 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/deps 39 | ) 40 | execute_process( 41 | COMMAND ${CMAKE_COMMAND} --build . 42 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/deps 43 | ) 44 | if(NOT EXISTS "${HOME_DIR}/${DEP_FILENAME}.txt") 45 | set(${output_var} "") 46 | message(WARNING "Dependencies failed to download - no version file at ${HOME_DIR}/${DEP_FILENAME}.txt") 47 | endif() 48 | endfunction() 49 | 50 | -------------------------------------------------------------------------------- /interop/logic/plot/plot_qscore_heatmap.h: -------------------------------------------------------------------------------- 1 | /** Plot the Q-score heat map 2 | * 3 | * @file 4 | * @date 5/5/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | 10 | #include "interop/model/run_metrics.h" 11 | #include "interop/model/plot/filter_options.h" 12 | #include "interop/model/plot/heatmap_data.h" 13 | #include "interop/logic/utils/metrics_to_load.h" 14 | 15 | namespace illumina { namespace interop { namespace logic { namespace plot 16 | { 17 | /** Plot a heat map of q-scores 18 | * 19 | * @ingroup plot_logic 20 | * @param metrics run metrics 21 | * @param options options to filter the data 22 | * @param data output heat map data 23 | * @param buffer optional buffer of preallocated memory (for SWIG) 24 | * @param buffer_size number of elements in buffer 25 | */ 26 | void plot_qscore_heatmap(model::metrics::run_metrics& metrics, 27 | const model::plot::filter_options& options, 28 | model::plot::heatmap_data& data, 29 | float* buffer=0, 30 | const size_t buffer_size=0) 31 | INTEROP_THROW_SPEC((model::index_out_of_bounds_exception, 32 | model::invalid_filter_option)); 33 | /** Count number of rows for the heat map 34 | * 35 | * @param metrics run metrics 36 | * @return number of rows 37 | */ 38 | size_t count_rows_for_heatmap(const model::metrics::run_metrics& metrics); 39 | /** Count number of columns for the heat map 40 | * 41 | * @param metrics run metrics 42 | * @return number of columns 43 | */ 44 | size_t count_columns_for_heatmap(const model::metrics::run_metrics& metrics); 45 | 46 | 47 | }}}} 48 | 49 | -------------------------------------------------------------------------------- /src/ext/csharp/package.nuspec.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | illumina_interop_@CSHARP_TYPE@_@PLATFORM@ 5 | @INTEROP_VERSION@ 6 | Illumina InterOp Library for @CSHARP_TYPE@ on @PLATFORM@ 7 | Illumina Inc. 8 | Illumina Inc. 9 | https://github.com/Illumina/interop/blob/master/LICENSE 10 | https://github.com/Illumina/interop 11 | true 12 | false 13 | 14 | The Illumina InterOp libraries are a set of common routines used for reading InterOp metric files 15 | produced by Illumina sequencers. These libraries are backwards compatible and capable of supporting prior 16 | releases of the software, with one exception: GA systems have been excluded. 17 | 18 | C++ Compiler: @COMPILER_INFO@ 19 | 20 | 21 | High-level C++ binding for Illumina C++ InterOp Library, packaged for 22 | @CSHARP_TYPE@ @CSHARP_VERSION@ on @PLATFORM@ 23 | 24 | https://github.com/Illumina/interop/blob/master/README.md 25 | GNU GPL v3 26 | native, Illumina, InterOp, C++, C#, @PLATFORM@, @CSHARP_TYPE@ 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/apps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | function(add_application _target _source_files) 3 | 4 | if(MSVC) 5 | set(SWIG_VERSION_INFO "${CMAKE_CURRENT_BINARY_DIR}/${_target}_version.rc") 6 | set(LIB_NAME "${_target}") # Used to configure the version info file 7 | configure_file(${CMAKE_SOURCE_DIR}/cmake/version.rc.in ${SWIG_VERSION_INFO} @ONLY) # Requires: LIB_NAME, VERSION_LIST and VERSION 8 | endif() 9 | 10 | add_executable(${_target} ${_source_files} inc/application.h inc/plot_options.h ${SWIG_VERSION_INFO}) 11 | target_link_libraries(${_target} ${INTEROP_LIB}) 12 | 13 | if(COMPILER_IS_GNUCC_OR_CLANG) 14 | set_target_properties(${_target} PROPERTIES COMPILE_FLAGS "${CXX_PEDANTIC_FLAG}" ) 15 | endif() 16 | 17 | if(NOT ENABLE_APPS) 18 | set_target_properties(${_target} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) 19 | else() 20 | install(TARGETS ${_target} 21 | RUNTIME DESTINATION bin 22 | ) 23 | endif() 24 | 25 | if(NOT ENABLE_STATIC) 26 | add_custom_command(TARGET ${_target} POST_BUILD 27 | COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${CMAKE_CURRENT_BINARY_DIR}) 28 | endif() 29 | endfunction() 30 | 31 | set(SWIG_VERSION_INFO "") 32 | 33 | add_application(dumptext dumptext.cpp) 34 | add_application(summary summary.cpp) 35 | add_application(index-summary index_summary.cpp) 36 | add_application(dumpbin dumpbin.cpp) 37 | add_application(plot_qscore_histogram plot_qscore_histogram.cpp) 38 | add_application(plot_by_cycle plot_by_cycle.cpp) 39 | add_application(plot_by_lane plot_by_lane.cpp) 40 | add_application(plot_flowcell plot_flowcell.cpp) 41 | add_application(plot_qscore_heatmap plot_qscore_heatmap.cpp) 42 | add_application(plot_sample_qc plot_sample_qc.cpp) 43 | add_application(imaging_table imaging_table.cpp) 44 | add_application(aggregate aggregate.cpp) 45 | -------------------------------------------------------------------------------- /docs/src/apps.md: -------------------------------------------------------------------------------- 1 | # Applications {#apps} 2 | 3 | The InterOp package includes several command line tools to extraction information from InterOp files. 4 | 5 | | Content | Description | 6 | | --------------------------------------- | ---------------------------------------------------------------------------| 7 | | @subpage dumptext "dumptext" | Deprecated: Convert binary InterOp data into a CSV formatted txt file | 8 | | @subpage imaging_table "imaging_table" | Generate the SAV Imaging Tab table as a CSV text file | 9 | | @subpage summary_table "summary" | Generate the SAV Summary Tab summary table as a text file | 10 | | @subpage plot_by_cycle "plot_by_cycle" | Generate the SAV Analysis Tab By Cycle Plot as a GNUPlot text file | 11 | | @subpage plot_by_lane "plot_by_lane" | Generate the SAV Analysis Tab By Lane Plot as a GNUPlot text file | 12 | | @subpage plot_flowcell "plot_flowcell" | Generate the SAV Analysis Tab Flowcell heat map as a GNUPlot text file | 13 | | @subpage q_hist "plot_qscore_histogram" | Generate the SAV Analysis Tab Q-score histogram as a GNUPlot text file | 14 | | @subpage q_hmap "plot_qscore_heatmap" | Generate the SAV Analysis Tab Q-score heat map as a GNUPlot text file | 15 | | @subpage plot_sampleqc "plot_sample_qc" | Generate the SAV Indexing Tab index graph as a GNUPlot text file | 16 | | @subpage index_summary "index-summary" | Generate the SAV Indexing Tab summary table as a CSV text file | 17 | | @subpage dumpbin "dumpbin" | Developer app to help create unit tests by dumping the binary format | 18 | | @subpage aggregate "aggregate" | Aggregate by cycle InterOps | 19 | 20 | Note: dumptext has been deprecated in favor of imaging_table 21 | -------------------------------------------------------------------------------- /cmake/Modules/UseGitVersion.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Provides a function that determines the version from tags in the Git repository. A target is added, which 3 | # generates a version header file. This version header file defines a single macro. 4 | # 5 | # Input to the function 6 | # - _target - name of the target 7 | # - _version_file - name of the version header file 8 | # - _macro_name - name of the macro in the header file 9 | # 10 | 11 | function(add_version_target _target _version_file _macro_name _default) 12 | if(NOT GIT_FOUND) 13 | find_package(Git REQUIRED) 14 | endif() 15 | get_filename_component(version_base ${_version_file} NAME) 16 | file(WRITE ${CMAKE_BINARY_DIR}/${version_base}.in "\#define ${_macro_name} \"@VERSION@\"\n") 17 | file(WRITE ${CMAKE_BINARY_DIR}/version.cmake 18 | "execute_process( 19 | COMMAND ${GIT_EXECUTABLE} describe --tags --dirty=-dirty 20 | WORKING_DIRECTORY \"${CMAKE_SOURCE_DIR}\" 21 | RESULT_VARIABLE 22 | res 23 | OUTPUT_VARIABLE 24 | VERSION 25 | OUTPUT_STRIP_TRAILING_WHITESPACE 26 | ) 27 | if(NOT res EQUAL 0) 28 | set(VERSION \"\${BKUP}\") 29 | endif() 30 | configure_file(\${SRC} \${DST} @ONLY) 31 | " 32 | ) 33 | add_custom_command(OUTPUT ${_version_file} 34 | COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_BINARY_DIR}/${version_base}.in 35 | -D DST=${_version_file} 36 | -D BKUP=${_default} 37 | -P ${CMAKE_BINARY_DIR}/version.cmake) 38 | add_custom_target(${_target} 39 | DEPENDS ${_version_file} 40 | ) 41 | execute_process( 42 | COMMAND ${GIT_EXECUTABLE} describe --tags --dirty=-dirty 43 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 44 | RESULT_VARIABLE 45 | res 46 | OUTPUT_VARIABLE 47 | VERSION 48 | OUTPUT_STRIP_TRAILING_WHITESPACE 49 | ) 50 | if(NOT res EQUAL 0) 51 | set(VERSION "${_default}") 52 | endif() 53 | set(${_macro_name} ${VERSION} PARENT_SCOPE) 54 | endfunction() 55 | -------------------------------------------------------------------------------- /interop/constants/enum_description.h: -------------------------------------------------------------------------------- 1 | /** Encapsulate an enum and a string description 2 | * 3 | * @file 4 | * @date 12/5/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | 9 | #pragma once 10 | #include 11 | #include 12 | #include "interop/constants/enums.h" 13 | 14 | 15 | namespace illumina { namespace interop { namespace constants 16 | { 17 | /** Encapsulates an enum and a string description 18 | */ 19 | template 20 | class enum_description 21 | { 22 | public: 23 | /** Type of the enum */ 24 | typedef Enum enum_t; 25 | 26 | public: 27 | /** Constructor */ 28 | enum_description() : m_value(static_cast(constants::Unknown)){} 29 | /** Constructor 30 | * 31 | * @param val enum value 32 | * @param description enum description 33 | */ 34 | enum_description(const enum_t val, const std::string& description) : m_value(val), m_description(description){} 35 | /** Constructor 36 | * 37 | * @param pair enum value/description pair 38 | */ 39 | enum_description(const std::pair& pair) : 40 | m_value(pair.first), m_description(pair.second){} 41 | 42 | public: 43 | /** Get the value of the enum 44 | * 45 | * @return enum value 46 | */ 47 | enum_t value()const 48 | { 49 | return m_value; 50 | } 51 | /** Get the description of the enum 52 | * 53 | * @return enum description 54 | */ 55 | const std::string& description()const 56 | { 57 | return m_description; 58 | } 59 | /** Implicit conversion operator 60 | * 61 | * @return enum value 62 | */ 63 | operator enum_t()const 64 | { 65 | return m_value; 66 | } 67 | 68 | private: 69 | Enum m_value; 70 | std::string m_description; 71 | }; 72 | }}} 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /cmake/Modules/csharp/dotnetStandard.csproj.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\netcore 6 | 7 | 8 | 9 | 10 | 11 | 12 | @CSHARP_TARGET_FRAMEWORK@ 13 | true 14 | @CSHARP_BUILDER_OUTPUT_TYPE@ 15 | @CSHARP_BUILDER_OUTPUT_PATH@ 16 | @CSHARP_PLATFORM@ 17 | @CSHARP_BUILDER_OUTPUT_NAME@ 18 | @DotNetCore_PLATFORM@ 19 | true 20 | false 21 | false 22 | false 23 | 24 | 25 | 26 | @CSHARP_BUILDER_SOURCES@ 27 | 28 | 29 | 30 | @CSHARP_BUILDER_ADDITIONAL_REFERENCES@ 31 | 32 | 33 | 34 | @CSHARP_PACKAGE_REFERENCES@ 35 | 36 | 37 | 38 | false 39 | false 40 | false 41 | false 42 | false 43 | false 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/interop/logic/metric/extended_tile_metric.cpp: -------------------------------------------------------------------------------- 1 | /** Logic for extended tile metrics 2 | * 3 | * @file 4 | * @date 7/31/2017 5 | * @version 1.0 6 | * @copyright GNU Public License 7 | */ 8 | #include "interop/logic/metric/extended_tile_metric.h" 9 | #include "interop/util/map.h" 10 | 11 | namespace illumina { namespace interop { namespace logic { namespace metric 12 | { 13 | /** Look up map type for id to offset mapping */ 14 | typedef INTEROP_UNORDERED_MAP(model::metric_base::base_metric::id_t, size_t) lookup_map_t; 15 | /** Build a mapping from the metric ID to its position in the metric set 16 | * 17 | * @tparam I iterator type 18 | * @param b iterator to start of collection 19 | * @param e iterator to end of collection 20 | * @param id_lookup_map map of ID to offset in collection 21 | */ 22 | template 23 | void build_index_map(I b, I e, lookup_map_t& id_lookup_map) 24 | { 25 | size_t offset = 0; 26 | for (;b != e; ++b) 27 | { 28 | id_lookup_map[b->id()] = offset; 29 | ++offset; 30 | } 31 | } 32 | /** Populate percent occupied in extended tile metrics 33 | * 34 | * @param tile_metrics tile metric set 35 | * @param extended_tile_metrics destination extended tile metric set 36 | */ 37 | void populate_percent_occupied(const model::metric_base::metric_set& tile_metrics, 38 | model::metric_base::metric_set& extended_tile_metrics) 39 | { 40 | typedef model::metric_base::metric_set::iterator extended_tile_iterator; 41 | lookup_map_t id_lookup_map; 42 | build_index_map(tile_metrics.begin(), tile_metrics.end(), id_lookup_map); 43 | for(extended_tile_iterator beg = extended_tile_metrics.begin();beg != extended_tile_metrics.end();++beg) 44 | { 45 | beg->set_cluster_count_k(tile_metrics[id_lookup_map[beg->id()]].cluster_count_k()); 46 | } 47 | } 48 | 49 | }}}} 50 | 51 | -------------------------------------------------------------------------------- /src/tests/csharp/metrics/RunMetricsTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using System.IO; 4 | using Illumina.InterOp.Run; 5 | using Illumina.InterOp.RunMetrics; 6 | using Illumina.InterOp.Metrics; 7 | using Illumina.InterOp.Comm; 8 | 9 | namespace Illumina.InterOp.Interop.UnitTest 10 | { 11 | /// 12 | /// Test C# Swig run_metrics Mapping 13 | /// 14 | public class RunMetricsTests 15 | { 16 | /// 17 | /// Test list_filenames 18 | /// 19 | [Test] 20 | public void TestListErrorMetricFilenames() 21 | { 22 | run_metrics run = new run_metrics(); 23 | 24 | read_info_vector reads = new read_info_vector(); 25 | reads.Add(new read_info(1, 1, 3)); 26 | run.run_info(new info(new flowcell_layout(2, 2, 2, 16), 27 | reads 28 | )); 29 | run.set_naming_method(tile_naming_method.FourDigit); 30 | run.legacy_channel_update(instrument_type.HiSeq); 31 | 32 | string_vector filenames = new string_vector(); 33 | run.list_filenames(metric_group.Error, filenames, "RunFolder"); 34 | Assert.AreEqual(filenames.Count, 4); 35 | string interopFolder = Path.Combine("RunFolder", "InterOp"); 36 | string interopFolderCycle1 = Path.Combine(interopFolder, "C1.1"); 37 | string interopFolderCycle2 = Path.Combine(interopFolder, "C2.1"); 38 | string interopFolderCycle3 = Path.Combine(interopFolder, "C3.1"); 39 | Assert.AreEqual(filenames[0], Path.Combine(interopFolder, "ErrorMetricsOut.bin")); 40 | Assert.AreEqual(filenames[1], Path.Combine(interopFolderCycle1, "ErrorMetricsOut.bin")); 41 | Assert.AreEqual(filenames[2], Path.Combine(interopFolderCycle2, "ErrorMetricsOut.bin")); 42 | Assert.AreEqual(filenames[3], Path.Combine(interopFolderCycle3, "ErrorMetricsOut.bin")); 43 | 44 | } 45 | [Test] 46 | public void RunInfoPath() 47 | { 48 | Assert.AreEqual(Path.Combine("RunFolder", "RunInfo.xml"), paths.run_info("RunFolder")); 49 | } 50 | } 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/src/performance.md: -------------------------------------------------------------------------------- 1 | # Performance {#perf} 2 | 3 | The InterOp library is not optimized for speed. Nonetheless, the user should be aware of certain downsides to 4 | using the SWIG interface to C# (or any other language). 5 | 6 | ## SWIG Binding Performance 7 | 8 | The C# unit tests include a PerformanceTest.cs. This file shows three ways to simply sum all the focus scores 9 | for the first channel over >5 million entries. 10 | 11 | The PerformanceTest.cs class demonstrates three different ways of summing focus scores: 12 | 13 | ### 2. Direct Call 1 14 | 15 | The main loop in is C# 16 | 17 | ```csharp 18 | double sum = 0.0; 19 | for(uint i=0;i 13 | /// Test plotting q-score histogram 14 | /// 15 | public class PlotQScoreHistogram 16 | { 17 | /// 18 | /// Test plotting q-score histogram 19 | /// 20 | [Test] 21 | public void Histogram() 22 | { 23 | 24 | int[] tmp = new int[]{ 25 | 6,34,1,7,2,10,20,25,30,35,40,9,19,24,29,34,39,40,2,14,21,27,32,36,40 26 | ,7,0,90,4,1,0,0,0,0,0,-70,22,4,0,-81,-49,1,0,-68,16,0,0,78,-86,42,0,0,0,0,0,0,0,0,0 27 | ,7,0,90,4,2,0,0,0,0,0,75,-81,3,0,-96,-81,0,0,76,4,0,0,112,62,44,0,0,0,0,0,0,0,0,0 28 | ,7,0,90,4,3,0,0,0,0,0,-80,60,3,0,-74,-46,0,0,-85,1,0,0,-106,-112,44,0,0,0,0,0,0,0,0,0 29 | }; 30 | byte[] expected_binary_data = new byte[tmp.Length]; 31 | for(int i=0;i 9 | #include 10 | #include 11 | #include "src/tests/interop/inc/failure_listener.h" 12 | #include "src/tests/interop/inc/regression_test_data.h" 13 | using namespace illumina::interop::unittest; 14 | 15 | int main(int argc, char **argv) 16 | { 17 | // set baseline 18 | // set regression data 19 | regression_test_data& data = regression_test_data::instance(); 20 | 21 | for(int i=1;i= 2 && arg.substr(0, 2) == "--") continue; 30 | if(data.baseline() == "") 31 | { 32 | data.baseline(arg); 33 | continue; 34 | } 35 | data.add_file(arg); 36 | } 37 | data.finalize(); 38 | 39 | 40 | // initialize 41 | try 42 | { 43 | ::testing::InitGoogleTest(&argc, argv); 44 | } 45 | catch(const std::exception& ex) 46 | { 47 | std::cerr << ex.what() << std::endl; 48 | return 1; 49 | } 50 | catch(...) 51 | { 52 | std::cerr << "Unknown error" << std::endl; 53 | return 1; 54 | } 55 | 56 | 57 | { 58 | // remove the default listener 59 | ::testing::TestEventListeners &listeners = ::testing::UnitTest::GetInstance()->listeners(); 60 | ::testing::TestEventListener *default_printer = listeners.Release(listeners.default_result_printer()); 61 | // Add listener that will only print failures 62 | failure_listener *listener = new failure_listener(default_printer, data.files().size() > 0); 63 | listeners.Append(listener); 64 | } 65 | 66 | // run 67 | try 68 | { 69 | return RUN_ALL_TESTS(); 70 | } 71 | catch(const std::exception& ex) 72 | { 73 | std::cerr << ex.what() << std::endl; 74 | return 1; 75 | } 76 | } 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/examples/csharp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Adds the following targets: 2 | # 1. csharp_unittest - Shared library for Unit Testing 3 | # 4 | # Post build of csharp_unittest the unit tests are run 5 | # 6 | 7 | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) 8 | find_package(CSBuild) 9 | 10 | if(NOT CSBUILD_FOUND) 11 | return() 12 | endif() 13 | 14 | find_package(SWIG) 15 | if(NOT SWIG_FOUND) 16 | return() 17 | endif() 18 | 19 | check_swig_version(swig_major_ver) 20 | if(swig_major_ver LESS "3") 21 | return() 22 | endif() 23 | 24 | if(NOT SWIG_GEN_CSHARP_SOURCE_FILES) 25 | message(WARNING "No source files found for unit testing") 26 | message(WARNING "Please run cmake and cmake --build . again") 27 | return() 28 | endif() 29 | 30 | include(${CSBUILD_USE_FILE}) 31 | 32 | 33 | 34 | function(add_csharp_example _target _source_files) 35 | set(CSBUILD_PROJECT_DIR ${_target}) 36 | csharp_add_executable(${_target} ${_source_files} ${SWIG_CSHARP_LIBRARY}) 37 | add_dependencies(${_target} csharp_interop) 38 | add_custom_command(TARGET ${_target} POST_BUILD 39 | COMMAND ${CMAKE_COMMAND} -E copy ${CSBUILD_${_target}_BINARY} $ 40 | COMMENT "${CMAKE_COMMAND} -E copy ${CSBUILD_${_target}_BINARY} -> InterOp DIR") 41 | if(NOT ENABLE_EXAMPLES OR NOT ENABLE_CSHARP) 42 | set_target_properties(${_target} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) 43 | else() 44 | install(FILES ${CSBUILD_${_target}_BINARY} ${CSHARP_INTEROP_LIBRARY} 45 | DESTINATION share/illumina/interop/examples 46 | ) 47 | endif() 48 | if(NOT ENABLE_STATIC) 49 | add_custom_command(TARGET ${_target} POST_BUILD 50 | COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${CMAKE_CURRENT_BINARY_DIR}) 51 | endif() 52 | endfunction() 53 | 54 | add_csharp_example(csharp_example1 Example1.cs) 55 | add_csharp_example(csharp_example2 Example2.cs) 56 | add_csharp_example(csharp_example3 Example3.cs) 57 | add_csharp_example(csharp_summary SummaryExample.cs) 58 | add_csharp_example(csharp_imaging ImagingExample.cs) 59 | 60 | -------------------------------------------------------------------------------- /interop/util/length_of.h: -------------------------------------------------------------------------------- 1 | /** Determine the length of an array or vector 2 | * 3 | * This generic function determines the length of an array or vector 4 | * 5 | * @file 6 | * @date 10/28/15 7 | * @version 1.0 8 | * @copyright GNU Public License. 9 | */ 10 | #pragma once 11 | 12 | #include 13 | 14 | namespace illumina { namespace interop { namespace util 15 | { 16 | 17 | /** Length of a generic type 18 | * 19 | * Returns 1 by default 20 | */ 21 | template 22 | struct length_of_type 23 | { 24 | /** Length of generic type 25 | * 26 | * @note requires dummy parameter 27 | * @return 1 28 | */ 29 | static size_t size(T) 30 | { return 1; } 31 | }; 32 | 33 | /** Length of a generic vector type 34 | * 35 | * Returns std::vector::size() 36 | */ 37 | template 38 | struct length_of_type > 39 | { 40 | /** Length of a generic vector type 41 | * 42 | * @param vec generic vector 43 | * @return std::vector::size() 44 | */ 45 | static size_t size(const std::vector &vec) 46 | { return vec.size(); } 47 | }; 48 | 49 | /** Get the number of elements in the collection or 1 if a value 50 | * 51 | * @param val collection or value 52 | * @return size of collection or 1 for value 53 | */ 54 | template 55 | size_t length_of(const T &val) 56 | { return length_of_type::size(val); } 57 | 58 | /** Get the number of elements in a stack array 59 | * 60 | * @return size of array 61 | */ 62 | template 63 | size_t length_of(const T (&)[N]) 64 | { return N; } 65 | 66 | /** Convert a stack array into a std::vector 67 | * 68 | * @tparam T type held by array 69 | * @tparam N number of elements in array 70 | * @param vals stack array 71 | * @return std::vector 72 | */ 73 | template 74 | static std::vector to_vector(const T (&vals)[N]) 75 | { 76 | return std::vector(vals, vals + N); 77 | } 78 | 79 | }}} 80 | 81 | 82 | -------------------------------------------------------------------------------- /tools/teamcity/pull_request/msvc.bat: -------------------------------------------------------------------------------- 1 | set GENERATOR="Visual Studio 14 2015" 2 | set PY= 3 | set CS_BUILD="DotNet" 4 | set TARGET=bundle 5 | 6 | set build_number=%1% 7 | if NOT '%2' == '' ( 8 | set GENERATOR=%2% 9 | ) 10 | if NOT "%3" == "" ( 11 | set CS_BUILD=%3% 12 | ) 13 | if NOT "%4" == "" ( 14 | set PY=%4% 15 | ) 16 | if NOT "%5" == "" ( 17 | set TARGET=%5% 18 | ) 19 | 20 | if "%PY%" == "2.7" ( 21 | set EXTRA="conda=4.5.3" 22 | ) 23 | 24 | echo "Generator: %GENERATOR%" 25 | echo "CS_BUILD: %CS_BUILD%" 26 | echo "PY: %PY%" 27 | echo "EXTRA: %EXTRA%" 28 | 29 | 30 | echo "##teamcity[blockOpened name='Install Deps']" 31 | call tools\prereqs\env_windows.bat %PY% %EXTRA% 32 | if %errorlevel% neq 0 exit /b %errorlevel% 33 | echo "##teamcity[blockClosed name='Install Deps']" 34 | 35 | echo "##teamcity[blockOpened name='Disable Float Compression %PY%']" 36 | call tools\package.bat Release %GENERATOR% %TARGET% "-Ax64 -DBUILD_NUMBER=%build_number% -DENABLE_FLOAT_COMPRESSION=OFF -DCSBUILD_TOOL=%CS_BUILD%" %PY% 37 | set errorcode=%errorlevel% 38 | type %CD%\build\CMakeFiles\CMakeOutput.log 39 | if %errorcode% neq 0 exit /b %errorcode% 40 | echo "##teamcity[blockClosed name='Disable Float Compression %PY%']" 41 | 42 | echo "##teamcity[blockOpened name='Disable Dynamic Array %PY%']" 43 | call tools\package.bat Release %GENERATOR% %TARGET% "-Ax64 -DBUILD_NUMBER=%build_number% -DDISABLE_DYNAMIC_ARRAY=OFF -DCSBUILD_TOOL=%CS_BUILD%" %PY% 44 | if %errorlevel% neq 0 exit /b %errorlevel% 45 | echo "##teamcity[blockClosed name='Disable Dynamic Array %PY%']" 46 | 47 | echo "##teamcity[blockOpened name='Python %PY%']" 48 | call tools\package.bat Release %GENERATOR% %TARGET% "-Ax64 -DBUILD_NUMBER=%build_number% -DCSBUILD_TOOL=%CS_BUILD%" %PY% 49 | if %errorlevel% neq 0 exit /b %errorlevel% 50 | echo "##teamcity[blockClosed name='Python %PY%']" 51 | 52 | echo "##teamcity[blockOpened name='RTA Settings %PY%']" 53 | call tools\package.bat Release %GENERATOR% %TARGET% "-Ax64 -DENABLE_BACKWARDS_COMPATIBILITY=OFF -DENABLE_EXAMPLES=OFF -DENABLE_DOCS=OFF -DENABLE_SWIG=OFF -DENABLE_TEST=OFF -DENABLE_APPS=OFF -DENABLE_PYTHON=OFF -DDISABLE_DYNAMIC_ARRAY=ON -DENABLE_FLOAT_COMPRESSION=OFF -DENABLE_PORTABLE=ON" %PY% 54 | if %errorlevel% neq 0 exit /b %errorlevel% 55 | echo "##teamcity[blockClosed name='RTA Settings %PY%']" -------------------------------------------------------------------------------- /src/ext/python/setup.py.in: -------------------------------------------------------------------------------- 1 | from setuptools import setup, Distribution 2 | from setuptools.command.install import install 3 | import os 4 | 5 | class BinaryDistribution(Distribution): 6 | 7 | def has_ext_modules(self): 8 | return True 9 | 10 | def is_pure(self): 11 | return False 12 | 13 | # Fixes a bug in distutils.command.install.finalize_options() - https://github.com/google/or-tools/issues/616 14 | class InstallPlatlib(install): 15 | def finalize_options(self): 16 | install.finalize_options(self) 17 | self.install_lib = self.install_platlib 18 | 19 | setup( 20 | name='interop', 21 | version='@INTEROP_VERSION@', 22 | description="The Illumina InterOp libraries are a set of common routines used for reading InterOp metric files.", 23 | long_description="""The Illumina InterOp libraries are a set of common routines used for reading InterOp metric files 24 | produced by Illumina sequencers. These libraries are backwards compatible and capable of supporting 25 | prior releases of the software, with one exception: GA systems have been excluded.""", 26 | long_description_content_type='text/plain', 27 | maintainer='Illumina Inc.', 28 | url='https://github.com/Illumina/interop', 29 | license='GPL', 30 | download_url='https://github.com/Illumina/interop/releases/latest', 31 | packages=['interop'], 32 | include_package_data=True, 33 | package_data={ 34 | 'interop': [ '*.so', '*.pyd', '*.dylib' ], 35 | }, 36 | classifiers=[ 37 | 'Development Status :: 5 - Production/Stable', 38 | 'Programming Language :: Python', 39 | 'Programming Language :: Python :: 2', 40 | 'Programming Language :: Python :: 3', 41 | 'Topic :: Scientific/Engineering :: Bio-Informatics' 42 | ], 43 | keywords="Illumina sequencer HiSeqX HiSeq NextSeq MiniSeq NovaSeq MiSeq SBS genome", 44 | install_requires=[ 45 | 'numpy>=1.26.2;python_version>="3.12"', 46 | 'numpy>=1.23.2;python_version>="3.11"', 47 | 'numpy>=1.21.6;python_version>="3.10"', 48 | 'numpy>=1.19.3;python_version>="3.9"', 49 | 'numpy>=1.16.6,<2.0;python_version<="3.8"', 50 | ], 51 | distclass=BinaryDistribution, 52 | cmdclass={'install': InstallPlatlib}, 53 | ) 54 | 55 | -------------------------------------------------------------------------------- /interop/model/metric_base/point2d.h: -------------------------------------------------------------------------------- 1 | /** Point in 2D space 2 | * 3 | * 4 | * @file 5 | * @date 3/1/17 6 | * @version 1.0 7 | * @copyright GNU Public License 8 | */ 9 | #pragma once 10 | #include 11 | #include "interop/io/format/generic_layout.h" 12 | 13 | namespace illumina { namespace interop { namespace model { namespace metrics 14 | { 15 | /** Point in 2D space 16 | * 17 | * Memory: 18 | * - x 4 bytes (float32) 19 | * - y 4 bytes (float32) 20 | * - Total 8 bytes 21 | */ 22 | class point2d 23 | { 24 | public: 25 | /** Constructor */ 26 | point2d() : m_x(std::numeric_limits::quiet_NaN()), m_y(std::numeric_limits::quiet_NaN()) 27 | { 28 | } 29 | 30 | /**Constructor 31 | * 32 | * @param x x-coordinate 33 | * @param y y-coordinate 34 | */ 35 | point2d(const float x, const float y) : m_x(x), m_y(y) 36 | { 37 | } 38 | 39 | public: 40 | /** Copy constructor 41 | * 42 | * @param val type that defines m_x and m_y 43 | */ 44 | point2d(const point2d &val) : m_x(val.m_x), m_y(val.m_y) 45 | { 46 | } 47 | /** Assign type val to point2d 48 | * 49 | * @param val type that defines m_x and m_y 50 | * @return point2d 51 | */ 52 | point2d &operator=(const point2d &val) 53 | { 54 | m_x = val.m_x; 55 | m_y = val.m_y; 56 | return *this; 57 | } 58 | 59 | public: 60 | /** Get x-coordinate 61 | * 62 | * @return x-coordinate 63 | */ 64 | float x() const 65 | { 66 | return m_x; 67 | } 68 | 69 | /** Get y-coordinate 70 | * 71 | * @return y-coordinate 72 | */ 73 | float y() const 74 | { 75 | return m_y; 76 | } 77 | /** Get size of data structure in bytes 78 | * 79 | * @return size of data structure in bytes 80 | */ 81 | size_t size_in_bytes()const 82 | { 83 | return sizeof(m_x)+ sizeof(m_y); 84 | } 85 | 86 | private: 87 | float m_x; 88 | float m_y; 89 | template 90 | friend 91 | struct io::generic_layout; 92 | }; 93 | }}}} 94 | -------------------------------------------------------------------------------- /interop/util/exception.h: -------------------------------------------------------------------------------- 1 | /** Exception utilities 2 | * 3 | * The header provides a macro to throw more informative exceptions 4 | * 5 | * @file 6 | * @date 6/11/16 7 | * @version 1.0 8 | * @copyright GNU Public License. 9 | */ 10 | #pragma once 11 | #include "interop/util/exception_specification.h" 12 | #include "interop/util/lexical_cast.h" 13 | 14 | /** Create a formatted message for the given exception 15 | * 16 | * @note The .flush() is a workaround for clang 17 | */ 18 | #define INTEROP_THROW(EXCEPTION, MESSAGE) \ 19 | throw EXCEPTION ( static_cast(std::ostringstream().flush() << MESSAGE << "\n" << __FILE__<< "::" \ 20 | << __FUNCTION__<< " (" << __LINE__ << ")" ).str()) 21 | 22 | /** Throw exception if value exceeds bounds 23 | */ 24 | #define INTEROP_BOUNDS_CHECK(VALUE, RANGE, MESSAGE) \ 25 | if((VALUE) >= (RANGE)) throw illumina::interop::model::index_out_of_bounds_exception ( \ 26 | static_cast(std::ostringstream().flush() << MESSAGE << " - " << VALUE << " >= " << RANGE << "\n" << __FILE__ << "::" \ 27 | << __FUNCTION__<< " (" << __LINE__ << ")" ).str()) 28 | 29 | /** Throw exception if value exceeds bounds 30 | */ 31 | #define INTEROP_RANGE_CHECK(VALUE, RANGE, EXCEPTION, MESSAGE) \ 32 | if((VALUE) >= (RANGE)) throw EXCEPTION ( \ 33 | static_cast(std::ostringstream().flush() << MESSAGE << " - " << VALUE << " >= " << RANGE << "\n" << __FILE__ << "::" \ 34 | << __FUNCTION__<< " (" << __LINE__ << ")" ).str()) 35 | 36 | /** Throw exception if value exceeds bounds 37 | */ 38 | #define INTEROP_RANGE_CHECK_GT(VALUE, RANGE, EXCEPTION, MESSAGE) \ 39 | if((VALUE) > (RANGE)) throw EXCEPTION ( \ 40 | static_cast(std::ostringstream().flush() << MESSAGE << " - " << VALUE << " > " << RANGE << "\n" << __FILE__ << "::" \ 41 | << __FUNCTION__<< " (" << __LINE__ << ")" ).str()) 42 | 43 | 44 | /** Throw exception if value exceeds bounds 45 | */ 46 | #define INTEROP_RANGE_CHECK_NE(VALUE, RANGE, EXCEPTION, MESSAGE) \ 47 | if((VALUE) > (RANGE)) throw EXCEPTION ( \ 48 | static_cast(std::ostringstream().flush() << MESSAGE << " - " << VALUE << " != " << RANGE << "\n" << __FILE__ << "::" \ 49 | << __FUNCTION__<< " (" << __LINE__ << ")" ).str()) 50 | 51 | -------------------------------------------------------------------------------- /interop/logic/summary/index_summary.h: -------------------------------------------------------------------------------- 1 | /** Summary logic for index metrics 2 | * 3 | * @file 4 | * @date 5/11/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include "interop/model/model_exceptions.h" 10 | #include "interop/model/summary/index_flowcell_summary.h" 11 | #include "interop/model/run_metrics.h" 12 | #include "interop/logic/utils/metrics_to_load.h" 13 | 14 | 15 | namespace illumina { namespace interop { namespace logic { namespace summary 16 | { 17 | 18 | /** Summarize a collection index metrics for a specific lane 19 | * 20 | * @param metrics source run metrics 21 | * @param lane lane number 22 | * @param summary destination index lane summary 23 | */ 24 | void summarize_index_metrics(model::metrics::run_metrics &metrics, 25 | const size_t lane, 26 | model::summary::index_lane_summary &summary) 27 | INTEROP_THROW_SPEC((model::index_out_of_bounds_exception)); 28 | /** Summarize a collection index metrics 29 | * 30 | * @ingroup summary_logic 31 | * @param index_metrics source collection of index metrics 32 | * @param tile_metrics source collection of tile metrics 33 | * @param lane_count number of lanes 34 | * @param summary destination index flowcell summary 35 | */ 36 | void summarize_index_metrics(model::metric_base::metric_set& index_metrics, 37 | const model::metric_base::metric_set& tile_metrics, 38 | const size_t lane_count, 39 | model::summary::index_flowcell_summary &summary) 40 | INTEROP_THROW_SPEC((model::index_out_of_bounds_exception)); 41 | 42 | /** Summarize index metrics from run metrics 43 | * 44 | * @ingroup summary_logic 45 | * @param metrics source collection of all metrics 46 | * @param summary destination index flowcell summary 47 | */ 48 | void summarize_index_metrics(model::metrics::run_metrics &metrics, 49 | model::summary::index_flowcell_summary &summary) 50 | INTEROP_THROW_SPEC((model::index_out_of_bounds_exception)); 51 | }}}} 52 | 53 | -------------------------------------------------------------------------------- /src/examples/example_populate_qmetricset.cpp: -------------------------------------------------------------------------------- 1 | /** Populate and use a Q-metric Set 2 | * 3 | * 4 | * @file 5 | * @date 4/6/17 6 | * @version 1.0 7 | * @copyright GNU Public License 8 | */ 9 | 10 | #include 11 | #include "interop/model/run_metrics.h" 12 | 13 | using namespace illumina::interop::model::metric_base; 14 | using namespace illumina::interop::model::metrics; 15 | using namespace illumina::interop::io; 16 | using namespace illumina::interop::util; 17 | using namespace illumina::interop; 18 | 19 | int check_args(int argc); 20 | 21 | int main(int argc, char** argv) 22 | { 23 | int ret; 24 | if((ret = check_args(argc)) != 0) return ret; 25 | const char* filename = argv[1]; 26 | 27 | 28 | // @ [Reading a single metric set using run_metrics] 29 | std::vector valid_to_load(constants::MetricCount, 0); 30 | valid_to_load[constants::Q]=1; 31 | run_metrics metrics; 32 | try 33 | { 34 | metrics.read(filename, valid_to_load); 35 | } 36 | catch(const std::exception& ex) 37 | { 38 | std::cerr << ex.what() << std::endl; 39 | return 1; 40 | } 41 | metric_set& q_metric_set = metrics.get(); 42 | // @ [Reading a single metric set using run_metrics] 43 | 44 | 45 | if(q_metric_set.size()==0) 46 | { 47 | std::cerr << "Empty q-metrics" << std::endl; 48 | return 1; 49 | } 50 | 51 | try 52 | { 53 | // @ [Calculating Total >= Q30] 54 | 55 | q_metric &metric0 = q_metric_set[0]; 56 | std::cout << "Total >= Q30: " << metric0.total_over_qscore(q_metric_set.index_for_q_value(30)) << std::endl; 57 | 58 | // @ [Calculating Total >= Q30] 59 | 60 | // @ [Calculating Percent >= Q30] 61 | 62 | q_metric &metric1 = q_metric_set[0]; 63 | std::cout << "Percent >= Q30: " << metric1.percent_over_qscore(q_metric_set.index_for_q_value(30)) << std::endl; 64 | 65 | // @ [Calculating Percent >= Q30] 66 | } 67 | catch(const std::exception& ex) 68 | { 69 | std::cerr << ex.what() << std::endl; 70 | return 1; 71 | } 72 | 73 | return 0; 74 | } 75 | 76 | 77 | int check_args(int argc) 78 | { 79 | if (argc != 2) 80 | { 81 | if (argc < 2) std::cerr << "No run folder" << std::endl; 82 | else std::cerr << "Too many arguments" << std::endl; 83 | return 1; 84 | } 85 | return 0; 86 | } 87 | 88 | 89 | -------------------------------------------------------------------------------- /interop/logic/table/create_imaging_table_columns.h: -------------------------------------------------------------------------------- 1 | /** Logic to populate the imaging table columns 2 | * 3 | * @file 4 | * @date 7/20/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include "interop/model/run_metrics.h" 10 | #include "interop/model/table/imaging_column.h" 11 | #include "interop/logic/table/table_util.h" 12 | 13 | 14 | namespace illumina { namespace interop { namespace logic { namespace table 15 | { 16 | 17 | /** Get the maximum number of digits to round 18 | * 19 | * @return maximum number of rounding digits 20 | */ 21 | ::uint32_t max_digits(); 22 | /** Get the number of digits to round a column 23 | * 24 | * @param index imaging table column id 25 | * @return number of digits to round a column 26 | */ 27 | size_t get_column_rounding(const model::table::column_id index); 28 | /** Create the imaging table columns 29 | * 30 | * @param channels names of each channel 31 | * @param filled boolean array indicating whether to include the column 32 | * @param columns destination column vector 33 | */ 34 | void create_imaging_table_columns(const std::vector& channels, 35 | const std::vector& filled, 36 | std::vector< model::table::imaging_column >& columns) 37 | INTEROP_THROW_SPEC((model::invalid_column_type, 38 | model::index_out_of_bounds_exception, 39 | model::invalid_channel_exception)); 40 | /** Populate the value offsets from the column headers 41 | * 42 | * @param columns column headers 43 | */ 44 | void populate_column_offsets(std::vector& columns) 45 | INTEROP_THROW_SPEC((model::invalid_column_type)); 46 | /** Create a vector of column descriptors 47 | * 48 | * @param metrics source collection of InterOp metrics from the run 49 | * @param columns destination vector of column descriptors 50 | */ 51 | void create_imaging_table_columns(model::metrics::run_metrics& metrics, 52 | std::vector< model::table::imaging_column >& columns) 53 | INTEROP_THROW_SPEC((model::invalid_column_type, 54 | model::index_out_of_bounds_exception, 55 | model::invalid_channel_exception)); 56 | 57 | 58 | }}}} 59 | 60 | -------------------------------------------------------------------------------- /interop/util/math.h: -------------------------------------------------------------------------------- 1 | /** Back port of C++11 math functions 2 | * 3 | * @todo include this everywhere isnan is used 4 | * 5 | * @file 6 | * @date 4/20/16 7 | * @version 1.0 8 | * @copyright GNU Public License. 9 | */ 10 | 11 | #pragma once 12 | #include "interop/config.h" 13 | #include 14 | 15 | #include 16 | #if defined(HAVE_NO_STD_ISNAN) 17 | # if defined(HAVE_ISNAN) 18 | # include 19 | #elif defined(HAVE___ISNAN) 20 | # include 21 | #elif defined(HAVE_FLOAT_H_ISNAN) 22 | # include 23 | #endif 24 | namespace std 25 | { 26 | /** Test if a floating point number is not a number (NaN) 27 | * 28 | * @param val floating point number 29 | * @return true if floating point is NaN 30 | */ 31 | template 32 | bool isnan(const T val) 33 | { 34 | # if defined(HAVE_ISNAN) 35 | return ::isnan(val); 36 | # elif defined(HAVE___ISNAN) 37 | return __isnan(val); 38 | # elif defined(HAVE_FLOAT_H_ISNAN) 39 | return _isnan(val); 40 | # else 41 | return val != val; 42 | #endif 43 | } 44 | /** Test if a floating point number is infinity (INF) 45 | * 46 | * @param val floating point number 47 | * @return true if floating point is infinity 48 | */ 49 | template 50 | bool isinf(const T val) 51 | { 52 | # if defined(HAVE_ISNAN) 53 | return ::isinf(val); 54 | # elif defined(HAVE___ISNAN) 55 | return __isinf(val); 56 | # elif defined(HAVE_FLOAT_H_ISNAN) 57 | return _isinf(val); 58 | # else 59 | return !isnan(val) && isnan(val-val); 60 | #endif 61 | } 62 | } 63 | #endif 64 | 65 | namespace illumina { namespace interop { namespace util 66 | { 67 | /** Cast a number to a float, return NaN if it matches the sentinel 68 | * 69 | * The default sentinel is the maximum value for the type. 70 | * 71 | * @tparam T 72 | * @param val number to cast 73 | * @param sentinel NaN sentinel, default max value 74 | * @return 75 | */ 76 | template 77 | float float_cast(const T val, const T sentinel = std::numeric_limits::max()) 78 | { 79 | if (val == sentinel) 80 | return std::numeric_limits::quiet_NaN(); 81 | return static_cast(val); 82 | } 83 | }}} 84 | -------------------------------------------------------------------------------- /src/ext/swig/arrays/arrays_numpy_impl.i: -------------------------------------------------------------------------------- 1 | %{ 2 | #define SWIG_FILE_WITH_INIT 3 | %} 4 | %include "numpy.i" 5 | %init 6 | %{ 7 | import_array(); 8 | %} 9 | 10 | %apply (unsigned char* INPLACE_ARRAY1, int DIM1) {(::uint8_t* buffer, const size_t buffer_size)} 11 | %apply (unsigned char* INPLACE_ARRAY1, int DIM1) {(unsigned char* buffer, const size_t buffer_size)} 12 | %apply (float* INPLACE_ARRAY1, int DIM1) {(float* buffer, size_t buffer_size)} 13 | %apply (unsigned int* INPLACE_ARRAY1, int DIM1) {(::uint32_t* id_buffer, size_t id_buffer_size)} 14 | %apply (float* INPLACE_ARRAY1, int DIM1) {(float* data_beg, const size_t n)} 15 | %apply (float* INPLACE_ARRAY1, int DIM1) {(float* input, size_t input_size)} 16 | %apply (float* INPLACE_ARRAY1, int DIM1) {(float* output, size_t output_size)} 17 | %apply (float* INPLACE_ARRAY1, int DIM1) {(float* matrix, size_t matrix_size)} 18 | 19 | %apply (unsigned int* INPLACE_ARRAY1, int DIM1) {(const ::uint32_t* called_counts, const size_t num_of_counts)} 20 | %apply (unsigned short* INPLACE_ARRAY1, int DIM1) {(const ::uint16_t* intensity_values, const size_t intensity_count)} 21 | %apply (float* INPLACE_ARRAY1, int DIM1) {(const float* focus_scores, const size_t focus_count)} 22 | 23 | %apply (unsigned short* INPLACE_ARRAY1, int DIM1) {(const ::uint16_t* buffer, const size_t count)} 24 | %apply (unsigned char* INPLACE_ARRAY1, int DIM1) {(const ::uint8_t* buffer, const size_t count)} 25 | %apply (int* INPLACE_ARRAY1, int DIM1) {(const ::int32_t* buffer, const size_t num_of_counts)} 26 | %apply (short* INPLACE_ARRAY1, int DIM1) {(const ::int16_t* buffer, const size_t count)} 27 | %apply (char* INPLACE_ARRAY1, int DIM1) {(const ::int8_t* buffer, const size_t count)} 28 | %apply (float* INPLACE_ARRAY1, int DIM1) {(const float* buffer, const size_t count)} 29 | %apply (double* INPLACE_ARRAY1, int DIM1) {(const double* buffer, const size_t count)} 30 | 31 | #if defined(SWIGWORDSIZE64) 32 | %apply (unsigned long* INPLACE_ARRAY1, int DIM1) {(::uint64_t* data_int_beg, const size_t n)} 33 | %apply (unsigned long* INPLACE_ARRAY1, int DIM1) {(::uint64_t* buffer, const size_t count)} 34 | %apply (long* INPLACE_ARRAY1, int DIM1) {(::int64_t* buffer, const size_t count)} 35 | #else 36 | %apply (unsigned long long* INPLACE_ARRAY1, int DIM1) {(::uint64_t* data_int_beg, const size_t n)} 37 | %apply (unsigned long long* INPLACE_ARRAY1, int DIM1) {(::uint64_t* buffer, const size_t count)} 38 | %apply (long long* INPLACE_ARRAY1, int DIM1) {(const ::int64_t* buffer, const size_t count)} 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /src/examples/csharp/Example2.cs: -------------------------------------------------------------------------------- 1 | /// @ [Reporting Tile Metrics in CSharp] 2 | using System; 3 | using System.Collections.Generic; 4 | using Illumina.InterOp.Run; 5 | using Illumina.InterOp.Metrics; 6 | using Illumina.InterOp.Comm; 7 | 8 | 9 | class TileSummary 10 | { 11 | public float cluster_count; 12 | public float cluster_count_pf; 13 | public uint tile_count; 14 | }; 15 | 16 | class Example2 17 | { 18 | static int Main(string[] args) 19 | { 20 | 21 | int ret; 22 | if((ret = Helper.CheckArguments(args)) != 0) return ret; 23 | 24 | base_tile_metrics tile_metric_set = new base_tile_metrics (); 25 | if ((ret = Helper.ReadInterop (args [0], tile_metric_set)) != 0) 26 | return ret; 27 | 28 | Dictionary lane_summary_map = new Dictionary(); 29 | foreach(var metric in tile_metric_set.metrics()) 30 | { 31 | if (!lane_summary_map.ContainsKey (metric.lane ())) 32 | lane_summary_map.Add (metric.lane (), new TileSummary ()); 33 | lane_summary_map[metric.lane()].cluster_count += metric.clusterCount(); 34 | lane_summary_map[metric.lane()].cluster_count_pf += metric.clusterCountPf(); 35 | lane_summary_map[metric.lane()].tile_count += 1; 36 | } 37 | foreach (KeyValuePair pair in lane_summary_map) 38 | { 39 | Console.WriteLine("Lane: {0}", pair.Key); 40 | Console.WriteLine("Tiles: {0}", pair.Value.tile_count); 41 | Console.WriteLine("Cluster PF (%): {0}", pair.Value.cluster_count_pf / pair.Value.cluster_count * 100); 42 | } 43 | 44 | return 0; 45 | } 46 | } 47 | /// @ [Reporting Tile Metrics in CSharp] 48 | 49 | class Helper 50 | { 51 | public static int CheckArguments (string[] args) 52 | { 53 | if (args.Length != 1) { 54 | if (args.Length < 1) 55 | Console.WriteLine ("No run folder"); 56 | else 57 | Console.WriteLine ("Too many arguments"); 58 | return 1; 59 | } 60 | return 0; 61 | } 62 | public static int ReadInterop(string filename, base_tile_metrics tile_metric_set) 63 | { 64 | try 65 | { 66 | c_csharp_comm.read_interop (filename, tile_metric_set); 67 | } 68 | catch(incomplete_file_exception){} 69 | catch(file_not_found_exception ex) 70 | { 71 | 72 | Console.WriteLine("File not found: "+filename); 73 | Console.WriteLine (ex); 74 | return 1; 75 | } 76 | catch(bad_format_exception ex) 77 | { 78 | Console.WriteLine (ex); 79 | return 1; 80 | } 81 | return 0; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/ext/swig/exceptions/exceptions_impl.i: -------------------------------------------------------------------------------- 1 | %include "std_except.i" 2 | %include "exception.i" 3 | 4 | #if defined(SWIGCSHARP) 5 | namespace std 6 | { 7 | %ignore runtime_error; 8 | struct runtime_error {}; 9 | %ignore out_of_range; 10 | struct out_of_range {}; 11 | %ignore invalid_argument; 12 | struct invalid_argument {}; 13 | %ignore invalid_parameter; 14 | } 15 | #elif defined(SWIGJAVA) 16 | %typemap(javabase) std::runtime_error "java.lang.Exception"; 17 | %typemap(javacode) std::runtime_error %{ 18 | public String getMessage() { 19 | return what(); 20 | } 21 | %} 22 | namespace std { 23 | struct runtime_error 24 | { 25 | runtime_error(const string& msg); 26 | virtual ~runtime_error() throw(); 27 | virtual const char* what() const throw(); 28 | }; 29 | } 30 | #else 31 | namespace std{ 32 | %std_exception_map(bad_alloc, SWIG_MemoryError); 33 | } 34 | #endif 35 | %{ 36 | #include "interop/io/stream_exceptions.h" 37 | #include "interop/model/model_exceptions.h" 38 | #include "interop/util/xml_exceptions.h" 39 | #include "interop/util/exception_specification.h" 40 | %} 41 | 42 | %define INTEROP_THROW_SPEC(SPEC) throw SPEC 43 | %enddef 44 | 45 | 46 | #if defined(SWIGCSHARP) 47 | 48 | %include "src/ext/swig/exceptions/exceptions_csharp.i" 49 | 50 | #elif defined(SWIGPYTHON) 51 | 52 | %define WRAP_EXCEPTION_IMPORT(NAMESPACE, EXCEPTION_CPLUS_PLUS, EXCEPTION_CSHARP) 53 | %enddef 54 | 55 | %define WRAP_EXCEPTION(NAMESPACE, EXCEPTION_CPLUS_PLUS, EXCEPTION_CSHARP) 56 | %extend NAMESPACE EXCEPTION_CPLUS_PLUS { 57 | std::string __str__()const{return self->what();} 58 | } 59 | %enddef 60 | 61 | #elif defined(SWIGJAVA) 62 | 63 | %define WRAP_EXCEPTION_IMPORT(NAMESPACE, EXCEPTION_CPLUS_PLUS, EXCEPTION_CSHARP) 64 | %enddef 65 | 66 | %define WRAP_EXCEPTION(NAMESPACE, EXCEPTION_CPLUS_PLUS, EXCEPTION_JAVA) 67 | %typemap(throws, throws="EXCEPTION_CPLUS_PLUS") NAMESPACE EXCEPTION_CPLUS_PLUS { 68 | // the following namespace thing is hacky 69 | jclass excep = jenv->FindClass("com/illumina/interop/EXCEPTION_CPLUS_PLUS"); 70 | if (excep) 71 | jenv->ThrowNew(excep, $1.what()); 72 | return $null; 73 | } 74 | %enddef 75 | 76 | #else 77 | 78 | %define WRAP_EXCEPTION_IMPORT(NAMESPACE, EXCEPTION_CPLUS_PLUS, EXCEPTION_CSHARP) 79 | %enddef 80 | 81 | %define WRAP_EXCEPTION(NAMESPACE, EXCEPTION_CPLUS_PLUS, EXCEPTION_CSHARP) 82 | %enddef 83 | 84 | #endif 85 | 86 | -------------------------------------------------------------------------------- /src/tests/csharp/metrics/ExtendedTileMetricsTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using System.IO; 4 | using Illumina.InterOp.Metrics; 5 | using Illumina.InterOp.Comm; 6 | 7 | namespace Illumina.InterOp.Interop.UnitTest 8 | { 9 | /// 10 | /// Confirm that the Extended Tile metrics InterOp works properly in C# 11 | /// 12 | public class ExtendedTileMetricsTestV2 13 | { 14 | const int Version = 2; 15 | base_extended_tile_metrics expected_metric_set; 16 | base_extended_tile_metrics actual_metric_set = new base_extended_tile_metrics(); 17 | vector_extended_tile_metrics expected_metrics = new vector_extended_tile_metrics(); 18 | byte[] expected_binary_data; 19 | 20 | /// 21 | /// Sets up the expected and actual metric sets for the test 22 | /// 23 | [SetUp] 24 | protected void SetUp() 25 | { 26 | expected_metrics.Add(new extended_tile_metric(7, 111014, 6309736)); 27 | expected_metrics.Add(new extended_tile_metric(7, 121014, 6260919)); 28 | expected_metrics.Add(new extended_tile_metric(7, 211014, 6232864)); 29 | 30 | int[] tmp = new int[]{ 31 | 2,10,7,0,-90,-79,1,0,-48,-114,-64,74,7,0,-74,-40,1,0,110,17,-65,74,7,0,70,56,3,0,64,54,-66,74 32 | }; 33 | expected_binary_data = new byte[tmp.Length]; 34 | for(int i=0;i 40 | /// Confirms that the data was properly parsed and matches the expected model. 41 | /// This test also confirms that the binding gives the expected results. 42 | /// 43 | [Test] 44 | public void TestHardCodedBinaryData() 45 | { 46 | Assert.AreEqual(expected_metric_set.version(), actual_metric_set.version()); 47 | Assert.AreEqual(expected_metric_set.size(), actual_metric_set.size()); 48 | 49 | for(uint i=0;i 9 | #include "interop/constants/enums.h" 10 | #include "interop/util/option_parser.h" 11 | #include "interop/model/plot/filter_options.h" 12 | 13 | using namespace illumina::interop; 14 | 15 | 16 | TEST(option_parser_test, parse_int) 17 | { 18 | int actual_value=0; 19 | int expected_value = 3; 20 | const char* argv[] = {"program", "file", "--actual=3"}; 21 | int argc = 3; 22 | 23 | util::option_parser description; 24 | description(actual_value, "actual", "Help description"); 25 | description.parse(argc, argv); 26 | 27 | EXPECT_EQ(expected_value, actual_value); 28 | EXPECT_EQ(argc, 2); 29 | } 30 | 31 | TEST(option_parser_test, parse_lane_wrapper) 32 | { 33 | model::plot::filter_options options(constants::UnknownTileNamingMethod); 34 | unsigned int expected_value = 3; 35 | const char* argv[] = {"program", "file", "--actual=3"}; 36 | int argc = 3; 37 | 38 | util::option_parser description; 39 | description(util::wrap_setter(options, &model::plot::filter_options::lane), "actual", "Help description"); 40 | description.parse(argc, argv); 41 | 42 | EXPECT_EQ(expected_value, options.lane()); 43 | EXPECT_EQ(argc, 2); 44 | } 45 | 46 | TEST(option_parser_test, invalid_option_exception) 47 | { 48 | int actual_value=0; 49 | const char* argv[] = {"program", "file", "--actual", "3"}; 50 | int argc = 3; 51 | 52 | util::option_parser description; 53 | description(actual_value, "actual", "Help description"); 54 | EXPECT_THROW(description.parse(argc, argv), util::invalid_option_exception); 55 | } 56 | 57 | TEST(option_parser_test, invalid_option_value_exception) 58 | { 59 | int actual_value=0; 60 | const char* argv[] = {"program", "file", "--actual=3b"}; 61 | int argc = 3; 62 | 63 | util::option_parser description; 64 | description(actual_value, "actual", "Help description"); 65 | EXPECT_THROW(description.parse(argc, argv), util::invalid_option_value_exception); 66 | } 67 | TEST(option_parser_test, no_invalid_option_value_exception) 68 | { 69 | int actual_value=0; 70 | const char* argv[] = {"program", "file", "--actual=3 "}; 71 | int argc = 3; 72 | 73 | util::option_parser description; 74 | description(actual_value, "actual", "Help description"); 75 | EXPECT_NO_THROW(description.parse(argc, argv)); 76 | } 77 | -------------------------------------------------------------------------------- /cmake/Modules/csharp/FindDotNet.cmake: -------------------------------------------------------------------------------- 1 | # Find the msbuild tool 2 | # 3 | # DotNet_FOUND System has msbuild 4 | # DotNet_EXECUTABLE Where to find csc 5 | # MSBUILD_EXECUTABLE Where to find 'msbuild' 6 | # DotNet_EXECUTABLE_VERSION The version number of the DotNet framework 7 | 8 | if(NOT WIN32) 9 | return() 10 | endif() 11 | 12 | set(DotNet_ROOT "" CACHE PATH "Set the location of the .NET root directory") 13 | set(DotNet_EXECUTABLE_VERSION "" CACHE STRING "C# .NET compiler version" ) 14 | 15 | if(DotNet_ROOT AND EXISTS "${DotNet_ROOT}") 16 | find_program(DotNet_EXECUTABLE csc.exe 17 | PATHS ${DotNet_ROOT} 18 | PATH_SUFFIXES bin 19 | NO_DEFAULT_PATH) 20 | find_program(MSBUILD_EXECUTABLE msbuild.exe 21 | PATHS ${DotNet_ROOT} 22 | PATH_SUFFIXES bin 23 | NO_DEFAULT_PATH) 24 | endif() 25 | 26 | if( ${CSHARP_PLATFORM} MATCHES "x64|itanium" ) 27 | set( csharp_DotNet_bin_hints "$ENV{windir}\\Microsoft.NET\\Framework64" ) 28 | else( ) 29 | set( csharp_DotNet_bin_hints "$ENV{windir}\\Microsoft.NET\\Framework" ) 30 | endif( ) 31 | file(TO_CMAKE_PATH "${csharp_DotNet_bin_hints}" csharp_DotNet_bin_hints) 32 | 33 | if(DotNet_EXECUTABLE_VERSION) 34 | set(csharp_DotNet_bin_hints "${csharp_DotNet_bin_hints}/${DotNet_EXECUTABLE_VERSION}") 35 | else() 36 | file(GLOB_RECURSE csharp_DotNet_executables ${csharp_DotNet_bin_hints}/csc.exe) 37 | list(SORT csharp_DotNet_executables ) 38 | list(REVERSE csharp_DotNet_executables ) 39 | list(GET csharp_DotNet_executables 0 DotNet_executable) 40 | string( REPLACE "${csharp_DotNet_bin_hints}/" "" csharp_DotNet_version_temp ${DotNet_executable} ) 41 | string( REPLACE "/csc.exe" "" csharp_DotNet_version_temp ${csharp_DotNet_version_temp} ) 42 | set(DotNet_EXECUTABLE_VERSION "${csharp_DotNet_version_temp}" CACHE STRING "C# .NET compiler version" FORCE ) 43 | set(csharp_DotNet_bin_hints "${csharp_DotNet_bin_hints}/${DotNet_EXECUTABLE_VERSION}") 44 | endif() 45 | find_program(DotNet_EXECUTABLE csc.exe 46 | HINTS ${csharp_DotNet_bin_hints} 47 | PATH_SUFFIXES bin 48 | NO_DEFAULT_PATH 49 | ) 50 | 51 | find_program(MSBUILD_EXECUTABLE msbuild.exe 52 | HINTS ${csharp_DotNet_bin_hints} 53 | PATH_SUFFIXES bin 54 | NO_DEFAULT_PATH 55 | ) 56 | 57 | include(FindPackageHandleStandardArgs) 58 | find_package_handle_standard_args(DotNet DEFAULT_MSG MSBUILD_EXECUTABLE DotNet_EXECUTABLE) 59 | mark_as_advanced(DotNet_EXECUTABLE MSBUILD_EXECUTABLE DotNet_EXECUTABLE_VERSION) -------------------------------------------------------------------------------- /cmake/Modules/csharp/msbuild.csproj.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x64 6 | {EED1EB2A-9001-4506-984E-E7DC92C9B237} 7 | @CSHARP_BUILDER_OUTPUT_TYPE@ 8 | Properties 9 | @CSHARP_BUILDER_OUTPUT_NAME@ 10 | @CSHARP_BUILDER_OUTPUT_NAME@ 11 | v@CSHARP_TARGET_FRAMEWORK_VERSION@ 12 | 512 13 | true 14 | false 15 | @CSHARP_BUILDER_OUTPUT_PATH@ 16 | @CSHARP_PLATFORM@ 17 | true 18 | false 19 | MinimumRecommendedRules.ruleset 20 | 21 | 22 | true 23 | DEBUG;TRACE 24 | full 25 | prompt 26 | 27 | 28 | TRACE 29 | true 30 | pdbonly 31 | prompt 32 | 33 | 34 | 35 | 36 | 37 | @CSHARP_BUILDER_ADDITIONAL_REFERENCES@ 38 | 39 | 40 | @CSHARP_BUILDER_SOURCES@ 41 | 42 | 43 | 44 | 45 | 46 | 47 | @CSHARP_IMPORTS@ 48 | 49 | 56 | 57 | -------------------------------------------------------------------------------- /interop/model/run/run_exceptions.h: -------------------------------------------------------------------------------- 1 | /** Exceptions used by the metrics namespace 2 | * 3 | * 4 | * @file 5 | * @date 4/1/17 6 | * @version 1.0 7 | * @copyright GNU Public License. 8 | */ 9 | 10 | #pragma once 11 | #include "interop/util/base_exception.h" 12 | 13 | 14 | namespace illumina { namespace interop { namespace model 15 | { 16 | 17 | /** @defgroup run_exceptions Run Exceptions 18 | * 19 | * Exceptions that can be thrown if a problem occurs while using the run model 20 | * 21 | * @ingroup interop_exceptions 22 | * @{ 23 | */ 24 | 25 | /** Exception raised if the read was not found 26 | */ 27 | struct invalid_read_exception : public util::base_exception 28 | { 29 | /** Constructor 30 | * 31 | * @param mesg error message 32 | */ 33 | invalid_read_exception(const std::string &mesg) : util::base_exception(mesg) 34 | { } 35 | }; 36 | 37 | /** Exception raised if the tile naming convention is invalid 38 | */ 39 | struct invalid_tile_naming_method : public util::base_exception 40 | { 41 | /** Constructor 42 | * 43 | * @param mesg error message 44 | */ 45 | invalid_tile_naming_method(const std::string &mesg) : util::base_exception(mesg) 46 | { } 47 | }; 48 | 49 | /** Exception raised if the RunInfo does not match the InterOps 50 | */ 51 | struct invalid_run_info_exception : public util::base_exception 52 | { 53 | /** Constructor 54 | * 55 | * @param mesg error message 56 | */ 57 | invalid_run_info_exception(const std::string &mesg) : util::base_exception(mesg) 58 | { } 59 | }; 60 | 61 | /** Exception raised if the RunInfo does not match the InterOps 62 | */ 63 | struct invalid_tile_list_exception : public invalid_run_info_exception 64 | { 65 | /** Constructor 66 | * 67 | * @param mesg error message 68 | */ 69 | invalid_tile_list_exception(const std::string &mesg) : invalid_run_info_exception(mesg) 70 | { } 71 | }; 72 | 73 | /** Exception raised if the RunInfo cycle does not match the InterOps (for legacy HiSeq datasets) 74 | */ 75 | struct invalid_run_info_cycle_exception : public util::base_exception 76 | { 77 | /** Constructor 78 | * 79 | * @param mesg error message 80 | */ 81 | invalid_run_info_cycle_exception(const std::string &mesg) : util::base_exception(mesg) {} 82 | }; 83 | /** @} */ 84 | 85 | }}} 86 | 87 | -------------------------------------------------------------------------------- /src/examples/csharp/ImagingExample.cs: -------------------------------------------------------------------------------- 1 | // @ [Create Imaging Table from a Run Folder] 2 | using System; 3 | using Illumina.InterOp.Run; 4 | using Illumina.InterOp.Metrics; 5 | using Illumina.InterOp.RunMetrics; 6 | using Illumina.InterOp.Comm; 7 | using Illumina.InterOp.Table; 8 | 9 | class ImagingTableExample 10 | { 11 | static int Main(string[] args) 12 | { 13 | if (args.Length != 1) 14 | { 15 | if (args.Length < 1) 16 | Console.WriteLine ("No run folder"); 17 | else 18 | Console.WriteLine ("Too many arguments"); 19 | return 1; 20 | } 21 | 22 | // @ [Reading only metrics required by the Imaging Tab] 23 | run_metrics metrics = new run_metrics(); 24 | uchar_vector interopsToLoad = new uchar_vector(); 25 | 26 | // Load only the metrics required by imaging table 27 | c_csharp_table.list_imaging_table_metrics_to_load(interopsToLoad); 28 | metrics.read(args[0], interopsToLoad); 29 | // @ [Reading only metrics required by the Imaging Tab] 30 | 31 | 32 | imaging_column_vector columnVector = new imaging_column_vector(); 33 | map_id_offset rowOffsets = new map_id_offset(); 34 | 35 | c_csharp_table.create_imaging_table_columns(metrics, columnVector); 36 | c_csharp_table.count_table_rows(metrics, rowOffsets); 37 | int rowCount = rowOffsets.Count; 38 | int columnCount = (int)c_csharp_table.count_table_columns(columnVector); 39 | float[] data = new float[rowCount * columnCount]; 40 | 41 | c_csharp_table.populate_imaging_table_data(metrics, columnVector, rowOffsets, data, (uint)data.Length); 42 | 43 | for(int rowIndex=0;rowIndex= Q30 2 | * 3 | * 4 | * @file 5 | * @date 4/4/16 6 | * @version 1.0 7 | * @copyright GNU Public License. 8 | */ 9 | 10 | #include 11 | #include "interop/model/metric_base/metric_set.h" 12 | #include "interop/model/metrics/q_metric.h" 13 | #include "interop/io/metric_file_stream.h" 14 | #include "interop/util/statistics.h" 15 | 16 | using namespace illumina::interop::model::metric_base; 17 | using namespace illumina::interop::model::metrics; 18 | using namespace illumina::interop::io; 19 | using namespace illumina::interop::util; 20 | using namespace illumina::interop; 21 | 22 | int check_args(int argc); 23 | 24 | int main(int argc, char** argv) 25 | { 26 | int ret; 27 | if((ret = check_args(argc)) != 0) return ret; 28 | metric_set q_metric_set; 29 | 30 | try { 31 | read_interop(argv[1], q_metric_set); 32 | } 33 | catch(const incomplete_file_exception&){}// Ignore incomplete files 34 | catch(const bad_format_exception& ex) // Something catastrophic happened to the file 35 | { 36 | std::cerr << "InterOp did not have the expected format: " << ex.what() << std::endl; 37 | return 1; 38 | } 39 | catch(const file_not_found_exception& ex) 40 | { 41 | std::cerr << "Count not find InterOp file: " << ex.what() << std::endl; 42 | return 1; 43 | } 44 | catch(const std::exception& ex) 45 | { 46 | std::cerr << ex.what() << std::endl; 47 | return 1; 48 | } 49 | if(q_metric_set.size()==0) 50 | { 51 | std::cerr << "Empty q-metrics" << std::endl; 52 | return 1; 53 | } 54 | 55 | try 56 | { 57 | // @ [Calculating Total >= Q30] 58 | 59 | q_metric &metric0 = q_metric_set[0]; 60 | std::cout << "Total >= Q30: " << metric0.total_over_qscore(q_metric_set.index_for_q_value(30)) << std::endl; 61 | 62 | // @ [Calculating Total >= Q30] 63 | 64 | // @ [Calculating Percent >= Q30] 65 | 66 | q_metric &metric1 = q_metric_set[0]; 67 | std::cout << "Percent >= Q30: " << metric1.percent_over_qscore(q_metric_set.index_for_q_value(30)) << std::endl; 68 | 69 | // @ [Calculating Percent >= Q30] 70 | } 71 | catch(const std::exception& ex) 72 | { 73 | std::cerr << ex.what() << std::endl; 74 | return 1; 75 | } 76 | 77 | return 0; 78 | } 79 | 80 | 81 | int check_args(int argc) 82 | { 83 | if (argc != 2) 84 | { 85 | if (argc < 2) std::cerr << "No run folder" << std::endl; 86 | else std::cerr << "Too many arguments" << std::endl; 87 | return 1; 88 | } 89 | return 0; 90 | } 91 | 92 | 93 | -------------------------------------------------------------------------------- /src/examples/example3.cpp: -------------------------------------------------------------------------------- 1 | /** Example 2: Reporting Extraction Metrics 2 | * 3 | * 4 | * @file 5 | * @date 11/6/15 6 | * @version 1.0 7 | * @copyright GNU Public License. 8 | */ 9 | 10 | // @ [Reporting Extraction Metrics] 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "interop/model/metric_base/metric_set.h" 16 | #include "interop/model/metrics/extraction_metric.h" 17 | #include "interop/io/metric_file_stream.h" 18 | 19 | using namespace illumina::interop::model::metric_base; 20 | using namespace illumina::interop::model::metrics; 21 | using namespace illumina::interop::io; 22 | typedef metric_set extraction_metric_set_t; 23 | int read_interop_file(const char* filename, extraction_metric_set_t& extraction_metric_set); 24 | int check_args(int argc); 25 | 26 | 27 | int main(int argc, char** argv) 28 | { 29 | int ret; 30 | if((ret = check_args(argc)) != 0) return ret; 31 | extraction_metric_set_t extraction_metric_set; 32 | 33 | if((ret = read_interop_file(argv[1], extraction_metric_set)) != 0) return ret; 34 | 35 | try 36 | { 37 | std::time_t t = static_cast(extraction_metric_set[0].date_time()); 38 | std::tm *tm = std::gmtime(&t); 39 | if (tm != 0) 40 | { 41 | char buffer[80]; 42 | std::strftime(buffer, 80, "%m/%d/%Y %r", tm); 43 | std::cout << "Time: " << buffer << std::endl; 44 | } else std::cout << "Invalid time" << std::endl; 45 | } 46 | catch(const std::exception& ex) 47 | { 48 | std::cerr << ex.what() << std::endl; 49 | return 1; 50 | } 51 | 52 | return 0; 53 | } 54 | 55 | // @ [Reporting Extraction Metrics] 56 | int check_args(int argc) 57 | { 58 | if(argc != 2) 59 | { 60 | if(argc < 2) std::cerr << "No run folder" << std::endl; 61 | else std::cerr << "Too many arguments" << std::endl; 62 | return 1; 63 | } 64 | return 0; 65 | } 66 | 67 | int read_interop_file(const char* filename, extraction_metric_set_t& extraction_metric_set) 68 | { 69 | try { 70 | read_interop(filename, 71 | extraction_metric_set); 72 | } 73 | catch(const incomplete_file_exception&){}// Ignore incomplete files 74 | catch(const bad_format_exception& ex) 75 | { 76 | std::cerr << "InterOp did not have the expected format: " << ex.what() << std::endl; 77 | return 1; 78 | } 79 | catch(const file_not_found_exception& ex) 80 | { 81 | std::cerr << "Count not find InterOp file: " << ex.what() << std::endl; 82 | return 1; 83 | } 84 | return 0; 85 | } 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /interop/logic/plot/plot_point.h: -------------------------------------------------------------------------------- 1 | /** Plot a point in a series 2 | * 3 | * @file 4 | * @date 5/1/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include "interop/util/statistics.h" 13 | #include "interop/model/plot/candle_stick_point.h" 14 | 15 | namespace illumina { namespace interop { namespace logic { namespace plot { 16 | 17 | /** Logic for creating a candle stick point 18 | * 19 | * @param point candle stick point 20 | * @param beg iterator to start of collection of values 21 | * @param end iterator to end of collection of values 22 | * @param x x-coordinate 23 | * @param outliers reusable memory for collecting outliers 24 | */ 25 | template 26 | void plot_candle_stick(model::plot::candle_stick_point& point, I beg, I end, const float x, std::vector& outliers) 27 | { 28 | const float eps = 1e-7f; 29 | const float NaN = std::numeric_limits::quiet_NaN(); 30 | INTEROP_ASSERT(beg != end); 31 | //std::sort(beg, end); 32 | std::stable_sort(beg, end); 33 | const float p25 = util::percentile_sorted(beg, end, 25); 34 | const float p50 = util::percentile_sorted(beg, end, 50); 35 | const float p75 = util::percentile_sorted(beg, end, 75); 36 | 37 | // Really just some arbitrary criteria derived by empirical observation in the 70s. 38 | const float tukey_constant = 1.5f; 39 | const float iqr = p75-p25; 40 | const float lower = p25 - tukey_constant * iqr; 41 | const float upper = p75 + tukey_constant * iqr; 42 | if(outliers.capacity()>0) 43 | { 44 | util::outliers_lower(beg, end, lower, std::back_inserter(outliers)); 45 | util::outliers_upper(beg, end, upper, std::back_inserter(outliers)); 46 | } 47 | const size_t count = static_cast(std::distance(beg,end)); 48 | 49 | I upper_it = std::lower_bound(beg, end, upper);// Not less 50 | I lower_it = std::lower_bound(beg, end, lower-(eps*lower)); 51 | 52 | 53 | 54 | const float max_val = (upper_it != beg) ? 55 | ((upper_it == end || *upper_it > upper) ? *(upper_it-1) : *upper_it) 56 | : // TODO: should be > not >= 57 | ((upper_it != end) ? *upper_it : NaN); 58 | 59 | const float min_val = (lower_it != end) ? *lower_it : NaN; 60 | point = model::plot::candle_stick_point(x, p25, p50, p75, min_val, max_val, count, outliers); 61 | outliers.clear(); 62 | } 63 | 64 | 65 | }}}} 66 | 67 | -------------------------------------------------------------------------------- /tools/build_cov_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ######################################################################################################################## 3 | # Test Build Script for Coverity 4 | # 5 | # This script takes three parameters: 6 | # 1. Build Configuration: Debug or Release 7 | # 2. Path to third party binaries: E.g. GTest, NUnit 8 | # 3. Location of Coverity tools 9 | # 10 | # Example running script (from the source directory) 11 | # 12 | # sh tools/build_test.sh Debug /var/external_libs /coverity/bin 13 | # 14 | # Note, you must already have CMake and GCC installed and on your path. And Coverity properly configured for C++. 15 | # 16 | ######################################################################################################################## 17 | 18 | # Ensure the script stops on first error 19 | set -e 20 | 21 | 22 | source_dir="${PWD}" 23 | build_dir="${PWD}/build" 24 | build_type="Debug" 25 | build_param="" 26 | coverity_host=coverity.illumina.com 27 | 28 | if [ ! -z $1 ] ; then 29 | build_type=$1 30 | fi 31 | if [ ! -z $2 ] ; then 32 | pushd $2 > /dev/null 33 | build_path=`pwd` 34 | popd > /dev/null 35 | build_param="-DGTEST_ROOT=$build_path -DGMOCK_ROOT=$build_path -DNUNIT_ROOT=$build_path/NUnit-2.6.4" 36 | fi 37 | if [ ! -z $3 ] ; then 38 | cov_path=$3 39 | fi 40 | 41 | tag=`git describe --tags` 42 | 43 | echo "##teamcity[blockOpened name='Configure $build_type']" 44 | rm -fr $build_dir 45 | mkdir $build_dir 46 | cd $build_dir 47 | echo "cmake $source_dir -DCMAKE_BUILD_TYPE=$build_type $build_param" 48 | cmake $source_dir -DCMAKE_BUILD_TYPE=$build_type $build_param 49 | echo "##teamcity[blockClosed name='Configure $build_type']" 50 | 51 | echo "##teamcity[blockOpened name='Coverity Build $build_type']" 52 | $cov_path/cov-build --dir cov make 53 | echo "##teamcity[blockClosed name='Coverity Build $build_type']" 54 | 55 | echo "##teamcity[blockOpened name='Coverity Analyze $build_type']" 56 | $cov_path/cov-analyze --dir cov --strip-path $(dirname `pwd`) --security --concurrency --enable-constraint-fpp --enable-fnptr --enable-virtual 57 | echo "##teamcity[blockClosed name='Coverity Analyze $build_type']" 58 | 59 | echo "##teamcity[blockOpened name='Coverity Upload $build_type']" 60 | $cov_path/cov-manage-im --host $coverity_host --auth-key-file $HOME/key --mode streams --add --set name:InterOp_${tag} --set lang:cpp --set cmap:CM_IPA --set "triage:Primary Analysis" 61 | $cov_path/cov-manage-im --host $coverity_host --auth-key-file $HOME/key --mode projects --update --name InterOp --insert stream:InterOp_${tag} 62 | $cov_path/cov-commit-defects --dir cov --host $coverity_host --stream InterOp_${tag} --auth-key-file $HOME/key 63 | echo "##teamcity[blockClosed name='Coverity Upload $build_type']" 64 | 65 | cd .. 66 | rm -fr $build_dir 67 | 68 | -------------------------------------------------------------------------------- /src/tests/interop/metrics/inc/metric_format_fixtures.h: -------------------------------------------------------------------------------- 1 | /** Fixtures for all the metric formats 2 | * 3 | * 4 | * @file 5 | * @date 9/21/16 6 | * @version 1.0 7 | * @copyright GNU Public License. 8 | */ 9 | #pragma once 10 | 11 | #include "interop/model/run_metrics.h" 12 | #include "src/tests/interop/metrics/inc/corrected_intensity_metrics_test.h" 13 | #include "src/tests/interop/metrics/inc/error_metrics_test.h" 14 | #include "src/tests/interop/metrics/inc/extraction_metrics_test.h" 15 | #include "src/tests/interop/metrics/inc/image_metrics_test.h" 16 | #include "src/tests/interop/metrics/inc/index_metrics_test.h" 17 | #include "src/tests/interop/metrics/inc/phasing_metrics_test.h" 18 | #include "src/tests/interop/metrics/inc/q_collapsed_metrics_test.h" 19 | #include "src/tests/interop/metrics/inc/q_metrics_test.h" 20 | #include "src/tests/interop/metrics/inc/tile_metrics_test.h" 21 | #include "src/tests/interop/metrics/inc/extended_tile_metrics_test.h" 22 | #include "src/tests/interop/metrics/inc/summary_run_metrics_test.h" 23 | 24 | namespace illumina{ namespace interop { namespace unittest 25 | { 26 | 27 | 28 | typedef ::testing::Types 29 | < 30 | corrected_intensity_metric_v2, 31 | corrected_intensity_metric_v3, 32 | corrected_intensity_metric_v4, 33 | error_metric_v3, 34 | error_metric_v4, 35 | error_metric_v5, 36 | error_metric_v6, 37 | extended_tile_metric_v1, 38 | extended_tile_metric_v2, 39 | extended_tile_metric_v3, 40 | extraction_metric_v2, 41 | extraction_metric_v3, 42 | image_metric_v1, 43 | image_metric_v2, 44 | image_metric_v3, 45 | index_metric_v1, 46 | index_metric_v2, 47 | phasing_metric_v1, 48 | phasing_metric_v2, 49 | q_collapsed_metric_v2, 50 | q_collapsed_metric_v3, 51 | q_collapsed_metric_v4, 52 | q_collapsed_metric_v5, 53 | q_collapsed_metric_v6, 54 | q_collapsed_metric_no_median_v2, 55 | q_collapsed_metric_no_median_v5, 56 | q_metric_v4, 57 | q_metric_v5, 58 | q_metric_v6, 59 | q_metric_v6_unbinned, 60 | q_metric_v7, 61 | q_metric_v8, 62 | q_metric_v9, 63 | tile_metric_v2, 64 | tile_metric_v3, 65 | summary_run_v1 66 | > PublicFormats; 67 | 68 | 69 | }}} 70 | 71 | -------------------------------------------------------------------------------- /interop/io/format/abstract_text_format.h: -------------------------------------------------------------------------------- 1 | /** Metric format interface for the text format factory 2 | * 3 | * @file 4 | * @date 12/19/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include "interop/util/cstdint.h" 13 | 14 | namespace illumina { namespace interop { namespace io 15 | { 16 | /** Abstract class that provides an interface for the text format of a metric 17 | * 18 | * The template argument for this class corresponds to a specific type 19 | * of metric set. 20 | */ 21 | template 22 | struct abstract_text_format 23 | { 24 | /** Define the metric type */ 25 | typedef Metric metric_t; 26 | /** Define the metric header type */ 27 | typedef typename Metric::header_type header_t; 28 | /** ID type */ 29 | typedef typename metric_t::id_t id_t; 30 | 31 | /** Destructor 32 | */ 33 | virtual ~abstract_text_format() {} 34 | /** Write the header for a set of metric records to the given output stream 35 | * 36 | * @param out output stream to write the binary InterOp file data 37 | * @param header header of a metric set 38 | * @param channel_names list of channel names 39 | * @param sep column seperator 40 | * @param eol row separator 41 | * @return number of column headers 42 | */ 43 | virtual size_t write_header(std::ostream &out, 44 | const header_t &header, 45 | const std::vector& channel_names, 46 | const char sep, 47 | const char eol) = 0; 48 | /** Write a metric record to the given output stream 49 | * 50 | * @param out output stream to write the binary InterOp file data 51 | * @param metric interop metric data to write 52 | * @param header interop metric header data to write 53 | * @param sep column seperator 54 | * @param eol row separator 55 | * @param missing missing value indicator 56 | * @return number of columns written 57 | */ 58 | virtual size_t write_metric(std::ostream &out, 59 | const metric_t &metric, 60 | const header_t &header, 61 | const char sep, 62 | const char eol, 63 | const char missing) = 0; 64 | 65 | /** Get the version of this metric format 66 | * 67 | * @return version number 68 | */ 69 | virtual ::int16_t version() const=0; 70 | }; 71 | }}} 72 | 73 | -------------------------------------------------------------------------------- /interop/logic/table/create_imaging_table.h: -------------------------------------------------------------------------------- 1 | /** Logic to populate the imaging table 2 | * 3 | * @file 4 | * @date 7/20/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | #include 10 | #include "interop/model/run_metrics.h" 11 | #include "interop/model/table/imaging_column.h" 12 | #include "interop/model/table/imaging_table.h" 13 | #include "interop/logic/table/table_util.h" 14 | 15 | namespace illumina { namespace interop { namespace logic { namespace table 16 | { 17 | // TODO: Make unordered? - need to sort later 18 | // Workaround for SWIG not understanding the macro 19 | /** Define a row offset map */ 20 | typedef std::map row_offset_map_t; 21 | /** Populate the imaging table with all the metrics in the run 22 | * 23 | * @param metrics collection of all run metrics 24 | * @param columns vector of table columns 25 | * @param row_offset ordering for the rows 26 | * @param data_beg iterator to start of table data 27 | * @param n number of cells in the data table 28 | */ 29 | void populate_imaging_table_data(const model::metrics::run_metrics& metrics, 30 | const std::vector& columns, 31 | const row_offset_map_t& row_offset, 32 | float* data_beg, const size_t n) INTEROP_THROW_SPEC((model::index_out_of_bounds_exception, model::invalid_parameter)); 33 | /** Count the number of rows in the imaging table and setup an ordering 34 | * 35 | * @param metrics collections of InterOp metric sets 36 | * @param row_offset ordering for the rows 37 | */ 38 | void count_table_rows(const model::metrics::run_metrics& metrics, 39 | row_offset_map_t& row_offset); 40 | /** Count the total number of columns for the data table 41 | * 42 | * @param columns vector of table column descriptions 43 | * @return total number of columns including sub columns 44 | */ 45 | size_t count_table_columns(const std::vector& columns); 46 | /** Create an imaging table from run metrics 47 | * 48 | * @param metrics source run metrics 49 | * @param table destination imaging table 50 | */ 51 | void create_imaging_table(model::metrics::run_metrics& metrics, model::table::imaging_table& table) 52 | INTEROP_THROW_SPEC((model::invalid_column_type, model::index_out_of_bounds_exception, model::invalid_parameter)); 53 | 54 | /** List the required on demand metrics 55 | * 56 | * @param valid_to_load list of metrics to load on demand 57 | */ 58 | void list_imaging_table_metrics_to_load(std::vector& valid_to_load); 59 | 60 | }}}} 61 | 62 | -------------------------------------------------------------------------------- /interop/util/cstdint.h: -------------------------------------------------------------------------------- 1 | /** Back port of integer types 2 | * 3 | * This is defines a set of fixed width integer types. 4 | * 5 | * @file 6 | * 7 | * @date 9/26/15 8 | * @version 1.0 9 | * @copyright GNU Public License. 10 | */ 11 | 12 | #pragma once 13 | #include "interop/config.h" 14 | 15 | #ifdef HAVE_STDINT_H 16 | #include 17 | #elif defined(HAVE_SYS_TYPES_H) 18 | #include 19 | #else 20 | #include "interop/util/pstdint.h" 21 | #endif 22 | 23 | 24 | #if 0 25 | namespace illumina 26 | { 27 | namespace interop 28 | { 29 | namespace util 30 | { 31 | 32 | 33 | /** Create a fixed size integer of any size 34 | */ 35 | template 36 | struct fixed_integer 37 | { 38 | enum{ 39 | /** Size of integer in bytes */ 40 | byte_count=N/8, 41 | /** Size of integer in bits */ 42 | bit_count=N 43 | }; 44 | /** Conversion to standard integer type 45 | * 46 | * @return integer type 47 | */ 48 | operator T()const 49 | { 50 | return convert(data); 51 | } 52 | /** Convert binary data to integer 53 | * 54 | * @param pdata pointer to byte array 55 | * @return integer type 56 | */ 57 | static T convert(char* pdata) 58 | { 59 | return pdata[byte_count-1] << (bit_count-8) | fixed_integer::convert(pdata); 60 | } 61 | /** Byte array */ 62 | char data[byte_count]; 63 | }; 64 | /** Create a fixed size integer of any size 65 | * 66 | * Specialization for single byte. 67 | */ 68 | template 69 | struct fixed_integer 70 | { 71 | enum{ 72 | /** Size of integer in bytes */ 73 | byte_count=1, 74 | /** Size of integer in bits */ 75 | bit_count=8 76 | }; 77 | /** Conversion to standard integer type 78 | * 79 | * @return integer type 80 | */ 81 | operator T()const 82 | { 83 | return data; 84 | } 85 | /** Convert binary data to integer 86 | * 87 | * @param pdata pointer to byte array 88 | * @return integer type 89 | */ 90 | static T convert(char* pdata) 91 | { 92 | return pdata[0]; 93 | } 94 | /** Byte */ 95 | char data; 96 | }; 97 | /** Create a fixed size integer of any size 98 | * 99 | * Specialization for no data 100 | */ 101 | template 102 | struct fixed_integer{}; 103 | 104 | 105 | } 106 | } 107 | } 108 | 109 | namespace std 110 | { 111 | /** 16-bit unsigned integer */ 112 | typedef unsigned int16_t uint16_t; 113 | /** 32-bit unsigned integer */ 114 | typedef unsigned int uint32_t; 115 | /** 64-bit unsigned integer */ 116 | typedef unsigned long long uint64_t; 117 | } 118 | #endif 119 | 120 | 121 | -------------------------------------------------------------------------------- /interop/util/filesystem.h: -------------------------------------------------------------------------------- 1 | /** Filesystem utility functions 2 | * 3 | * This header provides facilities to manipulate files, directories and the paths that identify them. 4 | * 5 | * @file 6 | * @date 8/9/15 7 | * @version 1.0 8 | * @copyright GNU Public License. 9 | */ 10 | #pragma once 11 | 12 | #include 13 | #include "interop/util/cstdint.h" 14 | 15 | namespace illumina { namespace interop { namespace io 16 | { 17 | /** Combine two directories or a directory and a filename into a file path 18 | * 19 | * This function provides a platform independent way to generate a file path. It currently supports most 20 | * operating systems include Mac OSX, Windows and Linux/Unix. 21 | * 22 | * @param path string representing a file path 23 | * @param name string representing a file or directory name to append to the end of the path 24 | * @return proper os-dependent file path 25 | */ 26 | std::string combine(const std::string& path, const std::string& name); 27 | /** Combine two directories or a directory and a filename into a file path 28 | * 29 | * This function provides a platform independent way to generate a file path. It currently supports most 30 | * operating systems include Mac OSX, Windows and Linux/Unix. 31 | * 32 | * @param path1 string representing a file path 1 33 | * @param path2 string representing a file path 2 34 | * @param path3 string representing a file path 3 35 | * @return proper os-dependent file path 36 | */ 37 | std::string combine(const std::string& path1, const std::string& path2, const std::string& path3); 38 | /** Get the file name from a file path 39 | * 40 | * @param source full file path 41 | * @return name of the file 42 | */ 43 | std::string basename(std::string const& source); 44 | /** Get the directory name from a file path 45 | * 46 | * @param source full file path 47 | * @return name of the directory 48 | */ 49 | std::string dirname(std::string source); 50 | /** Check if a file exists 51 | * 52 | * @param filename name of the file 53 | * @return true if the file exists and is readable 54 | */ 55 | bool is_file_readable(const std::string& filename); 56 | /** Create a directory 57 | * 58 | * @param path path to new directory 59 | * @param mode permissions on directory 60 | * @return true if directory was created 61 | */ 62 | bool mkdir(const std::string& path, const int mode=0733); 63 | 64 | /** Get the size of a file 65 | * 66 | * This should be more efficient than opening a file and seeking the end. 67 | * 68 | * @param path path to the target file 69 | * @return size of the file or -1 if the operation failed 70 | */ 71 | ::int64_t file_size(const std::string& path); 72 | }}} 73 | 74 | 75 | -------------------------------------------------------------------------------- /interop/io/format/default_layout.h: -------------------------------------------------------------------------------- 1 | /** Default layout for shared functions 2 | * 3 | * @file 4 | * @date 8/15/15 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include "interop/io/format/map_io.h" 13 | 14 | namespace illumina { namespace interop { namespace io 15 | { 16 | /** Define default methods and typedefs for a record layout 17 | */ 18 | template 19 | struct default_layout 20 | { 21 | enum 22 | { 23 | /** Version of the format */ 24 | VERSION = V, 25 | /** Flag indicating whether metric is split into multiple records in the InterOp file */ 26 | MULTI_RECORD=MultiRecord, 27 | /** Flag to indicate the format is no longer supported */ 28 | IS_DEPRECATED=Deprecated 29 | }; 30 | /** Define a record size type */ 31 | typedef ::uint8_t record_size_t; 32 | /** Define a version type */ 33 | typedef ::uint8_t version_t; 34 | 35 | /** Map reading/writing a header to a stream 36 | * 37 | * Does nothing 38 | * 39 | * @return 0 40 | */ 41 | template 42 | static std::streamsize map_stream_for_header(Stream &, Header &) 43 | { 44 | return 0; 45 | } 46 | 47 | /** Map reading/writing the record size to the stream 48 | * 49 | * @param stream input/output stream 50 | * @param record_size size of the record 51 | * @return size of the record 52 | */ 53 | template 54 | static RecordSize map_stream_record_size(Stream &stream, RecordSize record_size) 55 | { 56 | stream_map(stream, record_size); 57 | return record_size; 58 | } 59 | /** Skip inserting this metric into the metric set 60 | * 61 | * This function was originally added to skip control records in tile metrics. 62 | * 63 | * @param metric metric to check 64 | * @return true, if the metric id is 0 65 | */ 66 | template 67 | static bool skip_metric(const Metric& metric) 68 | { 69 | return metric.id() == 0; 70 | } 71 | /** Skip inserting this metric into the metric set 72 | * 73 | * This function was originally added to skip control records in tile metrics. 74 | * 75 | * @param id metric to check 76 | * @return true, if the metric id is 0 77 | */ 78 | template 79 | static bool is_valid(const LayoutId& id) 80 | { 81 | return id.is_valid(); 82 | } 83 | }; 84 | }}} 85 | 86 | 87 | -------------------------------------------------------------------------------- /src/tests/csharp/logic/PlotQScoreHeatmap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using System.IO; 4 | using Illumina.InterOp.RunMetrics; 5 | using Illumina.InterOp.Plot; 6 | using Illumina.InterOp.Metrics; 7 | using Illumina.InterOp.Run; 8 | using Illumina.InterOp.Comm; 9 | 10 | namespace Illumina.InterOp.Interop.UnitTest 11 | { 12 | /// 13 | /// Test plotting q-score heat map 14 | /// 15 | public class PlotQScoreHeatmap 16 | { 17 | /// 18 | /// Test plotting q-score heat map 19 | /// 20 | [Test] 21 | public void Heatmap() 22 | { 23 | int[] tmp = new int[]{ 24 | 6,34,1,7,2,10,20,25,30,35,40,9,19,24,29,34,39,40,2,14,21,27,32,36,40 25 | ,7,0,90,4,1,0,0,0,0,0,-70,22,4,0,-81,-49,1,0,-68,16,0,0,78,-86,42,0,0,0,0,0,0,0,0,0 26 | ,7,0,90,4,2,0,0,0,0,0,75,-81,3,0,-96,-81,0,0,76,4,0,0,112,62,44,0,0,0,0,0,0,0,0,0 27 | ,7,0,90,4,3,0,0,0,0,0,-80,60,3,0,-74,-46,0,0,-85,1,0,0,-106,-112,44,0,0,0,0,0,0,0,0,0 28 | }; 29 | byte[] expected_binary_data = new byte[tmp.Length]; 30 | for(int i=0;i 26 | R call_adapter(const T& obj, P2 param1, R (T::*func )(P1)const) 27 | { 28 | return (obj.*func)(param1); 29 | } 30 | /** Function interface for method call with single dummy parameter 31 | * 32 | * @note This is necessary because you cannot pass anything into an function that expects no arguments, not even void 33 | * 34 | * @param obj object corresponding to the method 35 | * @param func pointer to member function 36 | * @return functor wrapper 37 | */ 38 | template 39 | R call_adapter(const T& obj, P1, R (T::*func )()const) 40 | { 41 | return (obj.*func)(); 42 | } 43 | 44 | 45 | }}}} 46 | 47 | 48 | /** This macro maps an enum to a string/enum pair */ 49 | #define INTEROP_TUPLE7(X, Ignore1, Ignore2, Ignore3, Ignore4, Ignore5, Ignored6) name_type_pair_t(#X, model::table:: X##Column), 50 | namespace illumina { namespace interop { namespace constants { 51 | 52 | /** Specialization that maps imaging column types to a string */ 53 | template<> 54 | class enumeration_string_mapping 55 | { 56 | typedef std::pair name_type_pair_t; 57 | public: 58 | /** Pass an array of string, enum pairs and its length to the given function 59 | * 60 | * @param func pointer to a function that takes an array of string/enum pairs as a parameter 61 | * @return the value returned by the given function (in the case of `parse` and `to_string` the return value is a singleton) 62 | */ 63 | template 64 | static R setup(F func) 65 | { 66 | static const name_type_pair_t name_types[] = {INTEROP_IMAGING_COLUMN_TYPES name_type_pair_t("Dummy", model::table::ImagingColumnCount)}; 67 | return func(name_types, util::length_of(name_types)); 68 | } 69 | }; 70 | }}} 71 | #undef INTEROP_TUPLE7 // Reuse this for another conversion 72 | 73 | -------------------------------------------------------------------------------- /interop/model/summary/surface_summary.h: -------------------------------------------------------------------------------- 1 | /** Summary statistics compiled by surface 2 | * 3 | * @file 4 | * @date 9/27/16 5 | * @version 1.0 6 | * @copyright GNU Public License. 7 | */ 8 | #pragma once 9 | 10 | #include "interop/model/summary/stat_summary.h" 11 | #include "interop/io/format/generic_layout.h" 12 | 13 | namespace illumina { namespace interop { namespace model { namespace summary 14 | { 15 | 16 | /** Summary statistics compiled by surface 17 | * 18 | * @note The reported standard deviation is always between tiles, not cycles. For metrics like error metrics, 19 | * the mean over all cycles is used for each tile, before calculating the standard deviation. 20 | * 21 | */ 22 | class surface_summary : public stat_summary 23 | { 24 | public: 25 | /** Collection of metric statistics type */ 26 | typedef metric_stat metric_stat_t; 27 | public: 28 | /** Constructor 29 | * 30 | * @param surface surface number 31 | * @param channel_count number of channels 32 | */ 33 | surface_summary(const size_t surface = 0, const size_t channel_count=0) : 34 | stat_summary(channel_count), 35 | m_surface(surface), 36 | m_tile_count(0) 37 | { 38 | } 39 | 40 | public: 41 | /** @defgroup surface_summary Read/Lane summary 42 | * 43 | * Summary of key metrics in each read/lane/surface 44 | * 45 | * @ingroup read_summary 46 | * @ref illumina::interop::model::summary::surface_summary "See full class description" 47 | * @ref illumina::interop::model::summary::stat_summary "See full class description" 48 | * @{ 49 | */ 50 | /** Get surface number 51 | * 52 | * @return surface number 53 | */ 54 | size_t surface() const 55 | { 56 | return m_surface; 57 | } 58 | /** Get number of tiles on the surface 59 | * 60 | * @return number of tiles on the surface 61 | */ 62 | size_t tile_count() const 63 | { 64 | return m_tile_count; 65 | } 66 | /** @} */ 67 | 68 | public: 69 | /** Set surface number 70 | * 71 | * @param val surface number 72 | */ 73 | void surface(const size_t val) 74 | { 75 | m_surface = val; 76 | } 77 | /** Set number of tiles on the surface 78 | * 79 | * @param val number of tiles in the surface 80 | */ 81 | void tile_count(const size_t val) 82 | { 83 | m_tile_count = val; 84 | } 85 | 86 | private: 87 | size_t m_surface; 88 | size_t m_tile_count; 89 | template 90 | friend struct io::generic_layout; 91 | }; 92 | 93 | }}}} 94 | 95 | -------------------------------------------------------------------------------- /src/tests/csharp/logic/PlotFlowcellMap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using System.IO; 4 | using Illumina.InterOp.RunMetrics; 5 | using Illumina.InterOp.Plot; 6 | using Illumina.InterOp.Metrics; 7 | using Illumina.InterOp.Run; 8 | using Illumina.InterOp.Comm; 9 | 10 | namespace Illumina.InterOp.Interop.UnitTest 11 | { 12 | /// 13 | /// Test plotting q-score flowcell map 14 | /// 15 | public class FlowcellMap 16 | { 17 | /// 18 | /// Test plotting q-score flowcell map 19 | /// 20 | [Test] 21 | public void PlotFlowcellMap() 22 | { 23 | int[] tmp = new int[]{ 24 | 6,34,1,7,2,10,20,25,30,35,40,9,19,24,29,34,39,40,2,14,21,27,32,36,40 25 | ,7,0,90,4,1,0,0,0,0,0,-70,22,4,0,-81,-49,1,0,-68,16,0,0,78,-86,42,0,0,0,0,0,0,0,0,0 26 | ,7,0,90,4,2,0,0,0,0,0,75,-81,3,0,-96,-81,0,0,76,4,0,0,112,62,44,0,0,0,0,0,0,0,0,0 27 | ,7,0,90,4,3,0,0,0,0,0,-80,60,3,0,-74,-46,0,0,-85,1,0,0,-106,-112,44,0,0,0,0,0,0,0,0,0 28 | }; 29 | byte[] expected_binary_data = new byte[tmp.Length]; 30 | for(int i=0;i 55 | /// Test whether you can load metrics specific to flowcell layout 56 | /// 57 | [Test] 58 | public void TestListFlowMetrics() 59 | { 60 | uchar_vector interopsToLoad = new uchar_vector(); 61 | c_csharp_run_metrics.list_analysis_metrics_to_load(interopsToLoad); 62 | } 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /interop/util/unique_ptr.h: -------------------------------------------------------------------------------- 1 | /** Back port of unique_ptr from c++11 2 | * 3 | * 4 | * @file 5 | * @date 8/6/2015 6 | * @version 1.0 7 | * @copyright GNU Public License. 8 | */ 9 | 10 | #pragma once 11 | #include "interop/config.h" 12 | 13 | 14 | 15 | #if defined(__cplusplus) && __cplusplus < 201103L && (!defined(_MSC_VER) || _MSC_VER < 1600) && !defined(HAVE_UNIQUE_PTR) 16 | namespace stdbp 17 | { 18 | /** Memory management for a unique pointer 19 | */ 20 | template 21 | class unique_ptr 22 | { 23 | public: 24 | /** Constructor 25 | * 26 | * @param ptr pointer to object 27 | */ 28 | unique_ptr(T* ptr=0) : m_ptr(ptr){} 29 | /** Destructor 30 | * 31 | * Delete the pointer to the object, freeing memory 32 | */ 33 | ~unique_ptr(){delete m_ptr;} 34 | /** Copy constructor 35 | * 36 | * Move the pointer from one unique pointer to the next 37 | * 38 | * @param up unique pointer 39 | */ 40 | unique_ptr(const unique_ptr& up) : m_ptr(up.m_ptr){up.m_ptr = 0;} 41 | /** Assignment operator 42 | * 43 | * Move the pointer from one unique pointer to the next 44 | * 45 | * @param up unique pointer 46 | * @return this unique pointer object 47 | */ 48 | unique_ptr& operator=(const unique_ptr& up) {m_ptr=up.m_ptr;up.m_ptr = 0;return *this;} 49 | 50 | public: 51 | /** Get pointer 52 | * 53 | * @return pointer to object 54 | */ 55 | T* operator->() const {return m_ptr;} 56 | /** Get the object pointed to 57 | * 58 | * @return reference to object 59 | */ 60 | T& operator*() const{return *m_ptr;} 61 | /** Test if pointer does not equal to another pointer 62 | * 63 | * @param up unique pointer 64 | * @return true if not equal 65 | */ 66 | bool operator!=(const unique_ptr& up)const 67 | { 68 | return m_ptr != up.m_ptr; 69 | } 70 | /** Test if pointer does not equal to another pointer 71 | * 72 | * @param ptr pointer held by unique pointer 73 | * @return true if not equal 74 | */ 75 | bool operator!=(const T* ptr)const 76 | { 77 | return m_ptr != ptr; 78 | } 79 | /** Test if the unique pointer is empty 80 | * 81 | * @return true of the pointer != null 82 | */ 83 | operator bool()const 84 | { 85 | return m_ptr != 0; 86 | } 87 | 88 | private: 89 | mutable T* m_ptr; 90 | }; 91 | } 92 | #else 93 | #include 94 | namespace stdbp 95 | { 96 | template using unique_ptr = std::unique_ptr; 97 | } 98 | #endif 99 | 100 | 101 | -------------------------------------------------------------------------------- /src/tests/csharp/logic/PlotDataByLaneTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using System.IO; 4 | using Illumina.InterOp.RunMetrics; 5 | using Illumina.InterOp.Plot; 6 | using Illumina.InterOp.Metrics; 7 | using Illumina.InterOp.Run; 8 | using Illumina.InterOp.Comm; 9 | 10 | namespace Illumina.InterOp.Interop.UnitTest 11 | { 12 | /// 13 | /// Test plotting data by lane 14 | /// 15 | public class PlotDataByLaneTest 16 | { 17 | /// 18 | /// Test plotting ClusterCountPF by lane 19 | /// 20 | [Test] 21 | public void IntensityTest() 22 | { 23 | int[] tmp = new int[]{2,10 24 | ,7,0,90,4,100,0,-67,-66,15,74 25 | ,7,0,90,4,102,0,74,122,-59,74 26 | ,7,0,90,4,101,0,12,94,-115,73 27 | ,7,0,90,4,103,0,16,54,66,74 28 | ,7,0,90,4,-56,0,82,-11,80,58 29 | ,7,0,90,4,-55,0,-62,42,-99,58 30 | ,7,0,90,4,44,1,-102,113,39,64 31 | ,7,0,-66,4,100,0,-67,-66,15,74 32 | ,7,0,-66,4,102,0,74,122,-59,74 33 | ,7,0,-66,4,101,0,46,103,-113,73 34 | ,7,0,-66,4,103,0,0,2,69,74 35 | ,7,0,-66,4,-56,0,21,111,-87,58 36 | ,7,0,-66,4,-55,0,-86,29,-79,58 37 | ,7,0,-66,4,44,1,6,-42,39,64 38 | ,7,0,66,8,100,0,-67,-66,15,74 39 | ,7,0,66,8,102,0,74,122,-59,74 40 | ,7,0,66,8,101,0,67,-26,-109,73 41 | ,7,0,66,8,103,0,92,47,75,74 42 | ,7,0,66,8,-56,0,123,22,-100,58 43 | ,7,0,66,8,-55,0,85,6,115,58 44 | ,7,0,66,8,44,1,57,97,31,64 45 | }; 46 | byte[] expected_binary_data = new byte[tmp.Length]; 47 | for(int i=0;i