[med-svn] [ngs-sdk] 01/02: Imported Upstream version 1.0.0

Andreas Tille tille at debian.org
Fri Oct 24 14:47:32 UTC 2014


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository ngs-sdk.

commit 44b0e62f3e5b354111c05bca4e5db70f236cfe71
Author: Andreas Tille <tille at debian.org>
Date:   Fri Oct 24 16:46:06 2014 +0200

    Imported Upstream version 1.0.0
---
 .gitignore                                         |    4 +
 README.md                                          |    8 +
 configure                                          |   36 +
 ngs-java/.gitignore                                |    7 +
 ngs-java/Makefile                                  |   44 +
 ngs-java/Makefile.java                             |  246 +++
 ngs-java/Makefile.rules                            |   72 +
 ngs-java/configure                                 |   45 +
 ngs-java/examples/Makefile                         |   64 +
 ngs-java/examples/examples/AlignSliceTest.java     |   89 +
 ngs-java/examples/examples/AlignTest.java          |   91 +
 ngs-java/examples/examples/FragTest.java           |   93 +
 ngs-java/examples/examples/RefTest.java            |   79 +
 ngs-java/gov/nih/nlm/ncbi/ngs/FileCreator.java     |   34 +
 ngs-java/gov/nih/nlm/ncbi/ngs/HttpManager.java     |  159 ++
 ngs-java/gov/nih/nlm/ncbi/ngs/LibManager.java      |  500 +++++
 ngs-java/gov/nih/nlm/ncbi/ngs/LibPathIterator.java |  579 ++++++
 ngs-java/gov/nih/nlm/ncbi/ngs/Logger.java          |   74 +
 ngs-java/gov/nih/nlm/ncbi/ngs/Makefile             |  110 ++
 ngs-java/gov/nih/nlm/ncbi/ngs/Manager.java         |  112 ++
 ngs-java/gov/nih/nlm/ncbi/ngs/NGS.java             |   56 +
 ngs-java/gov/nih/nlm/ncbi/ngs/TestyTheBear.java    |  383 ++++
 ngs-java/konfigure.perl                            | 1210 ++++++++++++
 ngs-java/ngs/Alignment.java                        |  217 +++
 ngs-java/ngs/AlignmentIterator.java                |   45 +
 ngs-java/ngs/ErrorMsg.java                         |   62 +
 ngs-java/ngs/Fragment.java                         |   94 +
 ngs-java/ngs/FragmentIterator.java                 |   44 +
 ngs-java/ngs/Pileup.java                           |   74 +
 ngs-java/ngs/PileupEvent.java                      |  154 ++
 ngs-java/ngs/PileupEventIterator.java              |   45 +
 ngs-java/ngs/PileupIterator.java                   |   44 +
 ngs-java/ngs/Read.java                             |  138 ++
 ngs-java/ngs/ReadCollection.java                   |  243 +++
 ngs-java/ngs/ReadGroup.java                        |   54 +
 ngs-java/ngs/ReadGroupIterator.java                |   45 +
 ngs-java/ngs/ReadIterator.java                     |   46 +
 ngs-java/ngs/Reference.java                        |  186 ++
 ngs-java/ngs/ReferenceIterator.java                |   44 +
 ngs-java/ngs/Statistics.java                       |   95 +
 ngs-java/ngs/itf/AlignmentIteratorItf.java         |   93 +
 ngs-java/ngs/itf/AlignmentItf.java                 |  417 +++++
 ngs-java/ngs/itf/FragmentIteratorItf.java          |   89 +
 ngs-java/ngs/itf/FragmentItf.java                  |  158 ++
 ngs-java/ngs/itf/PileupEventIteratorItf.java       |   92 +
 ngs-java/ngs/itf/PileupEventItf.java               |  256 +++
 ngs-java/ngs/itf/PileupIteratorItf.java            |   91 +
 ngs-java/ngs/itf/PileupItf.java                    |  141 ++
 ngs-java/ngs/itf/ReadCollectionItf.java            |  382 ++++
 ngs-java/ngs/itf/ReadGroupIteratorItf.java         |   89 +
 ngs-java/ngs/itf/ReadGroupItf.java                 |  162 ++
 ngs-java/ngs/itf/ReadIteratorItf.java              |   91 +
 ngs-java/ngs/itf/ReadItf.java                      |  302 +++
 ngs-java/ngs/itf/Refcount.java                     |   78 +
 ngs-java/ngs/itf/ReferenceIteratorItf.java         |   89 +
 ngs-java/ngs/itf/ReferenceItf.java                 |  318 ++++
 ngs-java/ngs/itf/StatisticsItf.java                |  112 ++
 ngs-java/os-arch.perl                              |   22 +
 ngs-java/os-arch.pm                                |  100 +
 ngs-java/package.pm                                |   29 +
 ngs-java/win-configure.bat                         |    2 +
 ngs-python/.gitignore                              |    3 +
 ngs-python/Makefile                                |   43 +
 ngs-python/Makefile.python                         |   79 +
 ngs-python/Makefile.rules                          |   72 +
 ngs-python/configure                               |   45 +
 ngs-python/konfigure.perl                          | 1210 ++++++++++++
 ngs-python/ngs/Alignment.py                        |  166 ++
 ngs-python/ngs/AlignmentIterator.py                |   42 +
 ngs-python/ngs/ErrorMsg.py                         |   52 +
 ngs-python/ngs/Fragment.py                         |   58 +
 ngs-python/ngs/FragmentIterator.py                 |   39 +
 ngs-python/ngs/LibManager.py                       |  206 +++
 ngs-python/ngs/Pileup.py                           |   64 +
 ngs-python/ngs/PileupEvent.py                      |  120 ++
 ngs-python/ngs/PileupEventIterator.py              |   42 +
 ngs-python/ngs/PileupIterator.py                   |   41 +
 ngs-python/ngs/Read.py                             |   86 +
 ngs-python/ngs/ReadCollection.py                   |  244 +++
 ngs-python/ngs/ReadGroup.py                        |   51 +
 ngs-python/ngs/ReadGroupIterator.py                |   42 +
 ngs-python/ngs/ReadIterator.py                     |   43 +
 ngs-python/ngs/Refcount.py                         |   59 +
 ngs-python/ngs/Reference.py                        |  152 ++
 ngs-python/ngs/ReferenceIterator.py                |   42 +
 ngs-python/ngs/Statistics.py                       |  102 +
 ngs-python/ngs/String.py                           |  154 ++
 ngs-python/ngs/__init__.py                         |   43 +
 ngs-python/os-arch.perl                            |   22 +
 ngs-python/os-arch.pm                              |  100 +
 ngs-python/package.pm                              |   42 +
 ngs-python/setup.py                                |   23 +
 ngs-python/win-configure.bat                       |    1 +
 ngs-sdk/.gitignore                                 |    5 +
 ngs-sdk/CONTENTS.txt                               |   44 +
 ngs-sdk/Makefile                                   |   48 +
 ngs-sdk/Makefile.install                           |  108 ++
 ngs-sdk/Makefile.libs                              |  123 ++
 ngs-sdk/Makefile.rules                             |   72 +
 ngs-sdk/adapter/AlignmentItf.cpp                   |  442 +++++
 ngs-sdk/adapter/ErrBlock.cpp                       |  106 ++
 ngs-sdk/adapter/ErrBlock.hpp                       |   73 +
 ngs-sdk/adapter/ErrorMsg.cpp                       |   97 +
 ngs-sdk/adapter/FragmentItf.cpp                    |  125 ++
 ngs-sdk/adapter/Makefile                           |   78 +
 ngs-sdk/adapter/PileupEventItf.cpp                 |  302 +++
 ngs-sdk/adapter/PileupItf.cpp                      |  139 ++
 ngs-sdk/adapter/ReadCollectionItf.cpp              |  290 +++
 ngs-sdk/adapter/ReadGroupItf.cpp                   |  107 ++
 ngs-sdk/adapter/ReadItf.cpp                        |  189 ++
 ngs-sdk/adapter/Refcount.cpp                       |  135 ++
 ngs-sdk/adapter/ReferenceItf.cpp                   |  267 +++
 ngs-sdk/adapter/StatisticsItf.cpp                  |  154 ++
 ngs-sdk/adapter/StringItf.cpp                      |  146 ++
 ngs-sdk/adapter/unix/i386/atomic32.h               |  104 ++
 ngs-sdk/adapter/unix/x86_64/atomic32.h             |  101 +
 ngs-sdk/configure                                  |   45 +
 ngs-sdk/dispatch/AlignmentItf.cpp                  |  537 ++++++
 ngs-sdk/dispatch/ErrBlock.cpp                      |   43 +
 ngs-sdk/dispatch/ErrorMsg.cpp                      |   96 +
 ngs-sdk/dispatch/FragmentItf.cpp                   |  164 ++
 ngs-sdk/dispatch/Makefile                          |   73 +
 ngs-sdk/dispatch/PileupEventItf.cpp                |  362 ++++
 ngs-sdk/dispatch/PileupItf.cpp                     |  162 ++
 ngs-sdk/dispatch/ReadCollectionItf.cpp             |  365 ++++
 ngs-sdk/dispatch/ReadGroupItf.cpp                  |  120 ++
 ngs-sdk/dispatch/ReadItf.cpp                       |  244 +++
 ngs-sdk/dispatch/Refcount.cpp                      |  123 ++
 ngs-sdk/dispatch/ReferenceItf.cpp                  |  337 ++++
 ngs-sdk/dispatch/StatisticsItf.cpp                 |  193 ++
 ngs-sdk/dispatch/StringItf.cpp                     |  156 ++
 ngs-sdk/dispatch/VTable.cpp                        |  144 ++
 ngs-sdk/examples/.gitignore                        |    3 +
 ngs-sdk/examples/AlignSliceTest.cpp                |   98 +
 ngs-sdk/examples/AlignTest.cpp                     |  103 ++
 ngs-sdk/examples/FragTest.cpp                      |  105 ++
 ngs-sdk/examples/Makefile                          |  102 +
 ngs-sdk/examples/Makefile.config                   |   85 +
 ngs-sdk/konfigure.perl                             | 1210 ++++++++++++
 ngs-sdk/language/Makefile                          |   51 +
 ngs-sdk/language/c++/Alignment.cpp                 |   55 +
 ngs-sdk/language/c++/AlignmentIterator.cpp         |   55 +
 ngs-sdk/language/c++/Fragment.cpp                  |   62 +
 ngs-sdk/language/c++/FragmentIterator.cpp          |   56 +
 ngs-sdk/language/c++/Makefile                      |   77 +
 ngs-sdk/language/c++/Pileup.cpp                    |   61 +
 ngs-sdk/language/c++/PileupEvent.cpp               |   62 +
 ngs-sdk/language/c++/PileupEventIterator.cpp       |   55 +
 ngs-sdk/language/c++/PileupIterator.cpp            |   55 +
 ngs-sdk/language/c++/Read.cpp                      |   56 +
 ngs-sdk/language/c++/ReadCollection.cpp            |   69 +
 ngs-sdk/language/c++/ReadGroup.cpp                 |   69 +
 ngs-sdk/language/c++/ReadGroupIterator.cpp         |   56 +
 ngs-sdk/language/c++/ReadIterator.cpp              |   56 +
 ngs-sdk/language/c++/Refcount.cpp                  |  123 ++
 ngs-sdk/language/c++/Reference.cpp                 |   63 +
 ngs-sdk/language/c++/ReferenceIterator.cpp         |   56 +
 ngs-sdk/language/c++/Statistics.cpp                |   60 +
 ngs-sdk/language/c++/StringRef.cpp                 |  115 ++
 ngs-sdk/language/java/.gitignore                   |    1 +
 ngs-sdk/language/java/Makefile                     |   76 +
 ngs-sdk/language/java/jni.h                        | 1944 ++++++++++++++++++++
 ngs-sdk/language/java/jni_AlignmentIteratorItf.cpp |   72 +
 ngs-sdk/language/java/jni_AlignmentIteratorItf.h   |   21 +
 ngs-sdk/language/java/jni_AlignmentItf.cpp         |  774 ++++++++
 ngs-sdk/language/java/jni_AlignmentItf.h           |  213 +++
 ngs-sdk/language/java/jni_ErrorMsg.cpp             |  142 ++
 ngs-sdk/language/java/jni_ErrorMsg.hpp             |  112 ++
 ngs-sdk/language/java/jni_FragmentItf.cpp          |  133 ++
 ngs-sdk/language/java/jni_FragmentItf.h            |   37 +
 .../language/java/jni_PileupEventIteratorItf.cpp   |   71 +
 ngs-sdk/language/java/jni_PileupEventIteratorItf.h |   21 +
 ngs-sdk/language/java/jni_PileupEventItf.cpp       |  447 +++++
 ngs-sdk/language/java/jni_PileupEventItf.h         |  125 ++
 ngs-sdk/language/java/jni_PileupIteratorItf.cpp    |   70 +
 ngs-sdk/language/java/jni_PileupIteratorItf.h      |   21 +
 ngs-sdk/language/java/jni_PileupItf.cpp            |  164 ++
 ngs-sdk/language/java/jni_PileupItf.h              |   45 +
 ngs-sdk/language/java/jni_ReadCollectionItf.cpp    |  492 +++++
 ngs-sdk/language/java/jni_ReadCollectionItf.h      |  117 ++
 ngs-sdk/language/java/jni_ReadGroupIteratorItf.cpp |   69 +
 ngs-sdk/language/java/jni_ReadGroupIteratorItf.h   |   21 +
 ngs-sdk/language/java/jni_ReadGroupItf.cpp         |  153 ++
 ngs-sdk/language/java/jni_ReadGroupItf.h           |   29 +
 ngs-sdk/language/java/jni_ReadIteratorItf.cpp      |   70 +
 ngs-sdk/language/java/jni_ReadIteratorItf.h        |   21 +
 ngs-sdk/language/java/jni_ReadItf.cpp              |  381 ++++
 ngs-sdk/language/java/jni_ReadItf.h                |  101 +
 ngs-sdk/language/java/jni_Refcount.cpp             |  137 ++
 ngs-sdk/language/java/jni_Refcount.h               |   37 +
 ngs-sdk/language/java/jni_ReferenceIteratorItf.cpp |   71 +
 ngs-sdk/language/java/jni_ReferenceIteratorItf.h   |   21 +
 ngs-sdk/language/java/jni_ReferenceItf.cpp         |  387 ++++
 ngs-sdk/language/java/jni_ReferenceItf.h           |  109 ++
 ngs-sdk/language/java/jni_StatisticsItf.cpp        |  267 +++
 ngs-sdk/language/java/jni_StatisticsItf.h          |   61 +
 ngs-sdk/language/java/jni_String.cpp               |  161 ++
 ngs-sdk/language/java/jni_String.hpp               |   84 +
 ngs-sdk/language/java/jni_md.h                     |   28 +
 ngs-sdk/language/java/libngs-java-ncbi.vers        |    1 +
 ngs-sdk/language/python/Makefile                   |   77 +
 .../language/python/py_AlignmentIteratorItf.cpp    |   32 +
 ngs-sdk/language/python/py_AlignmentIteratorItf.h  |   40 +
 ngs-sdk/language/python/py_AlignmentItf.cpp        |   63 +
 ngs-sdk/language/python/py_AlignmentItf.h          |   68 +
 ngs-sdk/language/python/py_ErrorMsg.cpp            |   27 +
 ngs-sdk/language/python/py_ErrorMsg.hpp            |  330 ++++
 ngs-sdk/language/python/py_FragmentIteratorItf.cpp |   32 +
 ngs-sdk/language/python/py_FragmentIteratorItf.h   |   40 +
 ngs-sdk/language/python/py_FragmentItf.cpp         |   34 +
 ngs-sdk/language/python/py_FragmentItf.h           |   44 +
 .../language/python/py_PileupEventIteratorItf.cpp  |   32 +
 .../language/python/py_PileupEventIteratorItf.h    |   40 +
 ngs-sdk/language/python/py_PileupEventItf.cpp      |   45 +
 ngs-sdk/language/python/py_PileupEventItf.h        |   53 +
 ngs-sdk/language/python/py_PileupIteratorItf.cpp   |   32 +
 ngs-sdk/language/python/py_PileupIteratorItf.h     |   40 +
 ngs-sdk/language/python/py_PileupItf.cpp           |   35 +
 ngs-sdk/language/python/py_PileupItf.h             |   43 +
 ngs-sdk/language/python/py_ReadCollectionItf.cpp   |   44 +
 ngs-sdk/language/python/py_ReadCollectionItf.h     |   52 +
 .../language/python/py_ReadGroupIteratorItf.cpp    |   32 +
 ngs-sdk/language/python/py_ReadGroupIteratorItf.h  |   40 +
 ngs-sdk/language/python/py_ReadGroupItf.cpp        |   38 +
 ngs-sdk/language/python/py_ReadGroupItf.h          |   47 +
 ngs-sdk/language/python/py_ReadIteratorItf.cpp     |   32 +
 ngs-sdk/language/python/py_ReadIteratorItf.h       |   40 +
 ngs-sdk/language/python/py_ReadItf.cpp             |   44 +
 ngs-sdk/language/python/py_ReadItf.h               |   53 +
 ngs-sdk/language/python/py_Refcount.cpp            |  105 ++
 ngs-sdk/language/python/py_Refcount.h              |   42 +
 .../language/python/py_ReferenceIteratorItf.cpp    |   32 +
 ngs-sdk/language/python/py_ReferenceIteratorItf.h  |   40 +
 ngs-sdk/language/python/py_ReferenceItf.cpp        |   42 +
 ngs-sdk/language/python/py_ReferenceItf.h          |   50 +
 ngs-sdk/language/python/py_StatisticsItf.cpp       |   37 +
 ngs-sdk/language/python/py_StatisticsItf.h         |   45 +
 ngs-sdk/language/python/py_StringItf.cpp           |   48 +
 ngs-sdk/language/python/py_StringItf.h             |   43 +
 ngs-sdk/language/python/py_ngs_defs.h              |   39 +
 ngs-sdk/ngs/Alignment.hpp                          |  245 +++
 ngs-sdk/ngs/AlignmentIterator.hpp                  |   85 +
 ngs-sdk/ngs/ErrorMsg.hpp                           |   34 +
 ngs-sdk/ngs/Fragment.hpp                           |  126 ++
 ngs-sdk/ngs/FragmentIterator.hpp                   |   84 +
 ngs-sdk/ngs/Pileup.hpp                             |  117 ++
 ngs-sdk/ngs/PileupEvent.hpp                        |  194 ++
 ngs-sdk/ngs/PileupEventIterator.hpp                |   84 +
 ngs-sdk/ngs/PileupIterator.hpp                     |   84 +
 ngs-sdk/ngs/Read.hpp                               |  148 ++
 ngs-sdk/ngs/ReadCollection.hpp                     |  210 +++
 ngs-sdk/ngs/ReadGroup.hpp                          |   99 +
 ngs-sdk/ngs/ReadGroupIterator.hpp                  |   85 +
 ngs-sdk/ngs/ReadIterator.hpp                       |   85 +
 ngs-sdk/ngs/Reference.hpp                          |  190 ++
 ngs-sdk/ngs/ReferenceIterator.hpp                  |   84 +
 ngs-sdk/ngs/Statistics.hpp                         |  136 ++
 ngs-sdk/ngs/StringRef.hpp                          |  129 ++
 ngs-sdk/ngs/adapter/AlignmentItf.hpp               |  128 ++
 ngs-sdk/ngs/adapter/ErrorMsg.hpp                   |   90 +
 ngs-sdk/ngs/adapter/FragmentItf.hpp                |   78 +
 ngs-sdk/ngs/adapter/PileupEventItf.hpp             |   96 +
 ngs-sdk/ngs/adapter/PileupItf.hpp                  |   77 +
 ngs-sdk/ngs/adapter/ReadCollectionItf.hpp          |  106 ++
 ngs-sdk/ngs/adapter/ReadGroupItf.hpp               |   73 +
 ngs-sdk/ngs/adapter/ReadItf.hpp                    |   95 +
 ngs-sdk/ngs/adapter/Refcount.hpp                   |  131 ++
 ngs-sdk/ngs/adapter/ReferenceItf.hpp               |   99 +
 ngs-sdk/ngs/adapter/StatisticsItf.hpp              |   78 +
 ngs-sdk/ngs/adapter/StringItf.hpp                  |   88 +
 ngs-sdk/ngs/adapter/defs.h                         |   64 +
 ngs-sdk/ngs/defs.h                                 |   43 +
 ngs-sdk/ngs/inl/Alignment.hpp                      |  164 ++
 ngs-sdk/ngs/inl/AlignmentIterator.hpp              |   59 +
 ngs-sdk/ngs/inl/Fragment.hpp                       |   84 +
 ngs-sdk/ngs/inl/FragmentIterator.hpp               |   54 +
 ngs-sdk/ngs/inl/Pileup.hpp                         |   68 +
 ngs-sdk/ngs/inl/PileupEvent.hpp                    |  118 ++
 ngs-sdk/ngs/inl/PileupEventIterator.hpp            |   52 +
 ngs-sdk/ngs/inl/PileupIterator.hpp                 |   52 +
 ngs-sdk/ngs/inl/Read.hpp                           |  108 ++
 ngs-sdk/ngs/inl/ReadCollection.hpp                 |  132 ++
 ngs-sdk/ngs/inl/ReadGroup.hpp                      |   57 +
 ngs-sdk/ngs/inl/ReadGroupIterator.hpp              |   52 +
 ngs-sdk/ngs/inl/ReadIterator.hpp                   |   55 +
 ngs-sdk/ngs/inl/Reference.hpp                      |  122 ++
 ngs-sdk/ngs/inl/ReferenceIterator.hpp              |   53 +
 ngs-sdk/ngs/inl/Statistics.hpp                     |   77 +
 ngs-sdk/ngs/inl/StringRef.hpp                      |   68 +
 ngs-sdk/ngs/itf/AlignmentItf.h                     |   82 +
 ngs-sdk/ngs/itf/AlignmentItf.hpp                   |  101 +
 ngs-sdk/ngs/itf/ErrBlock.h                         |   60 +
 ngs-sdk/ngs/itf/ErrBlock.hpp                       |   67 +
 ngs-sdk/ngs/itf/ErrorMsg.hpp                       |   94 +
 ngs-sdk/ngs/itf/FragmentItf.h                      |   63 +
 ngs-sdk/ngs/itf/FragmentItf.hpp                    |   72 +
 ngs-sdk/ngs/itf/PileupEventItf.h                   |   80 +
 ngs-sdk/ngs/itf/PileupEventItf.hpp                 |   87 +
 ngs-sdk/ngs/itf/PileupItf.h                        |   72 +
 ngs-sdk/ngs/itf/PileupItf.hpp                      |   67 +
 ngs-sdk/ngs/itf/ReadCollectionItf.h                |   84 +
 ngs-sdk/ngs/itf/ReadCollectionItf.hpp              |   87 +
 ngs-sdk/ngs/itf/ReadGroupItf.h                     |   68 +
 ngs-sdk/ngs/itf/ReadGroupItf.hpp                   |   69 +
 ngs-sdk/ngs/itf/ReadItf.h                          |   68 +
 ngs-sdk/ngs/itf/ReadItf.hpp                        |   79 +
 ngs-sdk/ngs/itf/Refcount.h                         |   60 +
 ngs-sdk/ngs/itf/Refcount.hpp                       |  122 ++
 ngs-sdk/ngs/itf/ReferenceItf.h                     |   80 +
 ngs-sdk/ngs/itf/ReferenceItf.hpp                   |   89 +
 ngs-sdk/ngs/itf/StatisticsItf.h                    |   65 +
 ngs-sdk/ngs/itf/StatisticsItf.hpp                  |   67 +
 ngs-sdk/ngs/itf/StringItf.h                        |   62 +
 ngs-sdk/ngs/itf/StringItf.hpp                      |   59 +
 ngs-sdk/ngs/itf/VTable.h                           |   98 +
 ngs-sdk/ngs/itf/VTable.hpp                         |  110 ++
 ngs-sdk/ngs/itf/defs.h                             |   80 +
 ngs-sdk/os-arch.perl                               |   22 +
 ngs-sdk/os-arch.pm                                 |  100 +
 ngs-sdk/package.pm                                 |   15 +
 ngs-sdk/test/Makefile                              |   57 +
 ngs-sdk/test/ngs-test/Makefile                     |   61 +
 ngs-sdk/test/ngs-test/main.cpp                     |  794 ++++++++
 ngs-sdk/test/test_engine/AlignmentItf.hpp          |  232 +++
 ngs-sdk/test/test_engine/Makefile                  |   64 +
 ngs-sdk/test/test_engine/PileupEventItf.hpp        |  149 ++
 ngs-sdk/test/test_engine/PileupItf.hpp             |  100 +
 ngs-sdk/test/test_engine/ReadCollectionItf.hpp     |  137 ++
 ngs-sdk/test/test_engine/ReadGroupItf.hpp          |   95 +
 ngs-sdk/test/test_engine/ReadItf.hpp               |  169 ++
 ngs-sdk/test/test_engine/ReferenceItf.hpp          |  144 ++
 ngs-sdk/test/test_engine/StatisticsItf.hpp         |   92 +
 ngs-sdk/test/test_engine/test_engine.cpp           |   58 +
 ngs-sdk/test/test_engine/test_engine.hpp           |   50 +
 ngs-sdk/win-configure.bat                          |    2 +
 ngs-sdk/win/.gitignore                             |    1 +
 ngs-sdk/win/atomic32.h                             |   77 +
 ngs-sdk/win/libadapter.vcxproj                     |  193 ++
 ngs-sdk/win/libadapter.vcxproj.filters             |   95 +
 ngs-sdk/win/libdispatch.vcxproj                    |  207 +++
 ngs-sdk/win/libdispatch.vcxproj.filters            |  143 ++
 ngs-sdk/win/libngs-c++.vcxproj                     |  179 ++
 ngs-sdk/win/libngs-c++.vcxproj.filters             |   66 +
 ngs-sdk/win/libngs.vcxproj                         |  187 ++
 ngs-sdk/win/libngs.vcxproj.filters                 |  123 ++
 ngs-sdk/win/libtest_engine.vcxproj                 |  193 ++
 ngs-sdk/win/libtest_engine.vcxproj.filters         |   47 +
 ngs-sdk/win/ngs-common.props                       |   14 +
 ngs-sdk/win/ngs-sdk.sln                            |  123 ++
 ngs-sdk/win/ngs-sdk.vcxproj                        |  213 +++
 ngs-sdk/win/ngs-sdk.vcxproj.filters                |  106 ++
 ngs-sdk/win/ngs-test.vcxproj                       |  169 ++
 ngs-sdk/win/ngs-test.vcxproj.filters               |   18 +
 ngs-sdk/win/stdbool.h                              |   46 +
 354 files changed, 42695 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..84ad061
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+ngs-sdk/win/ngs-sdk.opensdf
+ngs-sdk/win/ngs-sdk.sdf
+ngs-sdk/win/ngs-sdk.suo
+ngs-sdk/win/ipch
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b9717eb
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+ngs
+===
+
+NGS Language Bindings
+
+NGS is a new, domain-specific API for accessing reads, alignments and pileups produced from Next Generation Sequencing. The API itself is independent from any particular back-end implementation, and supports use of multiple back-ends simultaneously. It also provides a library for building new back-end "engines". The engine for accessing SRA data is contained within the sister repository ncbi-vdb.
+
+The API is currently expressed in C++, Java and Python languages. The design makes it possible to maintain a high degree of similarity between the code in one language and code in another - especially between C++ and Java.
diff --git a/configure b/configure
new file mode 100755
index 0000000..e0bcd21
--- /dev/null
+++ b/configure
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+perl -v > /dev/null 2>&1 || { echo "checking for perl... no"; echo >&2 "configure: error: perl not found."; exit 1; }
+
+for D in ngs-sdk ngs-java ngs-python
+do
+  if [ -d $D ]
+    then echo "CONFIGURING $D"
+    $D/configure $@
+    echo
+  fi
+done 
diff --git a/ngs-java/.gitignore b/ngs-java/.gitignore
new file mode 100644
index 0000000..3259482
--- /dev/null
+++ b/ngs-java/.gitignore
@@ -0,0 +1,7 @@
+Makefile.userconfig
+Makefile.config*
+user.status
+*.o
+*.class
+*.jar
+core.*
diff --git a/ngs-java/Makefile b/ngs-java/Makefile
new file mode 100644
index 0000000..3d4147c
--- /dev/null
+++ b/ngs-java/Makefile
@@ -0,0 +1,44 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# default response to "make"
+default: subtargs
+
+# the sub-targets
+SUBTARGS =  \
+	java
+
+# standard rules and phony targets
+include $(CURDIR)/Makefile.rules
+
+# rules for making java code
+# Java is given special rules because javac defies makefiles
+java: Makefile.config
+	@ $(MAKE) -f Makefile.java
+
+java_cln: Makefile.config
+	@ $(MAKE) -f Makefile.java clean
+
+java_inst: Makefile.config
+	@ $(MAKE) -f Makefile.java install
diff --git a/ngs-java/Makefile.java b/ngs-java/Makefile.java
new file mode 100644
index 0000000..12f066f
--- /dev/null
+++ b/ngs-java/Makefile.java
@@ -0,0 +1,246 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(CURDIR)
+MODPATH =
+include $(TOP)/Makefile.config
+
+INTLIBS = \
+
+# jar file containing all generated classes
+EXTLIBS =       \
+	ngs-java    \
+	ngs-examples
+
+TARGETS =      \
+	$(INTLIBS) \
+	$(EXTLIBS)
+
+copyexamples:
+	@ echo "Installing examples to $(INST_SHAREDIR)/examples-java"
+	@ mkdir -p $(INST_SHAREDIR)/examples-java
+	@ cp $(TOP)/examples/Makefile $(INST_SHAREDIR)/examples-java
+	@ cp -r $(TOP)/examples/examples $(INST_SHAREDIR)/examples-java
+    
+# if configure was able to locate where the JNI headers go
+ifdef JNIPATH
+TARGETS += ngs-jni
+endif
+
+all std: $(TARGETS)
+
+#-------------------------------------------------------------------------------
+# install
+# 
+ifeq (linux, $(OS))
+
+#fake root for debugging
+#uncomment this line and change the test for root ( see under install: ) to succeed:
+#ROOT = ~/root
+
+PROFILE_FILE = $(ROOT)/etc/profile.d/ngs-java
+JAR_TARGET = $(INST_JARDIR)/ngs-java.jar
+
+install: $(TARGETS) $(INST_JARDIR) $(INST_JARDIR)/ngs-java.jar.$(VERSION) copyexamples
+ifeq (0, $(shell id -u))
+	@ echo "Updating $(PROFILE_FILE).[c]sh"
+	@ echo -e \
+"#version $(VERSION)\n"\
+"if ! echo \$$CLASSPATH | /bin/grep -q $(JAR_TARGET)\n"\
+"then export CLASSPATH=$(JAR_TARGET):\$$CLASSPATH\n"\
+"fi" \
+        >$(PROFILE_FILE).sh && chmod 644 $(PROFILE_FILE).sh || true;
+	@ echo -e \
+"#version $(VERSION)\n"\
+"echo \$$CLASSPATH | /bin/grep -q $(JAR_TARGET)\n"\
+"if ( \$$status ) setenv CLASSPATH $(JAR_TARGET):\$$CLASSPATH\n"\
+        >$(PROFILE_FILE).csh && chmod 644 $(PROFILE_FILE).sh || true;
+	@ #TODO: check version of the files above
+    
+else
+	@ #
+	@ echo "Please add $(JAR_TARGET) to your CLASSPATH, i.e.:"
+	@ echo "      export CLASSPATH=$(JAR_TARGET):\$$CLASSPATH"    
+endif
+
+$(INST_JARDIR)/ngs-java.jar.$(VERSION): $(LIBDIR)/ngs-java.jar
+	@ echo -n "installing '$(@F)'... "
+	@ if cp $^ $@ && chmod 644 $@;                                                    \
+	  then                                                                            \
+	      rm -f $(subst $(VERSION),$(MAJVERS),$@) $(subst jar.$(VERSION),jar,$@);     \
+	      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);                              \
+	      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) $(subst jar.$(VERSION),jar,$@) ; \
+	      echo success;                                                               \
+	  else                                                                            \
+	      echo failure;                                                               \
+	      false;                                                                      \
+	  fi
+
+clean:
+	rm -rf $(LIBDIR)/ngs-java* $(CLSDIR)
+
+else
+install:
+
+endif
+
+.PHONY: default all std install $(TARGETS)
+
+#-------------------------------------------------------------------------------
+# JAVA NGS
+#
+ngs-java: $(LIBDIR) $(CLSDIR) $(LIBDIR)/ngs-java.jar
+
+# java API
+NGS_SRC =                  \
+	ErrorMsg               \
+	Statistics             \
+	Fragment               \
+	FragmentIterator       \
+	Read                   \
+	ReadIterator           \
+	ReadGroup              \
+	ReadGroupIterator      \
+	Alignment              \
+	AlignmentIterator      \
+	PileupEvent            \
+	PileupEventIterator    \
+	Pileup                 \
+	PileupIterator         \
+	Reference              \
+	ReferenceIterator      \
+	ReadCollection
+
+NGS_SRC_PATH = \
+	$(addprefix $(SRCDIR)/ngs/,$(addsuffix .java,$(NGS_SRC)))
+
+$(CLSDIR)/ngs-java-api: $(NGS_SRC_PATH)
+	$(JAVAC) $(DBG) $^ -d $(CLSDIR) $(CLSPATH) $(SRCINC) && touch $@
+
+# java language bindings
+ITF_SRC =                  \
+	Refcount               \
+	StatisticsItf          \
+	FragmentItf            \
+	FragmentIteratorItf    \
+	ReadItf                \
+	ReadIteratorItf        \
+	ReadGroupItf           \
+	ReadGroupIteratorItf   \
+	AlignmentItf           \
+	AlignmentIteratorItf   \
+	PileupEventItf         \
+	PileupEventIteratorItf \
+	PileupItf              \
+	PileupIteratorItf      \
+	ReferenceItf           \
+	ReferenceIteratorItf   \
+	ReadCollectionItf
+
+ITF_SRC_PATH = \
+	$(addprefix $(SRCDIR)/ngs/itf/,$(addsuffix .java,$(ITF_SRC)))
+
+$(CLSDIR)/ngs-java-itf: $(CLSDIR)/ngs-java-api $(ITF_SRC_PATH)
+	$(JAVAC) $(DBG) $(ITF_SRC_PATH) -d $(CLSDIR) $(CLSPATH) $(SRCINC) && touch $@
+
+# NCBI engine bindings
+NCBI_SRC =                 \
+	FileCreator            \
+	Logger                 \
+	HttpManager            \
+	LibManager             \
+	LibPathIterator        \
+	Manager                \
+	NGS
+
+NCBI_SRC_PATH = \
+	$(addprefix $(SRCDIR)/gov/nih/nlm/ncbi/ngs/,$(addsuffix .java,$(NCBI_SRC)))
+
+$(CLSDIR)/ngs-java-ncbi: $(CLSDIR)/ngs-java-itf $(NCBI_SRC_PATH)
+	$(JAVAC) $(DBG) $(NCBI_SRC_PATH) -d $(CLSDIR) $(CLSPATH) $(SRCINC) && touch $@
+
+# rule to produce the jar
+$(LIBDIR)/ngs-java.jar: $(CLSDIR)/ngs-java-api $(CLSDIR)/ngs-java-itf $(CLSDIR)/ngs-java-ncbi
+	( cd $(CLSDIR); $(JAR) $@ `find . -name "*.class"`; chmod -x,go-w $@ ) || ( rm -f $@ && false )
+
+
+#-------------------------------------------------------------------------------
+# NGS examples
+#
+ngs-examples: $(LIBDIR) $(CLSDIR) $(LIBDIR)/ngs-examples.jar
+
+# java examples
+NGS_EXAMPLES =    \
+	RefTest       \
+	FragTest      \
+	AlignTest     \
+	AlignSliceTest
+
+NGS_EXAMPLES_PATH = \
+	$(addprefix $(SRCDIR)examples/examples/,$(addsuffix .java,$(NGS_EXAMPLES)))
+
+$(CLSDIR)/ngs-examples: $(NGS_EXAMPLES_PATH)
+	$(JAVAC) $(DBG) $^ -d $(CLSDIR) $(CLSPATH) $(SRCINC) && touch $@
+
+# rule to produce the jar
+$(LIBDIR)/ngs-examples.jar: $(CLSDIR)/ngs-examples
+	( cd $(CLSDIR); $(JAR) $@ `find examples -name "*.class"`; chmod -x,go-w $@  ) || ( rm -f $@ && false )
+
+#-------------------------------------------------------------------------------
+# JNI headers
+#
+ifdef JNIPATH
+
+ngs-jni: $(JNIPATH) $(JNIPATH)/headers-generated
+
+JNI_ITF =                  \
+	ReadCollectionItf      \
+	ReadGroupItf           \
+	ReadGroupIteratorItf   \
+	ReferenceItf           \
+	ReferenceIteratorItf   \
+	PileupItf              \
+	PileupIteratorItf      \
+	PileupEventItf         \
+	PileupEventIteratorItf \
+	AlignmentItf           \
+	AlignmentIteratorItf   \
+	ReadItf                \
+	ReadIteratorItf        \
+	FragmentItf            \
+	StatisticsItf          \
+	Refcount
+
+JNI_CLASSES =                        \
+	$(addprefix ngs.itf.,$(JNI_ITF))
+
+$(JNIPATH)/headers-generated: $(MAKEFILE) $(LIBDIR)/ngs-java.jar
+	cd $(JNIPATH); $(JAVAH) -classpath $(CLSDIR) $(JNI_CLASSES)
+	@ cd $(JNIPATH); echo 'for f in ngs_itf_*.h; do mv $$f jni_$${f#ngs_itf_}; done' | bash
+	@ touch $@
+
+endif
diff --git a/ngs-java/Makefile.rules b/ngs-java/Makefile.rules
new file mode 100644
index 0000000..3ecb6ac
--- /dev/null
+++ b/ngs-java/Makefile.rules
@@ -0,0 +1,72 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+TOP ?= $(CURDIR)
+export TOP
+
+subdirs: $(SUBDIRS)
+
+$(SUBDIRS): Makefile.config
+	@ $(MAKE) -C $@
+
+subtargs: Makefile.config $(SUBTARGS)
+
+# rules for "make clean"
+SUBDIRS_CLN = \
+	$(addsuffix _cln,$(SUBDIRS))
+
+$(SUBDIRS_CLN): Makefile.config
+	@ $(MAKE) -s -C $(subst _cln,,$@) clean
+
+SUBTARGS_CLN = \
+	$(addsuffix _cln,$(SUBTARGS))
+
+clean: Makefile.config $(SUBTARGS_CLN)
+
+# rules for "make install"
+SUBDIRS_INST = \
+	$(addsuffix _inst,$(SUBDIRS))
+
+$(SUBDIRS_INST): Makefile.config
+	@ $(MAKE) -s -C $(subst _inst,,$@) install
+
+SUBTARGS_INST = \
+	$(addsuffix _inst,$(SUBTARGS))
+
+install: Makefile.config $(SUBTARGS_INST)
+
+# rule to run tests
+test runtests: Makefile.config
+#	@ $(MAKE) -C test runtests
+
+# rule to run configuration
+Makefile.config: Makefile.config.$(shell perl $(TOP)/os-arch.perl) konfigure.perl
+
+Makefile.config.$(shell perl $(TOP)/os-arch.perl):
+	@echo "*** File '$@' is missing. Please run ./configure"
+	@false
+
+# not real targets
+.PHONY: default subdirs subtargs install clean test runtests \
+	$(SUBTARGS) $(SUBTARGS_INST) $(SUBTARGS_CLN)
diff --git a/ngs-java/configure b/ngs-java/configure
new file mode 100755
index 0000000..3313aac
--- /dev/null
+++ b/ngs-java/configure
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+FILENAME="`basename $0`"
+CURDIR="`dirname $0`"
+
+if [ -z "$CURDIR" ]
+    then
+    echo configure: error: configure should be run as ./configure
+    exit 1
+fi
+
+if [ "$FILENAME" != configure -a ! -s konfigure.perl ]
+    then
+    echo configure: error: configure should be run as ./configure
+else
+    perl -v > /dev/null 2>&1 || { echo "checking for perl... no"; \
+        echo >&2 "configure: error: perl not found."; exit 1; }
+
+    cd $CURDIR
+    perl -w ./konfigure.perl $@
+fi
diff --git a/ngs-java/examples/Makefile b/ngs-java/examples/Makefile
new file mode 100644
index 0000000..72330be
--- /dev/null
+++ b/ngs-java/examples/Makefile
@@ -0,0 +1,64 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TARGETS =             \
+    NGS-JavaTest.jar
+
+std: $(TARGETS)
+
+clean:
+	rm -f $(TARGETS) examples/*.class
+
+.PHONY: default std $(TARGETS)
+
+TEST_SRC =                      \
+	examples/FragTest.java      \
+	examples/AlignTest.java     \
+	examples/AlignSliceTest.java
+
+NGS-JavaTest.jar: $(TEST_SRC)
+	javac $^ -d . -classpath $(CLASSPATH) && touch $@
+    
+# ===========================================================================
+#
+# example runs
+
+JAVAFLAGS = -classpath $(CLASSPATH) 
+#JAVAFLAGS += -Dvdb.System.loadLibrary=1
+#JAVAFLAGS += -Dvdb.log=FINEST
+
+run_frag: NGS-JavaTest.jar
+	java $(JAVAFLAGS) examples.FragTest ERR225922 1 1 
+
+run_align: NGS-JavaTest.jar
+	java $(JAVAFLAGS) examples.AlignTest ERR225922 1 1
+
+run_align_slice: NGS-JavaTest.jar
+	java $(JAVAFLAGS) examples.AlignSliceTest SRR1121656 1 10000 20000
+
+
+.PHONY: run_align run_align_slice run_frag
diff --git a/ngs-java/examples/examples/AlignSliceTest.java b/ngs-java/examples/examples/AlignSliceTest.java
new file mode 100644
index 0000000..cf9ce0c
--- /dev/null
+++ b/ngs-java/examples/examples/AlignSliceTest.java
@@ -0,0 +1,89 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package examples;
+
+import ngs.ErrorMsg;
+import ngs.ReadCollection;
+import ngs.Reference;
+import ngs.AlignmentIterator;
+import ngs.Alignment;
+
+public class AlignSliceTest
+{
+    static void run ( String acc, String refname, int start, int stop )
+        throws ErrorMsg, Exception
+    {
+
+        // open requested accession using SRA implementation of the API
+        ReadCollection run = gov.nih.nlm.ncbi.ngs.NGS.openReadCollection ( acc );
+        String run_name = run.getName ();
+
+        // get requested reference
+        Reference ref = run.getReference ( refname );
+
+        // start iterator on requested range of primary alignments
+        long length = stop - start + 1;
+        AlignmentIterator it = ref.getAlignmentSlice ( start, length, Alignment.primaryAlignment );
+
+        // walk all primary alignments within range
+        long i;
+        for ( i = 0; it.nextAlignment (); ++ i )
+        {
+            System.out.println (        it.getReadId ()
+                                 +'\t'+ it.getReferenceSpec ()
+                                 +'\t'+ it.getAlignmentPosition ()
+                                 +'\t'+ it.getLongCigar ( false )     // unclipped
+                                 +'\t'+ it.getAlignedFragmentBases ()
+                );
+        }
+
+        // report to stderr
+        System.err.println ( "Read " + i + " alignments for " + run_name );
+    }
+
+    public static void main ( String [] args )
+    {
+        if ( args.length != 4 )
+        {
+            System.out.print ( "Usage: AlignSliceTest accession reference start stop\n" );
+        }
+        else try
+        {
+            run ( args[0], args[1], Integer.parseInt ( args[2] ), Integer.parseInt ( args[3] ) );
+        }
+        catch ( ErrorMsg x )
+        {
+            System.err.println ( x.toString () );
+            x.printStackTrace ();
+        }
+        catch ( Exception x )
+        {
+            System.err.println ( x.toString () );
+            x.printStackTrace ();
+        }
+    }
+}
diff --git a/ngs-java/examples/examples/AlignTest.java b/ngs-java/examples/examples/AlignTest.java
new file mode 100644
index 0000000..a180fd3
--- /dev/null
+++ b/ngs-java/examples/examples/AlignTest.java
@@ -0,0 +1,91 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package examples;
+
+import ngs.ErrorMsg;
+import ngs.ReadCollection;
+import ngs.AlignmentIterator;
+import ngs.Alignment;
+
+public class AlignTest
+{
+    static void run ( String acc, int splitNum, int splitNo )
+        throws ErrorMsg, Exception
+    {
+
+        // open requested accession using SRA implementation of the API
+        ReadCollection run = gov.nih.nlm.ncbi.ngs.NGS.openReadCollection ( acc );
+        String run_name = run.getName ();
+
+        // compute window to iterate through
+        long MAX_ROW = run.getAlignmentCount (); 
+        double chunk = ( double ) MAX_ROW / splitNum;
+        long first = ( long ) Math.round ( chunk * ( splitNo-1 ) );
+
+        long next_first = ( long ) Math.round ( chunk * ( splitNo ) );
+        if ( next_first > MAX_ROW )
+            next_first = MAX_ROW;
+
+        // start iterator on primary alignments
+        long count = next_first - first;
+        AlignmentIterator it = run.getAlignmentRange ( first+1, count, Alignment.primaryAlignment );
+
+        long i;
+        for (i = 0; it.nextAlignment (); ++ i )
+        {
+            System.out.println (        it.getReadId ()
+                                 +'\t'+ it.getReferenceSpec ()
+                                 +'\t'+ it.getAlignmentPosition()
+                                 +'\t'+ it.getShortCigar ( false )  // unclipped
+                                 +'\t'+ it.getFragmentBases ()
+                  );
+        }
+
+        System.err.println ( "Read " + i + " alignments for " + run_name );
+    }
+    public static void main ( String [] args )
+    {
+        if ( args.length != 3 )
+        {
+            System.out.print ( "Usage: AlignTest accession NumChunks ChunkNo\n" );
+        }
+        else try
+        {
+            run ( args[0], Integer.parseInt ( args[1] ), Integer.parseInt ( args[2] ) );
+        }
+        catch ( ErrorMsg x )
+        {
+            System.err.println ( x.toString () );
+            x.printStackTrace ();
+        }
+        catch ( Exception x )
+        {
+            System.err.println ( x.toString () );
+            x.printStackTrace ();
+        }
+    }
+}
diff --git a/ngs-java/examples/examples/FragTest.java b/ngs-java/examples/examples/FragTest.java
new file mode 100644
index 0000000..ed441db
--- /dev/null
+++ b/ngs-java/examples/examples/FragTest.java
@@ -0,0 +1,93 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package examples;
+
+import ngs.ErrorMsg;
+import ngs.ReadCollection;
+import ngs.ReadIterator;
+import ngs.Read;
+
+public class FragTest
+{
+    static void run ( String acc, int splitNum, int splitNo )
+        throws ErrorMsg, Exception
+    {
+
+        // open requested accession using SRA implementation of the API
+        ReadCollection run = gov.nih.nlm.ncbi.ngs.NGS.openReadCollection ( acc );
+        String run_name = run.getName ();
+
+        // compute window to iterate through
+        long MAX_ROW = run.getReadCount (); 
+        double chunk = ( double ) MAX_ROW / splitNum;
+        long first = ( long ) Math.round ( chunk * ( splitNo-1 ) );
+
+        long next_first = ( long ) Math.round ( chunk * ( splitNo ) );
+        if ( next_first > MAX_ROW )
+            next_first = MAX_ROW;
+
+        // start iterator on all reads within range
+        long count = next_first - first;
+        ReadIterator it = run.getReadRange ( first+1, count, Read.all );
+
+        long i;
+        for ( i = 0; it.nextRead (); ++ i )
+        {
+            System.out.print ( it.getReadId () );
+
+            //iterate through fragments
+            while ( it.nextFragment () )
+                System.out.print ( '\t'+ it.getFragmentBases () );
+
+            System.out.print ('\n' );
+        }
+
+        System.err.println ( "Read " + i + " spots for " + run_name );
+    }
+
+    public static void main ( String [] args )
+    {
+        if ( args.length != 3 )
+        {
+            System.out.print ( "Usage: FragTest accession NumChunks ChunkNo\n" );
+        }
+        else try
+        {
+            run ( args[0], Integer.parseInt ( args[1] ), Integer.parseInt ( args[2] ) );
+        }
+        catch ( ErrorMsg x )
+        {
+            System.err.println ( x.toString () );
+            x.printStackTrace ();
+        }
+        catch ( Exception x )
+        {
+            System.err.println ( x.toString () );
+            x.printStackTrace ();
+        }
+    }
+}
diff --git a/ngs-java/examples/examples/RefTest.java b/ngs-java/examples/examples/RefTest.java
new file mode 100644
index 0000000..c3e441c
--- /dev/null
+++ b/ngs-java/examples/examples/RefTest.java
@@ -0,0 +1,79 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package examples;
+
+import ngs.ErrorMsg;
+import ngs.ReadCollection;
+import ngs.ReferenceIterator;
+
+public class RefTest
+{
+    static void run ( String acc )
+        throws ErrorMsg, Exception
+    {
+
+        // open requested accession using SRA implementation of the API
+        ReadCollection run = gov.nih.nlm.ncbi.ngs.NGS.openReadCollection ( acc );
+        String run_name = run.getName ();
+
+        // get all references
+        ReferenceIterator it = run.getReferences (); 
+
+        long i;
+        for (i = 0; it.nextReference (); ++ i )
+        {
+            System.out.println (        it.getCommonName ()
+                                 +'\t'+ it.getCanonicalName ()
+                                 +'\t'+ it.getLength ()
+                                 +'\t'+ ( it.getIsCircular () ? "circular" : "linear" )
+                );
+        }
+
+        System.err.println ( "Read " + i + " references for " + run_name );
+    }
+    public static void main ( String [] args )
+    {
+        if ( args.length != 1 )
+        {
+            System.out.print ( "Usage: RefTest accession\n" );
+        }
+        else try
+        {
+            run ( args[0] );
+        }
+        catch ( ErrorMsg x )
+        {
+            System.err.println ( x.toString () );
+            x.printStackTrace ();
+        }
+        catch ( Exception x )
+        {
+            System.err.println ( x.toString () );
+            x.printStackTrace ();
+        }
+    }
+}
diff --git a/ngs-java/gov/nih/nlm/ncbi/ngs/FileCreator.java b/ngs-java/gov/nih/nlm/ncbi/ngs/FileCreator.java
new file mode 100644
index 0000000..afe32c1
--- /dev/null
+++ b/ngs-java/gov/nih/nlm/ncbi/ngs/FileCreator.java
@@ -0,0 +1,34 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ==============================================================================
+*
+*/
+
+package gov.nih.nlm.ncbi.ngs;
+
+/** Interface used in HttpManager to create output file */
+interface FileCreator {
+
+    /** Creates a stream */
+    java.io.BufferedOutputStream create( String name );
+}
diff --git a/ngs-java/gov/nih/nlm/ncbi/ngs/HttpManager.java b/ngs-java/gov/nih/nlm/ncbi/ngs/HttpManager.java
new file mode 100644
index 0000000..187fdf9
--- /dev/null
+++ b/ngs-java/gov/nih/nlm/ncbi/ngs/HttpManager.java
@@ -0,0 +1,159 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ==============================================================================
+*
+*/
+
+package gov.nih.nlm.ncbi.ngs;
+
+import java.io.BufferedInputStream;
+import java.io.DataOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+/** Helper class responsible for HTTP-related activities:
+    download files using GET/POST */
+class HttpManager
+{
+    /** GET implementation. Calls download() to process the response. */
+    private static boolean get(String from, FileCreator creator, String libname)
+    {
+        System.err.println(from + " ->" + libname + "...");
+
+        URL url = null;
+        try {
+            url = new URL(from);
+        } catch (java.net.MalformedURLException e) {
+            System.err.println("Bad URL: " + from + ": " + e);
+            return false;
+        }
+
+        InputStream in = null;
+        try {
+            in = url.openStream();
+        } catch (IOException e) {
+            System.err.println("Cannot download " + from + ": " + e);
+            return false;
+        }
+
+        return download(in, creator, libname);
+    }
+
+    /** POST implementation. Calls download() to process the response. */
+    static int post(String spec,
+        String request,
+        FileCreator creator,
+        String libname)
+    {
+        Logger.fine(spec + "?" + request + " -> " + libname + "...");
+
+        URL url = null;
+        try {
+            url = new URL(spec);
+        } catch (java.net.MalformedURLException e) {
+            System.err.println("Bad URL: " + spec + ": " + e);
+            return -1;
+        }
+        InputStream in = null;
+        try {
+            java.net.URLConnection urlConn = url.openConnection();
+            urlConn.setDoInput(true);
+            urlConn.setDoOutput (true);
+            urlConn.setUseCaches(false);
+            urlConn.setRequestProperty("Content-Type",
+                "application/x-www-form-urlencoded");
+
+            java.io.OutputStream out = urlConn.getOutputStream();
+            DataOutputStream printout = new DataOutputStream(out);
+            printout.writeBytes(request);
+            printout.flush();
+            printout.close();
+
+            in = urlConn.getInputStream();
+
+            // What if CGI returns non-200 status?
+            HttpURLConnection httpConnection = (HttpURLConnection) urlConn;
+            int status = httpConnection.getResponseCode();
+            if (status != 200) {
+                return status;
+            }
+        } catch (IOException e) {
+            System.err.println(e);
+            return -2;
+        }
+
+        if (download(in, creator, libname)) {
+            return 200;
+        } else {
+            return -3;
+        }
+    }
+
+    /** Download InputStream, use FileCreator to create output file */
+    private static boolean download(InputStream in,
+         FileCreator creator, String libname)
+    {
+        java.io.BufferedOutputStream bout = creator.create( libname );
+        if (bout == null) {
+            System.err.println("Not possible to create a file for downloading");
+            return false;
+        }
+
+        BufferedInputStream bin = new BufferedInputStream(in);
+        byte data[] = new byte[BUF_SZ];
+
+        while (true) {
+            int count = 0;
+            try {
+                count = bin.read(data, 0, BUF_SZ);
+            } catch (IOException e) {
+                System.err.println(e);
+                return false;
+            }
+            if (count == -1) {
+                break;
+            }
+
+            try {
+                bout.write(data, 0, count);
+            } catch (IOException e) {
+                System.err.println(e);
+                return false;
+            }
+        }
+
+        try {
+            bout.close();
+        } catch (IOException e) {
+            System.err.println(e);
+            return false;
+        }
+
+        return true;
+    }
+
+    /** Size of buffer for HTTP-related buffered IO operations */
+    static final int BUF_SZ = 128 * 1024;
+}
diff --git a/ngs-java/gov/nih/nlm/ncbi/ngs/LibManager.java b/ngs-java/gov/nih/nlm/ncbi/ngs/LibManager.java
new file mode 100644
index 0000000..7190ad7
--- /dev/null
+++ b/ngs-java/gov/nih/nlm/ncbi/ngs/LibManager.java
@@ -0,0 +1,500 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ==============================================================================
+*
+*/
+
+package gov.nih.nlm.ncbi.ngs;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.BufferedOutputStream;
+
+
+/** This class is responsible for JNI dynamic library load
+    and download from NCBI - when it cannot be found locally */
+class LibManager implements FileCreator
+{
+
+    /** Force it in force-majeure situations.
+        It also could be set without recompiling
+        by setting vdb.System.loadLibrary java system property */
+    private static boolean JUST_DO_REGULAR_JAVA_SYSTEM_LOAD_LIBRARY = false;
+
+
+    private static final String[] SRATOOLKIT_CGI =
+    {
+        "http://trace.ncbi.nlm.nih.gov/Traces/sratoolkit/sratoolkit.cgi"
+    };
+
+
+    /** Possible location to search for library to load.
+        The order of enum elements defines library location search order. */
+    enum Location
+    {
+/* KNOWN_PATH should be the first entry here
+   if you want it to be loaded right after download.
+   Otherwise the manager will try to the search previous location entries first.
+   May be you want it to test something (e.g. a bad library file). */
+        KNOWN_PATH,    // from config or file downloaded from NCBI
+        LIBPATH,       // iterate "java.library.path" - extended LD_LIBRARY_PATH
+        NCBI_NGS_JAR_DIR, // directory where ncbi-ngs.jar is
+        CLASSPATH,     // iterate "java.class.path" - where java classes are
+        NCBI_HOME,     // ~/.ncbi/ TODO: mkdir NCBI_HOME if does not exist
+        CWD,           // "."
+        TMP            // Temporary folder
+    }
+
+
+//TODO check out of space condition
+
+
+    LibManager ()
+    {
+        this ( null );
+    }
+
+
+    private LibManager ( Location locations [] )
+    {
+//      if (locations == null) locations = getLocationProperty ();
+
+        if (locations != null)
+            this.location = locations;
+        else
+            this.location = Location.values ();
+
+        if (System.getProperty("vdb.System.loadLibrary") != null)
+        {
+            System.err.println ( "Smart DLL search was turned off" );
+            JUST_DO_REGULAR_JAVA_SYSTEM_LOAD_LIBRARY = true;
+        }
+
+        if (System.getProperty("vdb.deleteLibraries") != null)
+        {
+            //System.err.println ( "Deleting all JNI libraries..." );
+            //LibPathIterator.deleteLibraries(this, libname);
+        }
+    }
+
+
+    /** Creates a file by finding directory by iterating the location array
+        and using libname to generate the file name */
+    public BufferedOutputStream create ( String libname )
+    {
+        LibPathIterator it
+            = new LibPathIterator(this, mapLibraryName(libname), true);
+
+        while (true) {
+            String pathname = it.nextName();
+            if (pathname == null) {
+                return null;
+            }
+
+            Logger.fine("Trying to create " + pathname + "...");
+            File file = new File(pathname);
+            try {
+                pathname = file.getAbsolutePath();
+            } catch (SecurityException e) {
+                System.err.println(pathname + " : cannot getAbsolutePath " + e);
+            }
+            FileOutputStream s = null;
+            try {
+                s = new FileOutputStream(pathname);
+            } catch (java.io.FileNotFoundException e) {
+/* e.message = pathname (Permission denied):
+could be because pathname is not writable
+or pathname not found and its directory is not writable */
+                System.err.println("Cannot open " + pathname);
+                continue;
+            }
+
+            int l = 9;
+            if (knownLibPath == null) {
+                knownLibPath = new String[l];
+            } else {
+                l = knownLibPath.length;
+            }
+            int i = 0;
+            for (i = 0; i < l; ++i) {
+                if (knownLibPath[i] == null) {
+                    break;
+                }
+            }
+            if (i >= l) {
+                String tmp[] = knownLibPath;
+                l *= 2;
+                knownLibPath = new String[l];
+                for (i = 0; i < tmp.length; ++i) {
+                    knownLibPath[i] = tmp[i];
+                }
+            }
+            knownLibPath[i] = pathname;
+
+            Logger.fine("Opened " + pathname);
+            return new BufferedOutputStream(s, HttpManager.BUF_SZ);
+        }
+    }
+
+
+    /** Loads the system library by finding it by iterating the location array.
+        Try to download it from NCBI if not found. */
+    boolean loadLibrary( String libname )
+    {
+        Logger.fine("Loading " + libname + " library...");
+        if (load(libname)) {
+            Logger.fine("Loaded " + libname + " library");
+            return true;
+        }
+
+        System.err.println("Failed to load " + libname + " library");
+        if (JUST_DO_REGULAR_JAVA_SYSTEM_LOAD_LIBRARY) {
+            return false;
+        }
+
+/* Here we try do download the library from NCBI always
+   when we were not able to System.load Library it. */
+
+        System.err.println("Downloading " + libname + " from NCBI...");
+        if (download( libname )) {
+            System.err.println("Downloaded " + libname + " from NCBI");
+            Logger.fine("Loading " + libname + " library...");
+            boolean b = load(libname);
+            Logger.fine(b ? "Loaded " : "Failed to load "
+                + libname + " library");
+            return b;
+        }
+        else {
+            System.err.println("Failed to download " + libname + " from NCBI");
+            return false;
+        }
+    }
+
+
+    Location[] locations()
+    {
+        return location;
+    }
+
+
+    static String[] mapLibraryName(String libname)
+    {
+        String m = libnameWithModel(libname);
+        String name = System.getProperty("os.name");
+        int dup = 1;
+        if (name != null  && name.equals("Mac OS X")) {
+            dup = 2;
+        }
+        int n = (m == null ? 1 : 2) * dup;
+        String[] ns = new String[n];
+        int i = 0;
+        if (m != null) {
+            ns[i++] = System.mapLibraryName(m);
+        }
+        ns[i++] = System.mapLibraryName(libname);
+        if (dup == 2) {
+            if (m != null) {
+                ns[i++] = m + ".dylib";;
+            }
+            ns[i++] = libname + ".dylib";;
+        }
+        return ns;
+    }
+
+
+    static Bit DetectJVM()
+    {
+        final String keys [] = {
+            "sun.arch.data.model",
+            "com.ibm.vm.bitmode",
+            "os.arch",
+        };
+        for (String key : keys ) {
+            String property = System.getProperty(key);
+            Logger.fine(key + "=" + property);
+            if (property != null) {
+                int errCode = (property.indexOf("64") >= 0) ? 64 : 32;
+                Logger.fine(errCode + "-bit JVM");
+                return errCode == 64 ? Bit.b64 : Bit.b32;
+            }
+        }
+        Logger.fine("Unknown-bit JVM");
+        return Bit.bUNKNOWN;
+    }
+
+
+    static String getEnv()
+        throws Exception
+    {
+        String request = "os_name=";
+        String name = System.getProperty("os.name");
+        if (name == null) {
+            throw new Exception("Cannot detect OS");
+        }
+        request += name;
+        request += "&bits=";
+        switch (DetectJVM()) {
+            case b64:
+                request += "64";
+                break;
+            case b32:
+                request += "32";
+                break;
+            case bUNKNOWN:
+                request += "unknown";
+        }
+        String arch = System.getProperty("os.arch");
+        if (arch != null) {
+            request += "&os_arch=" + arch;
+        }
+        String version = System.getProperty("os.version");
+        if (version != null) {
+            request += "&os_version=" + version;
+        }
+        return request;
+    }
+
+
+    private static String libnameWithModel(String libname)
+    {
+        String m = null;
+        switch (DetectJVM()) {
+            case b64:
+                m = "-64";
+                break;
+            case b32:
+                m = "-32";
+                break;
+        }
+        if (m != null) {
+            m = libname + m;
+        }
+        return m;
+    }
+
+    private enum Bit {
+        b32,
+        b64,
+        bUNKNOWN,
+    }    
+
+
+    /** Fetches the library from NCBI and writes it to where it can be found by
+        LibManager.loadLibrary() */
+    private boolean download( String libname )
+    {
+        String request = "cmd=lib&version=1.0&libname=" + libname;
+
+        request += "&jar_vers=" + Manager.version();
+
+        try {
+            request += "&" + getEnv();
+        } catch (Exception e) {
+            System.err.println("Cannot download library: " + e.getMessage());
+            return false;
+        }
+
+        for (int i = 0; i < SRATOOLKIT_CGI.length; ++i) {
+            int code
+                = HttpManager.post(SRATOOLKIT_CGI[i], request, this, libname);
+            if (code == 200) {
+                return true;
+            } else {
+                System.err.println("Cannot download library: " + code);
+            }
+        }
+        return false;
+    }
+
+
+    /** Tries to load the library by searching it using location array.
+        If JUST_DO_REGULAR_JAVA_SYSTEM_LOAD_LIBRARY = true
+        then just call plain System.LoadLibrary(libname) */
+    private boolean load(String libname)
+    {
+        for (Location l : location) {
+            if (JUST_DO_REGULAR_JAVA_SYSTEM_LOAD_LIBRARY) {
+                l = Location.LIBPATH;
+            }
+
+            printLoadingMsg(l, libname);
+
+            if (l == Location.LIBPATH) {
+// System.loadLibrary is using java.library.path to find the library
+                Logger.finest("java.library.path = "
+                    + System.getProperty("java.library.path"));
+                Logger.fine(l + ": System.loadLibrary(" + libname + ")...");
+                Logger.finest("System.mapLibraryName(" + libname + ") = "
+                    + System.mapLibraryName(libname));
+                try {
+                    System.loadLibrary(libname);
+                    Logger.fine("Loaded library " + libname);
+                    return true;
+                } catch (UnsatisfiedLinkError e) {
+                    Logger.fine("cannot load library: " + e);
+                } catch (Throwable e) {
+                    System.err.println("Cannot load library: " + e);
+                }
+                if (JUST_DO_REGULAR_JAVA_SYSTEM_LOAD_LIBRARY) {
+                    return false;
+                }
+                String libnameWithModel = libnameWithModel(libname);
+                if (libnameWithModel != null) {
+                    try {
+                        System.loadLibrary(libnameWithModel);
+                        Logger.fine("Loaded library " + libnameWithModel);
+                        return true;
+                    } catch (UnsatisfiedLinkError e) {
+                        Logger.fine("cannot load library: " + e);
+                    } catch (Throwable e) {
+                        System.err.println("Cannot load library: " + e);
+                    }
+                }
+            }
+            else {
+                String name[] = null;
+                if (l == Location.KNOWN_PATH) {
+                    if (knownLibPath == null) {
+                        continue;
+                    } else {
+                        for (int i = 0;
+                            i < knownLibPath.length && knownLibPath[i] != null;
+                            ++i)
+                        {
+                            if (knownLibPath[i].contains(libname)) {
+                                name = new String[1];
+                                name[0] = knownLibPath[i];
+                                break;
+                            }
+                        }
+                    }
+                }
+                if (name == null) {
+                    name = mapLibraryName(libname);
+                }
+                Logger.finest("System.mapLibraryName(" + libname + ") = "
+                    + name[0]);
+
+                LibPathIterator it = new LibPathIterator(l, name);
+                while (true) {
+                    String filename = it.nextName();
+                    if (filename == null) {
+                        break;
+                    }
+
+                    Logger.fine("System.load(" + filename + ")...");
+                    try {
+                        System.load(filename);
+                        Logger.fine("Loaded library " + libname);
+                        return true;
+                    } catch (UnsatisfiedLinkError e) {
+                        Logger.fine("error: " + e);
+                    } catch (Throwable e) {
+                        System.err.println("Cannot load library: " + e);
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
+
+
+    private static Location[] getLocationProperty()
+    {
+        String p = System.getProperty("vdb.loadLibraryLocations");
+        if (p == null) {
+            return null;
+        }
+
+        int n = 0;
+        for (int i = 0; i < p.length(); ++i) {
+            if ("CJKLNTW".indexOf(p.charAt(i)) >= 0) {
+                ++n;
+            }
+        }
+
+        if (n == 0) {
+            return null;
+        }
+                
+        Location locations[] = new Location[n];
+        n = 0;
+        for (int i = 0; i < p.length(); ++i) {
+            switch (p.charAt(i)) {
+                case 'C':
+                    locations[n] = Location.CLASSPATH;
+                    break;
+                case 'J':
+                    locations[n] = Location.NCBI_NGS_JAR_DIR;
+                    break;
+                case 'K':
+                    locations[n] = Location.KNOWN_PATH;
+                    break;
+                case 'L':
+                    locations[n] = Location.LIBPATH;
+                    break;
+                case 'N':
+                    locations[n] = Location.NCBI_HOME;
+                    break;
+                case 'T':
+                    locations[n] = Location.TMP;
+                    break;
+                case 'W':
+                    locations[n] = Location.CWD;
+                    break;
+                default:
+                    continue;
+            }
+            ++n;
+        }
+
+        return locations;
+    }
+
+    private static void printLoadingMsg(Location l, String libname)
+    {
+        if (l == Location.LIBPATH) {
+            Logger.fine("LoadingLibrary " + libname + "...");
+        } else {
+            Logger.fine("Loading " + libname + " from " + l + "...");
+        }
+    }
+
+
+    private String[] knownLibPath; // location where library was downloaded to
+
+    private Location location[];
+
+/* TODO save location where library was found
+(try to use load instead of loadLibrary even for LIBPATH);
+add which() method to return this location(?);
+try to load the library if LibManager.loadLibrary() was never called.
+What if loadLibrary() is called several times? load()
+      http://docs.oracle.com/javase/6/docs/api/java/util/logging/Level.html
+      http://en.wikipedia.org/wiki/Log4j
+      http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html
+-Dlog=0   1
+-Dlog=OFF SEVERE/FATAL
+-Dlog=O   S/F   */
+}
diff --git a/ngs-java/gov/nih/nlm/ncbi/ngs/LibPathIterator.java b/ngs-java/gov/nih/nlm/ncbi/ngs/LibPathIterator.java
new file mode 100644
index 0000000..a5a7c86
--- /dev/null
+++ b/ngs-java/gov/nih/nlm/ncbi/ngs/LibPathIterator.java
@@ -0,0 +1,579 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ==============================================================================
+*
+*/
+
+package gov.nih.nlm.ncbi.ngs;
+
+import java.io.File;
+
+
+/** Library Path Iterator is used to find location of JNI DLL.
+  It iterates over all file names generated using LibManager.Location [array] */
+class LibPathIterator {
+
+    private static final String NCBI_NGS_JAR_NAME = "ngs-java.jar";
+
+
+    /** Creates an iterator that will go through all LibManager's location-s */
+    LibPathIterator(LibManager mgr,
+        String filename[])
+    {
+        this(mgr, null, filename, false);
+    }
+
+
+    /** Creates an iterator that will go through all LibManager's location-s;
+        if parents == true then create file's parent directory */
+    LibPathIterator(LibManager mgr,
+        String filename[],
+        boolean parents)
+    {
+        this(mgr, null, filename, parents);
+    }
+
+
+    /** Creates an iterator that will go through just a single location */
+    LibPathIterator(LibManager.Location location,
+        String filename[])
+    {
+        this(null, location, filename, false);
+    }
+
+
+    private LibPathIterator(LibManager mgr,
+        LibManager.Location location,
+        String filename[],
+        boolean parents)
+    {
+        Logger.finer("\nCreating LibPathIterator(" + toString(filename) + ", "
+            + location + ")...");
+
+        if (mgr == null && location == null) {
+            throw new NullPointerException();
+        }
+
+        if (filename == null) {
+            throw new NullPointerException();
+        }
+
+        this.mgr = mgr;
+        this.location = location;
+
+        if (location == LibManager.Location.KNOWN_PATH) {
+            this.abspath = filename[0];
+        } else {
+            this.filenames = filename;
+        }
+        
+        this.parents = parents;
+        this.separator = fileSeparator();
+
+        reset();
+    }
+
+
+    /** Get next file name-candidate */
+    String nextName()
+    {
+        while (true) {
+            if ((paths == null || iPaths >= paths.length) // done iterating
+                                                          // current location 
+                && !reset())    // done iterating all locations
+            {
+                return null;
+            }
+
+            String path = paths[iPaths];
+
+            String filename = null;
+            if (filenames != null) {
+                filename = filenames[iFilename];
+            }
+
+            if (filenames == null) {
+                ++iPaths;
+            } else if (++iFilename >= filenames.length) {
+                iFilename = 0;
+                ++iPaths;
+            }
+            if (path.length() == 0) { // ignore empty PATH elements
+                continue;
+            }
+
+            LibManager.Location crn = location;
+            if (crn == null) {
+                crn = crnLocation;
+            }
+
+            if (crn != null && crn == LibManager.Location.KNOWN_PATH) {
+                if (abspath != null) {
+                    return abspath;
+                } else {
+                    continue;
+                }
+            }
+            else {
+                if (separator == null) {
+                    throw new NullPointerException();
+                }
+                return path += separator + filename;
+            }
+        }
+    }
+
+
+    /** Iterate over all locations and print them: debug/test */
+    static boolean list( String libname )
+    {
+        return iterate(new LibManager(), libname, false);
+    }
+
+
+    /** delete all libraries found by the LibManager */
+    static boolean deleteLibraries(LibManager mgr, String libname)
+    {
+        return iterate(mgr, libname, true);
+    }
+
+
+    /** Resets the LibPathIterator to use the next (first) location */
+    private boolean reset()
+    {
+        if (location != null) { // this object iterates just over one location
+            if (crnLocation != null) {
+                return false; // iterated over the requested location
+            } else {
+                crnLocation = location;
+            }
+        } else { // this object iterates over all locations
+            if (crnLocation == null) {
+                iLocation = -1; // constructor call : use the first location
+            }
+        }
+
+        while (true) {
+            ++iLocation;
+            Logger.finer("LibPathIterator.reset() " + iLocation);
+            if (location == null) {
+                if (iLocation >= mgr.locations().length) {
+                    return false; // iterated over all locations
+                }
+                crnLocation = mgr.locations()[iLocation];
+                Logger.finer("LibPathIterator.reset(" + crnLocation + ")");
+            } else if (iLocation > 1) {
+                return false; /* A single location was requested;
+                                 already processed it: break this loop */
+            }
+            iPaths = 0;
+            String pathSeparator = pathSeparator();
+            String path = null;
+            switch (crnLocation) {
+                case CLASSPATH:
+                    path = System.getProperty("java.class.path");
+                    Logger.finest("java.class.path = " + path);
+                    if (!resetPaths(path, pathSeparator)) {
+                        continue;
+                    }
+                    return true;
+                case CWD:
+                    if (!resetPaths(System.getProperty("user.dir"),
+                        pathSeparator))
+                    {
+                        continue;
+                    }
+                    return true;
+                case KNOWN_PATH:
+                    if (!resetPaths(abspath)) {
+                        continue;
+                    }
+                    return true;
+                case LIBPATH:
+                    path = System.getProperty("java.library.path");
+                    Logger.finest("java.library.path = " + path);
+                    if (!resetPaths(path, pathSeparator)) {
+                        continue;
+                    }
+                    return true;
+                case NCBI_HOME:
+                    if (!resetPaths(ncbiHome())) {
+                        continue;
+                    }
+                    return true;
+                case NCBI_NGS_JAR_DIR:
+                    path = findJarDir(pathSeparator);
+                    if (path == null) {
+                        Logger.finest(NCBI_NGS_JAR_NAME + " was not found");
+                        continue;
+                    } else {
+                        Logger.finest("jar directory is " + path);
+                        resetPaths(path);
+                        return true;
+                    }
+                case TMP:
+                    path = findTmpDirEnv();
+                    if (path != null) {
+                        Logger.fine("Use " + path + " as temporary directory");
+                        resetPaths(path);
+                        return true;
+                    }
+                    Logger.finest(
+                        "Temporary directory was not found in environment");
+                    if (resetPathsToTmpDirs()) {
+                        Logger.finest("Found a temporary directory");
+                        return true;
+                    } else {
+                        Logger.fine("Could not find any temporary directory");
+                        continue;
+                    }
+            }
+        }
+    }
+
+
+    /** Find directory where ncbi-ngs.jar is located */
+    private String findJarDir(String pathSeparator)
+    {
+        String path = System.getProperty("java.class.path");
+        Logger.finest("java.class.path = " + path);
+        if (path == null) {
+            return null;
+        }
+
+        String[] paths = path.split(pathSeparator);
+        for (int i = 0; i < paths.length; ++i) {
+            Logger.finest("findJarDir() " + i + " " + paths[i]);
+            if (paths[i].endsWith(NCBI_NGS_JAR_NAME)) {
+                File f = new File(paths[i]);
+                if (!f.exists()) {
+                    System.err.println(NCBI_NGS_JAR_NAME
+                        + " from class path does not exist");
+                    continue;
+                }
+
+                Logger.finest("Found NCBI jar file: " + paths[i]);
+                String dir = null;
+                if (NCBI_NGS_JAR_NAME.equals(paths[i])) {
+                    dir = System.getProperty("user.dir");
+                    if (dir == null) {
+                        System.err.println("cannot get directory "
+                            + "for " + NCBI_NGS_JAR_NAME);
+                        continue;
+                    }
+                } else {
+                    dir = paths[i].substring(0, paths[i].length()
+                        - NCBI_NGS_JAR_NAME.length());
+                }
+                return dir;
+            }
+        }
+
+        return null;
+    }
+
+
+    /** Find a temporary directory */
+    private String findTmpDirEnv() {
+        String name = "TMPDIR";
+        String path = System.getenv(name);
+        if (path != null) {
+            Logger.finest(name + " = " + path);
+            return path;
+        }
+
+        name = "TEMP";
+        path = System.getenv(name);
+        if (path != null) {
+            Logger.finest(name + " = " + path);
+            return path;
+        }
+
+        name = "TMP";
+        path = System.getenv(name);
+        if (path != null) {
+            Logger.finest(name + " = " + path);
+            return path;
+        }
+
+        name = "TEMPDIR";
+        path = System.getenv(name);
+        if (path != null) {
+            Logger.finest(name + " = " + path);
+            return path;
+        }
+
+        return null;
+    }
+
+
+    private boolean resetPathsToTmpDirs() {
+        int cnt = 0;
+
+        String var = "/var/tmp";
+        File fVar = new File(var);
+        if (fVar.exists()) {
+            ++cnt;
+        } else {
+            fVar = null;
+        }
+
+        String tmp = "/tmp";
+        File fTmp = new File(tmp);
+        if (fTmp.exists()) {
+            ++cnt;
+        } else {
+            fTmp = null;
+        }
+
+        if (cnt == 0) {
+            return false;
+        }
+
+        if (paths == null || paths.length != cnt) {
+            paths = new String[cnt];
+        }
+
+        int i = 0;
+        if (fVar != null) {
+            paths[i++] = var;
+        }
+        if (fTmp != null) {
+            paths[i++] = tmp;
+        }
+
+        return true;
+    }
+
+
+    /** Sets paths = path */
+    private boolean resetPaths(String path) { return resetPaths(path, null); }
+
+
+    /** Resets paths by splitting path using regex */
+    private boolean resetPaths(String path,
+        String regex)
+    {
+        if (path == null) {
+            return false;
+        }
+
+        if (regex != null) {
+            paths = path.split(regex);
+
+// In the classpath there could be file names and/or relative elements.
+// TODO what is there is a relative directory in the classpath?
+            if (crnLocation == LibManager.Location.CLASSPATH) {
+                for (int i = 0; i < paths.length; ++i) {
+                    File elm = new File(paths[i]);
+                    if (elm.isFile()) { /* Replace file path by its parent
+TODO should it be absolute? System.loadLibrary uses it property directly.
+Here we use it just to find where to write the downoaded file. */
+                        String p = elm.getParent();
+                        if (p == null) { // parent is null when elm is just a 
+                          // leaf file name. I.e. it is in the current directory
+                            p = System.getProperty("user.dir");
+                        }
+
+                        if (p == null) {
+                            System.err.println(
+                                "cannot get parent directory for " + paths[i]);
+                            paths[i] = "."; // TODO test use . during f.download
+                        } else {
+                            paths[i] = p;
+                        }
+                    }
+                }
+            }
+        }
+        else {
+            if (paths == null || paths.length != 1) {
+                paths = new String[1];
+            }
+
+            paths[0] = path;
+        }
+
+        return true;
+    }
+
+    /** NCBI_HOME (~/.ncbi). Create it if required. */
+    private String ncbiHome()
+    {
+        String path = System.getProperty("user.home");
+        if (path == null) {
+            return null;
+        }
+
+        path += fileSeparator() + ".ncbi";
+
+        if (parents) {
+            File f = new File(path);
+            if (!f.exists()) {
+                try {
+                    f.mkdirs();
+                } catch (SecurityException e) {
+                    Logger.fine(e.toString());
+                    return null;
+                }
+                try {
+                    f.setExecutable(false, false);
+                } catch (SecurityException e) {
+                    Logger.fine(e.toString());
+                }
+                try {
+                    f.setReadable(false, false);
+                } catch (SecurityException e) {
+                    Logger.fine(e.toString());
+                }
+                try {
+                    f.setWritable(false, false);
+                } catch (SecurityException e) {
+                    Logger.fine(e.toString());
+                }
+                try {
+                    f.setExecutable(true, true);
+                } catch (SecurityException e) {
+                    Logger.fine(e.toString());
+                }
+                try {
+                    f.setReadable(true, true);
+                } catch (SecurityException e) {
+                    Logger.fine(e.toString());
+                }
+                try {
+                    f.setWritable(true, true);
+                } catch (SecurityException e) {
+                    Logger.fine(e.toString());
+                }
+            }
+        }
+
+        return path;
+    }
+
+
+    /** Path separator character used in java.class.path */
+    private static String pathSeparator()
+    {
+        String separator = System.getProperty("path.separator");
+        if (separator == null) {
+            String os = System.getProperty("os.name");
+            if (os != null && os.indexOf("win") >= 0) {
+                separator = ";";
+            }
+        }
+        if (separator == null) {
+            separator = ":";
+        }
+        return separator;
+    }
+
+
+    private String toString(String[] s) {
+        if (s == null) {
+            throw new NullPointerException();
+        }
+        String r = "[";
+        for (int i = 0; i < s.length; ++i) {
+            if (i > 0) {
+                r += ", ";
+            }
+            r += s[i];
+        }
+        r += "]";
+        return r;
+    }
+
+    /** Separates components of a file path. "/" on UNIX and "\" on Windows. */
+    private static String fileSeparator()
+    {
+        String separator = System.getProperty("file.separator");
+        if (separator == null) {
+            String os = System.getProperty("os.name");
+            if (os != null && os.indexOf("win") >= 0) {
+                separator = "\\";
+            }
+        }
+        if (separator == null) {
+            separator = "/";
+        }
+        return separator;
+    }
+
+
+    private static boolean iterate(LibManager mgr, String libname, boolean rm)
+    {
+        boolean removed = rm ? false : true;
+
+//      LibManager mgr = new LibManager("ncbi-ngs-jni");
+//      String filename[] = LibManager.mapLibraryName("ncbi-ngs-jni");
+        LibPathIterator it =
+            new LibPathIterator(mgr, LibManager.mapLibraryName( libname ));
+        String s = null;
+
+        int i = 0;
+        while ((s = it.nextName()) != null) {
+            File f = new File(s);
+            boolean delete = f.exists();
+            System.err.println("(" + ++i + ") " + s + " "
+                + (delete ? "+" : "-"));
+            if (rm && delete) {
+                try {
+                    delete = f.delete();
+                    if (delete) {
+                        removed = delete;
+                    } else {
+                        System.err.println("Cannot delete '" + s + "'");
+                    }
+                } catch (SecurityException e) {
+                    System.err.println("Cannot delete '" + s + "': " + e);
+                }
+            }
+        }
+
+        return removed;
+    }
+
+
+    // mgr has list of library locations (not used if location is set below)
+    private LibManager mgr;
+
+    private LibManager.Location location; // requested location; all if null
+
+    private LibManager.Location crnLocation; // current location
+    private int iLocation; // current location idx in LibManager.location[]
+
+    private String[] paths;         // list of paths (directories) to iterate
+    private int iPaths;             // index in paths
+
+    private String separator;       // path separator
+
+    private String filenames[];     // file names
+    private int iFilename;          // index in file name
+
+    private String abspath;         // absolute file path
+
+    // if is true and file's parent directory does not exist then create it
+    private boolean parents;
+}
diff --git a/ngs-java/gov/nih/nlm/ncbi/ngs/Logger.java b/ngs-java/gov/nih/nlm/ncbi/ngs/Logger.java
new file mode 100644
index 0000000..a0c6689
--- /dev/null
+++ b/ngs-java/gov/nih/nlm/ncbi/ngs/Logger.java
@@ -0,0 +1,74 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ==============================================================================
+*
+*/
+
+package gov.nih.nlm.ncbi.ngs;
+
+/** The Logger is used to print log messages to stderr.
+ An associated "Level" reflects a minimum Level that this logger cares about. */
+class Logger {
+
+    enum Level {
+        WARNING(0), // WARNING is a message level indicating a potential problem
+        FINE(1),    // FINE is a message level providing tracing information
+        FINER(2),   // FINER indicates a fairly detailed tracing message
+        FINEST(3);  // FINEST indicates a highly detailed tracing message
+        private Level(int id) { this.id = id; }
+        private int id() { return id; }
+        private final int id;
+    }
+
+    /** Default logging Level is WARNING.
+        It could be changed by setting "vdb.log" java system property */
+    private Logger() {
+        String s = System.getProperty("vdb.log");
+        if (s == null) {
+            level = Level.WARNING;
+        } else if (s.equals("FINER")) {
+            level = Level.FINER;
+        } else if (s.equals("FINEST")) {
+            level = Level.FINEST;
+        } else {
+            level = Level.FINE;
+        }
+    }
+
+    static void fine  (String msg) { logger.log(msg, Level.FINE  ); }
+    static void finer (String msg) { logger.log(msg, Level.FINER ); }
+    static void finest(String msg) { logger.log(msg, Level.FINEST); }
+
+    static Level getLevel() { return logger.level; }
+    static void setLevel(Level newLevel) { logger.level = newLevel; }
+
+    private void log(String msg, Level level) {
+        if (this.level.id() < level.id()) {
+            return;
+        }
+        System.err.println(msg);
+    }
+
+    private Level level;
+    private static Logger logger = new Logger();
+}
diff --git a/ngs-java/gov/nih/nlm/ncbi/ngs/Makefile b/ngs-java/gov/nih/nlm/ncbi/ngs/Makefile
new file mode 100644
index 0000000..e8d4b44
--- /dev/null
+++ b/ngs-java/gov/nih/nlm/ncbi/ngs/Makefile
@@ -0,0 +1,110 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../../../../../../..)
+MODULE = ngs/ngs-java/gov/nih/nlm/ncbi/ngs
+
+JARS = \
+	ngs-ncbi.jar
+
+ALL_TARGS = \
+	$(JARS)
+
+# default settings for java do not work here, override    
+CLSPATH = $(TARGDIR)/ngs/ngs-java
+JAVASOURCEPATH = $(TOP)/ngs/ngs-java
+include $(TOP)/build/Makefile.env
+#$(warning JMAKE_CMD=$(JMAKE_CMD))
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: $(ALL_TARGS)
+
+$(JARS): makejdirs
+	@ $(JMAKE_CMD) $(CLSPATH)/$@
+
+.PHONY: all std $(ALL_TARGS)
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdjclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# classes for ngs-ncbi
+#
+
+LIB_SRC =                      \
+	HttpManager                \
+	LibManager      	       \
+	LibPathIterator   	       \
+	Logger      	           \
+	Manager      	           \
+    ReadCollectionItf          \
+    Refcount                   \
+    ReadGroupIteratorItf       \
+    ReadGroupItf               \
+    ReferenceIteratorItf       \
+    ReferenceItf               \
+    AlignmentItf               \
+    AlignmentIteratorItf       \
+    ReadItf                    \
+    ReadIteratorItf            \
+    PileupIteratorItf          \
+    PileupItf                  \
+    FragmentItf                \
+    PileupEventIteratorItf     \
+    PileupEventItf             \
+	TestyTheBear               \
+
+NGS_SRC =                      \
+    NGS                        \
+	$(LIB_SRC)
+
+#VARS = -Dvdb.System.loadLibrary=1
+#VARS = -Dvdb.log=FINEST
+#J=/net/pan1/sra-test/local/jdk1.7.0_51/bin/
+#JAVABITS=-d$(BITS)
+
+$(SRCDIR)/NGS.java: \
+	$(addprefix $(SRCDIR)/,$(addsuffix .java,$(LIB_SRC)))
+
+NGS_CLS = \
+	$(addsuffix .class,$(NGS_SRC))
+
+$(CLSPATH)/ngs-ncbi.jar: $(NGS_CLS)
+	( cd $(CLSPATH); jar -cf $@ `find ngs gov -name *.class` )
+
+#-------------------------------------------------------------------------------
+# manual integration test
+#
+test: $(CLSPATH)/ngs-ncbi.jar 
+	cd $(CLSPATH); $(J)java $(JAVABITS) -classpath ngs-ncbi.jar $(VARS) \
+		-Djava.library.path=$(LIBDIR) gov.nih.nlm.ncbi.ngs.TestyTheBear
diff --git a/ngs-java/gov/nih/nlm/ncbi/ngs/Manager.java b/ngs-java/gov/nih/nlm/ncbi/ngs/Manager.java
new file mode 100644
index 0000000..702a97f
--- /dev/null
+++ b/ngs-java/gov/nih/nlm/ncbi/ngs/Manager.java
@@ -0,0 +1,112 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package gov.nih.nlm.ncbi.ngs;
+
+import ngs.ErrorMsg;
+import ngs.ReadCollection;
+import ngs.itf.ReadCollectionItf;
+
+
+/*==========================================================================
+ * Manager
+ *  NGS library manager
+ */
+class Manager
+{
+
+    ReadCollection openReadCollection ( String spec )
+        throws ErrorMsg
+    {
+        long ref = this . OpenReadCollection ( spec );
+        try
+        {
+            return new ReadCollectionItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    Manager ()
+        throws ExceptionInInitializerError
+    {
+        try
+        {
+            /* Load the DLL for JNI (download it?).
+
+               To do just a plain call to System.LoadLibrary(libname)
+                set LibManager.JUST_DO_REGULAR_JAVA_SYSTEM_LOAD_LIBRARY to true
+                or set vdb.System.loadLibrary java system property. */
+
+            LibManager m = new LibManager ();
+            if ( ! m . loadLibrary ( "ngs-sdk" ) )
+                throw new ExceptionInInitializerError ( "Cannot load ngs-sdk library" );
+            if ( ! m . loadLibrary ( "ncbi-vdb" ) )
+                throw new ExceptionInInitializerError ( "Cannot load ncbi-vdb library" );
+
+            // try to initialize the NCBI library
+            String err = Initialize ();
+            if ( err != null )
+                throw new ExceptionInInitializerError ( err );
+
+            // install shutdown hook for library cleanup
+            Runtime . getRuntime () . addShutdownHook
+            (
+                new Thread ()
+                {
+                    public void run ()
+                    {
+                        Shutdown ();
+                    }
+                }
+            );
+        }
+        catch ( ExceptionInInitializerError x )
+        {
+            throw x;
+        }
+        catch ( Throwable x )
+        {
+            throw new ExceptionInInitializerError ( x );
+        }
+    }
+
+
+    // This jar's version : should match to JNI DLL's version
+    static int version ()
+    {
+        return 0x01000000;
+    }
+
+    private native static String Initialize ();
+    private native static void Shutdown ();
+    private native static long OpenReadCollection ( String spec )
+        throws ErrorMsg;
+    private native static void release ( long ref );
+}
diff --git a/ngs-java/gov/nih/nlm/ncbi/ngs/NGS.java b/ngs-java/gov/nih/nlm/ncbi/ngs/NGS.java
new file mode 100644
index 0000000..74e6324
--- /dev/null
+++ b/ngs-java/gov/nih/nlm/ncbi/ngs/NGS.java
@@ -0,0 +1,56 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package gov.nih.nlm.ncbi.ngs;
+
+import ngs.ErrorMsg;
+import ngs.ReadCollection;
+
+
+/*==========================================================================
+ * NGS
+ *  static implementation root
+ */
+public class NGS
+{
+
+    /**
+     * Create an object representing a named collection of reads
+     *
+     * @param spec may be a path to an object or may be an id, accession, or URL
+     * @throws ErrorMsg if object cannot be located
+     * @throws ErrorMsg if object cannot be converted to a ReadCollection
+     * @throws ErrorMsg if an error occurs during construction
+     */
+    static public ReadCollection openReadCollection ( String spec )
+        throws ErrorMsg
+    {
+        return mgr . openReadCollection ( spec );
+    }
+
+    private static Manager mgr = new Manager ();
+
+}
diff --git a/ngs-java/gov/nih/nlm/ncbi/ngs/TestyTheBear.java b/ngs-java/gov/nih/nlm/ncbi/ngs/TestyTheBear.java
new file mode 100644
index 0000000..9614bb0
--- /dev/null
+++ b/ngs-java/gov/nih/nlm/ncbi/ngs/TestyTheBear.java
@@ -0,0 +1,383 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package gov.nih.nlm.ncbi.ngs;
+
+import ngs.ErrorMsg;
+import ngs.ReadCollection;
+import ngs.Read;
+import ngs.ReadIterator;
+import ngs.Fragment;
+
+import java.util.ArrayList;
+
+public class TestyTheBear
+{
+    // a list of accessions to test
+    static String [] ACCESSIONS =
+    {
+          "SRR000001"  // SRA
+        , "SRR600096"  // SRA_DB
+        , "SRR1063272" // CSRA
+    };
+
+    // loop types:
+    //  'a' processes whole reads
+    //  'b' processes fragments
+    static char LOOP_TYPE = 'a';
+
+    // use a range to both test the facility
+    // and to limit the rows that will be processed
+    static boolean USE_RANGE = true;
+    static long START = 10;
+    static long COUNT = 5;
+
+    // a boolean to silence the printing code
+    static boolean SILENT = false;
+
+    static void loopa ( ReadCollection run, ReadIterator it )
+        throws ErrorMsg, Exception
+    {
+        String run_name = run . getName ();
+
+        long i;
+        for ( i = 0; it . nextRead (); ++ i )
+        {
+            String read_name = it . getReadName ();
+            String bases = it . getReadBases ();
+            String qual = it . getReadQualities ();
+
+            if ( SILENT )
+                continue;
+
+            System . out . println ( "@"
+                                     + run_name
+                                     + "."
+                                     + it . getReadId ()
+                                     + " "
+                                     + read_name
+                                     + " length="
+                                     + bases . length ()
+                );
+
+if (TEST_DLL) {                      // This code is used for
+ Logger.Level l = Logger.getLevel(); // DLL load test only and is turned on
+ Logger.setLevel(Logger.Level.FINE); // by running this app with -q
+ LibManager.DetectJVM();
+ Logger.setLevel(l);
+ if (LibPathIterator.list()) {
+  System.err.println("LibPathIterator OK");
+  System.exit(0);
+ } else {
+  System.err.println("LibPathIterator KO");
+  System.exit(1);
+ }
+}
+
+            System . out . println ( bases );
+
+            System . out . println ( "+"
+                                     + run_name
+                                     + "."
+                                     + it . getReadId ()
+                                     + " "
+                                     + read_name
+                                     + " length="
+                                     + qual . length ()
+                );
+
+            System . out . println ( qual );
+        }
+
+        System . err . println ( "Read "
+                                + i
+                                + " spots for "
+                                + run_name
+            );
+
+        System . err . println ( "Written "
+                                 + i
+                                 + " spots for "
+                                 + run_name
+            );
+    }
+
+    static void loopb ( ReadCollection run, ReadIterator it )
+        throws ErrorMsg, Exception
+    {
+        String run_name = run . getName ();
+
+        long i;
+        for ( i = 0; it . nextRead (); ++ i )
+        {
+            String read_name = it . getReadName ();
+
+            int j; // this is wrong - needs to retrieve idx from Read
+            for ( j = 1; it . nextFragment (); ++ j )
+            {
+                String bases = it . getFragmentBases ();
+                String qual = it . getFragmentQualities ();
+
+                if ( SILENT )
+                    continue;
+
+                System . out . println ( "@"
+                                         + run_name
+                                         + "."
+                                         + it . getReadId ()
+                                         + "."
+                                         + j
+                                         + " "
+                                         + read_name
+                                         + " length="
+                                         + bases . length ()
+                    );
+
+                System . out . println ( bases );
+
+                System . out . println ( "+"
+                                         + run_name
+                                         + "."
+                                         + it . getReadId ()
+                                         + "."
+                                         + j
+                                         + " "
+                                         + read_name
+                                         + " length="
+                                         + qual . length ()
+                    );
+
+                System . out . println ( qual );
+            }
+        }
+
+        System . err . println ( "Read "
+                                + i
+                                + " spots for "
+                                + run_name
+            );
+
+        System . err . println ( "Written "
+                                 + i
+                                 + " spots for "
+                                 + run_name
+            );
+    }
+
+    static void run ( String accession )
+        throws ErrorMsg, Exception
+    {
+        // open the named run
+        ReadCollection run = NGS . openReadCollection ( accession );
+
+        // get an iterator
+        ReadIterator it = USE_RANGE ?
+            run . getReadRange ( START, COUNT ):
+            run . getReads ( Read . all );
+
+        // run the requested loop
+        switch ( LOOP_TYPE )
+        {
+        case 'a':
+            loopa ( run, it );
+            break;
+        case 'b':
+            loopb ( run, it );
+            break;
+        default:
+            throw new Exception ( "WRITE THE CODE!" );
+        }
+    }
+
+    static boolean parseCmdLine ( String [] args )
+        throws Exception
+    {
+        int i;
+        for ( i = 0; i < args . length; ++ i )
+        {
+            String arg = args [ i ];
+            if ( arg . equals ( "-?" ) || arg . equals ( "-h" ) || arg . equals ( "--help" ) )
+            {
+                System . err . println (
+                    "Usage: TestyTheBear [ <options> ] [ <read-collection> [ <read-collection> ... ] ]\n" +
+                    "\n" +
+                    "  Options:\n" +
+                    "    '--loop' ( 'a' | 'b' )  : select loop option where a = reads, b = fragments\n" +
+                    "    '--read'                : synonym for '--loop a'\n" +
+                    "    '--frag'                : synonym for '--loop b'\n" +
+                    "    '--full'                : select entire run ( default is range " + START + ".." + ( START + COUNT - 1 ) + " )\n" +
+                    "    '--range' start count   : alter default range to use provided values\n" +
+                    "    '--silent'              : do not run printing code ( better for timing )\n" +
+                    "    '-q'                    : be quiet: just make sure JNI DLL was loaded\n" +
+                    "    '--help|-h|-?'          : print this message and exit\n"
+                    );
+
+                try {
+                    Logger.fine(LibManager.getEnv());
+                } catch (Exception e) {
+                    System.err.println(e);
+                }
+
+                return false;
+            }
+        }
+
+        ArrayList < String > accessions = null;
+
+        for ( i = 0; i < args . length; ++ i )
+        {
+            String arg = args [ i ];
+
+            if ( arg . charAt ( 0 ) != '-' )
+            {
+                if ( accessions == null )
+                    accessions = new ArrayList < String > ();
+
+                accessions . add ( arg );
+            }
+            else
+            {
+                if ( arg . equals ( "--loop" ) )
+                    LOOP_TYPE = args [ ++ i ] . toLowerCase () . charAt ( 0 );
+                else if ( arg . equals ( "--read" ) )
+                    LOOP_TYPE = 'a';
+                else if ( arg . equals ( "--frag" ) )
+                    LOOP_TYPE = 'b';
+                else if ( arg . equals ( "--full" ) )
+                    USE_RANGE = false;
+                else if ( arg . equals ( "--range" ) )
+                {
+                    START = Long . parseLong ( args [ ++ i ] );
+                    COUNT = Long . parseLong ( args [ ++ i ] );
+                    if ( START < 1 )
+                        throw new Exception ( "bad range start: " + START );
+                    if ( COUNT < 0 )
+                        throw new Exception ( "bad range count: " + COUNT );
+
+                }
+                else if ( arg . equals ( "--silent" ) )
+                    SILENT = true;
+                else if ( arg . equals ( "-q" ) )
+                    TEST_DLL = true;
+                else
+                {
+                    throw new Exception ( "unknown switch: '" + arg + "'" );
+                }
+            }
+        }
+
+        switch ( LOOP_TYPE )
+        {
+        case 'a':
+        case 'b':
+            break;
+        default:
+            System . err . println ( "bad loop type - must be 'a' or 'b'" );
+            return false;
+        }
+
+        if ( accessions != null )
+        {
+            ACCESSIONS = accessions . toArray ( new String [ accessions . size () ] );
+        }
+
+        System . err . print ( "# Processing " );
+        if ( USE_RANGE )
+            System . err . println ( "rows " + START + ".." + ( START + COUNT - 1 ) + " of:" );
+        else
+            System . err . println ( "complete:" );
+
+        System . err . print ( "# Runs " );
+
+        String sep = "{ ";
+        int count = ACCESSIONS . length;
+        if ( count > 16 )
+            count = 16;
+        for ( i = 0; i < count; ++ i )
+        {
+            System . err . print ( sep + ACCESSIONS [ i ] );
+            sep = ", ";
+        }
+
+        if ( count < ACCESSIONS . length )
+            System . err . println ( ", ... }" );
+        else
+            System . err . println ( " }" );
+
+        System . err . print ( "# Using " );
+        System . err . print ( "dual-level ReadIterator, " );
+        if ( LOOP_TYPE == 'b' )
+            System . err . println ( "and Fragment access." );
+        else
+            System . err . println ( "and whole Read access." );
+        if ( SILENT )
+            System . err . println ( "# OUTPUT IS SILENCED." );
+        System . err . println ( "# Execute with '--help' to see how to modify these settings.\n" );
+
+        return true;
+    }
+
+    public static void main ( String [] args )
+    {
+        try
+        {
+            if ( parseCmdLine ( args ) )
+            {
+                int i, num_errs;
+                for ( i = num_errs = 0; i < ACCESSIONS . length; ++ i )
+                {
+                    try
+                    {
+                        run ( ACCESSIONS [ i ] );
+                    }
+                    catch ( ErrorMsg x )
+                    {
+                        System . err . println ( "ERROR - processing run '" + ACCESSIONS [ i ] + "'" );
+                        System . err . println ( x . toString () );
+                        x . printStackTrace ();
+                        ++ num_errs;
+                    }
+                    catch ( Exception x )
+                    {
+                        System . err . println ( "ERROR - processing run '" + ACCESSIONS [ i ] + "'" );
+                        System . err . println ( x . toString () );
+                        x . printStackTrace ();
+                        ++ num_errs;
+                    }
+                }
+            
+                System . err . println ( "Processed " + ACCESSIONS . length + " runs with " + num_errs + " errors" );
+            }
+        }
+        catch ( Exception x )
+        {
+            System . err . println ( x . toString () );
+            x . printStackTrace ();
+        }
+    }
+
+    private static boolean TEST_DLL = false;
+}
diff --git a/ngs-java/konfigure.perl b/ngs-java/konfigure.perl
new file mode 100644
index 0000000..2a7fde7
--- /dev/null
+++ b/ngs-java/konfigure.perl
@@ -0,0 +1,1210 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+use strict;
+
+sub println  { print @_; print "\n" }
+
+my ($filename, $directories, $suffix) = fileparse($0);
+if ($directories ne "./") {
+    println "configure: error: $filename should be run as ./$filename";
+    exit 1;
+}
+
+require 'package.pm';
+require 'os-arch.pm';
+
+use Cwd qw (abs_path getcwd);
+use File::Basename 'fileparse';
+use File::Spec 'catdir';
+use FindBin qw($Bin);
+use Getopt::Long 'GetOptions';
+
+check();
+
+my %PKG = PKG();
+
+my $PACKAGE_NAME = PACKAGE_NAME();
+my $OUT_MAKEFILE = 'Makefile.config';
+
+my $PACKAGE = PACKAGE();
+
+my $HOME = $ENV{HOME} || $ENV{USERPROFILE}
+    || $ENV{LOGDIR} || getcwd || (getpwuid($<))[7] || abs_path('.');
+
+$PKG{UPATH} =~ s/(\$\w+)/$1/eeg;
+
+my $OUTDIR = File::Spec->catdir($HOME, $PKG{OUT});
+
+my $package_default_prefix = $PKG{PATH};
+my $schema_default_dir = $PKG{SCHEMA_PATH} if ($PKG{SCHEMA_PATH});
+
+my @REQ = REQ();
+
+my @options = ( "arch=s",
+                "build=s",
+                "clean",
+                "debug",
+                "help",
+#               "output-makefile=s",
+                "prefix=s",
+                "status",
+                "with-debug",
+                "without-debug" );
+foreach my $href (@REQ) {
+    my %a = %$href;
+    push @options, "$a{option}=s";
+    push @options, "$a{boption}=s" if ($a{boption});
+    $href->{usrpath} =~ s/(\$\w+)/$1/eeg;
+}
+push @options, "shemadir" if ($PKG{SCHEMA_PATH});
+
+my %OPT;
+die "configure: error" unless (GetOptions(\%OPT, @options));
+
+if ($OPT{'help'}) {
+    help();
+    exit(0);
+} elsif ($OPT{'clean'}) {
+    {
+        foreach (glob(CONFIG_OUT() . '/Makefile.config*'),
+            File::Spec->catdir(CONFIG_OUT(), 'user.status'),
+            File::Spec->catdir(CONFIG_OUT(), 'Makefile.userconfig'))
+        {
+            my $f = $_;
+            print "removing $f... ";
+            if (-e $f) {
+                if (unlink $f) {
+                    println "ok";
+                } else {
+                    println "failed";
+                }
+            } else {
+                println "not found";
+            }
+        }
+    }
+    if (CONFIG_OUT() ne '.') {
+        foreach
+            (glob('Makefile.config*'), 'user.status', 'Makefile.userconfig')
+        {
+            my $f = $_;
+            print "removing $f... ";
+            if (-e $f) {
+                if (unlink $f) {
+                    println "ok";
+                } else {
+                    println "failed";
+                }
+            } else {
+                println "not found";
+            }
+        }
+    }
+    exit(0);
+} elsif ($OPT{'status'}) {
+    status(1);
+    exit(0);
+}
+$OPT{'prefix'} = $package_default_prefix unless ($OPT{'prefix'});
+
+my $AUTORUN = $OPT{status};
+print "checking system type... " unless ($AUTORUN);
+my ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+println $OSTYPE unless ($AUTORUN);
+
+{
+    $OPT{'prefix'} = expand($OPT{'prefix'});
+    my $prefix = $OPT{'prefix'};
+    $OPT{eprefix} = $prefix unless ($OPT{eprefix} || $OS eq 'win');
+    my $eprefix = $OPT{eprefix};
+    unless ($OPT{bindir} || $OS eq 'win') {
+        $OPT{bindir} = File::Spec->catdir($eprefix, 'bin') ;
+    }
+    unless ($OPT{libdir} || $OS eq 'win') {
+        $OPT{libdir} = File::Spec->catdir($eprefix, 'lib');
+    }
+    unless ($OPT{includedir} || $OS eq 'win') {
+        $OPT{includedir} = File::Spec->catdir($eprefix, 'include');
+    }
+    if ($PKG{LNG} eq 'PYTHON' && ! $OPT{pythondir} && $OS ne 'win') {
+        $OPT{pythondir} = $eprefix;
+    }
+    if ($PKG{LNG} eq 'JAVA' && ! $OPT{javadir} && $OS ne 'win') {
+        $OPT{javadir} = File::Spec->catdir($eprefix, 'jar');
+    }
+    if ($PKG{EXAMP} && ! $OPT{sharedir} && $OS ne 'win') {
+        $OPT{sharedir} = File::Spec->catdir($eprefix, 'share');
+    }
+}
+
+# initial values
+my $TARGDIR = File::Spec->catdir($OUTDIR, $PACKAGE);
+$TARGDIR = expand($OPT{'build'}) if ($OPT{'build'});
+
+my $BUILD = 'rel';
+
+# parse command line
+$BUILD = 'dbg' if ($OPT{'with-debug'});
+$BUILD = 'rel' if ($OPT{'without-debug'});
+
+my $BUILD_TYPE = "release";
+$BUILD_TYPE = "debug" if ( $BUILD eq "dbg" );
+
+$OPT{arch} = $ARCH if (@ARCHITECTURES && ! $OPT{arch});
+
+if ($OPT{arch}) {
+    my $found;
+    foreach (@ARCHITECTURES) {
+        if ($_ eq $OPT{arch}) {
+            ++$found;
+            last;
+        }
+    }
+    if ($found) {
+        $ARCH = $MARCH = $OPT{arch};
+        while (1) {
+            open F, ">Makefile.config.$OS.arch" or last;
+            print F "$ARCH\n";
+            close F;
+            last;
+        }
+    } else {
+        delete $OPT{arch};
+    }
+}
+
+$OUT_MAKEFILE .= ".$OS.$ARCH";
+$OUT_MAKEFILE = File::Spec->catdir(CONFIG_OUT(), $OUT_MAKEFILE);
+
+#my $OSTYPE = `uname -s`; chomp $OSTYPE;
+
+print "checking machine architecture... " unless ($AUTORUN);
+#my $MARCH = `uname -m`; chomp $MARCH;
+println $MARCH unless ($AUTORUN);
+
+my $TOOLS = "";
+$TOOLS = "jdk" if ($PKG{LNG} eq 'JAVA');
+
+print "checking $PACKAGE_NAME version... " unless ($AUTORUN);
+my $FULL_VERSION = VERSION();
+println $FULL_VERSION unless ($AUTORUN);
+
+# determine architecture
+
+print "checking for supported architecture... " unless ($AUTORUN);
+
+my $BITS;
+
+if ( $MARCH =~ m/x86_64/i )
+{
+    $BITS = 64;
+}
+elsif ( $MARCH =~ m/i?86/i )
+{
+    $BITS = 32;
+}
+else
+{
+    die "unrecognized Architecture - " . $ARCH;
+}
+println "$MARCH ($BITS bits) is supported" unless ($AUTORUN);
+
+# determine OS and related norms
+my ($LPFX, $OBJX, $LOBX, $LIBX, $SHLX, $EXEX, $OSINC);
+
+print "checking for supported OS... " unless ($AUTORUN);
+if ( $OSTYPE =~ m/linux/i )
+{
+    $LPFX = "lib";
+    $OBJX = "o";
+    $LOBX = "pic.o";
+    $LIBX = "a";
+    $SHLX = "so";
+    $EXEX = "";
+    $OSINC = "unix";
+    if ( $TOOLS eq "" )
+    {
+        $TOOLS = "gcc";
+    }
+}
+elsif ( $OSTYPE =~ m/darwin/i )
+{
+    $LPFX = "lib";
+    $OBJX = "o";
+    $LOBX = "pic.o";
+    $LIBX = "a";
+    $SHLX = "dylib";
+    $EXEX = "";
+    $OSINC = "unix";
+    if ( $TOOLS eq "" )
+    {
+        $TOOLS = "clang";
+    }
+} elsif ($OSTYPE eq 'win') {
+    $TOOLS = "vc++";
+} else
+{
+    die "unrecognized OS - " . $OSTYPE;
+}
+println "$OSTYPE ($OS) is supported" unless ($AUTORUN);
+
+# tool chain
+my ($CC, $CP, $AR, $ARX, $ARLS, $LD, $LP);
+my ($JAVAC, $JAVAH, $JAR);
+my ($DBG, $OPT, $PIC, $INC, $MD);
+
+print "checking for supported tool chain... " unless ($AUTORUN);
+if ( $TOOLS =~ m/gcc/i )
+{
+    $CC = "gcc -c";
+    $CP = "g++ -c";
+    $AR = "ar rc";
+    $ARX = "ar x";
+    $ARLS = "ar t";
+    $LD = "gcc";
+    $LP = "g++";
+
+    $DBG = "-g -DDEBUG";
+    $OPT = "-O3";
+    $PIC = "-fPIC";
+    $INC = "-I";
+    $MD  = "-MD";
+}
+elsif ( $TOOLS =~ m/clang/i )
+{
+    $CC = "clang -c";
+    $CP = "clang++ -c";
+    $AR = "ar rc";
+    $ARX = "ar x";
+    $ARLS = "ar t";
+    $LD = "clang";
+    $LP = "clang++";
+
+    $DBG = "-g -DDEBUG";
+    $OPT = "-O3";
+    $PIC = "-fPIC";
+    $INC = "-I";
+    $MD  = "-MD";
+}
+elsif ( $TOOLS =~ m/jdk/i )
+{
+    $JAVAC = "javac";
+    $JAVAH = "javah";
+    $JAR   = "jar cf";
+
+    $DBG = "-g";
+} elsif ($TOOLS eq 'vc++') {
+} else
+{
+    die "unrecognized tool chain - " . $TOOLS;
+}
+println "$TOOLS tool chain is supported" unless ($AUTORUN);
+
+if ($OS ne 'win') {
+    $TARGDIR = File::Spec->catdir($TARGDIR, $OS, $TOOLS, $ARCH, $BUILD);
+}
+
+my @dependencies;
+
+foreach my $href (DEPENDS()) {
+    $_ = $href->{name};
+    my ($I, $L) = ($href->{Include});
+    if ($OPT{"with-$_-prefix"}) {
+        $I = File::Spec->catdir($OPT{"with-$_-prefix"}, 'include'); 
+        $L = File::Spec->catdir($OPT{"with-$_-prefix"}, 'lib'); 
+    }
+    my ($i, $l) = find_lib($_, $I, $L);
+    if (defined $i || $l) {
+        my $d = 'HAVE_' . uc($_) . ' = 1';
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+    if ($i) {
+        my $d = uc($_) . "_INCDIR = $i";
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+    if ($l) {
+        my $d = uc($_) . "_LIBDIR = $l";
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+}
+
+foreach my $href (@REQ) {
+    $href->{bldpath} =~ s/(\$\w+)/$1/eeg if ($href->{bldpath});
+    my ($found_itf, $found_lib, $found_ilib);        # found directories
+    my %a = %$href;
+    my $is_optional = optional($a{type});
+    my $need_source = $a{type} =~ /S/;
+    my $need_build = $a{type} =~ /B/;
+    my $need_lib = $a{type} =~ /L/;
+    
+    my ($inc, $lib, $ilib) = ($a{include}, $a{lib}); # file names to check
+    $lib =~ s/(\$\w+)/$1/eeg;
+
+    if ($need_build) {
+        $ilib = $a{ilib};
+        ++$need_lib;
+    }
+    unless ($AUTORUN) {
+        if ($need_source && $need_build) {
+            println
+               "checking for $a{name} package source files and build results..."
+        } elsif ($need_source) {
+            println "checking for $a{name} package source files...";
+        } else {
+            println "checking for $a{name} package...";
+        }
+    }
+    my %has_option;
+    foreach my $option ($a{option}, $a{boption}) {
+        next unless ($option);
+        if ($OPT{$option}) {
+            my $try = expand($OPT{$option});
+            my ($i, $l, $il) = ($inc, $lib, $ilib);
+            if ($option =~ /-build$/) {
+                undef $i;
+                ++$has_option{build};
+            } elsif ($option =~ /-prefix$/) {
+                undef $il;
+                ++$has_option{prefix};
+            } elsif ($option =~ /-sources$/) {
+                undef $l;
+                undef $il;
+                ++$has_option{sources};
+            }
+            my ($fi, $fl, $fil) = find_in_dir($try, $i, $l, $il);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+            $found_ilib = $fil if (! $found_ilib && $fil);
+        }
+    }
+    if (! $found_itf && ! $has_option{sources} && $a{srcpath}) {
+        my $try = $a{srcpath};
+        ($found_itf) = find_in_dir($try, $inc);
+    }
+    if (! $has_option{prefix}) {
+        if (! $found_itf || ($need_lib && ! $found_lib)) {
+            my $try = $a{pkgpath};
+            my ($fi, $fl) = find_in_dir($try, $inc, $lib);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+        }
+
+        if (! $found_itf || ($need_lib && ! $found_lib)) {
+            my $try = $a{usrpath};
+            my ($fi, $fl) = find_in_dir($try, $inc, $lib);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+        }
+    }
+    if (! $has_option{build}) {
+        if (($need_build || ($need_lib && ! $found_lib)) && $a{bldpath}) {
+            my $try = $a{bldpath};
+            my (undef, $fl, $fil) = find_in_dir($try, undef, $lib, $ilib);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+            $found_ilib = $fil if (! $found_ilib && $fil);
+        }
+    }
+    if (! $found_itf || ($need_lib && ! $found_lib) || ($ilib && ! $found_ilib))
+    {
+        if ($is_optional) {
+            println "configure: optional $a{name} package not found: skipped.";
+        } else {
+            if ($OPT{'debug'}) {
+                $_ = "$a{name}: includes: ";
+                $found_itf = '' unless $found_itf;
+                $_ .= $found_itf;
+                unless ($need_lib) {
+                    $_ .= "; libs: not needed";
+                } else {
+                    $found_lib = '' unless $found_lib;
+                    $_ .= "; libs: " . $found_lib;
+                }
+                unless ($ilib) {
+                    $_ .= "; ilibs: not needed";
+                } else {
+                    $found_ilib = '' unless $found_ilib;
+                    $_ .= "; ilibs: " . $found_ilib;
+                }
+                println "\t\t$_";
+            }
+            println "configure: error: required $a{name} package not found.";
+            exit 1;
+        }
+    } else {
+        $found_itf = abs_path($found_itf);
+        push(@dependencies, "$a{namew}_INCDIR = $found_itf");
+        if ($found_lib) {
+            $found_lib = abs_path($found_lib);
+            push(@dependencies, "$a{namew}_LIBDIR = $found_lib");
+        }
+        if ($ilib && $found_ilib) {
+            $found_ilib = abs_path($found_ilib);
+            push(@dependencies, "$a{namew}_ILIBDIR = $found_ilib");
+        }
+    }
+}
+
+if ($OS ne 'win' && ! $OPT{'status'}) {
+    # create Makefile.config
+    println "configure: creating '$OUT_MAKEFILE'" unless ($AUTORUN);
+    open my $F, ">$OUT_MAKEFILE" or die "cannot open $OUT_MAKEFILE to write";
+
+    print $F <<EndText;
+### AUTO-GENERATED FILE ###
+
+OS_ARCH = \$(shell perl \$(TOP)/os-arch.perl)
+
+# install paths
+EndText
+
+    L($F, "INST_BINDIR = $OPT{bindir}"        ) if ($OPT{bindir});
+    L($F, "INST_LIBDIR = $OPT{libdir}"        ) if ($OPT{libdir});
+    L($F, "INST_INCDIR = $OPT{includedir}"    ) if ($OPT{includedir});
+    L($F, "INST_SCHEMADIR = $OPT{'shemadir'}" ) if ($OPT{'shemadir'});
+    L($F, "INST_SHAREDIR = $OPT{'sharedir'}"  ) if ($OPT{'sharedir'});
+    L($F, "INST_JARDIR = $OPT{'javadir'}"     ) if ($OPT{'javadir'});
+    L($F, "INST_PYTHONDIR = $OPT{'pythondir'}") if ($OPT{'pythondir'});
+
+    my ($VERSION_SHLX, $MAJMIN_SHLX, $MAJVERS_SHLX);
+    if ($OSTYPE =~ /darwin/i) {
+        $VERSION_SHLX = '$(VERSION).$(SHLX)';
+        $MAJMIN_SHLX  = '$(MAJMIN).$(SHLX)';
+        $MAJVERS_SHLX = '$(MAJVERS).$(SHLX)';
+    } else {
+        $VERSION_SHLX = '$(SHLX).$(VERSION)';
+        $MAJMIN_SHLX  = '$(SHLX).$(MAJMIN)';
+        $MAJVERS_SHLX = '$(SHLX).$(MAJVERS)';
+    }
+
+
+    print $F <<EndText;
+
+# build type
+BUILD = $BUILD
+
+# target OS
+OS    = $OS
+OSINC = $OSINC
+
+# prefix string for system libraries
+LPFX = $LPFX
+
+# suffix strings for system libraries
+LIBX = $LIBX
+VERSION_LIBX = \$(LIBX).\$(VERSION)
+MAJMIN_LIBX  = \$(LIBX).\$(MAJMIN)
+MAJVERS_LIBX = \$(LIBX).\$(MAJVERS)
+
+SHLX = $SHLX
+VERSION_SHLX = $VERSION_SHLX
+MAJMIN_SHLX  = $MAJMIN_SHLX
+MAJVERS_SHLX = $MAJVERS_SHLX
+
+# suffix strings for system object files
+OBJX = $OBJX
+LOBX = $LOBX
+
+# suffix string for system executable
+EXEX = $EXEX
+VERSION_EXEX = \$(EXEX).\$(VERSION)
+MAJMIN_EXEX  = \$(EXEX).\$(MAJMIN)
+MAJVERS_EXEX = \$(EXEX).\$(MAJVERS)
+
+# system architecture and wordsize
+ARCH = $ARCH
+EndText
+
+    L($F, "# ARCH = $ARCH ( $MARCH )") if ($ARCH ne $MARCH);
+
+    print $F <<EndText;
+BITS = $BITS
+
+# tools
+EndText
+
+    L($F, "CC    = $CC"   ) if ($CC);
+    L($F, "CP    = $CP"   ) if ($CP);
+    L($F, "AR    = $AR"   ) if ($AR);
+    L($F, "ARX   = $ARX"  ) if ($ARX);
+    L($F, "ARLS  = $ARLS" ) if ($ARLS);
+    L($F, "LD    = $LD"   ) if ($LD);
+    L($F, "LP    = $LP"   ) if ($LP);
+    L($F, "JAVAC = $JAVAC") if ($JAVAC);
+    L($F, "JAVAH = $JAVAH") if ($JAVAH);
+    L($F, "JAR   = $JAR"  ) if ($JAR);
+    L($F);
+
+    L($F, '# tool options');
+    if ($BUILD eq "dbg") {
+        L($F, "DBG     = $DBG");
+        L($F, "OPT     = ");
+    } else {
+        L($F, "DBG     = -DNDEBUG") if ($PKG{LNG} eq 'C');
+        L($F, "OPT     = $OPT"    ) if ($OPT);
+    }
+    L($F, "PIC     = $PIC") if ($PIC);
+    if ($PKG{LNG} eq 'C') {
+        if ($TOOLS =~ /clang/i) {
+   L($F, 'SONAME  = -install_name ' .
+               '$(INST_LIBDIR)$(BITS)/$(subst $(VERSION),$(MAJVERS),$(@F)) \\');
+   L($F, '    -compatibility_version $(MAJMIN) -current_version $(VERSION) \\');
+   L($F, '    -flat_namespace -undefined suppress');
+        } else {
+      L($F, 'SONAME = -Wl,-soname=$(subst $(VERSION),$(MAJVERS),$(@F))');
+     }
+     L($F, "SRCINC  = $INC. $INC\$(SRCDIR)");
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'SRCINC  = -sourcepath $(INCPATHS)');
+    }
+    L($F, "INCDIRS = \$(SRCINC) $INC\$(TOP)") if ($PIC);
+    if ($PKG{LNG} eq 'C') {
+        L($F, "CFLAGS  = \$(DBG) \$(OPT) \$(INCDIRS) $MD");
+    }
+
+    L($F, 'CLSPATH = -classpath $(CLSDIR)');
+    L($F);
+
+    # version information
+
+    my ($VERSION, $MAJMIN, $MAJVERS);
+
+    if ($FULL_VERSION =~ /(\d+)\.(\d+)\.(\d+)-?\w*\d*/) {
+        $VERSION = "$1.$2.$3";
+        $MAJMIN = "$1.$2";
+        $MAJVERS = $1;
+    } else {
+        die $VERSION;
+    }
+
+    print $F <<EndText;
+# $PACKAGE_NAME and library version
+VERSION = $VERSION
+MAJMIN  = $MAJMIN
+MAJVERS = $MAJVERS
+
+# output path
+TARGDIR = $TARGDIR
+
+# derived paths
+MODPATH  ?= \$(subst \$(TOP)/,,\$(CURDIR))
+SRCDIR   ?= \$(TOP)/\$(MODPATH)
+MAKEFILE ?= \$(abspath \$(firstword \$(MAKEFILE_LIST)))
+BINDIR    = \$(TARGDIR)/bin
+EndText
+
+    if ($PKG{LNG} eq 'C') {
+        L($F, 'LIBDIR    = $(TARGDIR)/lib');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'LIBDIR    = $(TARGDIR)/jar');
+    }
+
+    print $F <<EndText;
+ILIBDIR   = \$(TARGDIR)/ilib
+OBJDIR    = \$(TARGDIR)/obj/\$(MODPATH)
+CLSDIR    = \$(TARGDIR)/cls
+EndText
+
+    if ($PKG{LNG} eq 'JAVA') {
+        L($F,
+            "INCPATHS = \$(SRCDIR):\$(SRCDIR)/itf:\$(TOP)/gov/nih/nlm/ncbi/ngs")
+    }
+
+    print $F <<EndText;
+
+# exports
+export TOP
+export MODPATH
+export SRCDIR
+export MAKEFILE
+
+# auto-compilation rules
+EndText
+
+    if ($PKG{LNG} eq 'C') {
+        L($F, '$(OBJDIR)/%.$(OBJX): %.c');
+        T($F, '$(CC) -o $@ $< $(CFLAGS)');
+        L($F, '$(OBJDIR)/%.$(LOBX): %.c');
+        T($F, '$(CC) -o $@ $< $(PIC) $(CFLAGS)');
+    }
+    L($F, '$(OBJDIR)/%.$(OBJX): %.cpp');
+    T($F, '$(CP) -o $@ $< $(CFLAGS)');
+    L($F, '$(OBJDIR)/%.$(LOBX): %.cpp');
+    T($F, '$(CP) -o $@ $< $(PIC) $(CFLAGS)');
+    L($F);
+
+    # this is part of Makefile
+    L($F, 'VPATH = $(SRCDIR)');
+    L($F);
+
+    # we know how to find jni headers
+    if ($PKG{LNG} eq 'JAVA' and $OPT{'with-ngs-sdk-src'}) {
+        L($F, "JNIPATH = $OPT{'with-ngs-sdk-src'}/language/java");
+    }
+
+    L($F, '# directory rules');
+    if ($PKG{LNG} eq 'C') {
+        L($F, '$(BINDIR) $(LIBDIR) $(ILIBDIR) '
+            . '$(OBJDIR) $(INST_LIBDIR) $(INST_LIBDIR)$(BITS):');
+        T($F, 'mkdir -p $@');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        # test if we have jni header path
+        L($F, '$(LIBDIR) $(CLSDIR) $(INST_JARDIR):');
+        T($F, 'mkdir -p $@');
+    }
+    L($F);
+
+    L($F, '# not real targets');
+    L($F, '.PHONY: default clean install all std $(TARGETS)');
+    L($F);
+
+    L($F, '# dependencies');
+    if ($PKG{LNG} eq 'C') {
+        L($F, 'include $(wildcard $(OBJDIR)/*.d)');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'include $(wildcard $(CLSDIR)/*.d)');
+    }
+    L($F, $_) foreach (@dependencies);
+    L($F);
+
+    if ($OS eq 'linux' || $OS eq 'mac') {
+        L($F, '# installation rules');
+        L($F,
+        '$(INST_LIBDIR)$(BITS)/%.$(VERSION_LIBX): $(LIBDIR)/%.$(VERSION_LIBX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 644 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_LIBX),$(LIBX),$@) '
+                      . '$(subst .$(VERSION_LIBX),-static.$(LIBX),$@); \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_LIBX),$(LIBX),$@); \\');
+        T($F, '      ln -s $(subst $(VERSION_LIBX),$(LIBX),$(@F)) ' .
+       '$(INST_LIBDIR)$(BITS)/$(subst .$(VERSION_LIBX),-static.$(LIBX),$(@F));'
+                                                              . ' \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+        L($F);
+
+        L($F,
+        '$(INST_LIBDIR)$(BITS)/%.$(VERSION_SHLX): $(LIBDIR)/%.$(VERSION_SHLX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 755 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_SHLX),$(SHLX),$@);    \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_SHLX),$(SHLX),$@); \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+        L($F);
+
+        L($F, '$(INST_BINDIR)/%$(VERSION_EXEX): $(BINDIR)/%$(VERSION_EXEX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 755 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_EXEX),$(EXEX),$@);     \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_EXEX),$(EXEX),$@); \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+    }
+    close $F;
+}
+
+if (! $OPT{'status'} ) {
+    if ($OS eq 'win') {
+        my $OUT = File::Spec->catdir(CONFIG_OUT(), 'Makefile.config.win');
+        println "configure: creating '$OUT'";
+        open OUT, ">$OUT" or die "cannot open $OUT to write";
+        my $name = PACKAGE_NAMW();
+        my $outdir = $name . '_OUTDIR';
+        my $root = $name . '_ROOT';
+
+        print OUT <<EndText;
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
+  <PropertyGroup Label="Globals">
+    <$outdir>$TARGDIR/\</$outdir>
+EndText
+        foreach my $href (@REQ) {
+            my %a = %$href;
+            my $NGS_SDK_PREFIX = '';
+            $NGS_SDK_PREFIX = $a{found_itf} if ($a{found_itf});
+            if ($a{name} eq 'ngs-sdk') {
+                my $root = "$a{namew}_ROOT";
+                print OUT "    <$root>$NGS_SDK_PREFIX\/</$root>\n";
+                last;
+            }
+        }
+        print OUT <<EndText;
+    <$root>$Bin/\</$root>
+  </PropertyGroup>
+</Project>
+EndText
+        close OUT;
+    } else {
+        println "configure: creating 'Makefile.config'" unless ($AUTORUN);
+        my $CONFIG_OUT = CONFIG_OUT();
+        my $out = File::Spec->catdir($CONFIG_OUT, 'Makefile.config');
+        open COUT, ">$out" or die "cannot open $out to write";
+        print COUT "### AUTO-GENERATED FILE ###\n";
+        print COUT "\n";
+        print COUT "OS_ARCH = \$(shell perl \$(TOP)/os-arch.perl)\n";
+        print COUT "include \$(TOP)/$CONFIG_OUT/Makefile.config.\$(OS_ARCH)\n";
+        close COUT;
+    }
+}
+
+status() if ($OS ne 'win');
+
+unlink 'a.out';
+
+sub L { $_[1] = '' unless ($_[1]); print { $_[0] }   "$_[1]\n" }
+sub T {                            print { $_[0] } "\t$_[1]\n" }
+
+sub status {
+    my ($load) = @_;
+    if ($load) {
+        ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+        my $MAKEFILE
+            = File::Spec->catdir(CONFIG_OUT(), "$OUT_MAKEFILE.$OS.$ARCH");
+        println "\t\tloading $MAKEFILE" if ($OPT{'debug'});
+        unless (-e $MAKEFILE) {
+            print STDERR "configure: error: run ./configure [OPTIONS] first.\n";
+            exit 1;
+        }
+        open F, $MAKEFILE or die "cannot open $MAKEFILE";
+        foreach (<F>) {
+            chomp;
+            if (/BUILD = (.+)/) {
+                $BUILD_TYPE = $1;
+            } elsif (/BUILD \?= /) {
+                $BUILD_TYPE = $_ unless ($BUILD_TYPE);
+            }
+            elsif (/TARGDIR = /) {
+                $TARGDIR = $_;
+                println "\t\tgot $_" if ($OPT{'debug'});
+            } elsif (/TARGDIR \?= (.+)/) {
+                $TARGDIR = $1 unless ($TARGDIR);
+                println "\t\tgot $_" if ($OPT{'debug'});
+            }
+            elsif (/INST_INCDIR = (.+)/) {
+                $OPT{includedir} = $1;
+            }
+            elsif (/INST_BINDIR = (.+)/) {
+                $OPT{bindir} = $1;
+            }
+            elsif (/INST_LIBDIR = (.+)/) {
+                $OPT{libdir} = $1;
+            }
+        }
+    }
+
+    println "build type: $BUILD_TYPE";
+    println "build output path: $TARGDIR" if ($OS ne 'win');
+
+#   print "prefix: ";    print $OPT{'prefix'} if ($OS ne 'win');    println;
+#   print "eprefix: ";    print $OPT{'eprefix'} if ($OPT{'eprefix'});   println;
+
+    print "includedir: ";
+    print $OPT{'includedir'} if ($OPT{'includedir'});
+    println;
+
+    print "bindir: ";
+    print $OPT{'bindir'} if ($OPT{'bindir'});
+    println;
+
+    print "libdir: ";
+    print $OPT{'libdir'} if ($OPT{'libdir'});
+    println;
+
+    println "schemadir: $OPT{'shemadir'}" if ($OPT{'shemadir'});
+    println "sharedir: $OPT{'sharedir'}" if ($OPT{'sharedir'});
+    println "javadir: $OPT{'javadir'}" if ($OPT{'javadir'});
+    println "pythondir: $OPT{'pythondir'}" if ($OPT{'pythondir'});
+
+    println;
+}
+
+sub expand {
+    my ($filename) = @_;
+    return unless ($filename);
+    if ($filename =~ /^~/) {
+        $filename =~ s{ ^ ~ ( [^/]* ) }
+                      { $1
+                            ? (getpwnam($1))[7]
+                            : ( $ENV{HOME} || $ENV{USERPROFILE} || $ENV{LOGDIR}
+                                || (getpwuid($<))[7]
+                              )
+                      }ex;
+    }
+    my $a = abs_path($filename);
+    $filename = $a if ($a);
+    $filename;
+}
+
+sub find_in_dir {
+    my ($dir, $include, $lib, $ilib) = @_;
+    print "\t$dir... " unless ($AUTORUN);
+    unless (-d $dir) {
+        println "no" unless ($AUTORUN);
+        println "\t\tnot found $dir" if ($OPT{'debug'});
+        return;
+    }
+    print "[found] " if ($OPT{'debug'});
+    my ($found_inc, $found_lib, $found_ilib);
+    my $nl = 1;
+    if ($include) {
+        print "includes... " unless ($AUTORUN);
+        if (-e "$dir/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = $dir;
+        } elsif (-e "$dir/include/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = "$dir/include";
+        } elsif (-e "$dir/interfaces/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = "$dir/interfaces";
+        } else {
+            println 'no' unless ($AUTORUN);
+        }
+        $nl = 0;
+    }
+    if ($lib || $ilib) {
+        print "\n\t" if ($nl && !$AUTORUN);
+        print "libraries... " unless ($AUTORUN);
+        if ($lib) {
+            my $builddir = File::Spec->catdir($dir, $OS, $TOOLS, $ARCH, $BUILD);
+            my $libdir  = File::Spec->catdir($builddir, 'lib');
+            my $ilibdir = File::Spec->catdir($builddir, 'ilib');
+            my $f = File::Spec->catdir($libdir, $lib);
+            print "\n\t\tchecking $f\n\t" if ($OPT{'debug'});
+            my $found;
+            if (-e $f) {
+                $found_lib = $libdir;
+                if ($ilib) {
+                    my $f = File::Spec->catdir($ilibdir, $ilib);
+                    print "\tchecking $f\n\t" if ($OPT{'debug'});
+                    if (-e $f) {
+                        println 'yes';
+                        $found_ilib = $ilibdir;
+                    } else {
+                        println 'no' unless ($AUTORUN);
+                        return;
+                    }
+                } else {
+                    println 'yes';
+                }
+                ++$found;
+            }
+            if (! $found) {
+                my $libdir = File::Spec->catdir($dir, 'lib' . $BITS);
+                my $f = File::Spec->catdir($libdir, $lib);
+                print "\tchecking $f\n\t" if ($OPT{'debug'});
+                if (-e $f) {
+                    println 'yes';
+                    $found_lib = $libdir;
+                    ++$found;
+                }
+            }
+            if (! $found) {
+                my $builddir = File::Spec->catdir
+                    ($dir, $OS, $TOOLS, $ARCH, reverse_build($BUILD));
+                my $libdir  = File::Spec->catdir($builddir, 'lib');
+                my $ilibdir = File::Spec->catdir($builddir, 'ilib');
+                my $f = File::Spec->catdir($libdir, $lib);
+                print "\tchecking $f\n\t" if ($OPT{'debug'});
+                if (-e $f) {
+                    $found_lib = $libdir;
+                    if ($ilib) {
+                        my $f = File::Spec->catdir($ilibdir, $ilib);
+                        print "\tchecking $f\n\t" if ($OPT{'debug'});
+                        if (-e $f) {
+                            println 'yes';
+                            $found_ilib = $ilibdir;
+                        } else {
+                            println 'no' unless ($AUTORUN);
+                            return;
+                        }
+                    } else {
+                        println 'yes';
+                    }
+                    ++$found;
+                }
+            }
+        }
+        if ($found_lib && $ilib && ! $found_ilib) {
+            println "\n\t\tfound $found_lib but no ilib/" if ($OPT{'debug'});
+            print "\t" if ($OPT{'debug'});
+            println 'no' unless ($AUTORUN);
+            undef $found_lib;
+        }
+        ++$nl;
+    }
+    return ($found_inc, $found_lib, $found_ilib);
+}
+
+sub reverse_build {
+    ($_) = @_;
+    if ($_ eq 'rel') {
+        return 'dbg';
+    } elsif ($_ eq 'dbg') {
+        return 'rel';
+    } else {
+        die $_;
+    }
+}
+
+################################################################################
+
+sub find_lib {
+    my ($n, $i, $l) = @_;
+
+    print "checking for $n library... ";
+
+    while (1) {
+        my ($library, $log);
+
+        if ($n eq 'hdf5') {
+            $library = '-lhdf5';
+            $log = '#include <hdf5.h>            \n main() { H5close     (); }';
+        } elsif ($n eq 'xml2') {
+            $library = '-lxml2';
+            $log = '#include <libxml/xmlreader.h>\n main() { xmlInitParser();}';
+        } elsif ($n eq 'magic') {
+            $library = '-lmagic';
+            $log = '#include <magic.h>           \n main() { magic_open (0); }';
+        } else {
+            println 'unknown: skipped';
+            return;
+        }
+
+        if (($i && ! -d $i) || ($l && ! -d $l)) {
+            println 'no';
+            return;
+        }
+
+        my $cmd = $log;
+        $cmd =~ s/\\n/\n/g;
+
+        my $gcc = "| gcc -xc " . ($i ? "-I$i " : ' ')
+                               . ($l ? "-L$l " : ' ') . "- $library";
+        $gcc .= ' 2> /dev/null' unless ($OPT{'debug'});
+
+        open GCC, $gcc or last;
+        print "\n\t\trunning echo -e '$log' $gcc\n" if ($OPT{'debug'});
+        print GCC "$cmd" or last;
+        my $ok = close GCC;
+        print "\t" if ($OPT{'debug'});
+        println $ok ? 'yes' : 'no';
+
+        unlink 'a.out';
+
+        return if (!$ok);
+
+        return ($i, $l);
+    }
+
+    println 'cannot run gcc: skipped';
+}
+
+################################################################################
+
+sub check {
+    die "No CONFIG_OUT"   unless CONFIG_OUT();
+    die "No PACKAGE"      unless PACKAGE();
+    die "No PACKAGE_NAME" unless PACKAGE_NAME();
+    die "No PACKAGE_NAMW" unless PACKAGE_NAMW();
+    die "No PACKAGE_TYPE" unless PACKAGE_TYPE();
+    die "No VERSION"      unless VERSION();
+
+    my %PKG = PKG();
+
+    die "No LNG"   unless $PKG{LNG};
+    die "No OUT"   unless $PKG{OUT};
+    die "No PATH"  unless $PKG{PATH};
+    die "No UPATH" unless $PKG{UPATH};
+
+    foreach my $href (DEPENDS()) { die "No DEPENDS::name" unless $href->{name} }
+
+    foreach my $href (REQ()) {
+        die "No REQ::name" unless $href->{name};
+
+        my $origin = $href->{origin};
+        die  "No $href->{name}:origin"  unless $origin;
+        die  "No $href->{name}:include" unless $href->{include};
+        die  "No $href->{name}:lib"     unless $href->{lib};
+        die  "No $href->{name}:option"  unless $href->{option};
+        die  "No $href->{name}:pkgpath" unless $href->{pkgpath};
+        die  "No $href->{name}:type"    unless $href->{type};
+        die  "No $href->{name}:usrpath" unless $href->{usrpath};
+        if ($origin eq 'I') {
+         die "No $href->{name}:bldpath" unless $href->{bldpath};
+         die "No $href->{name}:ilib"    unless $href->{ilib};
+         die "No $href->{name}:namew"   unless $href->{namew};
+         die "No $href->{name}:srcpath" unless $href->{srcpath};
+        }
+    }
+}
+
+################################################################################
+
+sub optional { $_[0] =~ /^[LS]I$/ }
+
+sub help {
+#  --prefix=PREFIX         install architecture-independent files in PREFIX
+    print <<EndText;
+`configure' configures $PACKAGE_NAME to adapt to many kinds of systems.
+
+Usage: ./configure [OPTION]...
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+
+EndText
+
+    if ($^O ne 'MSWin32') {
+        print <<EndText;
+Installation directories:
+  --prefix=PREFIX         install all files in PREFIX
+                          [$package_default_prefix]
+
+EndText
+
+        my $other_prefix = $PKG{UPATH};
+        if ($PACKAGE eq 'sra-tools' && 0) {
+            print <<EndText;
+  --shemadir=DIR          install schema files in DIR
+                          [$schema_default_dir]
+
+EndText
+        }
+
+        print "By default, \`make install' will install all the files in\n";
+    
+        if (PACKAGE_TYPE() eq 'B') {
+            print "\`$package_default_prefix/bin', ";
+        } else {
+            print "\`$package_default_prefix/include', ";
+        }
+        println "\`$package_default_prefix/lib' etc.";
+
+        print <<EndText;
+You can specify an installation prefix other than \`$package_default_prefix'
+using \`--prefix', for instance \`--prefix=$other_prefix'.
+EndText
+    }
+
+    print <<EndText;
+
+For better control, use the options below.
+
+EndText
+
+    my ($required, $optional);
+    foreach my $href (@REQ) {
+        if (optional($href->{type})) {
+            ++$optional;
+        } else {
+            ++$required;
+        }
+    }
+
+    if ($required) {
+        print "Required Packages:\n";
+        foreach my $href (@REQ) {
+            next if (optional($href->{type}));
+            my %a = %$href;
+            if ($a{type} =~ /S/) {
+                println "  --$a{option}=DIR    search for $a{name} package";
+                println "                                 source files in DIR";
+            } else {
+                println
+                    "  --$a{option}=DIR      search for $a{name} package in DIR"
+            }
+            if ($a{boption}) {
+                println "  --$a{boption}=DIR      search for $a{name} package";
+                println "                                 build output in DIR";
+            }
+            println;
+        }
+    }
+    
+    if ($optional) {
+        print "Optional Packages:\n";
+        foreach my $href (@REQ) {
+            next unless (optional($href->{type}));
+            my %a = %$href;
+            if ($a{option} =~ /-sources$/) {
+                println "  --$a{option}=DIR    search for $a{name} package";
+                println "                                source files in DIR";
+            } else {
+                println "  --$a{option}=DIR    search for $a{name} files in DIR"
+            }
+        }
+        println;
+    }
+
+    print <<EndText if ($^O ne 'MSWin32');
+Build tuning:
+  --with-debug
+  --without-debug
+  --arch=name             specify the name of the target architecture
+
+  --build=DIR             generate build output into DIR directory
+                          [$OUTDIR]
+
+EndText
+
+    println "Miscellaneous:";
+    if ($^O ne 'MSWin32') {
+        println
+            "  --status                print current configuration information"
+    }
+    println "  --clean                 remove all configuration results";
+    println "  --debug                 print lots of debugging information";
+    println;
+}
+
+=pod
+################################################################################
+=cut
diff --git a/ngs-java/ngs/Alignment.java b/ngs-java/ngs/Alignment.java
new file mode 100644
index 0000000..e6cb7d3
--- /dev/null
+++ b/ngs-java/ngs/Alignment.java
@@ -0,0 +1,217 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+
+/**
+ *  Represents an alignment between a Fragment and Reference sub-sequence
+ *  provides a path to Read and mate Alignment
+ */
+public interface Alignment
+    extends Fragment
+{
+
+    /** 
+     * Retrieve an identifying String that can be used for later access.
+     * The id will be unique within ReadCollection.
+     * @return alignment id
+     * @throws ErrorMsg if the property cannot be retrieved
+     */
+    String getAlignmentId ()
+        throws ErrorMsg;
+
+
+    /*------------------------------------------------------------------
+     * Reference
+     */
+
+    /** 
+     * getReferenceSpec
+     */
+    String getReferenceSpec ()
+        throws ErrorMsg;
+
+    /**
+     * getMappingQuality 
+     * @return mapping quality 
+     */
+    int getMappingQuality ()
+        throws ErrorMsg;
+
+    /** 
+     * getReferenceBases
+     * @return reference bases
+     */
+    String getReferenceBases ()
+        throws ErrorMsg;
+
+
+    /*------------------------------------------------------------------
+     * Fragment
+     */
+
+    /**
+     *  getReadGroup
+     */
+    String getReadGroup ()
+        throws ErrorMsg;
+
+    /** 
+     * getReadId
+     */
+    String getReadId ()
+        throws ErrorMsg;
+
+    /** 
+     * getClippedFragmentBases
+     * @return clipped fragment bases
+     */
+    String getClippedFragmentBases ()
+        throws ErrorMsg;
+
+    /** 
+     * getClippedFragmentQualities
+     * @return clipped fragment phred quality values using ASCII offset of 33
+     */
+    String getClippedFragmentQualities ()
+        throws ErrorMsg;
+
+    /** 
+     * getAlignedFragmentBases
+     * @return fragment bases in their aligned orientation
+     */
+    String getAlignedFragmentBases ()
+        throws ErrorMsg;
+
+    /*------------------------------------------------------------------
+     * details of this alignment
+     */
+
+    /* AlignmentCategory
+     */
+    static int primaryAlignment   = 1;
+    static int secondaryAlignment = 2;
+    static int all                = primaryAlignment | secondaryAlignment;
+
+    /** 
+     * Alignments are categorized as primary or secondary (alternate).
+     * @return either Alignment.primaryAlignment or Alignment.secondaryAlignment
+     * @throws ErrorMsg if the property cannot be retrieved
+     */
+    int getAlignmentCategory ()
+        throws ErrorMsg;
+
+    /** 
+     * Retrieve the Alignment's starting position on the Reference
+     * @return unsigned 0-based offset from start of Reference
+     * @throws ErrorMsg if the property cannot be retrieved
+     */
+    long getAlignmentPosition ()
+        throws ErrorMsg;
+
+    /**
+     * Retrieve the projected length of an Alignment projected upon Reference.
+     * @return unsigned length of projection
+     * @throws ErrorMsg if the property cannot be retrieved
+     */
+    long getAlignmentLength ()
+        throws ErrorMsg;
+
+    /**
+     * Test if orientation is reversed with respect to the Reference sequence.
+     * @return true if reversed
+     * @throws ErrorMsg if the property cannot be retrieved
+     */
+    boolean getIsReversedOrientation ()
+        throws ErrorMsg;
+
+    /* ClipEdge
+     */
+    static int clipLeft  = 0;
+    static int clipRight = 1;
+
+    /** 
+     * getSoftClip 
+     */
+    int getSoftClip ( int edge )
+        throws ErrorMsg;
+
+    /** 
+     * getTemplateLength
+     */
+    long getTemplateLength ()
+        throws ErrorMsg;
+
+    /** 
+     * getShortCigar
+     * @return a text string describing alignment details
+     */
+    String getShortCigar ( boolean clipped )
+        throws ErrorMsg;
+
+    /** 
+     * getLongCigar
+     * @return a text string describing alignment details
+     */
+    String getLongCigar ( boolean clipped )
+        throws ErrorMsg;
+
+
+    /*------------------------------------------------------------------
+     * details of mate alignment
+     */
+
+    /** 
+     * hasMate
+     */
+    boolean hasMate ();
+        
+    /** 
+     * getMateAlignmentId
+     */
+    String getMateAlignmentId ()
+        throws ErrorMsg;
+
+    /** 
+     * getMateAlignment
+     */
+    Alignment getMateAlignment ()
+        throws ErrorMsg;
+
+    /** 
+     * getMateReferenceSpec
+     */
+    String getMateReferenceSpec ()
+        throws ErrorMsg;
+
+    /**
+     * getMateIsReversedOrientation
+     */
+    boolean getMateIsReversedOrientation ()
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/AlignmentIterator.java b/ngs-java/ngs/AlignmentIterator.java
new file mode 100644
index 0000000..08a83ae
--- /dev/null
+++ b/ngs-java/ngs/AlignmentIterator.java
@@ -0,0 +1,45 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/**
+ * Iterates across a list of Alignments
+ */
+public interface AlignmentIterator
+    extends Alignment
+{
+
+    /** 
+     *  Advance to first alignment on initial invocation
+     *  Advance to next Alignment subsequently
+     *  @return false if no more Alignments are available.
+     *  @throws ErrorMsg if more Alignments should be available, but could not be accessed.
+     */
+    boolean nextAlignment ()
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/ErrorMsg.java b/ngs-java/ngs/ErrorMsg.java
new file mode 100644
index 0000000..fdabb4c
--- /dev/null
+++ b/ngs-java/ngs/ErrorMsg.java
@@ -0,0 +1,62 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+/**
+ * A generic NGS error class
+ * Holds a message describing what happened
+ */
+public class ErrorMsg
+    extends Exception
+{
+
+    /** 
+     * What went wrong
+     */
+    public String what ()
+    {
+        return this . toString ();
+    }
+
+
+    /* constructors
+     *  various means of constructing
+     */        
+    public ErrorMsg ()
+    {
+    }
+
+    public ErrorMsg ( String message )
+    {
+        super ( message );
+    }
+
+    public ErrorMsg ( ErrorMsg obj )
+    {
+        super ( obj . toString () );
+    }
+}
diff --git a/ngs-java/ngs/Fragment.java b/ngs-java/ngs/Fragment.java
new file mode 100644
index 0000000..cc80f64
--- /dev/null
+++ b/ngs-java/ngs/Fragment.java
@@ -0,0 +1,94 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/**
+ * Represents an NGS biological fragment
+ */
+public interface Fragment
+{
+
+    /**
+     * getFragmentId
+     */
+    String getFragmentId ()
+        throws ErrorMsg;
+
+    /*------------------------------------------------------------------
+     * fragment details
+     */
+   
+    /** 
+     * getFragmentBases
+     * @return sequence bases
+     */
+    String getFragmentBases ()
+        throws ErrorMsg;
+    
+    /** 
+     * getFragmentBases
+     * @param offset is zero-based and non-negative
+     * @return sequence bases
+     */
+    String getFragmentBases ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException;
+    
+    /** 
+     * getFragmentBases
+     * @param offset is zero-based and non-negative
+     * @param length must be >= 0
+     * @return sequence bases
+     */
+    String getFragmentBases ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException;
+
+
+    /** 
+     * getFragmentQualities using ASCII offset of 33
+     * @return phred quality values for the whole fragment
+     */
+    String getFragmentQualities ()
+        throws ErrorMsg;
+    
+    /** 
+     * getFragmentQualities using ASCII offset of 33
+     * @param offset is zero-based and non-negative
+     * @return phred quality values
+     */
+    String getFragmentQualities ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException;
+    
+    /** 
+     * getFragmentQualities using ASCII offset of 33
+     * @param offset is zero-based and non-negative
+     * @param length must be >= 0
+     * @return phred quality values
+     */
+    String getFragmentQualities ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException;
+}
diff --git a/ngs-java/ngs/FragmentIterator.java b/ngs-java/ngs/FragmentIterator.java
new file mode 100644
index 0000000..d49d24c
--- /dev/null
+++ b/ngs-java/ngs/FragmentIterator.java
@@ -0,0 +1,44 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/**
+ * Iterates across a list of Fragments
+ */
+public interface FragmentIterator
+    extends Fragment
+{
+
+    /**
+     *  Advance to next Fragment
+     *  @return false if no more Fragments are available.
+     *  @throws ErrorMsg if more Fragments should be available, but could not be accessed.
+     */
+    boolean nextFragment ()
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/Pileup.java b/ngs-java/ngs/Pileup.java
new file mode 100644
index 0000000..b6984ce
--- /dev/null
+++ b/ngs-java/ngs/Pileup.java
@@ -0,0 +1,74 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/**
+ * Represents a slice through a stack of Alignments at a given position on the Reference
+ */
+public interface Pileup
+{
+
+    /*----------------------------------------------------------------------
+     * Reference
+     */
+
+    /**
+     * getReferenceSpec
+     */
+    String getReferenceSpec ()
+        throws ErrorMsg;
+
+    /**
+     * getReferencePosition
+     */
+    long getReferencePosition ()
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * PileupEvent
+     */
+
+    /**
+     * getPileupEvents
+     */
+    PileupEventIterator getPileupEvents ()
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * details of this pileup row
+     */
+
+    /**
+     * getPileupDepth
+     * @return the coverage depth at the current reference position
+     */
+    int getPileupDepth ()
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/PileupEvent.java b/ngs-java/ngs/PileupEvent.java
new file mode 100644
index 0000000..4c5ee69
--- /dev/null
+++ b/ngs-java/ngs/PileupEvent.java
@@ -0,0 +1,154 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/** 
+ *  Represents a single cell of a sparse 2D matrix with Reference coordinates on one axis
+ *  and stacked Alignments on the other axis
+ */
+public interface PileupEvent
+{
+
+    /*----------------------------------------------------------------------
+     * Reference
+     */
+
+    /** 
+     * getReferenceSpec
+     */
+    String getReferenceSpec ()
+        throws ErrorMsg;
+
+    /**
+     * getReferencePosition
+     */
+    long getReferencePosition ()
+        throws ErrorMsg;
+
+    /** 
+     * getMappingQuality
+     */
+    int getMappingQuality ()
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * Alignment
+     */
+
+    /**
+     * getAlignmentId
+     * @return unique AlignmentId within ReadCollection
+     */
+    String getAlignmentId ()
+        throws ErrorMsg;
+
+    /**
+     * getAlignment
+     */
+    Alignment getAlignment ()
+        throws ErrorMsg;
+
+    /** 
+     * getAlignmentPosition
+     */
+    long getAlignmentPosition ()
+        throws ErrorMsg;
+
+    /**
+     * getFirstAlignmentPosition
+     * @return the position of this Alignment's first event in Reference coordinates
+     */
+    long getFirstAlignmentPosition ()
+        throws ErrorMsg;
+
+    /**
+     * getLastAlignmentPosition
+     * @return the position of this Alignment's last event in INCLUSIVE Reference coordinates
+     */
+    long getLastAlignmentPosition ()
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * event details
+     */
+
+    /**
+     *  EventType
+     */
+    static int match     = 0;
+    static int mismatch  = 1;
+    static int insertion = 2;
+    static int deletion  = 3;
+
+    /**
+     * getEventType
+     * @return the type of event being represented
+     */
+    int getEventType ()
+        throws ErrorMsg;
+
+    /**
+     * getAlignmentBase
+     * @return retrieves base aligned at current Reference position
+     * @throws ErrorMsg if event is an insertion or deletion
+     */
+    char getAlignmentBase ()
+        throws ErrorMsg;
+
+    /** 
+     * getAlignmentQuality
+     * @return retrieves base aligned at current Reference position
+     * @throws ErrorMsg if event is an insertion or deletion
+     */
+    char getAlignmentQuality ()
+        throws ErrorMsg;
+
+
+    /**
+     * getInsertionBases
+     * @return bases corresponding to insertion event
+     */
+    String getInsertionBases ()
+        throws ErrorMsg;
+
+    /** 
+     * getInsertionQualities
+     * @return qualities corresponding to insertion event
+     */
+    String getInsertionQualities ()
+        throws ErrorMsg;
+
+    /**
+     * getDeletionCount
+     * @return the number of Reference base positions remaining until the next non-deletion event in this alignment.
+     */
+    int getDeletionCount ()
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/PileupEventIterator.java b/ngs-java/ngs/PileupEventIterator.java
new file mode 100644
index 0000000..15087d1
--- /dev/null
+++ b/ngs-java/ngs/PileupEventIterator.java
@@ -0,0 +1,45 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/**
+ * Iterates across a list of PileupEvents
+ */
+public interface PileupEventIterator
+    extends PileupEvent
+{
+
+    /**
+     * Advance to first PileupEvent on initial invocation
+     * advance to next PileupEvent subsequently
+     * @return false if no more PileupEvents are available.
+     * @throws ErrorMsg if more PileupEvents should be available, but could not be accessed.
+     */
+    boolean nextPileupEvent ()
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/PileupIterator.java b/ngs-java/ngs/PileupIterator.java
new file mode 100644
index 0000000..b4c6073
--- /dev/null
+++ b/ngs-java/ngs/PileupIterator.java
@@ -0,0 +1,44 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/**
+ * Iterates across a list of Pileups
+ */
+public interface PileupIterator
+    extends Pileup
+{
+
+    /**
+     * Advance to first Pileup on initial invocation advance to next Pileup subsequently
+     * @return false if no more Pileups are available.
+     * @throws ErrorMsg if more Pileups should be available, but could not be accessed.
+     */
+    boolean nextPileup ()
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/Read.java b/ngs-java/ngs/Read.java
new file mode 100644
index 0000000..373026c
--- /dev/null
+++ b/ngs-java/ngs/Read.java
@@ -0,0 +1,138 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/*==========================================================================
+ * Read
+ *  represents an NGS machine read
+ *  having some number of biological Fragments
+ */
+public interface Read
+    extends FragmentIterator
+{
+
+    /**
+     * getReadId
+     */
+    String getReadId ()
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * Fragment
+     */
+
+    /**
+     * getNumFragments
+     * @return the number of biological Fragments contained in the read
+     */
+    int getNumFragments ()
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * read details
+     */
+
+    /**
+     * ReadCategory
+     */
+    static int fullyAligned     = 1;
+    static int partiallyAligned = 2;
+    static int aligned          = fullyAligned | partiallyAligned;
+    static int unaligned        = 4;
+    static int all              = aligned | unaligned;
+
+    /**
+     * getReadCategory
+     */
+    int getReadCategory ()
+        throws ErrorMsg;
+
+    /**
+     * getReadGroup
+     */
+    String getReadGroup ()
+        throws ErrorMsg;
+
+    /**
+     * getReadName
+     */
+    String getReadName ()
+        throws ErrorMsg;
+
+
+    /** 
+     * getReadBases
+     * @return sequence bases
+     */
+    String getReadBases ()
+        throws ErrorMsg;
+
+    /** 
+     * getReadBases
+     * @param offset is zero-based and non-negative
+     * @return sequence bases
+     */
+    String getReadBases ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException;
+
+    /** 
+     * getReadBases
+     * @param offset is zero-based and non-negative
+     * @param length must be >= 0
+     * @return sequence bases
+     */
+    String getReadBases ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException;
+
+
+    /**
+     * getReadQualities
+     * @return phred quality values using ASCII offset of 33
+     */
+    String getReadQualities ()
+        throws ErrorMsg;
+
+    /**
+     * getReadQualities
+     * @param offset is zero-based and non-negative
+     * @return phred quality values using ASCII offset of 33
+     */
+    String getReadQualities ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException;
+
+    /**
+     * getReadQualities
+     * @param offset is zero-based and non-negative
+     * @param length must be >= 0
+     * @return phred quality values using ASCII offset of 33
+     */
+    String getReadQualities ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException;
+}
diff --git a/ngs-java/ngs/ReadCollection.java b/ngs-java/ngs/ReadCollection.java
new file mode 100644
index 0000000..4374d7e
--- /dev/null
+++ b/ngs-java/ngs/ReadCollection.java
@@ -0,0 +1,243 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/**
+ *<p>
+ * Represents an NGS-capable object with a collection of
+ * <strong>Reads</strong>, <strong>References</strong>
+ * and <strong>Alignments</strong>.
+ *</p>
+ *<p>
+ * Each of the basic content types may be accessed by <strong>id</strong>
+ * as either a standalone object, or more commonly through
+ * an <strong>Iterator</strong> over a selected collection of objects.
+ *</p>
+ *<p>
+ * <em>Reads</em> are grouped by <strong>ReadGroup</strong>. When
+ * not specifically assigned, <em>Reads</em> will be placed into the
+ * <strong>default</strong> <em>ReadGroup</em>.
+ *</p>
+ */
+public interface ReadCollection
+{
+
+    /**
+     * <p>
+     *  Access the simple name of the ReadCollection.
+     *  This name is generally extracted from the "spec"
+     *  used to create the object, but may also be mapped
+     *  to a canonical name if one may be determined and
+     *  differs from that given in the spec.
+     * </p>
+     * <p>
+     *  if the name is extracted from "spec" and contains
+     *  well-known file extensions that do not form part of
+     *  a canonical name (e.g. ".sra"), they will be removed.
+     * </p>
+     *
+     * @return the simple name of the ReadCollection
+     * @throws ErrorMsg if the name cannot be retrieved
+     * @see gov.nih.nlm.ncbi.ngs.NGS NGS class for "spec" definition
+     */
+    String getName ()
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * READ GROUPS
+     */
+
+    /**
+     * Access all non-empty ReadGroups.
+     * Iterator will contain at least one ReadGroup
+     * unless the ReadCollection itself is empty.
+     *
+     * @return an unordered Iterator of ReadGroups
+     * @throws ErrorMsg only upon an error accessing data
+     */
+    ReadGroupIterator getReadGroups ()
+        throws ErrorMsg;
+
+    /**
+     * Access a single ReadGroup by name.
+     *
+     * @param spec the name of a contained read group
+     * @return an instance of the designated ReadGroup
+     * @throws ErrorMsg if specified ReadGroup is not found
+     * @throws ErrorMsg upon an error accessing data
+     */
+    ReadGroup getReadGroup ( String spec )
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * REFERENCES
+     */
+
+    /**
+     * Access all References having aligned Reads.
+     * Iterator will contain at least one ReadGroup
+     * unless no Reads are aligned.
+     *
+     * @return an unordered Iterator of References
+     * @throws ErrorMsg upon an error accessing data
+     */
+    ReferenceIterator getReferences ()
+        throws ErrorMsg;
+
+    /**
+     * Access a single Reference by name spec.
+     *
+     * @param spec a common or canonical name of a contained reference
+     * @return an instance of the designated Reference
+     * @throws ErrorMsg if the Reference is not found
+     * @throws ErrorMsg upon an error accessing data
+     */
+    Reference getReference ( String spec )
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * ALIGNMENTS
+     */
+
+    /**
+     * Access a single Alignment by id.
+     * The object id is unique within any given ReadCollection,
+     * and may designate an Alignment of any category.
+     *
+     * @return an individual Alignment instance
+     * @throws ErrorMsg if Alignment is not found
+     * @throws ErrorMsg upon an error accessing data
+     * @.note Excessive usage may create pressure on JVM and System memory.
+     */
+    Alignment getAlignment ( String alignmentId )
+        throws ErrorMsg;
+
+    /**
+     * Select Alignments by AlignmentCategory.
+     * @return an iterator of all Alignments from specified categories
+     */
+    AlignmentIterator getAlignments ( int categories )
+        throws ErrorMsg;
+
+    /** 
+     * Count all Alignments within the ReadCollection
+     * @return 0 if there are no aligned Reads, > 0 otherwise
+     * @throws ErrorMsg upon an error accessing data
+     */
+    long getAlignmentCount ()
+        throws ErrorMsg;
+    
+    /** 
+     * Count selected Alignments within the ReadCollection
+     * @param categories is a bitfield of AlignmentCategory
+     * @return count of all alignments
+     * @see ngs.Alignment Alignment interface for definitions of AlignmentCategory
+     */
+    long getAlignmentCount ( int categories )
+        throws ErrorMsg;
+
+    /** 
+     * getAlignmentRange
+     * @param first is an unsigned ordinal into set
+     * @param count the number of alignments
+     * @return an iterator across a range of Alignments
+     */
+    AlignmentIterator getAlignmentRange ( long first, long count )
+        throws ErrorMsg;
+    
+    /** 
+     * getAlignmentRange
+     * @param first is an unsigned ordinal into set
+     * @param count number of alignments
+     * @param categories provides a means of filtering by AlignmentCategory
+     * @return an iterator across a range of Alignments
+     */
+  AlignmentIterator getAlignmentRange ( long first, long count, int categories )
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * READS
+     */
+
+    /** 
+     * getRead
+     * @return an individual Read
+     * @throws ErrorMsg if Read does not exist
+     */
+    Read getRead ( String readId )
+        throws ErrorMsg;
+
+    /* ReadCategory
+     *  see Read for categories
+     */
+
+    /**
+     * getReads
+     * @param categories provides a means of filtering by ReadCategory
+     * @return an iterator of all contained machine Reads
+     */
+    ReadIterator getReads ( int categories )
+        throws ErrorMsg;
+
+    /**
+     * getReadCount
+     * @return the number of reads in the collection
+     */
+    long getReadCount ()
+        throws ErrorMsg;
+
+    /**
+     * getReadCount
+     * @param categories provides an optional means of filtering by ReadCategory
+     * @return the number of reads in the collection
+     */
+    long getReadCount ( int categories )
+        throws ErrorMsg;
+
+    /** 
+     * getReadRange
+     * @param first is an unsigned ordinal into set
+     * @param count the number of reads
+     * @return an iterator across a range of Reads
+     */
+    ReadIterator getReadRange ( long first, long count )
+        throws ErrorMsg;
+    /** 
+     * getReadRange
+     * @param first is an unsigned ordinal into set
+     * @param count the number of reads
+     * @param categories provides an optional means of filtering by ReadCategory
+     * @return an iterator across a range of Reads
+     */
+    ReadIterator getReadRange ( long first, long count, int categories )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/ReadGroup.java b/ngs-java/ngs/ReadGroup.java
new file mode 100644
index 0000000..7008383
--- /dev/null
+++ b/ngs-java/ngs/ReadGroup.java
@@ -0,0 +1,54 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/**
+ * Represents an NGS-capable object with a group of Reads
+ */
+public interface ReadGroup
+{
+
+    /**
+     * getName
+     * @return the simple name of the read group
+     */
+    String getName ()
+        throws ErrorMsg;
+
+
+    /*------------------------------------------------------------------
+     * STATISTICS
+     */
+
+    /**
+     * getStatistics
+     * @return a collection of statistical data
+     */
+    Statistics getStatistics ()
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/ReadGroupIterator.java b/ngs-java/ngs/ReadGroupIterator.java
new file mode 100644
index 0000000..5f93b1d
--- /dev/null
+++ b/ngs-java/ngs/ReadGroupIterator.java
@@ -0,0 +1,45 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/**
+ * Iterates across a list of ReadGroups
+ */
+public interface ReadGroupIterator
+    extends ReadGroup
+{
+
+    /**
+     * Advance to first ReadGroup on initial invocation 
+     * Advance to next ReadGroup subsequently
+     * @return false if no more ReadGroups are available.
+     * @throws ErrorMsg if more ReadGroups should be available, but could not be accessed.
+     */
+    boolean nextReadGroup ()
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/ReadIterator.java b/ngs-java/ngs/ReadIterator.java
new file mode 100644
index 0000000..73df596
--- /dev/null
+++ b/ngs-java/ngs/ReadIterator.java
@@ -0,0 +1,46 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/*--------------------------------------------------------------------------
+ * ReadIterator
+ *  iterates across a list of Reads
+ */
+public interface ReadIterator
+    extends Read
+{
+
+    /** 
+     * Advance to first Read on initial invocation
+     * advance to next Read subsequently
+     * @return false if no more Reads are available.
+     * @throws ErrorMsg if more Reads should be available, but could not be accessed.
+     */
+    boolean nextRead ()
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/Reference.java b/ngs-java/ngs/Reference.java
new file mode 100644
index 0000000..d253215
--- /dev/null
+++ b/ngs-java/ngs/Reference.java
@@ -0,0 +1,186 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/**
+ * Represents a reference sequence
+ */
+public interface Reference
+{
+
+    /** 
+     * getCommonName
+     * @return the common name of reference, e.g. "chr1"
+     */
+    String getCommonName ()
+        throws ErrorMsg;
+
+    /** 
+     * getCanonicalName
+     * @return the accessioned name of reference, e.g. "NC_000001.11"
+     */
+    String getCanonicalName ()
+        throws ErrorMsg;
+
+
+    /** 
+     * getIsCircular
+     * @return true if reference is circular
+     */
+    boolean getIsCircular ()
+        throws ErrorMsg;
+
+
+    /** 
+     * getLength
+     * @return the length of the reference sequence
+     */
+    long getLength ()
+        throws ErrorMsg;
+
+
+    /** 
+     * getReferenceBases
+     * @param offset is zero-based and non-negative
+     * @return sub-sequence bases for Reference
+     */
+    String getReferenceBases ( long offset )
+        throws ErrorMsg;
+    
+    /** 
+     * getReferenceBases
+     * @param offset is zero-based and non-negative
+     * @param length must be >= 0
+     * @return sub-sequence bases for Reference
+     */
+    String getReferenceBases ( long offset, long length )
+        throws ErrorMsg;
+
+    /** 
+     * getReferenceChunk
+     * @param offset is zero-based and non-negative
+     * @return largest contiguous chunk available of sub-sequence bases for Reference
+     * <p>
+     *  NB - actual returned sequence may be shorter
+     *  than requested. to obtain all bases available
+     *  in chunk, use a negative "size" value
+     * </p>
+     */
+    String getReferenceChunk ( long offset )
+        throws ErrorMsg;
+    
+    /** 
+     * getReferenceChunk
+     * @param offset is zero-based and non-negative
+     * @param length must be >= 0
+     * @return largest contiguous chunk available of sub-sequence bases for Reference
+     * <p>
+     *  NB - actual returned sequence may be shorter
+     *  than requested. to obtain all bases available
+     *  in chunk, use a negative "size" value
+     * </p>
+     */
+    String getReferenceChunk ( long offset, long length )
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * ALIGNMENTS
+     */
+
+    /** 
+     * getAlignment
+     * @return an individual Alignment
+     * @throws ErrorMsg if Alignment does not exist or is not part of this Reference
+     */
+    Alignment getAlignment ( String alignmentId )
+        throws ErrorMsg;
+
+    /* AlignmentCategory
+     * see Alignment for categories
+     */
+
+    /** 
+     * getAlignments
+     * @return an iterator of contained alignments
+     */
+    AlignmentIterator getAlignments ( int categories )
+        throws ErrorMsg;
+
+    /** 
+     * getAlignmentSlice
+     * @param start is a signed 0-based offset from the start of the Reference
+     * @param length is the length of the slice.
+     * @return an iterator across a range of Alignments
+     */
+    AlignmentIterator getAlignmentSlice ( long start, long length )
+        throws ErrorMsg;
+    
+    /** 
+     * getAlignmentSlice
+     * @param start is a signed 0-based offset from the start of the Reference
+     * @param length is the length of the slice.
+     * @param categories provides a means of filtering by AlignmentCategory
+     * @return an iterator across a range of Alignments
+     */
+    AlignmentIterator getAlignmentSlice ( long start, long length, int categories )
+        throws ErrorMsg;
+
+
+    /*----------------------------------------------------------------------
+     * PILEUP
+     */
+    
+    /** 
+     * getPileups
+     * @return an iterator of contained Pileups
+     */
+    PileupIterator getPileups ( int categories )
+        throws ErrorMsg;
+
+    /** 
+     * getPileupSlice
+     * Creates a PileupIterator on a slice (window) of reference
+     * @param start is the signed starting position on reference
+     * @param length is the unsigned number of bases in the window
+     * @return an iterator of contained Pileups
+     */
+    PileupIterator getPileupSlice ( long start, long length )
+        throws ErrorMsg;
+
+    /** 
+     * getPileupSlice
+     * Creates a PileupIterator on a slice (window) of reference
+     * @param start is the signed starting position on reference
+     * @param length is the unsigned number of bases in the window
+     * @param categories provides a means of filtering by AlignmentCategory
+     * @return an iterator of contained Pileups
+     */
+    PileupIterator getPileupSlice ( long start, long length, int categories )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/ReferenceIterator.java b/ngs-java/ngs/ReferenceIterator.java
new file mode 100644
index 0000000..00e3ce2
--- /dev/null
+++ b/ngs-java/ngs/ReferenceIterator.java
@@ -0,0 +1,44 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/** 
+ * Iterates across a list of References
+ */
+public interface ReferenceIterator
+    extends Reference
+{
+    /** 
+     * Advance to first Reference on initial invocation
+     * Advance to next Reference subsequently
+     * @return false if no more References are available.
+     * @throws ErrorMsg if there is an error
+     */
+    boolean nextReference ()
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/Statistics.java b/ngs-java/ngs/Statistics.java
new file mode 100644
index 0000000..fae49a5
--- /dev/null
+++ b/ngs-java/ngs/Statistics.java
@@ -0,0 +1,95 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs;
+
+
+/**
+ * Statistical data container
+ */
+public interface Statistics
+{
+
+    /**
+     * ValueType
+     */
+    static int none = 0;
+    static int string = 1;
+    static int int64 = 2;
+    static int uint64 = 3;
+    static int real = 4;
+    
+    /**
+     * getValueType
+     * @param path is hierarchical path to value node
+     * @return one of { none, string, int64, uint64, real }
+     */
+    int getValueType ( String path );
+    
+    /**
+     * getAsString
+     * @param path is hierarchical path to value node
+     * @return textual representation of value
+     * @throws ErrorMsg if path not found or value cannot be converted
+     */
+    String getAsString ( String path )
+        throws ErrorMsg;
+
+    /**
+     * getAsI64
+     * @param path is hierarchical path to value node
+     * @return a signed 64-bit integer
+     * @throws ErrorMsg if path not found or value cannot be converted
+     */
+    long getAsI64 ( String path )
+        throws ErrorMsg;
+            
+    /**
+     * getAsU64
+     * @param path is hierarchical path to value node
+     * @return a non-negative 64-bit integer
+     * @throws ErrorMsg if path not found or value cannot be converted
+     */
+    long getAsU64 ( String path )
+        throws ErrorMsg;
+        
+    /**
+     * getAsDouble
+     * @param path is hierarchical path to value node
+     * @return a 64-bit floating point
+     * @throws ErrorMsg if path not found or value cannot be converted
+     */
+    double getAsDouble ( String path )
+        throws ErrorMsg;
+            
+    /**
+     * nextPath
+     * advance to next path in container
+     * @param path is null or empty to request first path, or a valid path string
+     * @return null if no more paths, or a valid path string
+     */
+    String nextPath ( String path );
+}
diff --git a/ngs-java/ngs/itf/AlignmentIteratorItf.java b/ngs-java/ngs/itf/AlignmentIteratorItf.java
new file mode 100644
index 0000000..ea679ed
--- /dev/null
+++ b/ngs-java/ngs/itf/AlignmentIteratorItf.java
@@ -0,0 +1,93 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.Fragment;
+import ngs.Alignment;
+import ngs.AlignmentIterator;
+
+
+/*==========================================================================
+ * AlignmentIteratorItf
+ *  represents an alignment between a Fragment and Reference sub-sequence
+ *  provides a path to Read and mate Alignment
+ */
+class AlignmentIteratorItf
+    extends AlignmentItf
+    implements AlignmentIterator
+{
+
+    /*******************************
+     * AlignmentIterator Interface *
+     *******************************/
+
+
+    /* nextAlignment
+     *  advance to first alignment on initial invocation
+     *  advance to next Alignment subsequently
+     *  returns false if no more Alignments are available.
+     *  throws exception if more Alignments should be available,
+     *  but could not be accessed.
+     */
+    public boolean nextAlignment ()
+        throws ErrorMsg
+    {
+        return this . NextAlignment ( self );
+    }
+
+
+    /***************************************
+     * AlignmentIteratorItf Implementation *
+     ***************************************/
+
+
+    // constructors
+    AlignmentIteratorItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    AlignmentIteratorItf ( AlignmentIterator obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            AlignmentIteratorItf ref = ( AlignmentIteratorItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native boolean NextAlignment ( long self )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/AlignmentItf.java b/ngs-java/ngs/itf/AlignmentItf.java
new file mode 100644
index 0000000..709703c
--- /dev/null
+++ b/ngs-java/ngs/itf/AlignmentItf.java
@@ -0,0 +1,417 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.Fragment;
+import ngs.Alignment;
+
+
+/*==========================================================================
+ * AlignmentItf
+ *  represents an alignment between a Fragment and Reference sub-sequence
+ *  provides a path to Read and mate Alignment
+ */
+class AlignmentItf
+    extends Refcount
+    implements Alignment
+{
+
+    /**********************
+     * Fragment Interface *
+     **********************/
+
+    /* getFragmentId
+     */
+    public String getFragmentId ()
+        throws ErrorMsg
+    {
+        return this . GetFragmentId ( self );
+    }
+
+    /* getFragmentBases
+     *  return sequence bases
+     *  "offset" is zero-based
+     *  "length" must be >= 0
+     */
+    public String getFragmentBases ()
+        throws ErrorMsg
+    {
+        return this . GetFragmentBases ( self, 0, -1 );
+    }
+
+    public String getFragmentBases ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+
+        return this . GetFragmentBases ( self, offset, -1 );
+    }
+
+    public String getFragmentBases ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+        if ( length < 0 )
+            throw new IndexOutOfBoundsException ( "length " + length + " is negative");
+
+        return this . GetFragmentBases ( self, offset, length );
+    }
+
+
+    /* getFragmentQualities
+     *  return phred quality values
+     *  using ASCII offset of 33
+     *  "offset" is zero-based
+     *  "length" must be >= 0
+     */
+    public String getFragmentQualities ()
+        throws ErrorMsg
+    {
+        return this . GetFragmentQualities ( self, 0, -1 );
+    }
+
+    public String getFragmentQualities ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+
+        return this . getFragmentQualities ( offset, -1 );
+    }
+
+    public String getFragmentQualities ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+        if ( length < 0 )
+            throw new IndexOutOfBoundsException ( "length " + length + " is negative");
+
+        return this . GetFragmentQualities ( self, offset, length );
+    }
+
+    /***********************
+     * Alignment Interface *
+     ***********************/
+
+    /* getAlignmentId
+     *  unique within ReadCollection
+     */
+    public String getAlignmentId ()
+        throws ErrorMsg
+    {
+        return this . GetAlignmentId ( self );
+    }
+
+
+    /*------------------------------------------------------------------
+     * Reference
+     */
+
+    /* getReferenceSpec
+     */
+    public String getReferenceSpec ()
+        throws ErrorMsg
+    {
+        return this . GetReferenceSpec ( self );
+    }
+
+    /* getMappingQuality 
+     */
+    public int getMappingQuality ()
+        throws ErrorMsg
+    {
+        return this . GetMappingQuality ( self );
+    }
+
+    /* getReferenceBases
+     *  return reference bases
+     */
+    public String getReferenceBases ()
+        throws ErrorMsg
+    {
+        return this . GetReferenceBases ( self );
+    }
+
+
+    /*------------------------------------------------------------------
+     * Fragment
+     */
+
+    /* getReadGroup
+     */
+    public String getReadGroup ()
+        throws ErrorMsg
+    {
+        return this . GetReadGroup ( self );
+    }
+
+    /* getReadId
+     */
+    public String getReadId ()
+        throws ErrorMsg
+    {
+        return this . GetReadId ( self );
+    }
+
+    /* getClippedFragmentBases
+     *  return fragment bases
+     */
+    public String getClippedFragmentBases ()
+        throws ErrorMsg
+    {
+        return this . GetClippedFragmentBases ( self );
+    }
+
+    /* getClippedFragmentQualities
+     *  return fragment phred quality values
+     *  using ASCII offset of 33
+     */
+    public String getClippedFragmentQualities ()
+        throws ErrorMsg
+    {
+        return this . GetClippedFragmentQualities ( self );
+    }
+
+    /* getAlignedFragmentBases
+     *  return fragment bases in their aligned orientation
+     */
+    public String getAlignedFragmentBases ()
+        throws ErrorMsg
+    {
+        return this . GetAlignedFragmentBases ( self );
+    }
+        
+    /*------------------------------------------------------------------
+     * details of this alignment
+     */
+
+
+    /* getAlignmentCategory
+     */
+    public int getAlignmentCategory ()
+        throws ErrorMsg
+    {
+        return this . GetAlignmentCategory ( self );
+    }
+
+    /* getAlignmentPosition
+     *  returns the alignment's starting position on reference
+     */
+    public long getAlignmentPosition ()
+        throws ErrorMsg
+    {
+        return this . GetAlignmentPosition ( self );
+    }
+
+    /* getAligmentLength
+     *  returns the alignment's projected length upon reference
+     */
+    public long getAlignmentLength ()
+        throws ErrorMsg
+    {
+        return this . GetAlignmentLength ( self );
+    }
+
+    /* getIsReversedOrientation
+     *  returns true if orientation is reversed
+     *  with respect to the reference sequence
+     */
+    public boolean getIsReversedOrientation ()
+        throws ErrorMsg
+    {
+        return this . GetIsReversedOrientation ( self );
+    }
+
+    /* getSoftClip 
+     */
+    public int getSoftClip ( int edge )
+        throws ErrorMsg
+    {
+        return this . GetSoftClip ( self, edge );
+    }
+
+    /* getTemplateLength
+     */
+    public long getTemplateLength ()
+        throws ErrorMsg
+    {
+        return this . GetTemplateLength ( self );
+    }
+
+    /* getShortCigar
+     *  returns a text string describing alignment details
+     */
+    public String getShortCigar ( boolean clipped )
+        throws ErrorMsg
+    {
+        return this . GetShortCigar ( self, clipped );
+    }
+
+    /* getLongCigar
+     *  returns a text string describing alignment details
+     */
+    public String getLongCigar ( boolean clipped )
+        throws ErrorMsg
+    {
+        return this . GetLongCigar ( self, clipped );
+    }
+
+
+    /*------------------------------------------------------------------
+     * details of mate alignment
+     */
+
+    /* hasMate
+     */
+    public boolean hasMate ()
+    {
+        return this . HasMate ( self );
+    }
+    
+    /* getMateAlignmentId
+     */
+    public String getMateAlignmentId ()
+        throws ErrorMsg
+    {
+        return this . GetMateAlignmentId ( self );
+    }
+
+    /* getMateAlignment
+     */
+    public Alignment getMateAlignment ()
+        throws ErrorMsg
+    {
+        long ref = this . GetMateAlignment ( self );
+        try
+        {
+            return new AlignmentItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    /* getMateReferenceSpec
+     */
+    public String getMateReferenceSpec ()
+        throws ErrorMsg
+    {
+        return this . GetMateReferenceSpec ( self );
+    }
+
+    /* getMateIsReversedOrientation
+     */
+    public boolean getMateIsReversedOrientation ()
+        throws ErrorMsg
+    {
+        return this . GetMateIsReversedOrientation ( self );
+    }
+
+
+    /*******************************
+     * AlignmentItf Implementation *
+     *******************************/
+
+
+    // constructors
+    AlignmentItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    AlignmentItf ( Alignment obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            AlignmentItf ref = ( AlignmentItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native String GetFragmentId ( long self )
+        throws ErrorMsg;
+    private native String GetFragmentBases ( long self, long offset, long length )
+        throws ErrorMsg;
+    private native String GetFragmentQualities ( long self, long offset, long length )
+        throws ErrorMsg;
+    private native String GetAlignmentId ( long self )
+        throws ErrorMsg;
+    private native String GetReferenceSpec ( long self )
+        throws ErrorMsg;
+    private native int GetMappingQuality ( long self )
+        throws ErrorMsg;
+    private native String GetReferenceBases ( long self )
+        throws ErrorMsg;
+    private native String GetReadGroup ( long self )
+        throws ErrorMsg;
+    private native String GetReadId ( long self )
+        throws ErrorMsg;
+    private native String GetClippedFragmentBases ( long self )
+        throws ErrorMsg;
+    private native String GetClippedFragmentQualities ( long self )
+        throws ErrorMsg;
+    private native String GetAlignedFragmentBases ( long self )
+        throws ErrorMsg;
+    private native int GetAlignmentCategory ( long self )
+        throws ErrorMsg;
+    private native long GetAlignmentPosition ( long self )
+        throws ErrorMsg;
+    private native long GetAlignmentLength ( long self )
+        throws ErrorMsg;
+    private native boolean GetIsReversedOrientation ( long self )
+        throws ErrorMsg;
+    private native int GetSoftClip ( long self, int edge )
+        throws ErrorMsg;
+    private native long GetTemplateLength ( long self )
+        throws ErrorMsg;
+    private native String GetShortCigar ( long self, boolean clipped )
+        throws ErrorMsg;
+    private native String GetLongCigar ( long self, boolean clipped )
+        throws ErrorMsg;
+    private native boolean HasMate ( long self );
+    private native String GetMateAlignmentId ( long self )
+        throws ErrorMsg;
+    private native long GetMateAlignment ( long self )
+        throws ErrorMsg;
+    private native String GetMateReferenceSpec ( long self )
+        throws ErrorMsg;
+    private native boolean GetMateIsReversedOrientation ( long self )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/FragmentIteratorItf.java b/ngs-java/ngs/itf/FragmentIteratorItf.java
new file mode 100644
index 0000000..3ea81ad
--- /dev/null
+++ b/ngs-java/ngs/itf/FragmentIteratorItf.java
@@ -0,0 +1,89 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.Fragment;
+import ngs.FragmentIterator;
+
+
+/*==========================================================================
+ * FragmentIteratorItf
+ *  represents an NGS biological fragment
+ */
+class FragmentIteratorItf
+    extends FragmentItf
+    implements FragmentIterator
+{
+
+    /******************************
+     * FragmentIterator Interface *
+     ******************************/
+
+    /* nextFragment
+     *  advance to next Fragment
+     *  returns false if no more Fragments are available.
+     *  throws exception if more Fragments should be available,
+     *  but could not be accessed.
+     */
+    public boolean nextFragment ()
+        throws ErrorMsg
+    {
+        return this . NextFragment ( self );
+    }
+
+
+    /******************************
+     * FragmentItf Implementation *
+     ******************************/
+
+
+    // constructors
+    FragmentIteratorItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    FragmentIteratorItf ( FragmentIterator obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            FragmentIteratorItf ref = ( FragmentIteratorItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native boolean NextFragment ( long self )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/FragmentItf.java b/ngs-java/ngs/itf/FragmentItf.java
new file mode 100644
index 0000000..957c5c1
--- /dev/null
+++ b/ngs-java/ngs/itf/FragmentItf.java
@@ -0,0 +1,158 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.Fragment;
+import ngs.FragmentIterator;
+
+
+/*==========================================================================
+ * FragmentItf
+ *  represents an NGS biological fragment
+ */
+class FragmentItf
+    extends Refcount
+    implements Fragment
+{
+
+    /**********************
+     * Fragment Interface *
+     **********************/
+
+    /* getFragmentId
+     */
+    public String getFragmentId ()
+        throws ErrorMsg
+    {
+        return this . GetFragmentId ( self );
+    }
+
+
+    /*----------------------------------------------------------------------
+     * fragment details
+     */
+
+    /* getFragmentBases
+     *  return sequence bases
+     *  "offset" is zero-based
+     *  "length" must be >= 0
+     */
+    public String getFragmentBases ()
+        throws ErrorMsg
+    {
+        return this . GetFragmentBases ( self, 0, -1 );
+    }
+
+    public String getFragmentBases ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+
+        return this . GetFragmentBases ( self, offset, -1 );
+    }
+
+    public String getFragmentBases ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+        if ( length < 0 )
+            throw new IndexOutOfBoundsException ( "length " + length + " is negative");
+
+        return this . GetFragmentBases ( self, offset, length );
+    }
+
+
+    /* getFragmentQualities
+     *  return phred quality values
+     *  using ASCII offset of 33
+     *  "offset" is zero-based
+     *  "length" must be >= 0
+     */
+    public String getFragmentQualities ()
+        throws ErrorMsg
+    {
+        return this . GetFragmentQualities ( self, 0, -1 );
+    }
+
+    public String getFragmentQualities ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+
+        return this . getFragmentQualities ( offset, -1 );
+    }
+
+    public String getFragmentQualities ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+        if ( length < 0 )
+            throw new IndexOutOfBoundsException ( "length " + length + " is negative");
+
+        return this . GetFragmentQualities ( self, offset, length );
+    }
+
+
+    /******************************
+     * FragmentItf Implementation *
+     ******************************/
+
+
+    // constructors
+    FragmentItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    FragmentItf ( Fragment obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            FragmentItf ref = ( FragmentItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native String GetFragmentId ( long self )
+        throws ErrorMsg;
+    private native String GetFragmentBases ( long self, long offset, long length )
+        throws ErrorMsg;
+    private native String GetFragmentQualities ( long self, long offset, long length )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/PileupEventIteratorItf.java b/ngs-java/ngs/itf/PileupEventIteratorItf.java
new file mode 100644
index 0000000..66f355d
--- /dev/null
+++ b/ngs-java/ngs/itf/PileupEventIteratorItf.java
@@ -0,0 +1,92 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.PileupEvent;
+import ngs.PileupEventIterator;
+
+
+/*==========================================================================
+ * PileupEventIteratorItf
+ *  represents a single cell of a sparse 2D matrix
+ *  with Reference coordinates on one axis
+ *  and stacked Alignments on the other axis
+ */
+class PileupEventIteratorItf
+    extends PileupEventItf
+    implements PileupEventIterator
+{
+
+    /*********************************
+     * PileupEventIterator Interface *
+     *********************************/
+
+    /* nextPileup
+     *  advance to first Pileup on initial invocation
+     *  advance to next Pileup subsequently
+     *  returns false if no more Pileups are available.
+     *  throws exception if more Pileups should be available,
+     *  but could not be accessed.
+     */
+    public boolean nextPileupEvent ()
+        throws ErrorMsg
+    {
+        return this . NextPileupEvent ( self );
+    }
+
+
+    /*****************************************
+     * PileupEventIteratorItf Implementation *
+     *****************************************/
+
+
+    // constructors
+    PileupEventIteratorItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    PileupEventIteratorItf ( PileupEventIterator obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            PileupEventIteratorItf ref = ( PileupEventIteratorItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native boolean NextPileupEvent ( long self )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/PileupEventItf.java b/ngs-java/ngs/itf/PileupEventItf.java
new file mode 100644
index 0000000..25b8a69
--- /dev/null
+++ b/ngs-java/ngs/itf/PileupEventItf.java
@@ -0,0 +1,256 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.PileupEvent;
+import ngs.Alignment;
+
+
+/*==========================================================================
+ * PileupEventItf
+ *  represents a single cell of a sparse 2D matrix
+ *  with Reference coordinates on one axis
+ *  and stacked Alignments on the other axis
+ */
+class PileupEventItf
+    extends Refcount
+    implements PileupEvent
+{
+
+    /*************************
+     * PileupEvent Interface *
+     *************************/
+
+    /*----------------------------------------------------------------------
+     * Reference
+     */
+
+    /* getReferenceSpec
+     */
+    public String getReferenceSpec ()
+        throws ErrorMsg
+    {
+        return this . GetReferenceSpec ( self );
+    }
+
+    /* getReferencePosition
+     */
+    public long getReferencePosition ()
+        throws ErrorMsg
+    {
+        return this . GetReferencePosition ( self );
+    }
+
+    /* getMappingQuality
+     */
+    public int getMappingQuality ()
+        throws ErrorMsg
+    {
+        return this . GetMappingQuality ( self );
+    }
+
+
+    /*----------------------------------------------------------------------
+     * Alignment
+     */
+
+    /* getAlignmentId
+     *  unique within ReadCollection
+     */
+    public String getAlignmentId ()
+        throws ErrorMsg
+    {
+        return this . GetAlignmentId ( self );
+    }
+
+    /* getAlignment
+     */
+    public Alignment getAlignment ()
+        throws ErrorMsg
+    {
+        long ref = this . GetAlignment ( self );
+        try
+        {
+            return new AlignmentItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    /* getAlignmentPosition
+     */
+    public long getAlignmentPosition ()
+        throws ErrorMsg
+    {
+        return this . GetAlignmentPosition ( self );
+    }
+
+    /* getFirstAlignmentPosition
+     *  returns the position of this Alignment's first event
+     *  in Reference coordinates
+     */
+    public long getFirstAlignmentPosition ()
+        throws ErrorMsg
+    {
+        return this . GetFirstAlignmentPosition ( self );
+    }
+
+    /* getLastAlignmentPosition
+     *  returns the position of this Alignment's last event
+     *  in INCLUSIVE Reference coordinates
+     */
+    public long getLastAlignmentPosition ()
+        throws ErrorMsg
+    {
+        return this . GetLastAlignmentPosition ( self );
+    }
+
+
+    /*----------------------------------------------------------------------
+     * event details
+     */
+
+    /* getEventType
+     *  the type of event being represented
+     */
+    public int getEventType ()
+        throws ErrorMsg
+    {
+        return this . GetEventType ( self );
+    }
+
+    /* getAlignmentBase
+     *  retrieves base aligned at current Reference position
+     *  throws exception if event is an insertion or deletion
+     */
+    public char getAlignmentBase ()
+        throws ErrorMsg
+    {
+        return this . GetAlignmentBase ( self );
+    }
+
+    /* getAlignmentQuality
+     *  retrieves base aligned at current Reference position
+     *  throws exception if event is an insertion or deletion
+     */
+    public char getAlignmentQuality ()
+        throws ErrorMsg
+    {
+        return this . GetAlignmentQuality ( self );
+    }
+
+
+    /* getInsertionBases
+     *  returns bases corresponding to insertion event
+     */
+    public String getInsertionBases ()
+        throws ErrorMsg
+    {
+        return this . GetInsertionBases ( self );
+    }
+
+    /* getInsertionQualities
+     *  returns qualities corresponding to insertion event
+     */
+    public String getInsertionQualities ()
+        throws ErrorMsg
+    {
+        return this . GetInsertionQualities ( self );
+    }
+
+    /* getDeletionCount
+     *  returns the number of bases remaining in deletion event
+     *  i.e. the number of Reference base positions remaining
+     *  until the next non-deletion event in this alignment.
+     */
+    public int getDeletionCount ()
+        throws ErrorMsg
+    {
+        return this . GetDeletionCount ( self );
+    }
+
+
+    /*********************************
+     * PileupEventItf Implementation *
+     *******************************/
+
+
+    // constructors
+    PileupEventItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    PileupEventItf ( PileupEvent obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            PileupEventItf ref = ( PileupEventItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native String GetReferenceSpec ( long self )
+        throws ErrorMsg;
+    private native long GetReferencePosition ( long self )
+        throws ErrorMsg;
+    private native int GetMappingQuality ( long self )
+        throws ErrorMsg;
+    private native String GetAlignmentId ( long self )
+        throws ErrorMsg;
+    private native long GetAlignment ( long self )
+        throws ErrorMsg;
+    private native long GetAlignmentPosition ( long self )
+        throws ErrorMsg;
+    private native long GetFirstAlignmentPosition ( long self )
+        throws ErrorMsg;
+    private native long GetLastAlignmentPosition ( long self )
+        throws ErrorMsg;
+    private native int GetEventType ( long self )
+        throws ErrorMsg;
+    private native char GetAlignmentBase ( long self )
+        throws ErrorMsg;
+    private native char GetAlignmentQuality ( long self )
+        throws ErrorMsg;
+    private native String GetInsertionBases ( long self )
+        throws ErrorMsg;
+    private native String GetInsertionQualities ( long self )
+        throws ErrorMsg;
+    private native int GetDeletionCount ( long self )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/PileupIteratorItf.java b/ngs-java/ngs/itf/PileupIteratorItf.java
new file mode 100644
index 0000000..c0555a6
--- /dev/null
+++ b/ngs-java/ngs/itf/PileupIteratorItf.java
@@ -0,0 +1,91 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.Pileup;
+import ngs.PileupIterator;
+
+
+/*==========================================================================
+ * PileupIteratorItf
+ *  represents a slice through a stack of Alignments
+ *  at a given position on the Reference
+ */
+class PileupIteratorItf
+    extends PileupItf
+    implements PileupIterator
+{
+
+    /****************************
+     * PileupIterator Interface *
+     ****************************/
+
+    /* nextPileup
+     *  advance to first Pileup on initial invocation
+     *  advance to next Pileup subsequently
+     *  returns false if no more Pileups are available.
+     *  throws exception if more Pileups should be available,
+     *  but could not be accessed.
+     */
+    public boolean nextPileup ()
+        throws ErrorMsg
+    {
+        return this . NextPileup ( self );
+    }
+
+
+    /************************************
+     * PileupIteratorItf Implementation *
+     ************************************/
+
+
+    // constructors
+    PileupIteratorItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    PileupIteratorItf ( PileupIterator obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            PileupIteratorItf ref = ( PileupIteratorItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native boolean NextPileup ( long self )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/PileupItf.java b/ngs-java/ngs/itf/PileupItf.java
new file mode 100644
index 0000000..c4ec0ff
--- /dev/null
+++ b/ngs-java/ngs/itf/PileupItf.java
@@ -0,0 +1,141 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.Pileup;
+import ngs.PileupEventIterator;
+
+
+/*==========================================================================
+ * PileupItf
+ *  represents a slice through a stack of Alignments
+ *  at a given position on the Reference
+ */
+class PileupItf
+    extends Refcount
+    implements Pileup
+{
+
+    /********************
+     * Pileup Interface *
+     ********************/
+
+    /*----------------------------------------------------------------------
+     * Reference
+     */
+
+    /* getReferenceSpec
+     */
+    public String getReferenceSpec ()
+        throws ErrorMsg
+    {
+        return this . GetReferenceSpec ( self );
+    }
+
+    /* getReferencePosition
+     */
+    public long getReferencePosition ()
+        throws ErrorMsg
+    {
+        return this . GetReferencePosition ( self );
+    }
+
+
+    /*----------------------------------------------------------------------
+     * PileupEvent
+     */
+
+    /* getPileupEvents
+     */
+    public PileupEventIterator getPileupEvents ()
+        throws ErrorMsg
+    {
+        long ref = this . GetPileupEvents ( self );
+        try
+        {
+            return new PileupEventIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+
+    /*----------------------------------------------------------------------
+     * details of this pileup row
+     */
+
+    /* getPileupDepth
+     *  returns the coverage depth
+     *  at the current reference position
+     */
+    public int getPileupDepth ()
+        throws ErrorMsg
+    {
+        return this . GetPileupDepth ( self );
+    }
+
+
+    /****************************
+     * PileupItf Implementation *
+     **************************/
+
+
+    // constructors
+    PileupItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    PileupItf ( Pileup obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            PileupItf ref = ( PileupItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native String GetReferenceSpec ( long self )
+        throws ErrorMsg;
+    private native long GetReferencePosition ( long self )
+        throws ErrorMsg;
+    private native long GetPileupEvents ( long self )
+        throws ErrorMsg;
+    private native int GetPileupDepth ( long self )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/ReadCollectionItf.java b/ngs-java/ngs/itf/ReadCollectionItf.java
new file mode 100644
index 0000000..1895f0b
--- /dev/null
+++ b/ngs-java/ngs/itf/ReadCollectionItf.java
@@ -0,0 +1,382 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.ReadCollection;
+import ngs.ReadGroup;
+import ngs.ReadGroupIterator;
+import ngs.Read;
+import ngs.ReadIterator;
+import ngs.Reference;
+import ngs.ReferenceIterator;
+import ngs.Alignment;
+import ngs.AlignmentIterator;
+
+
+/*==========================================================================
+ * ReadIteratorItf
+ *  represents an NGS machine read
+ *  having some number of biological Fragments
+ */
+public class ReadCollectionItf
+    extends Refcount
+    implements ReadCollection
+{
+
+    /****************************
+     * ReadCollection Interface *
+     ****************************/
+
+    /* getName
+     *  returns the simple name of the read collection
+     *  this name is generally extracted from the "spec"
+     *  used to create the object, but may also be mapped
+     *  to a canonical name if one may be determined and
+     *  differs from that given in the spec.
+     *
+     *  if the name is extracted from "spec" and contains
+     *  well-known file extensions that do not form part of
+     *  a canonical name (e.g. ".sra"), they will be removed.
+     */
+    public String getName ()
+        throws ErrorMsg
+    {
+        return this . GetName ( self );
+    }
+
+
+    /*----------------------------------------------------------------------
+     * READ GROUPS
+     */
+
+    /* getReadGroups
+     *  returns an iterator of all ReadGroups used
+     */
+    public ReadGroupIterator getReadGroups ()
+        throws ErrorMsg
+    {
+        long ref = this . GetReadGroups ( self );
+        try
+        {
+            return new ReadGroupIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    /* getReadGroup
+     */
+    public ReadGroup getReadGroup ( String spec )
+        throws ErrorMsg
+    {
+        long ref = this . GetReadGroup ( self, spec );
+        try
+        {
+            return new ReadGroupItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+
+    /*----------------------------------------------------------------------
+     * REFERENCES
+     */
+
+    /* getReferences
+     *  returns an iterator of all References used
+     */
+    public ReferenceIterator getReferences ()
+        throws ErrorMsg
+    {
+        long ref = this . GetReferences ( self );
+        try
+        {
+            return new ReferenceIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    /* getReference
+     */
+    public Reference getReference ( String spec )
+        throws ErrorMsg
+    {
+        long ref = this . GetReference ( self, spec );
+        try
+        {
+            return new ReferenceItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+
+    /*----------------------------------------------------------------------
+     * ALIGNMENTS
+     */
+
+    /* getAlignment
+     *  returns an individual Alignment
+     *  throws ErrorMsg if Alignment does not exist
+     */
+    public Alignment getAlignment ( String alignmentId )
+        throws ErrorMsg
+    {
+        long ref = this . GetAlignment ( self, alignmentId );
+        try
+        {
+            return new AlignmentItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    /* AlignmentCategory
+     *  see Alignment for categories
+     */
+
+    /* getAlignments
+     *  returns an iterator of all Alignments from specified categories
+     */
+    public AlignmentIterator getAlignments ( int categories )
+        throws ErrorMsg
+    {
+        long ref = this . GetAlignments ( self, categories );
+        try
+        {
+            return new AlignmentIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+
+    /* getAlignmentCount
+     *  returns count of all alignments
+     *  "categories" provides a means of filtering by AlignmentCategory
+     */
+    public long getAlignmentCount ()
+        throws ErrorMsg
+    {
+        return this . GetAlignmentCount ( self, Alignment . all );
+    }
+
+    public long getAlignmentCount ( int categories )
+        throws ErrorMsg
+    {
+        return this . GetAlignmentCount ( self, categories );
+    }
+
+    /* getAlignmentRange
+     *  returns an iterator across a range of Alignments
+     *  "first" is an unsigned ordinal into set
+     *  "categories" provides a means of filtering by AlignmentCategory
+     */
+    public AlignmentIterator getAlignmentRange ( long first, long count )
+        throws ErrorMsg
+    {
+        return this . getAlignmentRange ( first, count, Alignment . all );
+    }
+
+    public AlignmentIterator getAlignmentRange ( long first, long count, int categories )
+        throws ErrorMsg
+    {
+        long ref = this . GetAlignmentRange ( self, first, count, categories );
+        try
+        {
+            return new AlignmentIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+
+
+
+    /*----------------------------------------------------------------------
+     * READS
+     */
+
+    /* getRead
+     *  returns an individual Read
+     *  throws ErrorMsg if Read does not exist
+     */
+    public Read getRead ( String readId )
+        throws ErrorMsg
+    {
+        long ref = this . GetRead ( self, readId );
+        try
+        {
+            return new ReadItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    /* ReadCategory
+     *  see Read for categories
+     */
+
+    /* getReads
+     *  returns an iterator of all contained machine Reads
+     */
+    public ReadIterator getReads ( int categories )
+        throws ErrorMsg
+    {
+        long ref = this . GetReads ( self, categories );
+        try
+        {
+            return new ReadIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    /* getReadCount
+     *  returns the number of reads in the collection
+     *  of all combined categories
+     */
+    public long getReadCount ()
+        throws ErrorMsg
+    {
+        return this . GetReadCount ( self, Read . all );
+    }
+
+    public long getReadCount ( int categories )
+        throws ErrorMsg
+    {
+        return this . GetReadCount ( self, categories );
+    }
+
+    /* getReadRange
+     *  returns an iterator across a range of Reads
+     */
+    public ReadIterator getReadRange ( long first, long count )
+        throws ErrorMsg
+    {
+        return getReadRange ( first, count, Read . all );
+    }
+
+    public ReadIterator getReadRange ( long first, long count, int categories )
+        throws ErrorMsg
+    {
+        long ref = this . GetReadRange ( self, first, count, categories );
+        try
+        {
+            return new ReadIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+
+    /************************************
+     * ReadCollectionItf Implementation *
+     ************************************/
+
+    // constructors
+    public ReadCollectionItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    ReadCollectionItf ( ReadCollection obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            ReadCollectionItf ref = ( ReadCollectionItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native String GetName ( long self )
+        throws ErrorMsg;
+    private native long GetReadGroups ( long self )
+        throws ErrorMsg;
+    private native long GetReadGroup ( long self, String spec )
+        throws ErrorMsg;
+    private native long GetReferences ( long self )
+        throws ErrorMsg;
+    private native long GetReference ( long self, String spec )
+        throws ErrorMsg;
+    private native long GetAlignment ( long self, String alignmentId )
+        throws ErrorMsg;
+    private native long GetAlignments ( long self, int categories )
+        throws ErrorMsg;
+    private native long GetAlignmentCount ( long self, int categories )
+        throws ErrorMsg;
+    private native long GetAlignmentRange ( long self, long first, long count, int categories )
+        throws ErrorMsg;
+    private native long GetRead ( long self, String readId )
+        throws ErrorMsg;
+    private native long GetReads ( long self, int categories )
+        throws ErrorMsg;
+    private native long GetReadCount ( long self, int categories )
+        throws ErrorMsg;
+    private native long GetReadRange ( long self, long first, long count, int categories )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/ReadGroupIteratorItf.java b/ngs-java/ngs/itf/ReadGroupIteratorItf.java
new file mode 100644
index 0000000..7f245a2
--- /dev/null
+++ b/ngs-java/ngs/itf/ReadGroupIteratorItf.java
@@ -0,0 +1,89 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.ReadGroup;
+import ngs.ReadGroupIterator;
+
+
+/*==========================================================================
+ * ReadGroupItf
+ *  represents an NGS-capable object with a group of Reads
+ */
+class ReadGroupIteratorItf
+    extends ReadGroupItf
+    implements ReadGroupIterator
+{
+
+    /*******************************
+     * ReadGroupIterator Interface *
+     *******************************/
+
+    /* nextReadGroup
+     *  advance to first ReadGroup on initial invocation
+     *  advance to next ReadGroup subsequently
+     *  returns false if no more ReadGroups are available.
+     *  throws exception if more ReadGroups should be available,
+     *  but could not be accessed.
+     */
+    public boolean nextReadGroup ()
+        throws ErrorMsg
+    {
+        return this . NextReadGroup ( self );
+    }
+
+
+    /***************************************
+     * ReadGroupIteratorItf Implementation *
+     ***************************************/
+
+    // constructors
+    ReadGroupIteratorItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    ReadGroupIteratorItf ( ReadGroupIterator obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            ReadGroupIteratorItf ref = ( ReadGroupIteratorItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native boolean NextReadGroup ( long self )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/ReadGroupItf.java b/ngs-java/ngs/itf/ReadGroupItf.java
new file mode 100644
index 0000000..bbb46f7
--- /dev/null
+++ b/ngs-java/ngs/itf/ReadGroupItf.java
@@ -0,0 +1,162 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.ReadGroup;
+import ngs.Read;
+import ngs.ReadIterator;
+import ngs.Statistics;
+
+
+/*==========================================================================
+ * ReadGroupItf
+ *  represents an NGS-capable object with a group of Reads
+ */
+class ReadGroupItf
+    extends Refcount
+    implements ReadGroup
+{
+
+    /***********************
+     * ReadGroup Interface *
+     ***********************/
+
+    /* getName
+     *  returns the simple name of the read group
+     */
+    public String getName ()
+        throws ErrorMsg
+    {
+        return this . GetName ( self );
+    }
+
+
+    /*------------------------------------------------------------------
+     * READS
+     *  [ support for reads has been removed ]
+     */
+
+    /* getRead
+     *  returns an individual Read
+     *  throws ErrorMsg if Read does not exist
+     *  or is not part of this ReadGroup
+     */
+/*
+    public Read getRead ( String readId )
+        throws ErrorMsg
+    {
+        long ref = this . GetRead ( self, readId );
+        try
+        {
+            return new ReadItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+*/
+
+    /* ReadCategory
+     *  see Read for category definitions
+     */
+
+    /* getReads
+     *  returns an iterator of all contained machine Reads
+     */
+/*
+    public ReadIterator getReads ( int categories )
+        throws ErrorMsg
+    {
+        long ref = this . GetReads ( self, categories );
+        try
+        {
+            return new ReadIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+*/
+
+
+    public Statistics getStatistics ()
+        throws ErrorMsg
+    {
+        long ref = this . GetStatistics ( self );
+        try
+        {
+            return new StatisticsItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    /************************************
+     * ReadGroupItf Implementation *
+     ************************************/
+
+    // constructors
+    ReadGroupItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    ReadGroupItf ( ReadGroup obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            ReadGroupItf ref = ( ReadGroupItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native String GetName ( long self )
+        throws ErrorMsg;
+/*
+    private native long GetRead ( long self, String readId )
+        throws ErrorMsg;
+    private native long GetReads ( long self, int categories )
+        throws ErrorMsg;
+*/
+    private native long GetStatistics ( long self )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/ReadIteratorItf.java b/ngs-java/ngs/itf/ReadIteratorItf.java
new file mode 100644
index 0000000..f98a067
--- /dev/null
+++ b/ngs-java/ngs/itf/ReadIteratorItf.java
@@ -0,0 +1,91 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.Read;
+import ngs.ReadIterator;
+
+
+/*==========================================================================
+ * ReadIteratorItf
+ *  represents an NGS machine read
+ *  having some number of biological Fragments
+ */
+class ReadIteratorItf
+    extends ReadItf
+    implements ReadIterator
+{
+
+    /**************************
+     * ReadIterator Interface *
+     **************************/
+
+    /* nextRead
+     *  advance to first Read on initial invocation
+     *  advance to next Read subsequently
+     *  returns false if no more Reads are available.
+     *  throws exception if more Reads should be available,
+     *  but could not be accessed.
+     */
+    public boolean nextRead ()
+        throws ErrorMsg
+    {
+        return this . NextRead ( self );
+    }
+
+
+    /**********************************
+     * ReadIteratorItf Implementation *
+     **********************************/
+
+
+    // constructors
+    ReadIteratorItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    ReadIteratorItf ( ReadIterator obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            ReadIteratorItf ref = ( ReadIteratorItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native boolean NextRead ( long self )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/ReadItf.java b/ngs-java/ngs/itf/ReadItf.java
new file mode 100644
index 0000000..4647102
--- /dev/null
+++ b/ngs-java/ngs/itf/ReadItf.java
@@ -0,0 +1,302 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.Read;
+import ngs.Fragment;
+import ngs.FragmentIterator;
+
+
+/*==========================================================================
+ * ReadItf
+ *  represents an NGS machine read
+ *  having some number of biological Fragments
+ */
+class ReadItf
+    extends Refcount
+    implements Read
+{
+
+    /**********************
+     * Fragment Interface *
+     **********************/
+
+    /* getFragmentId
+     */
+    public String getFragmentId ()
+        throws ErrorMsg
+    {
+        return this . GetFragmentId ( self );
+    }
+
+    /* getFragmentBases
+     *  return sequence bases
+     *  "offset" is zero-based
+     *  "length" must be >= 0
+     */
+    public String getFragmentBases ()
+        throws ErrorMsg
+    {
+        return this . GetFragmentBases ( self, 0, -1 );
+    }
+
+    public String getFragmentBases ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+
+        return this . GetFragmentBases ( self, offset, -1 );
+    }
+
+    public String getFragmentBases ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+        if ( length < 0 )
+            throw new IndexOutOfBoundsException ( "length " + length + " is negative");
+
+        return this . GetFragmentBases ( self, offset, length );
+    }
+
+
+    /* getFragmentQualities
+     *  return phred quality values
+     *  using ASCII offset of 33
+     *  "offset" is zero-based
+     *  "length" must be >= 0
+     */
+    public String getFragmentQualities ()
+        throws ErrorMsg
+    {
+        return this . GetFragmentQualities ( self, 0, -1 );
+    }
+
+    public String getFragmentQualities ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+
+        return this . getFragmentQualities ( offset, -1 );
+    }
+
+    public String getFragmentQualities ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+        if ( length < 0 )
+            throw new IndexOutOfBoundsException ( "length " + length + " is negative");
+
+        return this . GetFragmentQualities ( self, offset, length );
+    }
+
+    /******************************
+     * FragmentIterator Interface *
+     ******************************/
+
+    /* nextFragment
+     *  advance to next Fragment
+     *  returns false if no more Fragments are available.
+     *  throws exception if more Fragments should be available,
+     *  but could not be accessed.
+     */
+    public boolean nextFragment ()
+        throws ErrorMsg
+    {
+        return this . NextFragment ( self );
+    }
+
+    /******************
+     * Read Interface *
+     ******************/
+
+    /* getReadId
+     */
+    public String getReadId ()
+        throws ErrorMsg
+    {
+        return this . GetReadId ( self );
+    }
+
+    /* getNumFragments
+     *  returns the number of biological Fragments contained in the read
+     */
+    public int getNumFragments ()
+        throws ErrorMsg
+    {
+        return this . GetNumFragments ( self );
+    }
+
+
+    /*----------------------------------------------------------------------
+     * read details
+     */
+
+    /* getReadCategory
+     */
+    public int getReadCategory ()
+        throws ErrorMsg
+    {
+        return this . GetReadCategory ( self );
+    }
+
+    /* getReadGroup
+     */
+    public String getReadGroup ()
+        throws ErrorMsg
+    {
+        return this . GetReadGroup ( self );
+    }
+
+    /* getReadName
+     */
+    public String getReadName ()
+        throws ErrorMsg
+    {
+        return this . GetReadName ( self );
+    }
+
+
+    /* getReadBases
+     *  return sequence bases
+     *  "offset" is zero-based
+     *  "length" must be >= 0
+     */
+    public String getReadBases ()
+        throws ErrorMsg
+    {
+        return this . GetReadBases ( self, 0, -1 );
+    }
+
+    public String getReadBases ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+
+        return this . GetReadBases ( self, offset, -1 );
+    }
+
+    public String getReadBases ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+        if ( length < 0 )
+            throw new IndexOutOfBoundsException ( "length " + length + " is negative");
+
+        return this . GetReadBases ( self, offset, length );
+    }
+
+
+    /* getReadQualities
+     *  return phred quality values
+     *  using ASCII offset of 33
+     *  "offset" is zero-based
+     *  "length" must be >= 0
+     */
+    public String getReadQualities ()
+        throws ErrorMsg
+    {
+        return this . GetReadQualities ( self, 0, -1 );
+    }
+
+    public String getReadQualities ( long offset )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+
+        return this . getReadQualities ( offset, -1 );
+    }
+
+    public String getReadQualities ( long offset, long length )
+        throws ErrorMsg, IndexOutOfBoundsException
+    {
+        if ( offset < 0 )
+            throw new IndexOutOfBoundsException ( "offset " + offset + " is negative" );
+        if ( length < 0 )
+            throw new IndexOutOfBoundsException ( "length " + length + " is negative");
+
+        return this . GetReadQualities ( self, offset, length );
+    }
+
+
+    /***************************
+     * ReadItf Implementation *
+     ***************************/
+
+
+    // constructors
+    ReadItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    ReadItf ( Read obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            ReadItf ref = ( ReadItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native String GetFragmentId ( long self )
+        throws ErrorMsg;
+    private native String GetFragmentBases ( long self, long offset, long length )
+        throws ErrorMsg;
+    private native String GetFragmentQualities ( long self, long offset, long length )
+        throws ErrorMsg;
+    private native boolean NextFragment ( long self )
+        throws ErrorMsg;
+    private native String GetReadId ( long self )
+        throws ErrorMsg;
+    private native int GetNumFragments ( long self )
+        throws ErrorMsg;
+    private native int GetReadCategory ( long self )
+        throws ErrorMsg;
+    private native String GetReadGroup ( long self )
+        throws ErrorMsg;
+    private native String GetReadName ( long self )
+        throws ErrorMsg;
+    private native String GetReadBases ( long self, long offset, long length )
+        throws ErrorMsg;
+    private native String GetReadQualities ( long self, long offset, long length )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/Refcount.java b/ngs-java/ngs/itf/Refcount.java
new file mode 100644
index 0000000..3fe896c
--- /dev/null
+++ b/ngs-java/ngs/itf/Refcount.java
@@ -0,0 +1,78 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+
+/*==========================================================================
+ * Refcount
+ *  manages reference in C heap
+ */
+class Refcount
+{
+
+    // constructors
+    Refcount ( long ref )
+    {
+        this . self = ref;
+    }
+
+    // implementation details
+    long duplicate ()
+        throws ErrorMsg
+    {
+        return this . Duplicate ( self );
+    }
+
+    synchronized void invalidate ()
+    {
+        this . Release ( self );
+        self = 0;
+    }
+
+    protected void finalize ()
+    {
+        if ( self != 0 )
+        {
+            this . Release ( self );
+            self = 0;
+        }
+    }
+
+    protected static void release ( long ref )
+    {
+        ReleaseRef ( ref );
+    }
+
+    // native interface
+    private native long Duplicate ( long self )
+        throws ErrorMsg;
+    private native void Release ( long self );
+    private native static void ReleaseRef ( long ref );
+
+    protected long self;
+}
diff --git a/ngs-java/ngs/itf/ReferenceIteratorItf.java b/ngs-java/ngs/itf/ReferenceIteratorItf.java
new file mode 100644
index 0000000..2078d48
--- /dev/null
+++ b/ngs-java/ngs/itf/ReferenceIteratorItf.java
@@ -0,0 +1,89 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.Reference;
+import ngs.ReferenceIterator;
+
+
+/*==========================================================================
+ * ReferenceIteratorItf
+ *  represents a reference sequence
+ */
+class ReferenceIteratorItf
+    extends ReferenceItf
+    implements ReferenceIterator
+{
+
+    /*******************************
+     * ReferenceIterator Interface *
+     *******************************/
+
+    /* nextReference
+     *  advance to first Reference on initial invocation
+     *  advance to next Reference subsequently
+     *  returns false if no more References are available.
+     *  throws exception if more References should be available,
+     *  but could not be accessed.
+     */
+    public boolean nextReference ()
+        throws ErrorMsg
+    {
+        return this . NextReference ( self );
+    }
+
+
+    /***************************************
+     * ReferenceIteratorItf Implementation *
+     ***************************************/
+
+    // constructors
+    ReferenceIteratorItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    ReferenceIteratorItf ( ReferenceIterator obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            ReferenceIteratorItf ref = ( ReferenceIteratorItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native boolean NextReference ( long self )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/ReferenceItf.java b/ngs-java/ngs/itf/ReferenceItf.java
new file mode 100644
index 0000000..41f6835
--- /dev/null
+++ b/ngs-java/ngs/itf/ReferenceItf.java
@@ -0,0 +1,318 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.Reference;
+import ngs.Alignment;
+import ngs.AlignmentIterator;
+import ngs.PileupIterator;
+
+
+/*==========================================================================
+ * ReferenceItf
+ *  represents a reference sequence
+ */
+class ReferenceItf
+    extends Refcount
+    implements Reference
+{
+
+    /***********************
+     * Reference Interface *
+     ***********************/
+
+    /* getCommonName
+     *  returns the common name of reference, e.g. "chr1"
+     */
+    public String getCommonName ()
+        throws ErrorMsg
+    {
+        return this . GetCommonName ( self );
+    }
+
+    /* getCanonicalName
+     *  returns the accessioned name of reference, e.g. "NC_000001.11"
+     */
+    public String getCanonicalName ()
+        throws ErrorMsg
+    {
+        return this . GetCanonicalName ( self );
+    }
+
+
+    /* getIsCircular
+     *  returns true if reference is circular
+     */
+    public boolean getIsCircular ()
+        throws ErrorMsg
+    {
+        return this . GetIsCircular ( self );
+    }
+
+
+    /* getLength
+     *  returns the length of the reference sequence
+     */
+    public long getLength ()
+        throws ErrorMsg
+    {
+        return this . GetLength ( self );
+    }
+
+
+    /* getReferenceBases
+     *  return sub-sequence bases for Reference
+     *  "offset" is zero-based
+     *  "size" must be >= 0
+     */
+    public String getReferenceBases ( long offset )
+        throws ErrorMsg
+    {
+        return this . getReferenceBases ( offset, -1 );
+    }
+
+    public String getReferenceBases ( long offset, long length )
+        throws ErrorMsg
+    {
+        return this . GetReferenceBases ( self, offset, length );
+    }
+
+    /* getReferenceChunk
+     *  return largest contiguous chunk available of
+     *  sub-sequence bases for Reference
+     *  "offset" is zero-based
+     *  "size" must be >= 0
+     *
+     * NB - actual returned sequence may be shorter
+     *  than requested. to obtain all bases available
+     *  in chunk, use a negative "size" value
+     */
+    public String getReferenceChunk ( long offset )
+        throws ErrorMsg
+    {
+        return this . getReferenceChunk ( offset, -1 );
+    }
+
+    public String getReferenceChunk ( long offset, long length )
+        throws ErrorMsg
+    {
+        return this . GetReferenceChunk ( self, offset, length );
+    }
+
+
+    /*----------------------------------------------------------------------
+     * ALIGNMENTS
+     */
+
+    /* getAlignment
+     *  returns an individual Alignment
+     *  throws ErrorMsg if Alignment does not exist
+     *  or is not part of this Reference
+     */
+    public Alignment getAlignment ( String alignmentId )
+        throws ErrorMsg
+    {
+        long ref = this . GetAlignment ( self, alignmentId );
+        try
+        {
+            return new AlignmentItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    /* AlignmentCategory
+     *  see Alignment for categories
+     */
+
+    /* getAlignments
+     *  returns an iterator of contained alignments
+     */
+    public AlignmentIterator getAlignments ( int categories )
+        throws ErrorMsg
+    {
+        long ref = this . GetAlignments ( self, categories );
+        try
+        {
+            return new AlignmentIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+
+    /* getAlignmentCount
+     *  returns count of all alignments
+     *  "categories" provides a means of filtering by AlignmentCategory
+     */
+    public long getAlignmentCount ()
+        throws ErrorMsg
+    {
+        return this . GetAlignmentCount ( self, Alignment . all );
+    }
+
+    public long getAlignmentCount ( int categories )
+        throws ErrorMsg
+    {
+        return this . GetAlignmentCount ( self, categories );
+    }
+
+    /* getAlignmentSlice
+     *  returns an iterator across a range of Alignments
+     *  "first" is an unsigned ordinal into set
+     *  "categories" provides a means of filtering by AlignmentCategory
+     */
+    public AlignmentIterator getAlignmentSlice ( long offset, long length )
+        throws ErrorMsg
+    {
+        return this . getAlignmentSlice ( offset, length, Alignment . all );
+    }
+
+    public AlignmentIterator getAlignmentSlice ( long offset, long length, int categories )
+        throws ErrorMsg
+    {
+        long ref = this . GetAlignmentSlice ( self, offset, length, categories );
+        try
+        {
+            return new AlignmentIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+
+    /*----------------------------------------------------------------------
+     * PILEUP
+     */
+    
+    /* getPileups
+     *  returns an iterator of contained Pileups
+     */
+    public PileupIterator getPileups ( int categories )
+        throws ErrorMsg
+    {
+        long ref = this . GetPileups ( self, categories );
+        try
+        {
+            return new PileupIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    /* getPileupSlice
+     *  creates a PileupIterator on a slice (window) of reference
+     *  "start" is the signed starting position on reference
+     *  "length" is the unsigned number of bases in the window
+     *  "categories" provides a means of filtering by AlignmentCategory
+     */
+    public PileupIterator getPileupSlice ( long offset, long length )
+        throws ErrorMsg
+    {
+        return this . getPileupSlice ( offset, length, Alignment . all );
+    }
+
+    public PileupIterator getPileupSlice ( long offset, long length, int categories )
+        throws ErrorMsg
+    {
+        long ref = this . GetPileupSlice ( self, offset, length, categories );
+        try
+        {
+            return new PileupIteratorItf ( ref );
+        }
+        catch ( Exception x )
+        {
+            this . release ( ref );
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+
+    /*******************************
+     * ReferenceItf Implementation *
+     *******************************/
+
+    // constructors
+    ReferenceItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    ReferenceItf ( Reference obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            ReferenceItf ref = ( ReferenceItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native String GetCommonName ( long self )
+        throws ErrorMsg;
+    private native String GetCanonicalName ( long self )
+        throws ErrorMsg;
+    private native boolean GetIsCircular ( long self )
+        throws ErrorMsg;
+    private native long GetLength ( long self )
+        throws ErrorMsg;
+    private native String GetReferenceBases ( long self, long offset, long length )
+        throws ErrorMsg;
+    private native String GetReferenceChunk ( long self, long offset, long length )
+        throws ErrorMsg;
+    private native long GetAlignment ( long self, String alignmentId )
+        throws ErrorMsg;
+    private native long GetAlignments ( long self, int categories )
+        throws ErrorMsg;
+    private native long GetAlignmentCount ( long self, int categories )
+        throws ErrorMsg;
+    private native long GetAlignmentSlice ( long self, long offset, long length, int categories )
+        throws ErrorMsg;
+    private native long GetPileups ( long self, int categories )
+        throws ErrorMsg;
+    private native long GetPileupSlice ( long self, long offset, long count, int categories )
+        throws ErrorMsg;
+}
diff --git a/ngs-java/ngs/itf/StatisticsItf.java b/ngs-java/ngs/itf/StatisticsItf.java
new file mode 100644
index 0000000..65d2c13
--- /dev/null
+++ b/ngs-java/ngs/itf/StatisticsItf.java
@@ -0,0 +1,112 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+package ngs.itf;
+
+import ngs.ErrorMsg;
+import ngs.Statistics;
+
+
+/*==========================================================================
+ * StatisticsItf
+ */
+class StatisticsItf
+    extends Refcount
+    implements Statistics
+{
+    
+    public int getValueType ( String path )
+    {
+        return this . GetValueType ( self, path );
+    }
+    
+    public String getAsString ( String path )
+        throws ErrorMsg
+    {
+        return this . GetAsString ( self, path );
+    }
+
+    public long getAsI64 ( String path )
+        throws ErrorMsg
+    {
+        return this . GetAsI64 ( self, path );
+    }
+            
+    public long getAsU64 ( String path )
+        throws ErrorMsg
+    {
+        return this . GetAsU64 ( self, path );
+    }
+        
+    public double getAsDouble ( String path )
+        throws ErrorMsg
+    {
+        return this . GetAsDouble ( self, path );
+    }
+            
+    public String nextPath ( String path )
+    {
+        return this . NextPath ( self, path );
+    }
+
+
+    /***************************
+     * StatisticsItf Implementation *
+     ***************************/
+
+    // constructors
+    StatisticsItf ( long ref )
+    {
+        super ( ref );
+    }
+
+    StatisticsItf ( Statistics obj )
+        throws ErrorMsg
+    {
+        super ( 0 );
+        try
+        {
+            StatisticsItf ref = ( StatisticsItf ) obj;
+            this . self = ref . duplicate ();
+        }
+        catch ( Exception x )
+        {
+            throw new ErrorMsg ( x . toString () );
+        }
+    }
+
+    // native interface
+    private native int GetValueType ( long self, String path );
+    private native String GetAsString ( long self, String path )
+        throws ErrorMsg;
+    private native long GetAsI64 ( long self, String path )
+        throws ErrorMsg;
+    private native long GetAsU64 ( long self, String path )
+        throws ErrorMsg;
+    private native double GetAsDouble ( long self, String path )
+        throws ErrorMsg;
+    private native String NextPath ( long self, String path );
+}
diff --git a/ngs-java/os-arch.perl b/ngs-java/os-arch.perl
new file mode 100644
index 0000000..a7b4990
--- /dev/null
+++ b/ngs-java/os-arch.perl
@@ -0,0 +1,22 @@
+use strict;
+
+use FindBin qw($Bin);
+require "$Bin/os-arch.pm";
+
+my ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+
+my $res = "$OS.$ARCH";
+
+if (@ARCHITECTURES) {
+    my $name = "$Bin/Makefile.config.$OS.arch";
+    if (-e $name) {
+        while (1) {
+            open F, $name or last;
+            $res = "$OS." . <F>;
+            chomp $res;
+            last;
+        }
+    }
+}
+
+print "$res\n";
diff --git a/ngs-java/os-arch.pm b/ngs-java/os-arch.pm
new file mode 100644
index 0000000..6fbd606
--- /dev/null
+++ b/ngs-java/os-arch.pm
@@ -0,0 +1,100 @@
+sub OsArch {
+    my ($UNAME, $HOST_OS, $HOST_ARCH, $MARCH, @ARCHITECTURES);
+    if ($^O eq 'MSWin32') {
+        $UNAME = $HOST_OS = 'win';
+        $HOST_ARCH = $MARCH = 'x86_64';
+        @ARCHITECTURES = qw(x86_64 i386);
+    } else {
+        $UNAME = `uname -s`;
+        chomp $UNAME;
+        if ($UNAME =~ /Darwin/) {
+            $HOST_OS = 'mac';
+        } elsif ($UNAME =~ /Linux/) {
+            $HOST_OS = 'linux';
+        } elsif ($UNAME =~ /SunOS/) {
+            $HOST_OS = 'sun';
+            @ARCHITECTURES = qw(x86_64 i386);
+        } elsif ($UNAME =~ /xCYGWIN/) {
+            $HOST_OS = 'win';
+        } elsif ($UNAME =~ /xMINGW/) {
+            $HOST_OS = 'win';
+        }
+        if ($HOST_OS eq 'mac') {
+            $MARCH = $HOST_ARCH = MacArch();
+            @ARCHITECTURES = qw(x86_64 i386) if ($MARCH eq 'x86_64');
+        } else {
+            $MARCH = `uname -m`;
+            chomp $MARCH;
+            if ($MARCH =~ /i386/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i486/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i586/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i686/) {
+                if ($UNAME =~ /WOW64/) { # 64-bit capable Cygwin.
+                     # Analyze the version of cl to set the correct architecture
+                    my $CL = `cl.exe 2>&1 > /dev/null`;
+                    if ($CL =~ /for x64/) {
+                        $HOST_ARCH = 'x86_64';
+                    } else {
+                        $HOST_ARCH = 'i386';
+                    }
+                } else {
+                    $HOST_ARCH = 'i386';
+                }
+            } elsif ($MARCH =~ /x86_64/) {
+                $HOST_ARCH = 'x86_64';
+            } elsif ($MARCH =~ /i86pc/) {
+                $HOST_ARCH = 'x86_64';
+                @ARCHITECTURES = qw(x86_64 i386);
+            } elsif ($MARCH =~ /sun4v/) {
+                $HOST_ARCH = 'sparc64';
+		        @ARCHITECTURES = qw(sparc64 sparc32);
+            }
+        }
+    }
+    ($HOST_OS, $HOST_ARCH, $UNAME, $MARCH, @ARCHITECTURES);
+}
+
+sub MacArch {
+    my $ARCH = `uname -m`;
+    chomp $ARCH;
+    if ($ARCH eq 'x86_64') {
+        return $ARCH;
+    } else {
+        my $SYSCTL = '/usr/sbin/sysctl';
+        $SYSCTL = '/sbin/sysctl' if (-x '/sbin/sysctl');
+
+        my $CAP64 = `$SYSCTL -n hw.cpu64bit_capable`;
+        chomp $CAP64;
+
+        my $PADDR_BITS = `$SYSCTL -n machdep.cpu.address_bits.physical`;
+        chomp $PADDR_BITS;
+
+        my $VADDR_BITS = `$SYSCTL -n machdep.cpu.address_bits.virtual`;
+        chomp $VADDR_BITS;
+        
+        if ($CAP64 != 0) {
+            if ($PADDR_BITS > 32 && $VADDR_BITS > 32) {
+                if ($ARCH eq 'i386' || $ARCH eq 'x86_64') {
+                    return 'x86_64';
+                } elsif ($ARCH eq 'Power Macintosh') {
+                    return 'ppc64';
+                } else {
+                    return 'unrecognized';
+                }
+            }
+        }
+
+        if ($ARCH eq 'i386') {
+            return 'i386';
+        } elsif ($ARCH eq 'Power Macintosh') {
+            return 'ppc32';
+        } else {
+            return 'unrecognized';
+        }
+    }
+}
+
+1
diff --git a/ngs-java/package.pm b/ngs-java/package.pm
new file mode 100644
index 0000000..c953e0c
--- /dev/null
+++ b/ngs-java/package.pm
@@ -0,0 +1,29 @@
+################################################################################
+sub PACKAGE      { "ngs-java" }
+sub VERSION      { "1.0.0" }
+sub PACKAGE_TYPE { 'B' }
+sub PACKAGE_NAME { "NGS-JAVA" }
+sub PACKAGE_NAMW { "NGS_JAVA" }
+sub DEPENDS      {}
+sub CONFIG_OUT   { '.' }
+sub PKG { ( LNG  => 'JAVA',
+            OUT  => 'ncbi-outdir',
+            PATH  => '/usr/local/ngs/ngs-java',
+            UPATH =>      '$HOME/ngs/ngs-java',
+            NGS_SDK_SRC => 1,
+            EXAMP => '1',  ) }
+sub REQ { ( { name    => 'ngs-sdk',
+              namew   => 'NGS',
+              option  => 'with-ngs-sdk-sources',
+              origin  => 'I',
+              type    => 'SI',
+              srcpath => '../ngs-sdk',
+              pkgpath => '/usr/local/ngs/ngs-sdk',
+              usrpath =>      '$HOME/ngs/ngs-sdk',
+              bldpath => '$HOME/ncbi-outdir/ngs-sdk/$OS',
+              include => 'ngs/itf/Refcount.h',
+              lib     => 'libngs-sdk.so',
+              ilib    => 'libngs-bind-c++.a',
+        } ) }
+
+1
diff --git a/ngs-java/win-configure.bat b/ngs-java/win-configure.bat
new file mode 100644
index 0000000..7b35820
--- /dev/null
+++ b/ngs-java/win-configure.bat
@@ -0,0 +1,2 @@
+perl -w ./konfigure.perl %*
+
diff --git a/ngs-python/.gitignore b/ngs-python/.gitignore
new file mode 100644
index 0000000..cfe3d89
--- /dev/null
+++ b/ngs-python/.gitignore
@@ -0,0 +1,3 @@
+Makefile.userconfig
+Makefile.config*
+user.status
\ No newline at end of file
diff --git a/ngs-python/Makefile b/ngs-python/Makefile
new file mode 100644
index 0000000..0b8331a
--- /dev/null
+++ b/ngs-python/Makefile
@@ -0,0 +1,43 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# default response to "make"
+default: subtargs
+
+# the sub-targets
+SUBTARGS =  \
+	dummy
+
+# standard rules and phony targets
+include $(CURDIR)/Makefile.rules
+
+# rules for making python code
+install: Makefile.config
+	@ $(MAKE) -f Makefile.python install
+
+dummy:
+	@ echo "make complete"
+
+dummy_cln dummy_inst:
+	@ true
diff --git a/ngs-python/Makefile.python b/ngs-python/Makefile.python
new file mode 100644
index 0000000..f6893b8
--- /dev/null
+++ b/ngs-python/Makefile.python
@@ -0,0 +1,79 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(CURDIR)
+MODPATH =
+
+include $(TOP)/Makefile.config
+
+INTLIBS = \
+
+EXTLIBS = \
+
+TARGETS = \
+
+all std: $(TARGETS)
+
+clean:
+
+copyexamples:
+	@ echo "Installing examples to $(INST_SHAREDIR)/examples-python"
+	@ mkdir -p $(INST_SHAREDIR)/examples-python
+	@ cp $(TOP)/examples/*.py $(INST_SHAREDIR)/examples-python
+
+
+#-------------------------------------------------------------------------------
+# install
+# 
+ifeq (linux, $(OS))
+
+#fake root for debugging
+#uncomment this line and change the test for root ( see under install: ) to succeed:
+#ROOT = ~/root 
+
+PROFILE_FILE = $(ROOT)/etc/profile.d/ngs-python
+
+install: $(TARGETS) $(INST_PYTHONDIR) copyexamples
+ifeq (0, $(shell id -u))
+	@ echo "Installing ngs package..."
+	@ python setup.py install
+	@ echo "Please add $(NGS_LIBDIR):$(VDB_LIBDIR) to your LD_LIBRARY_PATH, e.g.:"
+	@ echo "      export LD_LIBRARY_PATH=$(NGS_LIBDIR):$(VDB_LIBDIR):\$$LD_LIBRARY_PATH"
+   
+else
+	@ echo "Installing ngs package..."
+	@ python setup.py install --user
+	@ echo "Please add $(NGS_LIBDIR):$(VDB_LIBDIR) to your LD_LIBRARY_PATH, e.g.:"
+	@ echo "      export LD_LIBRARY_PATH=$(NGS_LIBDIR):$(VDB_LIBDIR):\$$LD_LIBRARY_PATH"
+endif
+
+else
+install:
+
+endif
+
+.PHONY: default all std install $(TARGETS)
diff --git a/ngs-python/Makefile.rules b/ngs-python/Makefile.rules
new file mode 100644
index 0000000..3ecb6ac
--- /dev/null
+++ b/ngs-python/Makefile.rules
@@ -0,0 +1,72 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+TOP ?= $(CURDIR)
+export TOP
+
+subdirs: $(SUBDIRS)
+
+$(SUBDIRS): Makefile.config
+	@ $(MAKE) -C $@
+
+subtargs: Makefile.config $(SUBTARGS)
+
+# rules for "make clean"
+SUBDIRS_CLN = \
+	$(addsuffix _cln,$(SUBDIRS))
+
+$(SUBDIRS_CLN): Makefile.config
+	@ $(MAKE) -s -C $(subst _cln,,$@) clean
+
+SUBTARGS_CLN = \
+	$(addsuffix _cln,$(SUBTARGS))
+
+clean: Makefile.config $(SUBTARGS_CLN)
+
+# rules for "make install"
+SUBDIRS_INST = \
+	$(addsuffix _inst,$(SUBDIRS))
+
+$(SUBDIRS_INST): Makefile.config
+	@ $(MAKE) -s -C $(subst _inst,,$@) install
+
+SUBTARGS_INST = \
+	$(addsuffix _inst,$(SUBTARGS))
+
+install: Makefile.config $(SUBTARGS_INST)
+
+# rule to run tests
+test runtests: Makefile.config
+#	@ $(MAKE) -C test runtests
+
+# rule to run configuration
+Makefile.config: Makefile.config.$(shell perl $(TOP)/os-arch.perl) konfigure.perl
+
+Makefile.config.$(shell perl $(TOP)/os-arch.perl):
+	@echo "*** File '$@' is missing. Please run ./configure"
+	@false
+
+# not real targets
+.PHONY: default subdirs subtargs install clean test runtests \
+	$(SUBTARGS) $(SUBTARGS_INST) $(SUBTARGS_CLN)
diff --git a/ngs-python/configure b/ngs-python/configure
new file mode 100755
index 0000000..3313aac
--- /dev/null
+++ b/ngs-python/configure
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+FILENAME="`basename $0`"
+CURDIR="`dirname $0`"
+
+if [ -z "$CURDIR" ]
+    then
+    echo configure: error: configure should be run as ./configure
+    exit 1
+fi
+
+if [ "$FILENAME" != configure -a ! -s konfigure.perl ]
+    then
+    echo configure: error: configure should be run as ./configure
+else
+    perl -v > /dev/null 2>&1 || { echo "checking for perl... no"; \
+        echo >&2 "configure: error: perl not found."; exit 1; }
+
+    cd $CURDIR
+    perl -w ./konfigure.perl $@
+fi
diff --git a/ngs-python/konfigure.perl b/ngs-python/konfigure.perl
new file mode 100644
index 0000000..2a7fde7
--- /dev/null
+++ b/ngs-python/konfigure.perl
@@ -0,0 +1,1210 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+use strict;
+
+sub println  { print @_; print "\n" }
+
+my ($filename, $directories, $suffix) = fileparse($0);
+if ($directories ne "./") {
+    println "configure: error: $filename should be run as ./$filename";
+    exit 1;
+}
+
+require 'package.pm';
+require 'os-arch.pm';
+
+use Cwd qw (abs_path getcwd);
+use File::Basename 'fileparse';
+use File::Spec 'catdir';
+use FindBin qw($Bin);
+use Getopt::Long 'GetOptions';
+
+check();
+
+my %PKG = PKG();
+
+my $PACKAGE_NAME = PACKAGE_NAME();
+my $OUT_MAKEFILE = 'Makefile.config';
+
+my $PACKAGE = PACKAGE();
+
+my $HOME = $ENV{HOME} || $ENV{USERPROFILE}
+    || $ENV{LOGDIR} || getcwd || (getpwuid($<))[7] || abs_path('.');
+
+$PKG{UPATH} =~ s/(\$\w+)/$1/eeg;
+
+my $OUTDIR = File::Spec->catdir($HOME, $PKG{OUT});
+
+my $package_default_prefix = $PKG{PATH};
+my $schema_default_dir = $PKG{SCHEMA_PATH} if ($PKG{SCHEMA_PATH});
+
+my @REQ = REQ();
+
+my @options = ( "arch=s",
+                "build=s",
+                "clean",
+                "debug",
+                "help",
+#               "output-makefile=s",
+                "prefix=s",
+                "status",
+                "with-debug",
+                "without-debug" );
+foreach my $href (@REQ) {
+    my %a = %$href;
+    push @options, "$a{option}=s";
+    push @options, "$a{boption}=s" if ($a{boption});
+    $href->{usrpath} =~ s/(\$\w+)/$1/eeg;
+}
+push @options, "shemadir" if ($PKG{SCHEMA_PATH});
+
+my %OPT;
+die "configure: error" unless (GetOptions(\%OPT, @options));
+
+if ($OPT{'help'}) {
+    help();
+    exit(0);
+} elsif ($OPT{'clean'}) {
+    {
+        foreach (glob(CONFIG_OUT() . '/Makefile.config*'),
+            File::Spec->catdir(CONFIG_OUT(), 'user.status'),
+            File::Spec->catdir(CONFIG_OUT(), 'Makefile.userconfig'))
+        {
+            my $f = $_;
+            print "removing $f... ";
+            if (-e $f) {
+                if (unlink $f) {
+                    println "ok";
+                } else {
+                    println "failed";
+                }
+            } else {
+                println "not found";
+            }
+        }
+    }
+    if (CONFIG_OUT() ne '.') {
+        foreach
+            (glob('Makefile.config*'), 'user.status', 'Makefile.userconfig')
+        {
+            my $f = $_;
+            print "removing $f... ";
+            if (-e $f) {
+                if (unlink $f) {
+                    println "ok";
+                } else {
+                    println "failed";
+                }
+            } else {
+                println "not found";
+            }
+        }
+    }
+    exit(0);
+} elsif ($OPT{'status'}) {
+    status(1);
+    exit(0);
+}
+$OPT{'prefix'} = $package_default_prefix unless ($OPT{'prefix'});
+
+my $AUTORUN = $OPT{status};
+print "checking system type... " unless ($AUTORUN);
+my ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+println $OSTYPE unless ($AUTORUN);
+
+{
+    $OPT{'prefix'} = expand($OPT{'prefix'});
+    my $prefix = $OPT{'prefix'};
+    $OPT{eprefix} = $prefix unless ($OPT{eprefix} || $OS eq 'win');
+    my $eprefix = $OPT{eprefix};
+    unless ($OPT{bindir} || $OS eq 'win') {
+        $OPT{bindir} = File::Spec->catdir($eprefix, 'bin') ;
+    }
+    unless ($OPT{libdir} || $OS eq 'win') {
+        $OPT{libdir} = File::Spec->catdir($eprefix, 'lib');
+    }
+    unless ($OPT{includedir} || $OS eq 'win') {
+        $OPT{includedir} = File::Spec->catdir($eprefix, 'include');
+    }
+    if ($PKG{LNG} eq 'PYTHON' && ! $OPT{pythondir} && $OS ne 'win') {
+        $OPT{pythondir} = $eprefix;
+    }
+    if ($PKG{LNG} eq 'JAVA' && ! $OPT{javadir} && $OS ne 'win') {
+        $OPT{javadir} = File::Spec->catdir($eprefix, 'jar');
+    }
+    if ($PKG{EXAMP} && ! $OPT{sharedir} && $OS ne 'win') {
+        $OPT{sharedir} = File::Spec->catdir($eprefix, 'share');
+    }
+}
+
+# initial values
+my $TARGDIR = File::Spec->catdir($OUTDIR, $PACKAGE);
+$TARGDIR = expand($OPT{'build'}) if ($OPT{'build'});
+
+my $BUILD = 'rel';
+
+# parse command line
+$BUILD = 'dbg' if ($OPT{'with-debug'});
+$BUILD = 'rel' if ($OPT{'without-debug'});
+
+my $BUILD_TYPE = "release";
+$BUILD_TYPE = "debug" if ( $BUILD eq "dbg" );
+
+$OPT{arch} = $ARCH if (@ARCHITECTURES && ! $OPT{arch});
+
+if ($OPT{arch}) {
+    my $found;
+    foreach (@ARCHITECTURES) {
+        if ($_ eq $OPT{arch}) {
+            ++$found;
+            last;
+        }
+    }
+    if ($found) {
+        $ARCH = $MARCH = $OPT{arch};
+        while (1) {
+            open F, ">Makefile.config.$OS.arch" or last;
+            print F "$ARCH\n";
+            close F;
+            last;
+        }
+    } else {
+        delete $OPT{arch};
+    }
+}
+
+$OUT_MAKEFILE .= ".$OS.$ARCH";
+$OUT_MAKEFILE = File::Spec->catdir(CONFIG_OUT(), $OUT_MAKEFILE);
+
+#my $OSTYPE = `uname -s`; chomp $OSTYPE;
+
+print "checking machine architecture... " unless ($AUTORUN);
+#my $MARCH = `uname -m`; chomp $MARCH;
+println $MARCH unless ($AUTORUN);
+
+my $TOOLS = "";
+$TOOLS = "jdk" if ($PKG{LNG} eq 'JAVA');
+
+print "checking $PACKAGE_NAME version... " unless ($AUTORUN);
+my $FULL_VERSION = VERSION();
+println $FULL_VERSION unless ($AUTORUN);
+
+# determine architecture
+
+print "checking for supported architecture... " unless ($AUTORUN);
+
+my $BITS;
+
+if ( $MARCH =~ m/x86_64/i )
+{
+    $BITS = 64;
+}
+elsif ( $MARCH =~ m/i?86/i )
+{
+    $BITS = 32;
+}
+else
+{
+    die "unrecognized Architecture - " . $ARCH;
+}
+println "$MARCH ($BITS bits) is supported" unless ($AUTORUN);
+
+# determine OS and related norms
+my ($LPFX, $OBJX, $LOBX, $LIBX, $SHLX, $EXEX, $OSINC);
+
+print "checking for supported OS... " unless ($AUTORUN);
+if ( $OSTYPE =~ m/linux/i )
+{
+    $LPFX = "lib";
+    $OBJX = "o";
+    $LOBX = "pic.o";
+    $LIBX = "a";
+    $SHLX = "so";
+    $EXEX = "";
+    $OSINC = "unix";
+    if ( $TOOLS eq "" )
+    {
+        $TOOLS = "gcc";
+    }
+}
+elsif ( $OSTYPE =~ m/darwin/i )
+{
+    $LPFX = "lib";
+    $OBJX = "o";
+    $LOBX = "pic.o";
+    $LIBX = "a";
+    $SHLX = "dylib";
+    $EXEX = "";
+    $OSINC = "unix";
+    if ( $TOOLS eq "" )
+    {
+        $TOOLS = "clang";
+    }
+} elsif ($OSTYPE eq 'win') {
+    $TOOLS = "vc++";
+} else
+{
+    die "unrecognized OS - " . $OSTYPE;
+}
+println "$OSTYPE ($OS) is supported" unless ($AUTORUN);
+
+# tool chain
+my ($CC, $CP, $AR, $ARX, $ARLS, $LD, $LP);
+my ($JAVAC, $JAVAH, $JAR);
+my ($DBG, $OPT, $PIC, $INC, $MD);
+
+print "checking for supported tool chain... " unless ($AUTORUN);
+if ( $TOOLS =~ m/gcc/i )
+{
+    $CC = "gcc -c";
+    $CP = "g++ -c";
+    $AR = "ar rc";
+    $ARX = "ar x";
+    $ARLS = "ar t";
+    $LD = "gcc";
+    $LP = "g++";
+
+    $DBG = "-g -DDEBUG";
+    $OPT = "-O3";
+    $PIC = "-fPIC";
+    $INC = "-I";
+    $MD  = "-MD";
+}
+elsif ( $TOOLS =~ m/clang/i )
+{
+    $CC = "clang -c";
+    $CP = "clang++ -c";
+    $AR = "ar rc";
+    $ARX = "ar x";
+    $ARLS = "ar t";
+    $LD = "clang";
+    $LP = "clang++";
+
+    $DBG = "-g -DDEBUG";
+    $OPT = "-O3";
+    $PIC = "-fPIC";
+    $INC = "-I";
+    $MD  = "-MD";
+}
+elsif ( $TOOLS =~ m/jdk/i )
+{
+    $JAVAC = "javac";
+    $JAVAH = "javah";
+    $JAR   = "jar cf";
+
+    $DBG = "-g";
+} elsif ($TOOLS eq 'vc++') {
+} else
+{
+    die "unrecognized tool chain - " . $TOOLS;
+}
+println "$TOOLS tool chain is supported" unless ($AUTORUN);
+
+if ($OS ne 'win') {
+    $TARGDIR = File::Spec->catdir($TARGDIR, $OS, $TOOLS, $ARCH, $BUILD);
+}
+
+my @dependencies;
+
+foreach my $href (DEPENDS()) {
+    $_ = $href->{name};
+    my ($I, $L) = ($href->{Include});
+    if ($OPT{"with-$_-prefix"}) {
+        $I = File::Spec->catdir($OPT{"with-$_-prefix"}, 'include'); 
+        $L = File::Spec->catdir($OPT{"with-$_-prefix"}, 'lib'); 
+    }
+    my ($i, $l) = find_lib($_, $I, $L);
+    if (defined $i || $l) {
+        my $d = 'HAVE_' . uc($_) . ' = 1';
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+    if ($i) {
+        my $d = uc($_) . "_INCDIR = $i";
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+    if ($l) {
+        my $d = uc($_) . "_LIBDIR = $l";
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+}
+
+foreach my $href (@REQ) {
+    $href->{bldpath} =~ s/(\$\w+)/$1/eeg if ($href->{bldpath});
+    my ($found_itf, $found_lib, $found_ilib);        # found directories
+    my %a = %$href;
+    my $is_optional = optional($a{type});
+    my $need_source = $a{type} =~ /S/;
+    my $need_build = $a{type} =~ /B/;
+    my $need_lib = $a{type} =~ /L/;
+    
+    my ($inc, $lib, $ilib) = ($a{include}, $a{lib}); # file names to check
+    $lib =~ s/(\$\w+)/$1/eeg;
+
+    if ($need_build) {
+        $ilib = $a{ilib};
+        ++$need_lib;
+    }
+    unless ($AUTORUN) {
+        if ($need_source && $need_build) {
+            println
+               "checking for $a{name} package source files and build results..."
+        } elsif ($need_source) {
+            println "checking for $a{name} package source files...";
+        } else {
+            println "checking for $a{name} package...";
+        }
+    }
+    my %has_option;
+    foreach my $option ($a{option}, $a{boption}) {
+        next unless ($option);
+        if ($OPT{$option}) {
+            my $try = expand($OPT{$option});
+            my ($i, $l, $il) = ($inc, $lib, $ilib);
+            if ($option =~ /-build$/) {
+                undef $i;
+                ++$has_option{build};
+            } elsif ($option =~ /-prefix$/) {
+                undef $il;
+                ++$has_option{prefix};
+            } elsif ($option =~ /-sources$/) {
+                undef $l;
+                undef $il;
+                ++$has_option{sources};
+            }
+            my ($fi, $fl, $fil) = find_in_dir($try, $i, $l, $il);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+            $found_ilib = $fil if (! $found_ilib && $fil);
+        }
+    }
+    if (! $found_itf && ! $has_option{sources} && $a{srcpath}) {
+        my $try = $a{srcpath};
+        ($found_itf) = find_in_dir($try, $inc);
+    }
+    if (! $has_option{prefix}) {
+        if (! $found_itf || ($need_lib && ! $found_lib)) {
+            my $try = $a{pkgpath};
+            my ($fi, $fl) = find_in_dir($try, $inc, $lib);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+        }
+
+        if (! $found_itf || ($need_lib && ! $found_lib)) {
+            my $try = $a{usrpath};
+            my ($fi, $fl) = find_in_dir($try, $inc, $lib);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+        }
+    }
+    if (! $has_option{build}) {
+        if (($need_build || ($need_lib && ! $found_lib)) && $a{bldpath}) {
+            my $try = $a{bldpath};
+            my (undef, $fl, $fil) = find_in_dir($try, undef, $lib, $ilib);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+            $found_ilib = $fil if (! $found_ilib && $fil);
+        }
+    }
+    if (! $found_itf || ($need_lib && ! $found_lib) || ($ilib && ! $found_ilib))
+    {
+        if ($is_optional) {
+            println "configure: optional $a{name} package not found: skipped.";
+        } else {
+            if ($OPT{'debug'}) {
+                $_ = "$a{name}: includes: ";
+                $found_itf = '' unless $found_itf;
+                $_ .= $found_itf;
+                unless ($need_lib) {
+                    $_ .= "; libs: not needed";
+                } else {
+                    $found_lib = '' unless $found_lib;
+                    $_ .= "; libs: " . $found_lib;
+                }
+                unless ($ilib) {
+                    $_ .= "; ilibs: not needed";
+                } else {
+                    $found_ilib = '' unless $found_ilib;
+                    $_ .= "; ilibs: " . $found_ilib;
+                }
+                println "\t\t$_";
+            }
+            println "configure: error: required $a{name} package not found.";
+            exit 1;
+        }
+    } else {
+        $found_itf = abs_path($found_itf);
+        push(@dependencies, "$a{namew}_INCDIR = $found_itf");
+        if ($found_lib) {
+            $found_lib = abs_path($found_lib);
+            push(@dependencies, "$a{namew}_LIBDIR = $found_lib");
+        }
+        if ($ilib && $found_ilib) {
+            $found_ilib = abs_path($found_ilib);
+            push(@dependencies, "$a{namew}_ILIBDIR = $found_ilib");
+        }
+    }
+}
+
+if ($OS ne 'win' && ! $OPT{'status'}) {
+    # create Makefile.config
+    println "configure: creating '$OUT_MAKEFILE'" unless ($AUTORUN);
+    open my $F, ">$OUT_MAKEFILE" or die "cannot open $OUT_MAKEFILE to write";
+
+    print $F <<EndText;
+### AUTO-GENERATED FILE ###
+
+OS_ARCH = \$(shell perl \$(TOP)/os-arch.perl)
+
+# install paths
+EndText
+
+    L($F, "INST_BINDIR = $OPT{bindir}"        ) if ($OPT{bindir});
+    L($F, "INST_LIBDIR = $OPT{libdir}"        ) if ($OPT{libdir});
+    L($F, "INST_INCDIR = $OPT{includedir}"    ) if ($OPT{includedir});
+    L($F, "INST_SCHEMADIR = $OPT{'shemadir'}" ) if ($OPT{'shemadir'});
+    L($F, "INST_SHAREDIR = $OPT{'sharedir'}"  ) if ($OPT{'sharedir'});
+    L($F, "INST_JARDIR = $OPT{'javadir'}"     ) if ($OPT{'javadir'});
+    L($F, "INST_PYTHONDIR = $OPT{'pythondir'}") if ($OPT{'pythondir'});
+
+    my ($VERSION_SHLX, $MAJMIN_SHLX, $MAJVERS_SHLX);
+    if ($OSTYPE =~ /darwin/i) {
+        $VERSION_SHLX = '$(VERSION).$(SHLX)';
+        $MAJMIN_SHLX  = '$(MAJMIN).$(SHLX)';
+        $MAJVERS_SHLX = '$(MAJVERS).$(SHLX)';
+    } else {
+        $VERSION_SHLX = '$(SHLX).$(VERSION)';
+        $MAJMIN_SHLX  = '$(SHLX).$(MAJMIN)';
+        $MAJVERS_SHLX = '$(SHLX).$(MAJVERS)';
+    }
+
+
+    print $F <<EndText;
+
+# build type
+BUILD = $BUILD
+
+# target OS
+OS    = $OS
+OSINC = $OSINC
+
+# prefix string for system libraries
+LPFX = $LPFX
+
+# suffix strings for system libraries
+LIBX = $LIBX
+VERSION_LIBX = \$(LIBX).\$(VERSION)
+MAJMIN_LIBX  = \$(LIBX).\$(MAJMIN)
+MAJVERS_LIBX = \$(LIBX).\$(MAJVERS)
+
+SHLX = $SHLX
+VERSION_SHLX = $VERSION_SHLX
+MAJMIN_SHLX  = $MAJMIN_SHLX
+MAJVERS_SHLX = $MAJVERS_SHLX
+
+# suffix strings for system object files
+OBJX = $OBJX
+LOBX = $LOBX
+
+# suffix string for system executable
+EXEX = $EXEX
+VERSION_EXEX = \$(EXEX).\$(VERSION)
+MAJMIN_EXEX  = \$(EXEX).\$(MAJMIN)
+MAJVERS_EXEX = \$(EXEX).\$(MAJVERS)
+
+# system architecture and wordsize
+ARCH = $ARCH
+EndText
+
+    L($F, "# ARCH = $ARCH ( $MARCH )") if ($ARCH ne $MARCH);
+
+    print $F <<EndText;
+BITS = $BITS
+
+# tools
+EndText
+
+    L($F, "CC    = $CC"   ) if ($CC);
+    L($F, "CP    = $CP"   ) if ($CP);
+    L($F, "AR    = $AR"   ) if ($AR);
+    L($F, "ARX   = $ARX"  ) if ($ARX);
+    L($F, "ARLS  = $ARLS" ) if ($ARLS);
+    L($F, "LD    = $LD"   ) if ($LD);
+    L($F, "LP    = $LP"   ) if ($LP);
+    L($F, "JAVAC = $JAVAC") if ($JAVAC);
+    L($F, "JAVAH = $JAVAH") if ($JAVAH);
+    L($F, "JAR   = $JAR"  ) if ($JAR);
+    L($F);
+
+    L($F, '# tool options');
+    if ($BUILD eq "dbg") {
+        L($F, "DBG     = $DBG");
+        L($F, "OPT     = ");
+    } else {
+        L($F, "DBG     = -DNDEBUG") if ($PKG{LNG} eq 'C');
+        L($F, "OPT     = $OPT"    ) if ($OPT);
+    }
+    L($F, "PIC     = $PIC") if ($PIC);
+    if ($PKG{LNG} eq 'C') {
+        if ($TOOLS =~ /clang/i) {
+   L($F, 'SONAME  = -install_name ' .
+               '$(INST_LIBDIR)$(BITS)/$(subst $(VERSION),$(MAJVERS),$(@F)) \\');
+   L($F, '    -compatibility_version $(MAJMIN) -current_version $(VERSION) \\');
+   L($F, '    -flat_namespace -undefined suppress');
+        } else {
+      L($F, 'SONAME = -Wl,-soname=$(subst $(VERSION),$(MAJVERS),$(@F))');
+     }
+     L($F, "SRCINC  = $INC. $INC\$(SRCDIR)");
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'SRCINC  = -sourcepath $(INCPATHS)');
+    }
+    L($F, "INCDIRS = \$(SRCINC) $INC\$(TOP)") if ($PIC);
+    if ($PKG{LNG} eq 'C') {
+        L($F, "CFLAGS  = \$(DBG) \$(OPT) \$(INCDIRS) $MD");
+    }
+
+    L($F, 'CLSPATH = -classpath $(CLSDIR)');
+    L($F);
+
+    # version information
+
+    my ($VERSION, $MAJMIN, $MAJVERS);
+
+    if ($FULL_VERSION =~ /(\d+)\.(\d+)\.(\d+)-?\w*\d*/) {
+        $VERSION = "$1.$2.$3";
+        $MAJMIN = "$1.$2";
+        $MAJVERS = $1;
+    } else {
+        die $VERSION;
+    }
+
+    print $F <<EndText;
+# $PACKAGE_NAME and library version
+VERSION = $VERSION
+MAJMIN  = $MAJMIN
+MAJVERS = $MAJVERS
+
+# output path
+TARGDIR = $TARGDIR
+
+# derived paths
+MODPATH  ?= \$(subst \$(TOP)/,,\$(CURDIR))
+SRCDIR   ?= \$(TOP)/\$(MODPATH)
+MAKEFILE ?= \$(abspath \$(firstword \$(MAKEFILE_LIST)))
+BINDIR    = \$(TARGDIR)/bin
+EndText
+
+    if ($PKG{LNG} eq 'C') {
+        L($F, 'LIBDIR    = $(TARGDIR)/lib');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'LIBDIR    = $(TARGDIR)/jar');
+    }
+
+    print $F <<EndText;
+ILIBDIR   = \$(TARGDIR)/ilib
+OBJDIR    = \$(TARGDIR)/obj/\$(MODPATH)
+CLSDIR    = \$(TARGDIR)/cls
+EndText
+
+    if ($PKG{LNG} eq 'JAVA') {
+        L($F,
+            "INCPATHS = \$(SRCDIR):\$(SRCDIR)/itf:\$(TOP)/gov/nih/nlm/ncbi/ngs")
+    }
+
+    print $F <<EndText;
+
+# exports
+export TOP
+export MODPATH
+export SRCDIR
+export MAKEFILE
+
+# auto-compilation rules
+EndText
+
+    if ($PKG{LNG} eq 'C') {
+        L($F, '$(OBJDIR)/%.$(OBJX): %.c');
+        T($F, '$(CC) -o $@ $< $(CFLAGS)');
+        L($F, '$(OBJDIR)/%.$(LOBX): %.c');
+        T($F, '$(CC) -o $@ $< $(PIC) $(CFLAGS)');
+    }
+    L($F, '$(OBJDIR)/%.$(OBJX): %.cpp');
+    T($F, '$(CP) -o $@ $< $(CFLAGS)');
+    L($F, '$(OBJDIR)/%.$(LOBX): %.cpp');
+    T($F, '$(CP) -o $@ $< $(PIC) $(CFLAGS)');
+    L($F);
+
+    # this is part of Makefile
+    L($F, 'VPATH = $(SRCDIR)');
+    L($F);
+
+    # we know how to find jni headers
+    if ($PKG{LNG} eq 'JAVA' and $OPT{'with-ngs-sdk-src'}) {
+        L($F, "JNIPATH = $OPT{'with-ngs-sdk-src'}/language/java");
+    }
+
+    L($F, '# directory rules');
+    if ($PKG{LNG} eq 'C') {
+        L($F, '$(BINDIR) $(LIBDIR) $(ILIBDIR) '
+            . '$(OBJDIR) $(INST_LIBDIR) $(INST_LIBDIR)$(BITS):');
+        T($F, 'mkdir -p $@');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        # test if we have jni header path
+        L($F, '$(LIBDIR) $(CLSDIR) $(INST_JARDIR):');
+        T($F, 'mkdir -p $@');
+    }
+    L($F);
+
+    L($F, '# not real targets');
+    L($F, '.PHONY: default clean install all std $(TARGETS)');
+    L($F);
+
+    L($F, '# dependencies');
+    if ($PKG{LNG} eq 'C') {
+        L($F, 'include $(wildcard $(OBJDIR)/*.d)');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'include $(wildcard $(CLSDIR)/*.d)');
+    }
+    L($F, $_) foreach (@dependencies);
+    L($F);
+
+    if ($OS eq 'linux' || $OS eq 'mac') {
+        L($F, '# installation rules');
+        L($F,
+        '$(INST_LIBDIR)$(BITS)/%.$(VERSION_LIBX): $(LIBDIR)/%.$(VERSION_LIBX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 644 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_LIBX),$(LIBX),$@) '
+                      . '$(subst .$(VERSION_LIBX),-static.$(LIBX),$@); \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_LIBX),$(LIBX),$@); \\');
+        T($F, '      ln -s $(subst $(VERSION_LIBX),$(LIBX),$(@F)) ' .
+       '$(INST_LIBDIR)$(BITS)/$(subst .$(VERSION_LIBX),-static.$(LIBX),$(@F));'
+                                                              . ' \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+        L($F);
+
+        L($F,
+        '$(INST_LIBDIR)$(BITS)/%.$(VERSION_SHLX): $(LIBDIR)/%.$(VERSION_SHLX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 755 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_SHLX),$(SHLX),$@);    \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_SHLX),$(SHLX),$@); \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+        L($F);
+
+        L($F, '$(INST_BINDIR)/%$(VERSION_EXEX): $(BINDIR)/%$(VERSION_EXEX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 755 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_EXEX),$(EXEX),$@);     \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_EXEX),$(EXEX),$@); \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+    }
+    close $F;
+}
+
+if (! $OPT{'status'} ) {
+    if ($OS eq 'win') {
+        my $OUT = File::Spec->catdir(CONFIG_OUT(), 'Makefile.config.win');
+        println "configure: creating '$OUT'";
+        open OUT, ">$OUT" or die "cannot open $OUT to write";
+        my $name = PACKAGE_NAMW();
+        my $outdir = $name . '_OUTDIR';
+        my $root = $name . '_ROOT';
+
+        print OUT <<EndText;
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
+  <PropertyGroup Label="Globals">
+    <$outdir>$TARGDIR/\</$outdir>
+EndText
+        foreach my $href (@REQ) {
+            my %a = %$href;
+            my $NGS_SDK_PREFIX = '';
+            $NGS_SDK_PREFIX = $a{found_itf} if ($a{found_itf});
+            if ($a{name} eq 'ngs-sdk') {
+                my $root = "$a{namew}_ROOT";
+                print OUT "    <$root>$NGS_SDK_PREFIX\/</$root>\n";
+                last;
+            }
+        }
+        print OUT <<EndText;
+    <$root>$Bin/\</$root>
+  </PropertyGroup>
+</Project>
+EndText
+        close OUT;
+    } else {
+        println "configure: creating 'Makefile.config'" unless ($AUTORUN);
+        my $CONFIG_OUT = CONFIG_OUT();
+        my $out = File::Spec->catdir($CONFIG_OUT, 'Makefile.config');
+        open COUT, ">$out" or die "cannot open $out to write";
+        print COUT "### AUTO-GENERATED FILE ###\n";
+        print COUT "\n";
+        print COUT "OS_ARCH = \$(shell perl \$(TOP)/os-arch.perl)\n";
+        print COUT "include \$(TOP)/$CONFIG_OUT/Makefile.config.\$(OS_ARCH)\n";
+        close COUT;
+    }
+}
+
+status() if ($OS ne 'win');
+
+unlink 'a.out';
+
+sub L { $_[1] = '' unless ($_[1]); print { $_[0] }   "$_[1]\n" }
+sub T {                            print { $_[0] } "\t$_[1]\n" }
+
+sub status {
+    my ($load) = @_;
+    if ($load) {
+        ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+        my $MAKEFILE
+            = File::Spec->catdir(CONFIG_OUT(), "$OUT_MAKEFILE.$OS.$ARCH");
+        println "\t\tloading $MAKEFILE" if ($OPT{'debug'});
+        unless (-e $MAKEFILE) {
+            print STDERR "configure: error: run ./configure [OPTIONS] first.\n";
+            exit 1;
+        }
+        open F, $MAKEFILE or die "cannot open $MAKEFILE";
+        foreach (<F>) {
+            chomp;
+            if (/BUILD = (.+)/) {
+                $BUILD_TYPE = $1;
+            } elsif (/BUILD \?= /) {
+                $BUILD_TYPE = $_ unless ($BUILD_TYPE);
+            }
+            elsif (/TARGDIR = /) {
+                $TARGDIR = $_;
+                println "\t\tgot $_" if ($OPT{'debug'});
+            } elsif (/TARGDIR \?= (.+)/) {
+                $TARGDIR = $1 unless ($TARGDIR);
+                println "\t\tgot $_" if ($OPT{'debug'});
+            }
+            elsif (/INST_INCDIR = (.+)/) {
+                $OPT{includedir} = $1;
+            }
+            elsif (/INST_BINDIR = (.+)/) {
+                $OPT{bindir} = $1;
+            }
+            elsif (/INST_LIBDIR = (.+)/) {
+                $OPT{libdir} = $1;
+            }
+        }
+    }
+
+    println "build type: $BUILD_TYPE";
+    println "build output path: $TARGDIR" if ($OS ne 'win');
+
+#   print "prefix: ";    print $OPT{'prefix'} if ($OS ne 'win');    println;
+#   print "eprefix: ";    print $OPT{'eprefix'} if ($OPT{'eprefix'});   println;
+
+    print "includedir: ";
+    print $OPT{'includedir'} if ($OPT{'includedir'});
+    println;
+
+    print "bindir: ";
+    print $OPT{'bindir'} if ($OPT{'bindir'});
+    println;
+
+    print "libdir: ";
+    print $OPT{'libdir'} if ($OPT{'libdir'});
+    println;
+
+    println "schemadir: $OPT{'shemadir'}" if ($OPT{'shemadir'});
+    println "sharedir: $OPT{'sharedir'}" if ($OPT{'sharedir'});
+    println "javadir: $OPT{'javadir'}" if ($OPT{'javadir'});
+    println "pythondir: $OPT{'pythondir'}" if ($OPT{'pythondir'});
+
+    println;
+}
+
+sub expand {
+    my ($filename) = @_;
+    return unless ($filename);
+    if ($filename =~ /^~/) {
+        $filename =~ s{ ^ ~ ( [^/]* ) }
+                      { $1
+                            ? (getpwnam($1))[7]
+                            : ( $ENV{HOME} || $ENV{USERPROFILE} || $ENV{LOGDIR}
+                                || (getpwuid($<))[7]
+                              )
+                      }ex;
+    }
+    my $a = abs_path($filename);
+    $filename = $a if ($a);
+    $filename;
+}
+
+sub find_in_dir {
+    my ($dir, $include, $lib, $ilib) = @_;
+    print "\t$dir... " unless ($AUTORUN);
+    unless (-d $dir) {
+        println "no" unless ($AUTORUN);
+        println "\t\tnot found $dir" if ($OPT{'debug'});
+        return;
+    }
+    print "[found] " if ($OPT{'debug'});
+    my ($found_inc, $found_lib, $found_ilib);
+    my $nl = 1;
+    if ($include) {
+        print "includes... " unless ($AUTORUN);
+        if (-e "$dir/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = $dir;
+        } elsif (-e "$dir/include/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = "$dir/include";
+        } elsif (-e "$dir/interfaces/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = "$dir/interfaces";
+        } else {
+            println 'no' unless ($AUTORUN);
+        }
+        $nl = 0;
+    }
+    if ($lib || $ilib) {
+        print "\n\t" if ($nl && !$AUTORUN);
+        print "libraries... " unless ($AUTORUN);
+        if ($lib) {
+            my $builddir = File::Spec->catdir($dir, $OS, $TOOLS, $ARCH, $BUILD);
+            my $libdir  = File::Spec->catdir($builddir, 'lib');
+            my $ilibdir = File::Spec->catdir($builddir, 'ilib');
+            my $f = File::Spec->catdir($libdir, $lib);
+            print "\n\t\tchecking $f\n\t" if ($OPT{'debug'});
+            my $found;
+            if (-e $f) {
+                $found_lib = $libdir;
+                if ($ilib) {
+                    my $f = File::Spec->catdir($ilibdir, $ilib);
+                    print "\tchecking $f\n\t" if ($OPT{'debug'});
+                    if (-e $f) {
+                        println 'yes';
+                        $found_ilib = $ilibdir;
+                    } else {
+                        println 'no' unless ($AUTORUN);
+                        return;
+                    }
+                } else {
+                    println 'yes';
+                }
+                ++$found;
+            }
+            if (! $found) {
+                my $libdir = File::Spec->catdir($dir, 'lib' . $BITS);
+                my $f = File::Spec->catdir($libdir, $lib);
+                print "\tchecking $f\n\t" if ($OPT{'debug'});
+                if (-e $f) {
+                    println 'yes';
+                    $found_lib = $libdir;
+                    ++$found;
+                }
+            }
+            if (! $found) {
+                my $builddir = File::Spec->catdir
+                    ($dir, $OS, $TOOLS, $ARCH, reverse_build($BUILD));
+                my $libdir  = File::Spec->catdir($builddir, 'lib');
+                my $ilibdir = File::Spec->catdir($builddir, 'ilib');
+                my $f = File::Spec->catdir($libdir, $lib);
+                print "\tchecking $f\n\t" if ($OPT{'debug'});
+                if (-e $f) {
+                    $found_lib = $libdir;
+                    if ($ilib) {
+                        my $f = File::Spec->catdir($ilibdir, $ilib);
+                        print "\tchecking $f\n\t" if ($OPT{'debug'});
+                        if (-e $f) {
+                            println 'yes';
+                            $found_ilib = $ilibdir;
+                        } else {
+                            println 'no' unless ($AUTORUN);
+                            return;
+                        }
+                    } else {
+                        println 'yes';
+                    }
+                    ++$found;
+                }
+            }
+        }
+        if ($found_lib && $ilib && ! $found_ilib) {
+            println "\n\t\tfound $found_lib but no ilib/" if ($OPT{'debug'});
+            print "\t" if ($OPT{'debug'});
+            println 'no' unless ($AUTORUN);
+            undef $found_lib;
+        }
+        ++$nl;
+    }
+    return ($found_inc, $found_lib, $found_ilib);
+}
+
+sub reverse_build {
+    ($_) = @_;
+    if ($_ eq 'rel') {
+        return 'dbg';
+    } elsif ($_ eq 'dbg') {
+        return 'rel';
+    } else {
+        die $_;
+    }
+}
+
+################################################################################
+
+sub find_lib {
+    my ($n, $i, $l) = @_;
+
+    print "checking for $n library... ";
+
+    while (1) {
+        my ($library, $log);
+
+        if ($n eq 'hdf5') {
+            $library = '-lhdf5';
+            $log = '#include <hdf5.h>            \n main() { H5close     (); }';
+        } elsif ($n eq 'xml2') {
+            $library = '-lxml2';
+            $log = '#include <libxml/xmlreader.h>\n main() { xmlInitParser();}';
+        } elsif ($n eq 'magic') {
+            $library = '-lmagic';
+            $log = '#include <magic.h>           \n main() { magic_open (0); }';
+        } else {
+            println 'unknown: skipped';
+            return;
+        }
+
+        if (($i && ! -d $i) || ($l && ! -d $l)) {
+            println 'no';
+            return;
+        }
+
+        my $cmd = $log;
+        $cmd =~ s/\\n/\n/g;
+
+        my $gcc = "| gcc -xc " . ($i ? "-I$i " : ' ')
+                               . ($l ? "-L$l " : ' ') . "- $library";
+        $gcc .= ' 2> /dev/null' unless ($OPT{'debug'});
+
+        open GCC, $gcc or last;
+        print "\n\t\trunning echo -e '$log' $gcc\n" if ($OPT{'debug'});
+        print GCC "$cmd" or last;
+        my $ok = close GCC;
+        print "\t" if ($OPT{'debug'});
+        println $ok ? 'yes' : 'no';
+
+        unlink 'a.out';
+
+        return if (!$ok);
+
+        return ($i, $l);
+    }
+
+    println 'cannot run gcc: skipped';
+}
+
+################################################################################
+
+sub check {
+    die "No CONFIG_OUT"   unless CONFIG_OUT();
+    die "No PACKAGE"      unless PACKAGE();
+    die "No PACKAGE_NAME" unless PACKAGE_NAME();
+    die "No PACKAGE_NAMW" unless PACKAGE_NAMW();
+    die "No PACKAGE_TYPE" unless PACKAGE_TYPE();
+    die "No VERSION"      unless VERSION();
+
+    my %PKG = PKG();
+
+    die "No LNG"   unless $PKG{LNG};
+    die "No OUT"   unless $PKG{OUT};
+    die "No PATH"  unless $PKG{PATH};
+    die "No UPATH" unless $PKG{UPATH};
+
+    foreach my $href (DEPENDS()) { die "No DEPENDS::name" unless $href->{name} }
+
+    foreach my $href (REQ()) {
+        die "No REQ::name" unless $href->{name};
+
+        my $origin = $href->{origin};
+        die  "No $href->{name}:origin"  unless $origin;
+        die  "No $href->{name}:include" unless $href->{include};
+        die  "No $href->{name}:lib"     unless $href->{lib};
+        die  "No $href->{name}:option"  unless $href->{option};
+        die  "No $href->{name}:pkgpath" unless $href->{pkgpath};
+        die  "No $href->{name}:type"    unless $href->{type};
+        die  "No $href->{name}:usrpath" unless $href->{usrpath};
+        if ($origin eq 'I') {
+         die "No $href->{name}:bldpath" unless $href->{bldpath};
+         die "No $href->{name}:ilib"    unless $href->{ilib};
+         die "No $href->{name}:namew"   unless $href->{namew};
+         die "No $href->{name}:srcpath" unless $href->{srcpath};
+        }
+    }
+}
+
+################################################################################
+
+sub optional { $_[0] =~ /^[LS]I$/ }
+
+sub help {
+#  --prefix=PREFIX         install architecture-independent files in PREFIX
+    print <<EndText;
+`configure' configures $PACKAGE_NAME to adapt to many kinds of systems.
+
+Usage: ./configure [OPTION]...
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+
+EndText
+
+    if ($^O ne 'MSWin32') {
+        print <<EndText;
+Installation directories:
+  --prefix=PREFIX         install all files in PREFIX
+                          [$package_default_prefix]
+
+EndText
+
+        my $other_prefix = $PKG{UPATH};
+        if ($PACKAGE eq 'sra-tools' && 0) {
+            print <<EndText;
+  --shemadir=DIR          install schema files in DIR
+                          [$schema_default_dir]
+
+EndText
+        }
+
+        print "By default, \`make install' will install all the files in\n";
+    
+        if (PACKAGE_TYPE() eq 'B') {
+            print "\`$package_default_prefix/bin', ";
+        } else {
+            print "\`$package_default_prefix/include', ";
+        }
+        println "\`$package_default_prefix/lib' etc.";
+
+        print <<EndText;
+You can specify an installation prefix other than \`$package_default_prefix'
+using \`--prefix', for instance \`--prefix=$other_prefix'.
+EndText
+    }
+
+    print <<EndText;
+
+For better control, use the options below.
+
+EndText
+
+    my ($required, $optional);
+    foreach my $href (@REQ) {
+        if (optional($href->{type})) {
+            ++$optional;
+        } else {
+            ++$required;
+        }
+    }
+
+    if ($required) {
+        print "Required Packages:\n";
+        foreach my $href (@REQ) {
+            next if (optional($href->{type}));
+            my %a = %$href;
+            if ($a{type} =~ /S/) {
+                println "  --$a{option}=DIR    search for $a{name} package";
+                println "                                 source files in DIR";
+            } else {
+                println
+                    "  --$a{option}=DIR      search for $a{name} package in DIR"
+            }
+            if ($a{boption}) {
+                println "  --$a{boption}=DIR      search for $a{name} package";
+                println "                                 build output in DIR";
+            }
+            println;
+        }
+    }
+    
+    if ($optional) {
+        print "Optional Packages:\n";
+        foreach my $href (@REQ) {
+            next unless (optional($href->{type}));
+            my %a = %$href;
+            if ($a{option} =~ /-sources$/) {
+                println "  --$a{option}=DIR    search for $a{name} package";
+                println "                                source files in DIR";
+            } else {
+                println "  --$a{option}=DIR    search for $a{name} files in DIR"
+            }
+        }
+        println;
+    }
+
+    print <<EndText if ($^O ne 'MSWin32');
+Build tuning:
+  --with-debug
+  --without-debug
+  --arch=name             specify the name of the target architecture
+
+  --build=DIR             generate build output into DIR directory
+                          [$OUTDIR]
+
+EndText
+
+    println "Miscellaneous:";
+    if ($^O ne 'MSWin32') {
+        println
+            "  --status                print current configuration information"
+    }
+    println "  --clean                 remove all configuration results";
+    println "  --debug                 print lots of debugging information";
+    println;
+}
+
+=pod
+################################################################################
+=cut
diff --git a/ngs-python/ngs/Alignment.py b/ngs-python/ngs/Alignment.py
new file mode 100644
index 0000000..88cbc9f
--- /dev/null
+++ b/ngs-python/ngs/Alignment.py
@@ -0,0 +1,166 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import byref, c_int, c_int32, c_uint32, c_int64, c_uint64, c_void_p
+from . import NGS
+
+from String import NGS_String, NGS_RawString, getNGSString, getNGSValue
+
+from Fragment import Fragment
+
+# Represents an alignment between a Fragment and Reference sub-sequence
+# provides a path to Read and mate Alignment
+
+class Alignment(Fragment):
+    primaryAlignment   = 1
+    secondaryAlignment = 2
+    all                = primaryAlignment | secondaryAlignment
+    
+    clipLeft  = 0
+    clipRight = 1    
+
+    def getAlignmentId(self):
+        """Retrieve an identifying String that can be used for later access.
+        The id will be unique within ReadCollection.
+        :returns: alignment id
+        :throws: ErrorMsg if the property cannot be retrieved
+        """
+        return getNGSString(self, NGS.lib_manager.PY_NGS_AlignmentGetAlignmentId)
+
+    # ------------------------------------------------------------------
+    # Reference        
+        
+    def getReferenceSpec(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_AlignmentGetReferenceSpec)
+        
+    def getMappingQuality(self):
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_AlignmentGetMappingQuality, c_int32)
+
+    def getReferenceBases(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_AlignmentGetReferenceBases)
+
+    # ------------------------------------------------------------------        
+    # Fragment        
+ 
+    def getReadGroup(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_AlignmentGetReadGroup)
+
+    def getReadId(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_AlignmentGetReadId)
+
+    def getClippedFragmentBases(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_AlignmentGetClippedFragmentBases)
+
+    def getClippedFragmentQualities(self):
+        """
+        :returns: clipped fragment phred quality values using ASCII offset of 33
+        """
+        return getNGSString(self, NGS.lib_manager.PY_NGS_AlignmentGetClippedFragmentQualities)
+
+    def getAlignedFragmentBases(self):
+        """
+        :returns: fragment bases in their aligned orientation
+        """
+        return getNGSString(self, NGS.lib_manager.PY_NGS_AlignmentGetAlignedFragmentBases)
+
+    # ------------------------------------------------------------------        
+    # details of this alignment
+    
+    def getAlignmentCategory(self):
+        """Alignments are categorized as primary or secondary (alternate).
+        :returns: either Alignment.primaryAlignment or Alignment.secondaryAlignment
+        :throws: ErrorMsg if the property cannot be retrieved
+        """
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_AlignmentGetAlignmentCategory, c_uint32)
+    
+    def getAlignmentPosition(self):
+        """Retrieve the Alignment's starting position on the Reference
+        :returns: unsigned 0-based offset from start of Reference
+        :throws: ErrorMsg if the property cannot be retrieved
+        """
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_AlignmentGetAlignmentPosition, c_int64)
+    
+    def getAlignmentLength(self):
+        """Retrieve the projected length of an Alignment projected upon Reference.
+        :returns: unsigned length of projection
+        :throws: ErrorMsg if the property cannot be retrieved
+        """
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_AlignmentGetAlignmentLength, c_uint64)
+
+    def getIsReversedOrientation(self):
+        """Test if orientation is reversed with respect to the Reference sequence.
+        :returns: true if reversed
+        :throws: ErrorMsg if the property cannot be retrieved
+        """
+        return bool(getNGSValue(self, NGS.lib_manager.PY_NGS_AlignmentGetIsReversedOrientation, c_int))
+
+    # ClipEdge
+        
+    def getSoftClip(self, edge):
+        ret = c_int32()
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_AlignmentGetSoftClip(self.ref, edge, byref(ret), byref(ngs_str_err.ref))
+        
+        return ret.value
+
+    def getTemplateLength(self):
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_AlignmentGetTemplateLength, c_uint64)
+
+    def getShortCigar(self, clipped):
+        """
+        :returns: a text string describing alignment details
+        """
+        with NGS_RawString() as ngs_str_err, NGS_String() as ngs_str_ret:
+            res = NGS.lib_manager.PY_NGS_AlignmentGetShortCigar(self.ref, clipped, byref(ngs_str_ret.ref), byref(ngs_str_err.ref))
+            return ngs_str_ret.getPyString()
+
+    def getLongCigar(self, clipped):
+        """
+        :returns: a text string describing alignment details
+        """
+        with NGS_RawString() as ngs_str_err, NGS_String() as ngs_str_ret:
+            res = NGS.lib_manager.PY_NGS_AlignmentGetLongCigar(self.ref, clipped, byref(ngs_str_ret.ref), byref(ngs_str_err.ref))
+            return ngs_str_ret.getPyString()
+
+    # ------------------------------------------------------------------
+    # details of mate alignment            
+            
+    def hasMate(self):
+        return bool(getNGSValue(self, NGS.lib_manager.PY_NGS_AlignmentHasMate, c_int))
+        
+    def getMateAlignmentId(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_AlignmentGetMateAlignmentId)
+
+    def getMateAlignment(self):
+        ret = Alignment()
+        ret.ref = getNGSValue(self, NGS.lib_manager.PY_NGS_AlignmentGetMateAlignment, c_void_p) # TODO: check if it works
+        return ret
+
+    def getMateReferenceSpec(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_AlignmentGetMateReferenceSpec)
+
+    def getMateIsReversedOrientation(self):
+        return bool(getNGSValue(self, NGS.lib_manager.PY_NGS_AlignmentGetMateIsReversedOrientation, c_int))
diff --git a/ngs-python/ngs/AlignmentIterator.py b/ngs-python/ngs/AlignmentIterator.py
new file mode 100644
index 0000000..25cab9d
--- /dev/null
+++ b/ngs-python/ngs/AlignmentIterator.py
@@ -0,0 +1,42 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import c_int
+
+from . import NGS
+from String import getNGSValue
+from Alignment import Alignment
+
+class AlignmentIterator(Alignment):
+    def nextAlignment(self):
+        """Advance to first alignment on initial invocation
+        Advance to next Alignment subsequently
+        :returns: false if no more Alignments are available.
+        :throws: ErrorMsg if more Alignments should be available, but could not be accessed.
+        """
+        return bool(getNGSValue(self, NGS.lib_manager.PY_NGS_AlignmentIteratorNext, c_int))
+
+
diff --git a/ngs-python/ngs/ErrorMsg.py b/ngs-python/ngs/ErrorMsg.py
new file mode 100644
index 0000000..dfb86db
--- /dev/null
+++ b/ngs-python/ngs/ErrorMsg.py
@@ -0,0 +1,52 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+from ctypes import cast, c_char_p, c_void_p, POINTER
+
+
+class ErrorMsg(RuntimeError):
+    pass
+
+
+# def check_res(res, ngs_str_error):
+    # if res != PY_RES_OK:
+        # raise ErrorMsg(ngs_str_error.getPyString())
+
+def _dereference_byref(byref_arg):
+    # this helper function exctracts a value of the argument passed to the C-function with byref
+    # it uses internal variable so it may change in the future version of python
+    return byref_arg._obj
+       
+def check_res_embedded(result, func, args):
+    from . import PY_RES_OK
+    if result != PY_RES_OK:
+        # We rely on the fact that we always have
+        # POINTER(c_void_p) parameter as the last one
+        # in args (check_res_embedded is intended to be
+        # used with ngs-sdk C-functions)
+        ref_err = _dereference_byref(args[-1]) # void* ref_err = *void_pp; (void** void_pp = args[-1])
+        assert isinstance(ref_err, c_void_p)
+        char_p = cast(ref_err, c_char_p) # char* char_p = (char*)ref_err;
+        raise ErrorMsg(str(char_p.value))
diff --git a/ngs-python/ngs/Fragment.py b/ngs-python/ngs/Fragment.py
new file mode 100644
index 0000000..4a002fa
--- /dev/null
+++ b/ngs-python/ngs/Fragment.py
@@ -0,0 +1,58 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import byref
+from . import NGS
+
+from Refcount import Refcount
+from String import NGS_String, NGS_RawString, getNGSString
+
+
+# Represents an NGS biological fragment
+
+class Fragment(Refcount):
+    def getFragmentId(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_FragmentGetFragmentId)
+            
+    def getFragmentBases(self, offset=0, length=-1):
+        """
+        :param: offset is zero-based and non-negative
+        :param: length must be >= 0
+        :returns: sequence bases
+        """
+        with NGS_RawString() as ngs_str_err, NGS_String() as ngs_str_seq:
+            res = NGS.lib_manager.PY_NGS_FragmentGetFragmentBases(self.ref, offset, length, byref(ngs_str_seq.ref), byref(ngs_str_err.ref))
+            return ngs_str_seq.getPyString()
+
+    def getFragmentQualities(self, offset=0, length=-1):
+        """getFragmentQualities using ASCII offset of 33
+        :param: offset is zero-based and non-negative
+        :param: length must be >= 0
+        :returns: phred quality values
+        """
+        with NGS_RawString() as ngs_str_err, NGS_String() as ngs_str_seq:
+            res = NGS.lib_manager.PY_NGS_FragmentGetFragmentQualities(self.ref, offset, length, byref(ngs_str_seq.ref), byref(ngs_str_err.ref))
+            return ngs_str_seq.getPyString()
diff --git a/ngs-python/ngs/FragmentIterator.py b/ngs-python/ngs/FragmentIterator.py
new file mode 100644
index 0000000..3dcfec3
--- /dev/null
+++ b/ngs-python/ngs/FragmentIterator.py
@@ -0,0 +1,39 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import c_int
+
+from . import NGS
+from String import getNGSValue
+from Fragment import Fragment
+
+class FragmentIterator(Fragment):
+    def nextFragment(self):
+        """Advance to next Fragment
+        :return: false if no more Fragments are available.
+        :throws: ErrorMsg if more Fragments should be available, but could not be accessed.
+        """
+        return bool(getNGSValue(self, NGS.lib_manager.PY_NGS_FragmentIteratorNext, c_int))
diff --git a/ngs-python/ngs/LibManager.py b/ngs-python/ngs/LibManager.py
new file mode 100644
index 0000000..9155937
--- /dev/null
+++ b/ngs-python/ngs/LibManager.py
@@ -0,0 +1,206 @@
+from ctypes import cdll, c_char, c_int, c_char_p, c_int32, c_int64, c_double, POINTER, c_size_t, c_void_p, c_uint64, c_uint32
+import os, tempfile, platform
+
+from ErrorMsg import check_res_embedded
+
+class LibManager:
+    # lib_path_engine = "/home/ukrainch/centos/gcc/x86_64/rel/lib/libncbi-vdb.so"
+    # lib_path_sdk = "/home/ukrainch/ncbi-outdir/ngs-sdk/x86_64/lib/libngs-sdk.so"
+    
+    c_lib_engine = None
+    c_lib_sdk = None
+    
+    def _bind(self, c_lib, c_func_name_str, param_types_list, errorcheck):
+        setattr(self, c_func_name_str, getattr(c_lib, c_func_name_str))
+        func = getattr(self, c_func_name_str)
+        func.argtypes = param_types_list
+        func.restype = c_int
+        if errorcheck:
+            func.errcheck = errorcheck
+        
+    def bind_sdk(self, c_func_name_str, param_types_list):
+        return self._bind(self.c_lib_sdk, c_func_name_str, param_types_list, check_res_embedded)
+    
+    def resolve_libpath(self, lib_filename):
+        # Try to load so from the root of ngs package
+        #full_path = os.path.join(os.path.dirname(__file__), lib_filename)
+        full_path = lib_filename
+        return full_path
+        
+        # TODO: cannot check path to dll with isfile()
+        # waiting on VDB-1296 to modify this function or
+        # get rid of it at all
+        if not os.path.isfile(full_path):
+            full_path = "./" + lib_filename # Try to load just by filename (CWD, PATH?)
+            
+        if not os.path.isfile(full_path):
+            full_path = os.path.join(tempfile.gettempdir(), lib_filename) # Try to load from TMP
+        
+        # TODO: add more options here (download from ncbi, known path)
+        
+        if not os.path.isfile(full_path): # nothing worked - cannot resolve path
+            raise RuntimeError("FAILED to resolve path for " + lib_filename)
+        
+        return full_path
+
+    @staticmethod
+    def get_lib_extension():
+        if platform.system() == "Windows":
+            return "dll"
+        #elif platform.name() == "": # TODO: add mac os
+        else:
+            return "so"
+    
+    def initialize_ngs_bindings(self):
+        if self.c_lib_engine and self.c_lib_sdk: # already initialized
+            return
+
+        lib_ext = "." + LibManager.get_lib_extension()
+        
+        libname_engine = "libncbi-vdb" + lib_ext
+        libname_sdk = "libngs-sdk" + lib_ext
+
+        path_engine = self.resolve_libpath(libname_engine)
+        path_sdk = self.resolve_libpath(libname_sdk)
+        
+        self.c_lib_engine = cdll.LoadLibrary(path_engine)
+        self.c_lib_sdk = cdll.LoadLibrary(path_sdk)
+
+        ##############  ngs-engine imports below  ####################
+        
+        self._bind(self.c_lib_engine, "PY_NGS_Engine_ReadCollectionMake", [c_char_p, POINTER(c_void_p), POINTER(c_char), c_size_t], None)
+        # self._bind(self.c_lib_engine, "PY_NGS_Engine_RefcountRelease", [c_void_p, POINTER(c_void_p)], None)
+        # self._bind(self.c_lib_engine, "PY_NGS_Engine_StringData", [c_void_p, POINTER(c_char_p)], None)
+        # self._bind(self.c_lib_engine, "PY_NGS_Engine_StringSize", [c_void_p, POINTER(c_size_t)], None)
+        
+        ##############  ngs-sdk imports below  ####################
+
+        # Common
+        
+        self._bind(self.c_lib_sdk, "PY_NGS_StringGetData",    [c_void_p, POINTER(c_char_p)], None)
+        self._bind(self.c_lib_sdk, "PY_NGS_StringGetSize",    [c_void_p, POINTER(c_size_t)], None)
+        self._bind(self.c_lib_sdk, "PY_NGS_RawStringRelease", [c_void_p, POINTER(c_void_p)], None)
+        self._bind(self.c_lib_sdk, "PY_NGS_RefcountRelease",  [c_void_p, POINTER(c_void_p)], None)
+        
+        # ReadCollection
+
+        self.bind_sdk("PY_NGS_ReadCollectionGetName",           [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetReadGroups",     [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetReadGroup",      [c_void_p, c_char_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetReferences",     [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetReference",      [c_void_p, c_char_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetAlignment",      [c_void_p, c_char_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetAlignments",     [c_void_p, c_uint32, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetAlignmentCount", [c_void_p, c_uint32, POINTER(c_uint64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetAlignmentRange", [c_void_p, c_uint64, c_uint64, c_uint32, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetRead",           [c_void_p, c_char_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetReads",          [c_void_p, c_uint32, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetReadCount",      [c_void_p, c_uint32, POINTER(c_uint64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadCollectionGetReadRange",      [c_void_p, c_uint64, c_uint64, c_uint32, POINTER(c_void_p), POINTER(c_void_p)])
+
+        # Alignment
+        
+        self.bind_sdk("PY_NGS_AlignmentGetAlignmentId",               [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetReferenceSpec",             [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetMappingQuality",            [c_void_p, POINTER(c_int32), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetReferenceBases",            [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetReadGroup",                 [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetReadId",                    [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetClippedFragmentBases",      [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetClippedFragmentQualities",  [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetAlignedFragmentBases",      [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetAlignmentCategory",         [c_void_p, POINTER(c_uint32), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetAlignmentPosition",         [c_void_p, POINTER(c_int64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetAlignmentLength",           [c_void_p, POINTER(c_uint64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetIsReversedOrientation",     [c_void_p, POINTER(c_int), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetSoftClip",                  [c_void_p, c_uint32, POINTER(c_int32), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetTemplateLength",            [c_void_p, POINTER(c_uint64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetShortCigar",                [c_void_p, c_int, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetLongCigar",                 [c_void_p, c_int, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentHasMate",                      [c_void_p, POINTER(c_int), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetMateAlignmentId",           [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetMateAlignment",             [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetMateReferenceSpec",         [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_AlignmentGetMateIsReversedOrientation", [c_void_p, POINTER(c_int), POINTER(c_void_p)])
+        
+        self.bind_sdk("PY_NGS_AlignmentIteratorNext",                 [c_void_p, POINTER(c_int), POINTER(c_void_p)])
+        
+        # Fragment
+        
+        self.bind_sdk("PY_NGS_FragmentGetFragmentId",        [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_FragmentGetFragmentBases",     [c_void_p, c_uint64, c_uint64, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_FragmentGetFragmentQualities", [c_void_p, c_uint64, c_uint64, POINTER(c_void_p), POINTER(c_void_p)])
+
+        self.bind_sdk("PY_NGS_FragmentIteratorNext",         [c_void_p, POINTER(c_int), POINTER(c_void_p)])
+        
+        # PileupEvent
+        
+        self.bind_sdk("PY_NGS_PileupEventGetReferenceSpec",          [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetReferencePosition",      [c_void_p, POINTER(c_int64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetMappingQuality",         [c_void_p, POINTER(c_int32), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetAlignmentId",            [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetAlignment",              [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetAlignmentPosition",      [c_void_p, POINTER(c_int64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetFirstAlignmentPosition", [c_void_p, POINTER(c_int64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetLastAlignmentPosition",  [c_void_p, POINTER(c_int64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetEventType",              [c_void_p, POINTER(c_uint32), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetAlignmentBase",          [c_void_p, POINTER(c_char), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetAlignmentQuality",       [c_void_p, POINTER(c_char), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetInsertionBases",         [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetInsertionQualities",     [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupEventGetDeletionCount",          [c_void_p, POINTER(c_uint32), POINTER(c_void_p)])
+
+        self.bind_sdk("PY_NGS_PileupEventIteratorNext",              [c_void_p, POINTER(c_int), POINTER(c_void_p)])
+        
+        # Pileup
+
+        self.bind_sdk("PY_NGS_PileupGetReferenceSpec",     [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupGetReferencePosition", [c_void_p, POINTER(c_int64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupGetPileupEvents",      [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_PileupGetPileupDepth",       [c_void_p, POINTER(c_uint32), POINTER(c_void_p)])
+
+        self.bind_sdk("PY_NGS_PileupIteratorNext",         [c_void_p, POINTER(c_int), POINTER(c_void_p)])
+        
+        # ReadGroup
+        
+        self.bind_sdk("PY_NGS_ReadGroupGetName",       [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadGroupGetStatistics", [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        
+        self.bind_sdk("PY_NGS_ReadGroupIteratorNext",  [c_void_p, POINTER(c_int), POINTER(c_void_p)])
+
+        # Read
+        
+        self.bind_sdk("PY_NGS_ReadGetReadId",        [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadGetNumFragments",  [c_void_p, POINTER(c_uint32), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadGetReadCategory",  [c_void_p, POINTER(c_uint32), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadGetReadGroup",     [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadGetReadName",      [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadGetReadBases",     [c_void_p, c_uint64, c_uint64, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReadGetReadQualities", [c_void_p, c_uint64, c_uint64, POINTER(c_void_p), POINTER(c_void_p)])
+
+        self.bind_sdk("PY_NGS_ReadIteratorNext",     [c_void_p, POINTER(c_int), POINTER(c_void_p)])
+        
+        # Reference
+        
+        self.bind_sdk("PY_NGS_ReferenceGetCommonName",     [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReferenceGetCanonicalName",  [c_void_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReferenceGetIsCircular",     [c_void_p, POINTER(c_int), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReferenceGetLength",         [c_void_p, POINTER(c_uint64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReferenceGetReferenceBases", [c_void_p, c_uint64, c_uint64, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReferenceGetReferenceChunk", [c_void_p, c_uint64, c_uint64, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReferenceGetAlignment",      [c_void_p, c_char_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReferenceGetAlignments",     [c_void_p, c_uint32, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReferenceGetAlignmentSlice", [c_void_p, c_int64, c_uint64, c_uint32, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReferenceGetPileups",        [c_void_p, c_uint32, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_ReferenceGetPileupSlice",    [c_void_p, c_int64, c_uint64, c_uint32, POINTER(c_void_p), POINTER(c_void_p)])
+
+        self.bind_sdk("PY_NGS_ReferenceIteratorNext",      [c_void_p, POINTER(c_int), POINTER(c_void_p)])
+        
+        # Statistics
+        
+        self.bind_sdk("PY_NGS_StatisticsGetValueType", [c_void_p, c_char_p, POINTER(c_uint32), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_StatisticsGetAsString",  [c_void_p, c_char_p, POINTER(c_void_p), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_StatisticsGetAsI64",     [c_void_p, c_char_p, POINTER(c_int64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_StatisticsGetAsU64",     [c_void_p, c_char_p, POINTER(c_uint64), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_StatisticsGetAsDouble",  [c_void_p, c_char_p, POINTER(c_double), POINTER(c_void_p)])
+        self.bind_sdk("PY_NGS_StatisticsGetNextPath",  [c_void_p, c_char_p, POINTER(c_void_p), POINTER(c_void_p)])
diff --git a/ngs-python/ngs/Pileup.py b/ngs-python/ngs/Pileup.py
new file mode 100644
index 0000000..ad16429
--- /dev/null
+++ b/ngs-python/ngs/Pileup.py
@@ -0,0 +1,64 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import c_void_p, c_uint32, c_int64
+from . import NGS
+
+from String import getNGSString, getNGSValue
+from Refcount import Refcount
+
+from PileupEventIterator import PileupEventIterator
+
+# Represents a slice through a stack of Alignments at a given position on the Reference
+
+class Pileup(Refcount):
+
+    # ----------------------------------------------------------------------
+    # Reference
+
+    def getReferenceSpec(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_PileupGetReferenceSpec)
+        
+    def getReferencePosition(self):
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_PileupGetReferencePosition, c_int64)
+
+    # ----------------------------------------------------------------------
+    # PileupEvent        
+        
+    def getPileupEvents(self):
+        ret = PileupEventIterator()
+        ret.ref = getNGSValue(self, NGS.lib_manager.PY_NGS_PileupGetPileupEvents, c_void_p)
+        return ret
+
+    # ----------------------------------------------------------------------
+    # details of this pileup row
+        
+    def getPileupDepth(self):
+        """
+        :returns: the coverage depth at the current reference position
+        """
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_PileupGetPileupDepth, c_uint32)
+
diff --git a/ngs-python/ngs/PileupEvent.py b/ngs-python/ngs/PileupEvent.py
new file mode 100644
index 0000000..9c3c4bf
--- /dev/null
+++ b/ngs-python/ngs/PileupEvent.py
@@ -0,0 +1,120 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+from ctypes import c_char, c_int32, c_uint32, c_int64, c_void_p
+from . import NGS
+
+from String import getNGSString, getNGSValue
+from Refcount import Refcount
+
+from Alignment import Alignment
+
+
+# Represents a single cell of a sparse 2D matrix with Reference coordinates on one axis
+# and stacked Alignments on the other axis
+
+class PileupEvent(Refcount):
+
+    # ----------------------------------------------------------------------
+    # Reference
+    
+    def getReferenceSpec(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_PileupEventGetReferenceSpec)
+
+    def getReferencePosition(self):
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_PileupEventGetReferencePosition, c_int64)
+
+    def getMappingQuality(self):
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_PileupEventGetMappingQuality, c_int32)
+
+    # ----------------------------------------------------------------------
+    # Alignment        
+        
+    def getAlignmentId(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_PileupEventGetAlignmentId)
+
+    def getAlignment(self):
+        ret = Alignment()
+        ret.ref = getNGSValue(self, NGS.lib_manager.PY_NGS_PileupEventGetAlignment, c_void_p)
+        return ret
+
+    def getAlignmentPosition(self):
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_PileupEventGetAlignmentPosition, c_int64)
+
+    def getFirstAlignmentPosition(self):
+        """
+        :returns: the position of this Alignment's first event in Reference coordinates
+        """
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_PileupEventGetFirstAlignmentPosition, c_int64)
+
+    def getLastAlignmentPosition(self):
+        """
+        :returns: the position of this Alignment's last event in INCLUSIVE Reference coordinates
+        """
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_PileupEventGetLastAlignmentPosition, c_int64)
+
+    # ----------------------------------------------------------------------
+    # event details        
+
+    match     = 0
+    mismatch  = 1
+    insertion = 2
+    deletion  = 3
+
+    def getEventType(self):
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_PileupEventGetEventType, c_uint32)
+
+    def getAlignmentBase(self):
+        """
+        :returns: retrieves base aligned at current Reference position
+        :throws: ErrorMsg if event is an insertion or deletion
+        """
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_PileupEventGetAlignmentBase, c_char)
+
+    def getAlignmentQuality(self):
+        """
+        :returns: retrieves base aligned at current Reference position
+        :throws: ErrorMsg if event is an insertion or deletion
+        """
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_PileupEventGetAlignmentQuality, c_char)
+
+    def getInsertionBases(self):
+        """
+        :returns: bases corresponding to insertion event
+        """
+        return getNGSString(self, NGS.lib_manager.PY_NGS_PileupEventGetInsertionBases)
+
+    def getInsertionQualities(self):
+        """
+        :returns: qualities corresponding to insertion event
+        """
+        return getNGSString(self, NGS.lib_manager.PY_NGS_PileupEventGetInsertionQualities)
+
+    def getDeletionCount(self):
+        """
+        :returns: the number of Reference base positions remaining until the next non-deletion event in this alignment.
+        """
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_PileupEventGetDeletionCount, c_uint32)
+
diff --git a/ngs-python/ngs/PileupEventIterator.py b/ngs-python/ngs/PileupEventIterator.py
new file mode 100644
index 0000000..06602ab
--- /dev/null
+++ b/ngs-python/ngs/PileupEventIterator.py
@@ -0,0 +1,42 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import c_int
+
+from . import NGS
+from String import getNGSValue
+from PileupEvent import PileupEvent
+
+#Iterates across a list of PileupEvents
+
+class PileupEventIterator(PileupEvent):
+    def nextPileupEvent(self):
+        """Advance to first PileupEvent on initial invocation
+        advance to next PileupEvent subsequently
+        :returns: false if no more PileupEvents are available.
+        :throws: ErrorMsg if more PileupEvents should be available, but could not be accessed.
+        """
+        return bool(getNGSValue(self, NGS.lib_manager.PY_NGS_PileupEventIteratorNext, c_int))
\ No newline at end of file
diff --git a/ngs-python/ngs/PileupIterator.py b/ngs-python/ngs/PileupIterator.py
new file mode 100644
index 0000000..9b99c02
--- /dev/null
+++ b/ngs-python/ngs/PileupIterator.py
@@ -0,0 +1,41 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import c_int
+
+from . import NGS
+from String import getNGSValue
+from Pileup import Pileup
+
+# Iterates across a list of Pileups
+
+class PileupIterator(Pileup):
+    def nextPileup(self):
+        """Advance to first Pileup on initial invocation advance to next Pileup subsequently
+        :returns: false if no more Pileups are available.
+        :throws: ErrorMsg if more Pileups should be available, but could not be accessed.
+        """
+        return bool(getNGSValue(self, NGS.lib_manager.PY_NGS_PileupIteratorNext, c_int))
\ No newline at end of file
diff --git a/ngs-python/ngs/Read.py b/ngs-python/ngs/Read.py
new file mode 100644
index 0000000..b4b7bef
--- /dev/null
+++ b/ngs-python/ngs/Read.py
@@ -0,0 +1,86 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import byref, c_uint32
+from . import NGS
+
+from String import NGS_String, NGS_RawString, getNGSString, getNGSValue
+from FragmentIterator import FragmentIterator
+
+    # Read
+    # represents an NGS machine read
+    # having some number of biological Fragments
+ 
+class Read(FragmentIterator):
+    fullyAligned     = 1
+    partiallyAligned = 2
+    aligned          = fullyAligned | partiallyAligned
+    unaligned        = 4
+    all              = aligned | unaligned
+
+    def getReadId(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_ReadGetReadId)
+            
+    # ----------------------------------------------------------------------
+    # Fragment
+    
+    def getNumFragments(self):
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_ReadGetNumFragments, c_uint32)
+
+    # ----------------------------------------------------------------------
+    # read details        
+    
+    # ReadCategory
+    
+    def getReadCategory(self):
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_ReadGetReadCategory, c_uint32)
+
+    def getReadGroup(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_ReadGetReadGroup)
+            
+    def getReadName(self):
+        return getNGSString(self, NGS.lib_manager.PY_NGS_ReadGetReadName)
+
+    def getReadBases(self, offset=0, length=-1):
+        """
+        :param: offset is zero-based and non-negative
+        :param: length must be >= 0
+        :returns: sequence bases
+        """
+        with NGS_RawString() as ngs_str_err, NGS_String() as ngs_str_seq:
+            res = NGS.lib_manager.PY_NGS_ReadGetReadBases(self.ref, offset, length, byref(ngs_str_seq.ref), byref(ngs_str_err.ref))
+            return ngs_str_seq.getPyString()
+        
+    def getReadQualities(self, offset=0, length=-1):
+        """
+        :param: offset is zero-based and non-negative
+        :param: length must be >= 0
+        :returns: phred quality values using ASCII offset of 33
+        """
+        with NGS_RawString() as ngs_str_err, NGS_String() as ngs_str_seq:
+            res = NGS.lib_manager.PY_NGS_ReadGetReadQualities(self.ref, offset, length, byref(ngs_str_seq.ref), byref(ngs_str_err.ref))
+            return ngs_str_seq.getPyString()
+
diff --git a/ngs-python/ngs/ReadCollection.py b/ngs-python/ngs/ReadCollection.py
new file mode 100644
index 0000000..dac7ae6
--- /dev/null
+++ b/ngs-python/ngs/ReadCollection.py
@@ -0,0 +1,244 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+
+from ctypes import c_void_p, c_uint64, byref, create_string_buffer
+from . import NGS
+
+from Refcount import Refcount
+from ErrorMsg import ErrorMsg
+from String import NGS_RawString, getNGSString, getNGSValue
+from Read import Read
+from ReadIterator import ReadIterator
+from ReadGroup import ReadGroup
+from ReadGroupIterator import ReadGroupIterator
+from Reference import Reference
+from ReferenceIterator import ReferenceIterator
+from Alignment import Alignment
+from AlignmentIterator import AlignmentIterator
+
+class ReadCollection(Refcount):
+    """Represents an NGS-capable object with a collection of
+    *Reads*, *References* and *Alignments*.
+    
+    Each of the basic content types may be accessed by *id*
+    as either a standalone object, or more commonly through
+    an *Iterator* over a selected collection of objects.
+
+    Reads are grouped by *ReadGroup*. When
+    not specifically assigned, Reads will be placed into the
+    *default* ReadGroup.
+    """
+    
+    def getName(self):
+        """Access the simple name of the ReadCollection.
+        This name is generally extracted from the "spec"
+        used to create the object, but may also be mapped
+        to a canonical name if one may be determined and
+        differs from that given in the spec.
+        
+        if the name is extracted from "spec" and contains
+        well-known file extensions that do not form part of
+        a canonical name (e.g. ".sra"), they will be removed.
+        
+        :returns: the simple name of the ReadCollection
+        :throws: ErrorMsg if the name cannot be retrieved
+        """
+        return getNGSString(self, NGS.lib_manager.PY_NGS_ReadCollectionGetName)
+    
+    #----------------------------------------------------------------------
+    # READ GROUPS
+    
+    def getReadGroups(self):
+        """Access all non-empty ReadGroups.
+        Iterator will contain at least one ReadGroup
+        unless the ReadCollection itself is empty.
+        
+        :returns: an unordered Iterator of ReadGroups
+        :throws: ErrorMsg only upon an error accessing data
+        """
+        ret = ReadGroupIterator()
+        ret.ref = getNGSValue(self, NGS.lib_manager.PY_NGS_ReadCollectionGetReadGroups, c_void_p) # TODO: check if it works
+        return ret
+
+    def getReadGroup(self, spec):
+        """Access a single ReadGroup by name.
+        
+        :param spec: the name of a contained read group
+        :returns: an instance of the designated ReadGroup
+        :throws: ErrorMsg if specified ReadGroup is not found
+        :throws: ErrorMsg upon an error accessing data
+        """
+        ret = ReadGroup()
+
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReadCollectionGetReadGroup(self.ref, spec, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+    
+    #----------------------------------------------------------------------
+    # REFERENCES
+    
+    def getReferences(self):
+        """Access all References having aligned Reads.
+        Iterator will contain at least one ReadGroup
+        unless no Reads are aligned.
+        
+        :returns: an unordered Iterator of References
+        :throws: ErrorMsg upon an error accessing data
+        """
+        ret = ReferenceIterator()
+        ret.ref = getNGSValue(self, NGS.lib_manager.PY_NGS_ReadCollectionGetReferences, c_void_p) # TODO: check if it works
+        return ret
+
+    def getReference(self, spec):
+        ret = Reference()
+
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReadCollectionGetReference(self.ref, spec, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+        
+    #----------------------------------------------------------------------
+    # ALIGNMENTS
+
+    def getAlignment(self, alignmentId):
+        """:returns: an individual Alignment
+        :throws: ErrorMsg if Alignment does not exist
+        """
+        ret = Alignment()
+
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReadCollectionGetAlignment(self.ref, alignmentId, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+    
+    # AlignmentCategory
+    #  see Alignment for categories
+    
+    def getAlignments(self, categories):
+        """
+        :returns: an iterator of all Alignments from specified categories
+        """
+        ret = AlignmentIterator()
+
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReadCollectionGetAlignments(self.ref, categories, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+        
+    def getAlignmentCount(self, categories=Alignment.all):
+        '''"categories" provides a means of filtering by AlignmentCategory
+        :returns: count of all alignments
+        '''
+        ret = c_uint64()
+
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReadCollectionGetAlignmentCount(self.ref, categories, byref(ret), byref(ngs_str_err.ref))
+        
+        return ret.value
+        
+    def getAlignmentRange(self, first, count, categories=Alignment.all): # TODO: parameters order!
+        '''"first" is an unsigned ordinal into set
+        "categories" provides a means of filtering by AlignmentCategory
+        :returns: an iterator across a range of Alignments
+        '''
+        ret = AlignmentIterator()
+
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReadCollectionGetAlignmentRange(self.ref, first, count, categories, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+
+    #----------------------------------------------------------------------
+    # READ
+
+    def getRead(self, readId):
+        """
+        :returns: an individual Read
+        :throws: ErrorMsg if Read does not exist
+        """
+        ret = Read()
+
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReadCollectionGetRead(self.ref, readId, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+    
+    # ReadCategory
+    #  see Read for categories
+    
+    def getReads(self, categories):
+        """
+        :returns: an iterator of all contained machine Reads
+        """
+        ret = ReadIterator()
+
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReadCollectionGetReads(self.ref, categories, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+
+    def getReadCount(self, categories=Read.all):
+        """of all combined categories
+        :returns: the number of reads in the collection
+        """
+        ret = c_uint64()
+
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReadCollectionGetReadCount(self.ref, categories, byref(ret), byref(ngs_str_err.ref))
+        
+        return ret.value
+
+    def getReadRange(self, first, count, categories=Read.all):
+        ret = ReadIterator()
+
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReadCollectionGetReadRange(self.ref, first, count, categories, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+
+
+def openReadCollection(spec):
+    """Create an object representing a named collection of reads
+     
+     :param: spec may be a path to an object or may be an id, accession, or URL
+     
+     :throws: ErrorMsg if object cannot be located
+     :throws: ErrorMsg if object cannot be converted to a ReadCollection
+     :throws: ErrorMsg if an error occurs during construction
+    """
+
+    ret = ReadCollection()
+    ERROR_BUFFER_SIZE = 4096
+    str_err = create_string_buffer(ERROR_BUFFER_SIZE)
+    from ctypes import cast
+    from . import PY_RES_OK
+    res = NGS.lib_manager.PY_NGS_Engine_ReadCollectionMake(spec, byref(ret.ref), str_err, len(str_err))
+    if res != PY_RES_OK:
+        raise ErrorMsg(str_err.value)
+        
+    return ret
diff --git a/ngs-python/ngs/ReadGroup.py b/ngs-python/ngs/ReadGroup.py
new file mode 100644
index 0000000..ab113d5
--- /dev/null
+++ b/ngs-python/ngs/ReadGroup.py
@@ -0,0 +1,51 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import c_void_p
+from . import NGS
+
+from Refcount import Refcount
+from String import getNGSString, getNGSValue
+
+from Statistics import Statistics
+
+# Represents an NGS-capable object with a group of Reads
+
+class ReadGroup(Refcount):
+            
+    def getName(self):
+        """
+        :returns: the simple name of the read group
+        """
+        return getNGSString(self, NGS.lib_manager.PY_NGS_ReadGroupGetName)
+
+    def getStatistics(self):
+        """
+        :returns: a collection of statistical data
+        """
+        ret = Statistics()
+        ret.ref = getNGSValue(self, NGS.lib_manager.PY_NGS_ReadGroupGetStatistics, c_void_p)
+        return ret
diff --git a/ngs-python/ngs/ReadGroupIterator.py b/ngs-python/ngs/ReadGroupIterator.py
new file mode 100644
index 0000000..db58bc0
--- /dev/null
+++ b/ngs-python/ngs/ReadGroupIterator.py
@@ -0,0 +1,42 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import c_int
+from . import NGS
+from String import getNGSValue
+from ReadGroup import ReadGroup
+
+# Iterates across a list of ReadGroups
+
+class ReadGroupIterator(ReadGroup):
+    def nextReadGroup(self):
+        """Advance to first ReadGroup on initial invocation 
+        Advance to next ReadGroup subsequently
+        :returns: false if no more ReadGroups are available.
+        :throws: ErrorMsg if more ReadGroups should be available, but could not be accessed.
+        """
+        return bool(getNGSValue(self, PY_NGS_ReadGroupIteratorNext, c_int))
+
diff --git a/ngs-python/ngs/ReadIterator.py b/ngs-python/ngs/ReadIterator.py
new file mode 100644
index 0000000..a623e1e
--- /dev/null
+++ b/ngs-python/ngs/ReadIterator.py
@@ -0,0 +1,43 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import c_int
+
+from . import NGS
+from String import getNGSValue
+from Read import Read
+
+# ReadIterator
+# iterates across a list of Reads
+
+class ReadIterator(Read):
+    def nextRead(self):
+        """Advance to first Read on initial invocation
+        advance to next Read subsequently
+        :returns: false if no more Reads are available.
+        :throws: ErrorMsg if more Reads should be available, but could not be accessed.
+        """
+        return bool(getNGSValue(self, NGS.lib_manager.PY_NGS_ReadIteratorNext, c_int))
\ No newline at end of file
diff --git a/ngs-python/ngs/Refcount.py b/ngs-python/ngs/Refcount.py
new file mode 100644
index 0000000..8597a59
--- /dev/null
+++ b/ngs-python/ngs/Refcount.py
@@ -0,0 +1,59 @@
+from ctypes import byref, c_void_p
+
+from . import NGS
+from String import NGS_RawString
+
+def RefcountRelease(ref):
+    """Releases NGS-object imported from ngs-sdk
+    
+    :param ref: reference to refcounted NGS-object to be released. It's expected to be of type c_void_p
+    :returns: None
+    :throws: ErrorMsg
+    """
+    with NGS_RawString() as ngs_str_err:
+        res = NGS.lib_manager.PY_NGS_RefcountRelease(ref, byref(ngs_str_err.ref))
+
+def RefcountRawStringRelease(ref):
+    """Releases raw string imported from ngs-sdk
+    
+    :param ref: reference to raw char string. It's expected to be of type c_char_p
+    :returns: None
+    :throws: ErrorMsg
+    """
+    with NGS_RawString() as ngs_str_err:
+        res = NGS.lib_manager.PY_NGS_RawStringRelease(ref, byref(ngs_str_err.ref))
+
+# def RefcountEngineRelease(ref):
+    # """Releases NGS-object imported from ngs engine
+    
+    # :param ref: reference to refcounted NGS-object to be released. It's expected to be of type c_void_p
+    # :returns: None
+    # :throws: ErrorMsg
+    # """
+    # with NGSEngine_String() as ngs_str_err:
+        # res = NGS.lib_manager.PY_NGS_Engine_RefcountRelease(ref, byref(ngs_str_err.ref))
+        # check_res(res, ngs_str_err)
+
+
+class Refcount:
+    """ Base class for all refcounted objects imported from ngs-sdk
+    """
+    def __init__(self):
+        self.init_members_with_null()
+    
+    def __del__(self):
+        self.close()
+            
+    def __enter__(self):
+        return self
+    
+    def __exit__(self, t, value, traceback):
+        self.close()
+
+    def close(self):
+        if self.ref:
+            RefcountRelease(self.ref)
+            self.init_members_with_null()
+            
+    def init_members_with_null(self):
+        self.ref = c_void_p()
diff --git a/ngs-python/ngs/Reference.py b/ngs-python/ngs/Reference.py
new file mode 100644
index 0000000..a791e3c
--- /dev/null
+++ b/ngs-python/ngs/Reference.py
@@ -0,0 +1,152 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import byref, c_int, c_uint64
+from . import NGS
+from Refcount import Refcount
+from String import NGS_RawString, NGS_String, getNGSString, getNGSValue
+
+from Alignment import Alignment
+from AlignmentIterator import AlignmentIterator
+from PileupIterator import PileupIterator
+
+# Represents a reference sequence
+
+class Reference(Refcount):
+            
+    def getCommonName(self):
+        """
+        :returns: the common name of reference, e.g. "chr1"
+        """
+        return getNGSString(self, NGS.lib_manager.PY_NGS_ReferenceGetCommonName)
+
+    def getCanonicalName(self):
+        '''
+        :returns: the accessioned name of reference, e.g. "NC_000001.11"
+        '''
+        return getNGSString(self, NGS.lib_manager.PY_NGS_ReferenceGetCanonicalName)
+        
+    def getIsCircular(self):
+        return bool(getNGSValue(self, NGS.lib_manager.PY_NGS_ReferenceGetIsCircular, c_int))
+        
+    def getLength(self):
+        return getNGSValue(self, NGS.lib_manager.PY_NGS_ReferenceGetLength, c_uint64)
+        
+    def getReferenceBases(self, offset, length=-1):
+        """
+        :param: offset is zero-based and non-negative
+        :param: length must be >= 0
+        :returns: sub-sequence bases for Reference
+        """
+        with NGS_RawString() as ngs_str_err, NGS_String() as ngs_str_ret:
+            res = NGS.lib_manager.PY_NGS_ReferenceGetReferenceBases(self.ref, offset, length, byref(ngs_str_ret.ref), byref(ngs_str_err.ref))
+            return ngs_str_ret.getPyString()
+    
+    def getReferenceChunk(self, offset, length=-1):
+        """
+        :param: offset is zero-based and non-negative
+        :param: length must be >= 0
+        :returns: largest contiguous chunk available of sub-sequence bases for Reference
+        NB - actual returned sequence may be shorter
+        than requested. to obtain all bases available
+        in chunk, use a negative "size" value
+        """
+        with NGS_RawString() as ngs_str_err, NGS_String() as ngs_str_ret:
+            res = NGS.lib_manager.PY_NGS_ReferenceGetReferenceChunk(self.ref, offset, length, byref(ngs_str_ret.ref), byref(ngs_str_err.ref))
+            return ngs_str_ret.getPyString()
+
+    # ----------------------------------------------------------------------
+    # ALIGNMENTS
+
+    def getAlignment(self, alignmentId):
+        """
+        :returns: an individual Alignment
+        :throws: ErrorMsg if Alignment does not exist or is not part of this Reference
+        """
+        ret = Alignment()
+
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReferenceGetAlignment(self.ref, alignmentId, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+
+    def getAlignments(self, categories):
+        """
+        :returns: an iterator of contained alignments
+        """
+        ret = AlignmentIterator()
+        
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReferenceGetAlignments(self.ref, categories, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+
+    def getAlignmentSlice(self, start, length, categories=Alignment.all):
+        """
+        :param: start is a signed 0-based offset from the start of the Reference
+        :param: length is the length of the slice.
+        :param: categories provides a means of filtering by AlignmentCategory
+        :returns: an iterator across a range of Alignments
+        """
+        ret = AlignmentIterator()
+        
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReferenceGetAlignmentSlice(self.ref, start, length, categories, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+
+    # ----------------------------------------------------------------------
+    # PILEUP
+    
+    def getPileups(self, categories):
+        """
+        :returns: an iterator of contained Pileups
+        """
+        ret = PileupIterator()
+        
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReferenceGetPileups(self.ref, categories, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+
+    def getPileupSlice(self, start, length, categories=Alignment.all):
+        """Creates a PileupIterator on a slice (window) of reference
+        :param: start is the signed starting position on reference
+        :param: length is the unsigned number of bases in the window
+        :param: categories provides a means of filtering by AlignmentCategory
+        :returns: an iterator of contained Pileups
+        """
+        ret = PileupIterator()
+        
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_ReferenceGetPileupSlice(self.ref, start, length, categories, byref(ret.ref), byref(ngs_str_err.ref))
+        
+        return ret
+    
+    
+    
+    
+    
\ No newline at end of file
diff --git a/ngs-python/ngs/ReferenceIterator.py b/ngs-python/ngs/ReferenceIterator.py
new file mode 100644
index 0000000..d7cf9f8
--- /dev/null
+++ b/ngs-python/ngs/ReferenceIterator.py
@@ -0,0 +1,42 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import c_int
+
+from . import NGS
+from String import getNGSValue
+from Reference import Reference
+
+# Iterates across a list of References
+
+class ReferenceIterator(Reference):
+    def nextReference(self):
+        """Advance to first Reference on initial invocation
+        Advance to next Reference subsequently
+        :returns: false if no more References are available.
+        :throws: ErrorMsg if there is an error
+        """
+        return bool(getNGSValue(self, NGS.lib_manager.PY_NGS_ReferenceIteratorNext, c_int))
\ No newline at end of file
diff --git a/ngs-python/ngs/Statistics.py b/ngs-python/ngs/Statistics.py
new file mode 100644
index 0000000..1bbf30b
--- /dev/null
+++ b/ngs-python/ngs/Statistics.py
@@ -0,0 +1,102 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import byref, c_uint32, c_int64, c_uint64, c_double
+from . import NGS
+
+from String import NGS_String, NGS_RawString, getNGSString, getNGSValue
+from Refcount import Refcount
+
+# Statistical data container
+
+class Statistics(Refcount):
+    none   = 0
+    string = 1
+    int64  = 2
+    uint64 = 3
+    real   = 4
+
+    def getValueType(self, path):
+        ret = c_uint32()
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_StatisticsGetValueType(self.ref, path, byref(ret), byref(ngs_str_err.ref))
+        
+        return ret.value
+
+    def getAsString(self, path):
+        """
+        :param: path is hierarchical path to value node
+        :returns: textual representation of value
+        :throws: ErrorMsg if path not found or value cannot be converted
+        """
+        with NGS_RawString() as ngs_str_err, NGS_String() as ngs_str_ret:
+            res = NGS.lib_manager.PY_NGS_StatisticsGetAsString(self.ref, path, byref(ngs_str_ret.ref), byref(ngs_str_err.ref))
+            return ngs_str_ret.getPyString()
+
+    def getAsI64(self, path):
+        """
+        :param: path is hierarchical path to value node
+        :returns: a signed 64-bit integer
+        :throws: ErrorMsg if path not found or value cannot be converted
+        """
+        ret = c_int64()
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_StatisticsGetAsI64(self.ref, path, byref(ret), byref(ngs_str_err.ref))
+        
+        return ret.value
+
+    def getAsU64(self, path):
+        """
+        :param: path is hierarchical path to value node
+        :returns: a non-negative 64-bit integer
+        :throws: ErrorMsg if path not found or value cannot be converted
+        """
+        ret = c_uint64()
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_StatisticsGetAsU64(self.ref, path, byref(ret), byref(ngs_str_err.ref))
+        
+        return ret.value
+
+    def getAsDouble(self, path):
+        """
+        :param: path is hierarchical path to value node
+        :returns: a 64-bit floating point
+        :throws: ErrorMsg if path not found or value cannot be converted
+        """
+        ret = c_double()
+        with NGS_RawString() as ngs_str_err:
+            res = NGS.lib_manager.PY_NGS_StatisticsGetAsDouble(self.ref, path, byref(ret), byref(ngs_str_err.ref))
+        
+        return ret.value
+
+    def nextPath(self, path):
+        """advance to next path in container
+        :param: path is null or empty to request first path, or a valid path string
+        :returns: null if no more paths, or a valid path string
+        """
+        with NGS_RawString() as ngs_str_err, NGS_String() as ngs_str_ret:
+            res = NGS.lib_manager.PY_NGS_StatisticsGetNextPath(self.ref, path, byref(ngs_str_ret.ref), byref(ngs_str_err.ref))
+            return ngs_str_ret.getPyString()
diff --git a/ngs-python/ngs/String.py b/ngs-python/ngs/String.py
new file mode 100644
index 0000000..c35dcc1
--- /dev/null
+++ b/ngs-python/ngs/String.py
@@ -0,0 +1,154 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+from ctypes import c_void_p, c_size_t, c_char_p, string_at, byref, cast
+from . import NGS
+
+class NGS_String:
+    """Refcounted object to work with StringItf objects imported from ngs-sdk
+    
+    Provides read-only operaton getPyString: returns python str object constructed from StringItf
+    """
+    
+    def __init__(self):
+        self.init_members_with_null()
+    
+    def __del__(self):
+        self.close()
+            
+    def __enter__(self):
+        return self
+    
+    def __exit__(self, t, value, traceback):
+        self.close()
+
+    def close(self):
+        if self.ref:
+            from Refcount import RefcountRelease
+            RefcountRelease(self.ref)
+            self.init_members_with_null()
+            
+    def init_members_with_null(self):
+        self.ref = c_void_p()
+        self.size = c_size_t()
+        self.data = c_char_p()        
+
+    def getData(self):
+        if not self.ref:
+            pass # TODO: process error?
+        res = NGS.lib_manager.PY_NGS_StringGetData(self.ref, byref(self.data))
+        # TODO: process error?
+        return self.data.value
+        
+    def getSize(self):
+        if not self.ref:
+            pass # TODO: process error?
+        res = NGS.lib_manager.PY_NGS_StringGetSize(self.ref, byref(self.size))
+        # TODO: process error?
+        return self.size.value
+        
+    def getPyString(self):
+        return string_at(self.getData(), self.getSize())
+
+
+class NGS_RawString:
+    """object to work with raw string (char*) objects imported from ngs-sdk
+    
+    Provides read-only operaton getPyString: returns python str object constructed from raw ngs-sdk string
+    This class is used for getting error string from ngs-sdk sicne its StringItf class doesn't provide
+    interface for NGS string duplication (creating a copy)
+    """
+    
+    def __init__(self):
+        self.init_members_with_null()
+    
+    def __del__(self):
+        self.close()
+            
+    def __enter__(self):
+        return self
+    
+    def __exit__(self, t, value, traceback):
+        self.close()
+
+    def close(self):
+        if self.ref:
+            from Refcount import RefcountRawStringRelease
+            RefcountRawStringRelease(self.ref)
+            self.init_members_with_null()
+            
+    def init_members_with_null(self):
+        self.ref = c_void_p()
+        
+    def ref_to_char_p(self):
+        return cast(self.ref, c_char_p)
+    
+    def getData(self):
+        if not self.ref:
+            pass # TODO: process error?
+        return self.ref_to_char_p().value
+        
+    def getSize(self):
+        if not self.ref:
+            pass # TODO: process error?
+        return len(self.ref_to_char_p().value)
+        
+    def getPyString(self):
+        return string_at(self.getData(), self.getSize())
+
+
+def getNGSString(self, py_func):
+    """Getter that returns a string-attribute for a given NGS-object (Read, Fragment, Alignment etc.)
+    
+    :param self: python class representing NGS-object (like Read or Fragment)
+    :param py_func: PY-function returning NGS_String for a given NGS-object
+    :returns: python str object
+    :throws: ErrorMsg
+    
+    :remarks: NGS_String object is automatically released after this function returns
+    """
+    with NGS_RawString() as ngs_str_err, NGS_String() as ngs_str_seq:
+        res = py_func(self.ref, byref(ngs_str_seq.ref), byref(ngs_str_err.ref))
+        #check_res(res, ngs_str_err)
+        return ngs_str_seq.getPyString()
+
+        
+def getNGSValue(self, py_func, value_type):
+    """Getter that returns a typed attribute for a given NGS-object (Read, Fragment, Alignment etc.)
+    
+    :param self: python class representing NGS-object (like Read or Fragment)
+    :param py_func: PY-function returning a typed object for a given NGS-object
+    :param value_type: c_type of the object to query from 'self'
+    :returns: python str object
+    :throws: ErrorMsg
+    """
+    ret = value_type()
+    with NGS_RawString() as ngs_str_err:
+        res = py_func(self.ref, byref(ret), byref(ngs_str_err.ref))
+        #check_res(res, ngs_str_err)
+    
+    return ret.value
+
diff --git a/ngs-python/ngs/__init__.py b/ngs-python/ngs/__init__.py
new file mode 100644
index 0000000..8bf6ef3
--- /dev/null
+++ b/ngs-python/ngs/__init__.py
@@ -0,0 +1,43 @@
+# ===========================================================================
+# 
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+# 
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+# 
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+# 
+#  Please cite the author in any work or product based on this material.
+# 
+# ===========================================================================
+# 
+# 
+
+#import os
+
+from .LibManager import LibManager # TODO probably, LibManager should not be the part of ngs package and be specific to engine
+
+PY_RES_OK    = 0
+
+class NGS:
+    lib_manager = LibManager()
+
+    @staticmethod
+    def openReadCollection(spec):
+        NGS.lib_manager.initialize_ngs_bindings()
+    
+        from ReadCollection import openReadCollection  # entry point - adding name to ngs package global namespace
+        return openReadCollection(spec)
+
+
diff --git a/ngs-python/os-arch.perl b/ngs-python/os-arch.perl
new file mode 100644
index 0000000..a7b4990
--- /dev/null
+++ b/ngs-python/os-arch.perl
@@ -0,0 +1,22 @@
+use strict;
+
+use FindBin qw($Bin);
+require "$Bin/os-arch.pm";
+
+my ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+
+my $res = "$OS.$ARCH";
+
+if (@ARCHITECTURES) {
+    my $name = "$Bin/Makefile.config.$OS.arch";
+    if (-e $name) {
+        while (1) {
+            open F, $name or last;
+            $res = "$OS." . <F>;
+            chomp $res;
+            last;
+        }
+    }
+}
+
+print "$res\n";
diff --git a/ngs-python/os-arch.pm b/ngs-python/os-arch.pm
new file mode 100644
index 0000000..6fbd606
--- /dev/null
+++ b/ngs-python/os-arch.pm
@@ -0,0 +1,100 @@
+sub OsArch {
+    my ($UNAME, $HOST_OS, $HOST_ARCH, $MARCH, @ARCHITECTURES);
+    if ($^O eq 'MSWin32') {
+        $UNAME = $HOST_OS = 'win';
+        $HOST_ARCH = $MARCH = 'x86_64';
+        @ARCHITECTURES = qw(x86_64 i386);
+    } else {
+        $UNAME = `uname -s`;
+        chomp $UNAME;
+        if ($UNAME =~ /Darwin/) {
+            $HOST_OS = 'mac';
+        } elsif ($UNAME =~ /Linux/) {
+            $HOST_OS = 'linux';
+        } elsif ($UNAME =~ /SunOS/) {
+            $HOST_OS = 'sun';
+            @ARCHITECTURES = qw(x86_64 i386);
+        } elsif ($UNAME =~ /xCYGWIN/) {
+            $HOST_OS = 'win';
+        } elsif ($UNAME =~ /xMINGW/) {
+            $HOST_OS = 'win';
+        }
+        if ($HOST_OS eq 'mac') {
+            $MARCH = $HOST_ARCH = MacArch();
+            @ARCHITECTURES = qw(x86_64 i386) if ($MARCH eq 'x86_64');
+        } else {
+            $MARCH = `uname -m`;
+            chomp $MARCH;
+            if ($MARCH =~ /i386/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i486/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i586/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i686/) {
+                if ($UNAME =~ /WOW64/) { # 64-bit capable Cygwin.
+                     # Analyze the version of cl to set the correct architecture
+                    my $CL = `cl.exe 2>&1 > /dev/null`;
+                    if ($CL =~ /for x64/) {
+                        $HOST_ARCH = 'x86_64';
+                    } else {
+                        $HOST_ARCH = 'i386';
+                    }
+                } else {
+                    $HOST_ARCH = 'i386';
+                }
+            } elsif ($MARCH =~ /x86_64/) {
+                $HOST_ARCH = 'x86_64';
+            } elsif ($MARCH =~ /i86pc/) {
+                $HOST_ARCH = 'x86_64';
+                @ARCHITECTURES = qw(x86_64 i386);
+            } elsif ($MARCH =~ /sun4v/) {
+                $HOST_ARCH = 'sparc64';
+		        @ARCHITECTURES = qw(sparc64 sparc32);
+            }
+        }
+    }
+    ($HOST_OS, $HOST_ARCH, $UNAME, $MARCH, @ARCHITECTURES);
+}
+
+sub MacArch {
+    my $ARCH = `uname -m`;
+    chomp $ARCH;
+    if ($ARCH eq 'x86_64') {
+        return $ARCH;
+    } else {
+        my $SYSCTL = '/usr/sbin/sysctl';
+        $SYSCTL = '/sbin/sysctl' if (-x '/sbin/sysctl');
+
+        my $CAP64 = `$SYSCTL -n hw.cpu64bit_capable`;
+        chomp $CAP64;
+
+        my $PADDR_BITS = `$SYSCTL -n machdep.cpu.address_bits.physical`;
+        chomp $PADDR_BITS;
+
+        my $VADDR_BITS = `$SYSCTL -n machdep.cpu.address_bits.virtual`;
+        chomp $VADDR_BITS;
+        
+        if ($CAP64 != 0) {
+            if ($PADDR_BITS > 32 && $VADDR_BITS > 32) {
+                if ($ARCH eq 'i386' || $ARCH eq 'x86_64') {
+                    return 'x86_64';
+                } elsif ($ARCH eq 'Power Macintosh') {
+                    return 'ppc64';
+                } else {
+                    return 'unrecognized';
+                }
+            }
+        }
+
+        if ($ARCH eq 'i386') {
+            return 'i386';
+        } elsif ($ARCH eq 'Power Macintosh') {
+            return 'ppc32';
+        } else {
+            return 'unrecognized';
+        }
+    }
+}
+
+1
diff --git a/ngs-python/package.pm b/ngs-python/package.pm
new file mode 100644
index 0000000..094f4f6
--- /dev/null
+++ b/ngs-python/package.pm
@@ -0,0 +1,42 @@
+################################################################################
+sub PACKAGE      { "ngs-python" }
+sub VERSION      { "1.0.0" }
+sub PACKAGE_TYPE { 'B' }
+sub PACKAGE_NAME { "NGS-PYTHON" }
+sub PACKAGE_NAMW { "NGS_PYTHON" }
+sub DEPENDS      {}
+sub CONFIG_OUT   { '.' }
+sub PKG { ( LNG  => 'PYTHON',
+            OUT  => 'ncbi-outdir',
+            PATH  => '/usr/local/ngs/ngs-python',
+            UPATH =>      '$HOME/ngs/ngs-python',
+            EXAMP => '1', ) }
+sub REQ { (
+            { name    => 'ngs-sdk',
+              namew   => 'NGS',
+              option  => 'with-ngs-sdk-prefix',
+              origin  => 'I',
+              type    => 'L',
+              srcpath => '../ngs-sdk',
+              pkgpath => '/usr/local/ngs/ngs-sdk',
+              usrpath =>      '$HOME/ngs/ngs-sdk',
+              bldpath => '$HOME/ncbi-outdir/ngs-sdk',
+              include => 'ngs/itf/Refcount.h',
+              lib     => 'libngs-sdk.$SHLX',
+              ilib    => 'libngs-bind-c++.a',
+            },
+            { name    => 'ncbi-vdb',
+              namew   => 'VDB',
+              option  => 'with-ncbi-vdb-prefix',
+              origin  => 'I',
+              type    => 'L',
+              srcpath => '../../ncbi-vdb',
+              pkgpath => '/usr/local/ncbi/ncbi-vdb',
+              usrpath =>      '$HOME/ncbi/ncbi-vdb',
+              bldpath => '$HOME/ncbi-outdir/ncbi-vdb',
+              include => 'klib/rc.h',
+              lib     => 'libncbi-vdb.$SHLX',
+              ilib    => 'libkapp.a',
+             } ) }
+
+1
diff --git a/ngs-python/setup.py b/ngs-python/setup.py
new file mode 100644
index 0000000..6275d08
--- /dev/null
+++ b/ngs-python/setup.py
@@ -0,0 +1,23 @@
+from setuptools import setup
+import sys
+#import version
+
+#ver = version.get_git_version()
+
+decimal_ver = sys.version_info[0]*10 + sys.version_info[1]
+min_version = 27
+
+if decimal_ver < min_version:
+    print ("At least python {} is required to run ngs package, and you're using {}".format(min_version/10., decimal_ver/10.))
+    exit()
+
+setup(name='ngs',
+      #version=ver,
+      version = "1.0",
+      author='sra-tools',
+      author_email='sra-tools at ncbi.nlm.nih.gov',
+      packages=['ngs'],
+      include_package_data=True,
+      scripts=[],
+      #test_suite="tests",
+      )
diff --git a/ngs-python/win-configure.bat b/ngs-python/win-configure.bat
new file mode 100644
index 0000000..47a955e
--- /dev/null
+++ b/ngs-python/win-configure.bat
@@ -0,0 +1 @@
+perl -w ./konfigure.perl %*
diff --git a/ngs-sdk/.gitignore b/ngs-sdk/.gitignore
new file mode 100644
index 0000000..3d8aed4
--- /dev/null
+++ b/ngs-sdk/.gitignore
@@ -0,0 +1,5 @@
+Makefile.userconfig
+Makefile.config*
+user.status
+*.o
+
diff --git a/ngs-sdk/CONTENTS.txt b/ngs-sdk/CONTENTS.txt
new file mode 100644
index 0000000..86336eb
--- /dev/null
+++ b/ngs-sdk/CONTENTS.txt
@@ -0,0 +1,44 @@
+NGS-SDK: CONTENTS
+
+language
+
+  The language sub-directory contains "bindings" for supported API languages.
+  Bindings are functions or methods that connect the API to the dispatch
+  interface.
+
+  All of the non-line API methods for C++ are contained in "language/c++".
+  Note that most of the C++ bindings are inlines, and can be found in "ngs/inl".
+
+  Java bindings come in the form of "JNI" (Java Native Interface) C functions.
+
+  Python bindings also come in the form of C functions, and serve the same
+  essential purpose as Java's JNI.
+
+
+dispatch
+
+  The dispatch sub-directory contains code responsible for dispatching API
+  messages to NGS back-end "engines," e.g. the NCBI SRA engine.
+
+  Dispatch code is written natively in C++, but performs the function of
+  relaying messages across a C interface to engine code. This avoids common
+  fragilities that make C++ inappropriate for use in shared libraries.
+
+  The dispatch sub-directory also contains NCBI-specific code that clients can
+  link against to bring in the NCBI SRA or BAM engines. This code is NCBI
+  specific, and does not affect the interface code.
+
+
+adapter
+
+  As mentioned in the "dispatch" section, the conduit between interface and
+  engine uses a C-only polymorphic protocol. While it is possible to implement
+  this directly within an engine, some developers may prefer to use C++. This
+  directory provides C++ base classes that adapt the C protocol to C++ in a safe
+  way.
+
+
+test
+
+  (* ANATOLY CAN PROVIDE INPUT HERE *)
+
diff --git a/ngs-sdk/Makefile b/ngs-sdk/Makefile
new file mode 100644
index 0000000..0ab029a
--- /dev/null
+++ b/ngs-sdk/Makefile
@@ -0,0 +1,48 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# default response to "make"
+default: subtargs
+
+# the sub-targets
+SUBDIRS =    \
+	language \
+	dispatch \
+	adapter  \
+
+SUBTARGS =     \
+	$(SUBDIRS) \
+	sdk-libs   \
+
+include $(CURDIR)/Makefile.rules
+
+sdk-libs: Makefile.config
+	@ $(MAKE) -f Makefile.libs
+
+sdk-libs_cln: Makefile.config
+	@ $(MAKE) -f Makefile.libs clean
+
+sdk-libs_inst: Makefile.config
+	@ $(MAKE) -s -f Makefile.libs
+	@ $(MAKE) -f Makefile.install install
diff --git a/ngs-sdk/Makefile.install b/ngs-sdk/Makefile.install
new file mode 100644
index 0000000..f42deb8
--- /dev/null
+++ b/ngs-sdk/Makefile.install
@@ -0,0 +1,108 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: install
+
+TOP ?= $(CURDIR)
+MODPATH =
+
+include $(TOP)/Makefile.config
+
+#-------------------------------------------------------------------------------
+# install
+# 
+ifeq (linux, $(OS))
+
+LIBRARIES_TO_INSTALL = \
+    ngs-sdk.$(VERSION_SHLX) \
+    ngs-c++.$(VERSION_LIBX) \
+    ngs-adapt-c++.$(VERSION_LIBX) \
+
+LIB_TARGET = $(INST_LIBDIR)$(BITS)
+
+LIBRARIES_WITH_PREFIX = \
+	$(addprefix $(LIB_TARGET)/$(LPFX),$(LIBRARIES_TO_INSTALL))
+
+copylibs: $(LIB_TARGET) $(LIBRARIES_WITH_PREFIX)
+
+copyincludes:
+	@ echo "Installing includes to $(INST_INCDIR)"
+	@ mkdir -p $(INST_INCDIR)
+	@ cp -r $(TOP)/ngs $(INST_INCDIR)/   
+
+copyexamples:
+	@ echo "Installing examples to $(INST_SHAREDIR)"
+	@ mkdir -p $(INST_SHAREDIR)
+	@ cp -r $(TOP)/examples $(INST_SHAREDIR)/
+
+#fake root for debugging
+#uncomment this line and change the test for root ( see under install: ) to succeed:
+#ROOT = ~/root
+
+INCLUDE_SYMLINK = $(ROOT)/usr/include/ngs
+PROFILE_FILE = $(ROOT)/etc/profile.d/ngs-sdk
+
+install: copylibs copyincludes copyexamples
+ifeq (0, $(shell id -u))
+	@ # install symlink to includes 
+	@ echo "Updating $(INCLUDE_SYMLINK)"
+	@ rm -f $(INCLUDE_SYMLINK)
+	@ ln -s $(INST_INCDIR)/ngs $(INCLUDE_SYMLINK)
+	@ #
+	@ echo "Updating $(PROFILE_FILE).[c]sh"
+	@ echo -e \
+"#version $(VERSION)\n"\
+"if ! echo \$$LD_LIBRARY_PATH | /bin/grep -q $(LIB_TARGET)\n"\
+"then export LD_LIBRARY_PATH=$(LIB_TARGET):\$$LD_LIBRARY_PATH\n"\
+"fi\n"\
+"export NGS_LIBDIR=$(LIB_TARGET)\n" \
+        >$(PROFILE_FILE).sh && chmod 644 $(PROFILE_FILE).sh || true;
+	@ echo -e \
+"#version $(VERSION)\n"\
+"echo \$$LD_LIBRARY_PATH | /bin/grep -q $(LIB_TARGET)\n"\
+"if ( \$$status ) setenv LD_LIBRARY_PATH $(LIB_TARGET):\$$LD_LIBRARY_PATH\n"\
+"setenv NGS_LIBDIR $(LIB_TARGET)\n" \
+        >$(PROFILE_FILE).csh && chmod 644 $(PROFILE_FILE).csh || true;
+	@ #TODO: check version of the files above
+	@ #
+	@ echo "Use \$$NGS_LIBDIR in your link commands, e.g.:"
+	@ echo "      ld -L\$$NGS_LIBDIR -lngs-sdk ..."
+else
+	@ #
+	@ echo "Please add $(LIB_TARGET) to your LD_LIBRARY_PATH, e.g.:"
+	@ echo "      export LD_LIBRARY_PATH=$(LIB_TARGET):\$$LD_LIBRARY_PATH"   
+	@ #
+	@ echo "Use $(LIB_TARGET) in your link commands, e.g.:"
+	@ echo "      export NGS_LIBDIR=$(LIB_TARGET)"   
+	@ echo "      ld -L\$$NGS_LIBDIR -lngs-sdk ..."
+endif
+.PHONY: copylibs copyincludes copyexamples
+
+else
+install:
+
+endif
+
+.PHONY: install
+
diff --git a/ngs-sdk/Makefile.libs b/ngs-sdk/Makefile.libs
new file mode 100644
index 0000000..31068d1
--- /dev/null
+++ b/ngs-sdk/Makefile.libs
@@ -0,0 +1,123 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(CURDIR)
+MODPATH =
+
+include $(TOP)/Makefile.config
+
+INTLIBS = \
+
+EXTLIBS =   \
+	ngs-c++ \
+	ngs-sdk
+
+TARGETS =      \
+	$(INTLIBS) \
+	$(EXTLIBS)
+
+all std: $(TARGETS)
+
+clean:
+	@ rm -rf $(OBJDIR)ngs-bind-c++ $(OBJDIR)ngs-disp
+	@ rm -f $(addprefix $(ILIBDIR)/$(LPFX),$(addsuffix *,$(INTLIBS))) \
+			$(addprefix $(LIBDIR)/$(LPFX),$(addsuffix *,$(EXTLIBS)))
+
+#-----------------------------------------------------------------------
+# C++ client library that provides API to any engine
+ngs-c++: $(LIBDIR) $(LIBDIR)/$(LPFX)ngs-c++.$(LIBX)
+
+$(OBJDIR)ngs-bind-c++: $(ILIBDIR)/$(LPFX)ngs-bind-c++.$(LIBX)
+	rm -rf $@
+	mkdir -p $@
+	( cd $@; $(ARX) $^; $(ARLS) $^ | sed -e '/__\.SYMDEF/d' -e 's/^\(..*\)$$/$(subst /,\/,$@)\/\1/' > $@/manifest )
+
+$(OBJDIR)ngs-disp: $(ILIBDIR)/$(LPFX)ngs-disp.$(LIBX)
+	rm -rf $@
+	mkdir -p $@
+	( cd $@; $(ARX) $^; $(ARLS) $^ | sed -e '/__\.SYMDEF/d' -e 's/^\(..*\)$$/$(subst /,\/,$@)\/\1/' > $@/manifest )
+
+$(LIBDIR)/$(LPFX)ngs-c++.$(VERSION_LIBX): $(OBJDIR)ngs-bind-c++ $(OBJDIR)ngs-disp
+	( $(AR) $@ `cat $(addsuffix /manifest,$^)` )
+
+$(LIBDIR)/$(LPFX)ngs-c++.$(MAJVERS_LIBX): $(LIBDIR)/$(LPFX)ngs-c++.$(VERSION_LIBX)
+	rm -f $@
+	ln -s $(notdir $^) $@
+
+$(LIBDIR)/$(LPFX)ngs-c++.$(LIBX): $(LIBDIR)/$(LPFX)ngs-c++.$(MAJVERS_LIBX)
+	rm -f $@
+	ln -s $(notdir $^) $@
+
+#-----------------------------------------------------------------------
+# Java and Python client library that provides language bindings to any engine
+# requires ngs-java.jar for Java
+ngs-sdk: $(LIBDIR) $(LIBDIR)/$(LPFX)ngs-sdk.$(SHLX)
+
+$(OBJDIR)ngs-bind-java: $(ILIBDIR)/$(LPFX)ngs-bind-java.$(LIBX)
+	rm -rf $@
+	mkdir -p $@
+	( cd $@; $(ARX) $^; $(ARLS) $^ | sed -e '/__\.SYMDEF/d' -e 's/^\(..*\)$$/$(subst /,\/,$@)\/\1/' > $@/manifest )
+
+$(OBJDIR)ngs-bind-python: $(ILIBDIR)/$(LPFX)ngs-bind-python.$(LIBX)
+	rm -rf $@
+	mkdir -p $@
+	( cd $@; $(ARX) $^; $(ARLS) $^ | sed -e '/__\.SYMDEF/d' -e 's/^\(..*\)$$/$(subst /,\/,$@)\/\1/' > $@/manifest )
+
+# sub-libraries to link against
+SDK_LIB =        \
+	-L$(ILIBDIR) \
+	-lngs-disp
+
+SDK_XLIBS =                            \
+	$(OBJDIR)ngs-bind-java             \
+	$(OBJDIR)ngs-bind-python
+
+SDK_DEPS =                             \
+	$(SDK_XLIBS)                       \
+	$(ILIBDIR)/$(LPFX)ngs-disp.$(LIBX)
+
+$(LIBDIR)/$(LPFX)ngs-sdk.$(VERSION_SHLX): $(SDK_DEPS)
+	$(LP) $(DBG) $(OPT) -shared -o $@ $(SONAME) `cat $(addsuffix /manifest,$(SDK_XLIBS))` $(SDK_LIB)
+
+$(LIBDIR)/$(LPFX)ngs-sdk.$(MAJVERS_SHLX): $(LIBDIR)/$(LPFX)ngs-sdk.$(VERSION_SHLX)
+	rm -f $@
+	ln -s $(notdir $^) $@
+
+$(LIBDIR)/$(LPFX)ngs-sdk.$(SHLX): $(LIBDIR)/$(LPFX)ngs-sdk.$(MAJVERS_SHLX)
+	rm -f $@
+	ln -s $(notdir $^) $@
+
+# dependent upon internal libraries
+INTERNAL_LIBS =                             \
+	$(ILIBDIR)/$(LPFX)ngs-disp.$(LIBX)      \
+	$(ILIBDIR)/$(LPFX)ngs-bind-c++.$(LIBX)  \
+	$(ILIBDIR)/$(LPFX)ngs-bind-java.$(LIBX) \
+	$(ILIBDIR)/$(LPFX)ngs-bind-python.$(LIBX)
+
+$(INTERNAL_LIBS):
+	@ echo Missing $@. Please run `make`
+	@ false
diff --git a/ngs-sdk/Makefile.rules b/ngs-sdk/Makefile.rules
new file mode 100644
index 0000000..1ac77d3
--- /dev/null
+++ b/ngs-sdk/Makefile.rules
@@ -0,0 +1,72 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+TOP ?= $(CURDIR)
+export TOP
+
+subdirs: $(SUBDIRS)
+
+$(SUBDIRS): Makefile.config
+	@ $(MAKE) -C $@
+
+subtargs: $(SUBTARGS)
+
+# rules for "make clean"
+SUBDIRS_CLN = \
+	$(addsuffix _cln,$(SUBDIRS) test)
+
+$(SUBDIRS_CLN): Makefile.config
+	@ $(MAKE) -s -C $(subst _cln,,$@) clean
+
+SUBTARGS_CLN = \
+	$(addsuffix _cln,$(SUBTARGS) test)
+
+clean: Makefile.config $(SUBTARGS_CLN)
+
+# rules for "make install"
+SUBDIRS_INST = \
+	$(addsuffix _inst,$(SUBDIRS))
+
+$(SUBDIRS_INST): Makefile.config
+	@ $(MAKE) -C $(subst _inst,,$@) install
+
+SUBTARGS_INST = \
+	$(addsuffix _inst,$(SUBTARGS))
+
+install: Makefile.config $(SUBTARGS_INST)
+
+# rule to run tests
+test runtests: Makefile.config default
+	@ $(MAKE) -C test runtests
+
+# rule to run configuration
+Makefile.config: Makefile.config.$(shell perl $(TOP)/os-arch.perl) konfigure.perl
+
+Makefile.config.$(shell perl $(TOP)/os-arch.perl):
+	@echo "*** File '$@' is missing. Please run ./configure"
+	@false
+
+# not real targets
+.PHONY: default subdirs subtargs install clean test runtests \
+	$(SUBTARGS) $(SUBTARGS_CLN) $(SUBTARGS_INST)
diff --git a/ngs-sdk/adapter/AlignmentItf.cpp b/ngs-sdk/adapter/AlignmentItf.cpp
new file mode 100644
index 0000000..d9854fd
--- /dev/null
+++ b/ngs-sdk/adapter/AlignmentItf.cpp
@@ -0,0 +1,442 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/AlignmentItf.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/ErrorMsg.hpp>
+
+#include "ErrBlock.hpp"
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * AlignmentItf
+     */
+
+    AlignmentItf :: AlignmentItf ()
+        : FragmentItf ( & ivt . dad )
+    {
+    }
+
+    bool AlignmentItf :: nextFragment ()
+    {
+        throw ErrorMsg ( "INTERNAL ERROR: nextFragment message on Alignment" );
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_id ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getAlignmentId ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_ref_spec ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReferenceSpec ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    int32_t CC AlignmentItf :: get_map_qual ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            return self -> getMappingQuality ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_ref_bases ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReferenceBases ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_read_group ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReadGroup ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_read_id ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReadId ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_clipped_frag_bases ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getClippedFragmentBases ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_clipped_frag_quals ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getClippedFragmentQualities ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_aligned_frag_bases ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getAlignedFragmentBases ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    bool CC AlignmentItf :: is_primary ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            return self -> isPrimary ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    int64_t CC AlignmentItf :: get_align_pos ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            return self -> getAlignmentPosition ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    uint64_t CC AlignmentItf :: get_align_length ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            return self -> getAlignmentLength ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    bool CC AlignmentItf :: get_is_reversed ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            return self -> getIsReversedOrientation ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return false;
+    }
+
+    int32_t CC AlignmentItf :: get_soft_clip ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err, uint32_t edge )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            return self -> getSoftClip ( edge );
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    uint64_t CC AlignmentItf :: get_template_len ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            return self -> getTemplateLength ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_short_cigar ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err, bool clipped )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getShortCigar ( clipped );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_long_cigar ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err, bool clipped )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getLongCigar ( clipped );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    bool CC AlignmentItf :: has_mate ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            return self -> hasMate ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return false;
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_mate_id ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getMateAlignmentId ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Alignment_v1 * CC AlignmentItf :: get_mate_alignment ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            AlignmentItf * val = self -> getMateAlignment ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC AlignmentItf :: get_mate_ref_spec ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getMateReferenceSpec ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    bool CC AlignmentItf :: get_mate_is_reversed ( const NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const AlignmentItf * self = Self ( iself );
+        try
+        {
+            return self -> getMateIsReversedOrientation ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return false;
+    }
+
+    bool CC AlignmentItf :: next ( NGS_Alignment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        AlignmentItf * self = Self ( iself );
+        try
+        {
+            return self -> nextAlignment ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return false;
+    }
+
+    NGS_Alignment_v1_vt AlignmentItf :: ivt =
+    {
+        {
+            "ngs_adapt::AlignmentItf",
+            "NGS_Alignment_v1",
+            0,
+            & FragmentItf :: ivt . dad
+        },
+
+        get_id,
+        get_ref_spec,
+        get_map_qual,
+        get_ref_bases,
+        get_read_group,
+        get_read_id,
+        get_clipped_frag_bases,
+        get_clipped_frag_quals,
+        get_aligned_frag_bases,
+        is_primary,
+        get_align_pos,
+        get_align_length,
+        get_is_reversed,
+        get_soft_clip,
+        get_template_len,
+        get_short_cigar,
+        get_long_cigar,
+        has_mate,
+        get_mate_id,
+        get_mate_alignment,
+        get_mate_ref_spec,
+        get_mate_is_reversed,
+        next
+    };
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/ErrBlock.cpp b/ngs-sdk/adapter/ErrBlock.cpp
new file mode 100644
index 0000000..bff6cea
--- /dev/null
+++ b/ngs-sdk/adapter/ErrBlock.cpp
@@ -0,0 +1,106 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "ErrBlock.hpp"
+#include <string.h>
+
+namespace ngs_adapt
+{
+
+    /* Throw
+     *  capture error state from a C++ exception
+     *
+     *  NB - this doesn't actually "throw" anything, but rather
+     *  sets state within "self" such that an exception is thrown
+     *  upon return from dispatch
+     */
+    void ErrBlockThrow ( NGS_ErrBlock_v1 * self, uint32_t type, const ErrorMsg & x )
+    {
+        const char * what = x . what ();
+        if ( what == 0 )
+            what = "BAD ERROR MESSAGE";
+
+        strncpy ( self -> msg, what, sizeof self -> msg );
+        self -> msg [ sizeof self -> msg - 1 ] = 0;
+
+        self -> xtype = type <= xt_runtime ? type : xt_runtime;
+    }
+
+    void ErrBlockThrow ( NGS_ErrBlock_v1 * self, uint32_t type, const :: std :: exception & x )
+    {
+        const char * what = x . what ();
+        if ( what == 0 )
+            what = "BAD ERROR MESSAGE";
+
+        strncpy ( self -> msg, what, sizeof self -> msg );
+        self -> msg [ sizeof self -> msg - 1 ] = 0;
+
+        self -> xtype = type <= xt_runtime ? type : xt_runtime;
+    }
+
+    /* ThrowUnknown
+     *  capture error state from an unknown C++ exception
+     *
+     *  NB - this doesn't actually "throw" anything, but rather
+     *  sets state within "self" such that an exception is thrown
+     *  upon return from dispatch
+     */
+    void ErrBlockThrowUnknown ( NGS_ErrBlock_v1 * self )
+    {
+        strncpy ( self -> msg, "unknown error", sizeof self -> msg );
+        self -> xtype = xt_runtime;
+    }
+
+    /* ErrBlockExceptionHandler
+     *  fill out ErrBlock in the case of any exception has occured
+     *
+     *  NB - this function is only to be called from within another
+     *  (outer) catch-block (usually - from "catch (...)"), i.e.
+     *  it handles an exception that has been already thrown by the
+     *  caller
+     */
+    void ErrBlockHandleException ( NGS_ErrBlock_v1 * err )
+    {
+        try
+        {
+            throw;
+        }
+        catch ( ErrorMsg & x )
+        {
+            ErrBlockThrow ( err, xt_error_msg, x );
+        }
+        catch ( :: std :: exception & x )
+        {
+            ErrBlockThrow ( err, xt_runtime, x );
+        }
+        catch ( ... )
+        {
+            ErrBlockThrowUnknown ( err );
+        }
+    }
+
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/ErrBlock.hpp b/ngs-sdk/adapter/ErrBlock.hpp
new file mode 100644
index 0000000..29ae7e3
--- /dev/null
+++ b/ngs-sdk/adapter/ErrBlock.hpp
@@ -0,0 +1,73 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_err_block_
+#define _hpp_ngs_adapt_err_block_
+
+#ifndef _hpp_ngs_adapt_error_msg_
+#include <ngs/adapter/ErrorMsg.hpp>
+#endif
+
+#ifndef _h_ngs_itf_err_block_
+#include <ngs/itf/ErrBlock.h>
+#endif
+
+namespace ngs_adapt
+{
+
+    /* Throw
+     *  capture error state from a C++ exception
+     *
+     *  NB - this doesn't actually "throw" anything, but rather
+     *  sets state within "self" such that an exception is thrown
+     *  upon return from dispatch
+     */
+    void ErrBlockThrow ( NGS_ErrBlock_v1 * self, uint32_t type, const ErrorMsg & x );
+    void ErrBlockThrow ( NGS_ErrBlock_v1 * self, uint32_t type, const :: std :: exception & x );
+
+    /* ThrowUnknown
+     *  capture error state from an unknown C++ exception
+     *
+     *  NB - this doesn't actually "throw" anything, but rather
+     *  sets state within "self" such that an exception is thrown
+     *  upon return from dispatch
+     */
+    void ErrBlockThrowUnknown ( NGS_ErrBlock_v1 * self );
+
+
+    /* ErrBlockExceptionHandler
+     *  fill out ErrBlock in the case of any exception has occured
+     *
+     *  NB - this function is only to be called from within another
+     *  (outer) catch-block (usually - from "catch (...)"), i.e.
+     *  it handles an exception that has been already thrown by the
+     *  caller
+     */
+    void ErrBlockHandleException ( NGS_ErrBlock_v1 * err );
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_err_block_
diff --git a/ngs-sdk/adapter/ErrorMsg.cpp b/ngs-sdk/adapter/ErrorMsg.cpp
new file mode 100644
index 0000000..adbb570
--- /dev/null
+++ b/ngs-sdk/adapter/ErrorMsg.cpp
@@ -0,0 +1,97 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/ErrorMsg.hpp>
+
+namespace ngs_adapt
+{
+    /*----------------------------------------------------------------------
+     * ErrorMsg
+     *  a generic NGS error class
+     *  holds a message describing what happened
+     */
+
+    /* what ( for C++ )
+     *  what went wrong
+     */
+    const char * ErrorMsg :: what () const
+        throw ()
+    {
+        return msg . c_str ();
+    }
+
+    /* toMessage ( for Java )
+     *  returns the detailed message
+     */
+    const :: std :: string & ErrorMsg :: toMessage () const
+        throw ()
+    {
+        return msg;
+    }
+
+    /* toString ( for Java )
+     *  returns a short description
+     */
+    const :: std :: string & ErrorMsg :: toString () const
+        throw ()
+    {
+        return msg;
+    }
+
+    /* constructors
+     *  various means of constructing
+     */        
+    ErrorMsg :: ErrorMsg ()
+        throw ()
+    {
+    }
+    
+    ErrorMsg :: ErrorMsg ( const :: std :: string & message )
+            throw ()
+        : msg ( message )
+    {
+    }
+
+    ErrorMsg :: ErrorMsg ( const ErrorMsg & obj )
+            throw ()
+        : msg ( obj . msg )
+    {
+    }
+
+    ErrorMsg & ErrorMsg :: operator = ( const ErrorMsg & obj )
+        throw ()
+    {
+        this -> msg = obj . msg;
+        return * this;
+    }
+
+
+    ErrorMsg :: ~ ErrorMsg ()
+        throw ()
+    {
+    }
+
+}
diff --git a/ngs-sdk/adapter/FragmentItf.cpp b/ngs-sdk/adapter/FragmentItf.cpp
new file mode 100644
index 0000000..62a7204
--- /dev/null
+++ b/ngs-sdk/adapter/FragmentItf.cpp
@@ -0,0 +1,125 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/FragmentItf.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/ErrorMsg.hpp>
+
+#include "ErrBlock.hpp"
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * FragmentItf
+     */
+
+    FragmentItf :: FragmentItf ( const NGS_VTable * vt )
+        : Refcount < FragmentItf, NGS_Fragment_v1 > ( vt )
+    {
+    }
+
+    NGS_String_v1 * CC FragmentItf :: get_id ( const NGS_Fragment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const FragmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getFragmentId ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC FragmentItf :: get_bases ( const NGS_Fragment_v1 * iself, NGS_ErrBlock_v1 * err,
+            uint64_t offset, uint64_t length )
+    {
+        const FragmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getFragmentBases ( offset, length );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC FragmentItf :: get_quals ( const NGS_Fragment_v1 * iself, NGS_ErrBlock_v1 * err,
+            uint64_t offset, uint64_t length )
+    {
+        const FragmentItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getFragmentQualities ( offset, length );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    bool FragmentItf :: next ( NGS_Fragment_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        FragmentItf * self = Self ( iself );
+        try
+        {
+            return self -> nextFragment ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return false;
+    }
+
+    NGS_Fragment_v1_vt FragmentItf :: ivt =
+    {
+        {
+            "ngs_adapt::FragmentItf",
+            "NGS_Fragment_v1",
+            0,
+            & OpaqueRefcount :: ivt . dad
+        },
+
+        get_id,
+        get_bases,
+        get_quals,
+        next
+    };
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/Makefile b/ngs-sdk/adapter/Makefile
new file mode 100644
index 0000000..9079055
--- /dev/null
+++ b/ngs-sdk/adapter/Makefile
@@ -0,0 +1,78 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ..)
+include $(TOP)/Makefile.config
+
+SRCINC += -I$(SRCDIR)/$(OSINC)/$(ARCH) -I$(SRCDIR)/$(OSINC)
+
+INTLIBS = \
+
+EXTLIBS = \
+	ngs-adapt-c++
+
+TARGETS =      \
+	$(INTLIBS) \
+	$(EXTLIBS)
+
+all std: $(TARGETS)
+
+clean:
+	rm -rf $(LIBDIR)/$(LPFX)ngs-adapt* $(OBJDIR)
+
+.PHONY: default all std $(TARGETS)
+
+ngs-adapt-c++: $(LIBDIR) $(OBJDIR) $(LIBDIR)/$(LPFX)ngs-adapt-c++.$(LIBX)
+
+ADAPT_SRC =           \
+	ReadCollectionItf \
+	PileupItf         \
+	PileupEventItf    \
+	ReferenceItf      \
+	AlignmentItf      \
+	ReadGroupItf      \
+	ReadItf           \
+	FragmentItf       \
+	StatisticsItf     \
+	StringItf         \
+	Refcount          \
+	ErrorMsg          \
+	ErrBlock
+
+ADAPT_OBJ = \
+	$(addprefix $(OBJDIR)/,$(addsuffix .$(LOBX),$(ADAPT_SRC)))
+
+$(LIBDIR)/$(LPFX)ngs-adapt-c++.$(VERSION_LIBX): $(ADAPT_OBJ)
+	$(AR) $@ $^
+    
+$(LIBDIR)/$(LPFX)ngs-adapt-c++.$(MAJVERS_LIBX): $(LIBDIR)/$(LPFX)ngs-adapt-c++.$(VERSION_LIBX)
+	rm -f $@
+	ln -s $(notdir $^) $@
+
+$(LIBDIR)/$(LPFX)ngs-adapt-c++.$(LIBX): $(LIBDIR)/$(LPFX)ngs-adapt-c++.$(MAJVERS_LIBX)
+	rm -f $@
+	ln -s $(notdir $^) $@  
\ No newline at end of file
diff --git a/ngs-sdk/adapter/PileupEventItf.cpp b/ngs-sdk/adapter/PileupEventItf.cpp
new file mode 100644
index 0000000..8017e39
--- /dev/null
+++ b/ngs-sdk/adapter/PileupEventItf.cpp
@@ -0,0 +1,302 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/PileupEventItf.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/AlignmentItf.hpp>
+#include <ngs/adapter/ErrorMsg.hpp>
+
+#include "ErrBlock.hpp"
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * PileupEventItf
+     */
+
+    PileupEventItf :: PileupEventItf ()
+        : Refcount < PileupEventItf, NGS_PileupEvent_v1 > ( & ivt . dad )
+    {
+    }
+
+    NGS_String_v1 * CC PileupEventItf :: get_ref_spec ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReferenceSpec ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    int64_t CC PileupEventItf :: get_ref_pos ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            return self -> getReferencePosition ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    int32_t CC PileupEventItf :: get_map_qual ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            return self -> getMappingQuality ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC PileupEventItf :: get_align_id ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getAlignmentId ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Alignment_v1 * CC PileupEventItf :: get_alignment ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            AlignmentItf * val = self -> getAlignment ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    int64_t CC PileupEventItf :: get_align_pos ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            return self -> getAlignmentPosition ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    int64_t CC PileupEventItf :: get_first_align_pos ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            return self -> getFirstAlignmentPosition ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    int64_t CC PileupEventItf :: get_last_align_pos ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            return self -> getLastAlignmentPosition ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    uint32_t CC PileupEventItf :: get_event_type ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            return self -> getEventType ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    char CC PileupEventItf :: get_align_base ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            return self -> getAlignmentBase ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    char CC PileupEventItf :: get_align_qual ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            return self -> getAlignmentQuality ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC PileupEventItf :: get_ins_bases ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getInsertionBases ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC PileupEventItf :: get_ins_quals ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getInsertionQualities ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    uint32_t CC PileupEventItf :: get_del_count ( const NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupEventItf * self = Self ( iself );
+        try
+        {
+            return self -> getDeletionCount ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    bool PileupEventItf :: next ( NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        PileupEventItf * self = Self ( iself );
+        try
+        {
+            return self -> nextPileupEvent ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return false;
+    }
+
+    NGS_PileupEvent_v1_vt PileupEventItf :: ivt =
+    {
+        {
+            "ngs_adapt::PileupEventItf",
+            "NGS_PileupEvent_v1",
+            0,
+            & OpaqueRefcount :: ivt . dad
+        },
+
+        get_ref_spec,
+        get_ref_pos,
+        get_map_qual,
+        get_align_id,
+        get_alignment,
+        get_align_pos,
+        get_first_align_pos,
+        get_last_align_pos,
+        get_event_type,
+        get_align_base,
+        get_align_qual,
+        get_ins_bases,
+        get_ins_quals,
+        get_del_count,
+        next
+    };
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/PileupItf.cpp b/ngs-sdk/adapter/PileupItf.cpp
new file mode 100644
index 0000000..4622b55
--- /dev/null
+++ b/ngs-sdk/adapter/PileupItf.cpp
@@ -0,0 +1,139 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/PileupItf.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/PileupEventItf.hpp>
+#include <ngs/adapter/ErrorMsg.hpp>
+
+#include "ErrBlock.hpp"
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * PileupItf
+     */
+
+    PileupItf :: PileupItf ()
+        : Refcount < PileupItf, NGS_Pileup_v1 > ( & ivt . dad )
+    {
+    }
+
+    NGS_String_v1 * CC PileupItf :: get_ref_spec ( const NGS_Pileup_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReferenceSpec ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    int64_t CC PileupItf :: get_ref_pos ( const NGS_Pileup_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupItf * self = Self ( iself );
+        try
+        {
+            return self -> getReferencePosition ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_PileupEvent_v1 * CC PileupItf :: get_pileup_events ( const NGS_Pileup_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupItf * self = Self ( iself );
+        try
+        {
+            PileupEventItf * val = self -> getPileupEvents ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    uint32_t CC PileupItf :: get_pileup_depth ( const NGS_Pileup_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const PileupItf * self = Self ( iself );
+        try
+        {
+            return self -> getPileupDepth ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    bool PileupItf :: next ( NGS_Pileup_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        PileupItf * self = Self ( iself );
+        try
+        {
+            return self -> nextPileup ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return false;
+    }
+
+    NGS_Pileup_v1_vt PileupItf :: ivt =
+    {
+        {
+            "ngs_adapt::PileupItf",
+            "NGS_Pileup_v1",
+            0,
+            & OpaqueRefcount :: ivt . dad
+        },
+
+        get_ref_spec,
+        get_ref_pos,
+        get_pileup_events,
+        get_pileup_depth,
+        next
+    };
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/ReadCollectionItf.cpp b/ngs-sdk/adapter/ReadCollectionItf.cpp
new file mode 100644
index 0000000..d75aeb9
--- /dev/null
+++ b/ngs-sdk/adapter/ReadCollectionItf.cpp
@@ -0,0 +1,290 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/ReadCollectionItf.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/ReadGroupItf.hpp>
+#include <ngs/adapter/ReferenceItf.hpp>
+#include <ngs/adapter/AlignmentItf.hpp>
+#include <ngs/adapter/ReadItf.hpp>
+#include <ngs/adapter/ErrorMsg.hpp>
+
+#include "ErrBlock.hpp"
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * ReadCollectionItf
+     */
+
+    ReadCollectionItf :: ReadCollectionItf ()
+        : Refcount < ReadCollectionItf, NGS_ReadCollection_v1 > ( & ivt . dad )
+    {
+    }
+
+
+    NGS_String_v1 * CC ReadCollectionItf :: get_name ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getName ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_ReadGroup_v1 * CC ReadCollectionItf :: get_read_groups ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            ReadGroupItf * val = self -> getReadGroups ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_ReadGroup_v1 * CC ReadCollectionItf :: get_read_group ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err,
+            const char * spec )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            ReadGroupItf * val = self -> getReadGroup ( spec );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Reference_v1 * CC ReadCollectionItf :: get_references ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            ReferenceItf * val = self -> getReferences ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Reference_v1 * CC ReadCollectionItf :: get_reference ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err,
+            const char * spec )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            ReferenceItf * val = self -> getReference ( spec );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Alignment_v1 * CC ReadCollectionItf :: get_alignment ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err,
+            const char * alignmentId )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            AlignmentItf * val = self -> getAlignment ( alignmentId );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Alignment_v1 * CC ReadCollectionItf :: get_alignments ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err,
+            bool wants_primary, bool wants_secondary )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            AlignmentItf * val = self -> getAlignments ( wants_primary, wants_secondary );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    uint64_t CC ReadCollectionItf :: get_align_count ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err,
+            bool wants_primary, bool wants_secondary )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            return self -> getAlignmentCount ( wants_primary, wants_secondary );
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Alignment_v1 * CC ReadCollectionItf :: get_align_range ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err,
+            uint64_t first, uint64_t count, bool wants_primary, bool wants_secondary )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            AlignmentItf * val = self -> getAlignmentRange ( first, count, wants_primary, wants_secondary );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Read_v1 * CC ReadCollectionItf :: get_read ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err,
+            const char * readId )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            ReadItf * val = self -> getRead ( readId );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Read_v1 * CC ReadCollectionItf :: get_reads ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err,
+            bool wants_full, bool wants_partial, bool wants_unaligned )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            ReadItf * val = self -> getReads ( wants_full, wants_partial, wants_unaligned );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    uint64_t CC ReadCollectionItf :: get_read_count ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err,
+            bool wants_full, bool wants_partial, bool wants_unaligned )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            return self -> getReadCount ( wants_full, wants_partial, wants_unaligned );
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Read_v1 * CC ReadCollectionItf :: get_read_range ( const NGS_ReadCollection_v1 * iself, NGS_ErrBlock_v1 * err,
+            uint64_t first, uint64_t count, bool wants_full, bool wants_partial, bool wants_unaligned )
+    {
+        const ReadCollectionItf * self = Self ( iself );
+        try
+        {
+            ReadItf * val = self -> getReadRange ( first, count, wants_full, wants_partial, wants_unaligned );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_ReadCollection_v1_vt ReadCollectionItf :: ivt =
+    {
+        {
+            "ngs_adapt::ReadCollectionItf",
+            "NGS_ReadCollection_v1",
+            0,
+            & OpaqueRefcount :: ivt . dad
+        },
+
+        get_name,
+        get_read_groups,
+        get_read_group,
+        get_references,
+        get_reference,
+        get_alignment,
+        get_alignments,
+        get_align_count,
+        get_align_range,
+        get_read,
+        get_reads,
+        get_read_count,
+        get_read_range
+    };
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/ReadGroupItf.cpp b/ngs-sdk/adapter/ReadGroupItf.cpp
new file mode 100644
index 0000000..b3264fc
--- /dev/null
+++ b/ngs-sdk/adapter/ReadGroupItf.cpp
@@ -0,0 +1,107 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/ReadGroupItf.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/StatisticsItf.hpp>
+#include <ngs/adapter/ErrorMsg.hpp>
+
+#include "ErrBlock.hpp"
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * ReadGroupItf
+     */
+
+    ReadGroupItf :: ReadGroupItf ()
+        : Refcount < ReadGroupItf, NGS_ReadGroup_v1 > ( & ivt . dad )
+    {
+    }
+
+    NGS_String_v1 * CC ReadGroupItf :: get_name ( const NGS_ReadGroup_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReadGroupItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getName ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Statistics_v1 * CC ReadGroupItf :: get_stats ( const NGS_ReadGroup_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReadGroupItf * self = Self ( iself );
+        try
+        {
+            StatisticsItf * val = self -> getStatistics ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    bool CC ReadGroupItf :: next ( NGS_ReadGroup_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        ReadGroupItf * self = Self ( iself );
+        try
+        {
+            return self -> nextReadGroup ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return false;
+    }
+
+    NGS_ReadGroup_v1_vt ReadGroupItf :: ivt =
+    {
+        {
+            "ngs_adapt::ReadGroupItf",
+            "NGS_ReadGroup_v1",
+            0,
+            & OpaqueRefcount :: ivt . dad
+        },
+
+        get_name,
+        get_stats,
+        next
+    };
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/ReadItf.cpp b/ngs-sdk/adapter/ReadItf.cpp
new file mode 100644
index 0000000..fedcb66
--- /dev/null
+++ b/ngs-sdk/adapter/ReadItf.cpp
@@ -0,0 +1,189 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/ReadItf.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/ErrorMsg.hpp>
+
+#include "ErrBlock.hpp"
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * ReadItf
+     */
+
+    ReadItf :: ReadItf ()
+        : FragmentItf ( & ivt . dad )
+    {
+    }
+
+    NGS_String_v1 * CC ReadItf :: get_id ( const NGS_Read_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReadItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReadId ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    uint32_t CC ReadItf :: get_num_frags ( const NGS_Read_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReadItf * self = Self ( iself );
+        try
+        {
+            return self -> getNumFragments ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    uint32_t CC ReadItf :: get_category ( const NGS_Read_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReadItf * self = Self ( iself );
+        try
+        {
+            return self -> getReadCategory ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC ReadItf :: get_read_group ( const NGS_Read_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReadItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReadGroup ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC ReadItf :: get_name ( const NGS_Read_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReadItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReadName ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC ReadItf :: get_bases ( const NGS_Read_v1 * iself, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length )
+    {
+        const ReadItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReadBases ( offset, length );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC ReadItf :: get_quals ( const NGS_Read_v1 * iself, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length )
+    {
+        const ReadItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReadQualities ( offset, length );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    bool CC ReadItf :: next ( NGS_Read_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        ReadItf * self = Self ( iself );
+        try
+        {
+            return self -> nextRead ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return false;
+    }
+
+    NGS_Read_v1_vt ReadItf :: ivt =
+    {
+        {
+            "ngs_adapt::ReadItf",
+            "NGS_Read_v1",
+            0,
+            & FragmentItf :: ivt . dad
+        },
+
+        get_id,
+        get_num_frags,
+        get_category,
+        get_read_group,
+        get_name,
+        get_bases,
+        get_quals,
+        next
+    };
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/Refcount.cpp b/ngs-sdk/adapter/Refcount.cpp
new file mode 100644
index 0000000..1792489
--- /dev/null
+++ b/ngs-sdk/adapter/Refcount.cpp
@@ -0,0 +1,135 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/Refcount.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/ErrorMsg.hpp>
+
+#include "ErrBlock.hpp"
+
+#include <limits.h>
+
+#include "atomic32.h"
+
+namespace ngs_adapt
+{
+    /*----------------------------------------------------------------------
+     * OpaqueRefcount
+     */
+
+    OpaqueRefcount :: ~OpaqueRefcount ()
+    {
+	}
+  
+    void OpaqueRefcount :: Release ()
+    {
+        int result = atomic32_read_and_add ( & refcount, -1 );
+        switch ( result )
+        {
+        case 1:
+            // the object should be collected
+            delete this;
+            break;
+
+        case 0:
+            // this is an exceptional case
+            atomic32_set ( & refcount, 0 );
+            throw ErrorMsg ( "releasing a zombie object" );
+
+        default:
+            // should be positive
+            assert ( result > 0 ); 
+        }
+    }
+
+    void * OpaqueRefcount :: Duplicate () const
+    {
+        int prior = atomic32_read_and_add_gt ( & refcount, 1, 0 );
+        if ( prior <= 0 )
+            throw ErrorMsg ( "attempt to duplicate a zombie object" );
+
+        if ( prior == INT_MAX )
+        {
+            atomic32_dec ( & refcount );
+            throw ErrorMsg ( "too many references to object" );
+        }
+
+        return ( void* ) this;
+    }
+
+    OpaqueRefcount :: OpaqueRefcount ( const OpaqueRefcount & obj )
+    {
+        cobj = obj . cobj;
+        // TBD - should we be copying the refcount?
+        atomic32_set ( & refcount, 1 );
+    }
+
+    OpaqueRefcount :: OpaqueRefcount ( const NGS_VTable * vt )
+    {
+        cobj . vt = vt;
+        atomic32_set ( & refcount, 1 );
+    }
+
+    void CC OpaqueRefcount :: release ( NGS_Refcount_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        OpaqueRefcount * self = static_cast < OpaqueRefcount* > ( offset_cobj ( ( void* ) iself ) );
+        try
+        {
+            self -> Release ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+    }
+
+    void * CC OpaqueRefcount :: duplicate ( const NGS_Refcount_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const OpaqueRefcount * self = static_cast < const OpaqueRefcount* > ( offset_cobj ( ( const void* ) iself ) );
+        try
+        {
+            OpaqueRefcount * obj = ( OpaqueRefcount* ) self -> Duplicate ();
+            return & obj -> cobj;
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+		return 0;
+    }
+
+    NGS_Refcount_v1_vt OpaqueRefcount :: ivt =
+    {
+        {
+            "ngs_adapt::OpaqueRefcount",
+            "NGS_Refcount_v1"
+        },
+
+        release,
+        duplicate
+    };
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/ReferenceItf.cpp b/ngs-sdk/adapter/ReferenceItf.cpp
new file mode 100644
index 0000000..4b75e25
--- /dev/null
+++ b/ngs-sdk/adapter/ReferenceItf.cpp
@@ -0,0 +1,267 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/ReferenceItf.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/StatisticsItf.hpp>
+#include <ngs/adapter/AlignmentItf.hpp>
+#include <ngs/adapter/PileupItf.hpp>
+#include <ngs/adapter/ErrorMsg.hpp>
+
+#include "ErrBlock.hpp"
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * ReferenceItf
+     */
+
+    ReferenceItf :: ReferenceItf ()
+        : Refcount < ReferenceItf, NGS_Reference_v1 > ( & ivt . dad )
+    {
+    }
+
+    NGS_String_v1 * CC ReferenceItf :: get_cmn_name ( const NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReferenceItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getCommonName ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC ReferenceItf :: get_canon_name ( const NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReferenceItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getCanonicalName ();
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    bool CC ReferenceItf :: is_circular ( const NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReferenceItf * self = Self ( iself );
+        try
+        {
+            return self -> getIsCircular ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    uint64_t CC ReferenceItf :: get_length ( const NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const ReferenceItf * self = Self ( iself );
+        try
+        {
+            return self -> getLength ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC ReferenceItf :: get_ref_bases ( const NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err,
+            uint64_t offset, uint64_t length )
+    {
+        const ReferenceItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReferenceBases ( offset, length );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC ReferenceItf :: get_ref_chunk ( const NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err,
+            uint64_t offset, uint64_t length )
+    {
+        const ReferenceItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getReferenceChunk ( offset, length );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Alignment_v1 * CC ReferenceItf :: get_alignment ( const NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err,
+            const char * alignmentId )
+    {
+        const ReferenceItf * self = Self ( iself );
+        try
+        {
+            AlignmentItf * val = self -> getAlignment ( alignmentId );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Alignment_v1 * CC ReferenceItf :: get_alignments ( const NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err,
+                                           bool wants_primary, bool wants_secondary )
+    {
+        const ReferenceItf * self = Self ( iself );
+        try
+        {
+            AlignmentItf * val = self -> getAlignments ( wants_primary, wants_secondary );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Alignment_v1 * CC ReferenceItf :: get_align_slice ( const NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err,
+                                            int64_t start, uint64_t length, bool wants_primary, bool wants_secondary )
+    {
+        const ReferenceItf * self = Self ( iself );
+        try
+        {
+            AlignmentItf * val = self -> getAlignmentSlice ( start, length, wants_primary, wants_secondary );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Pileup_v1 * CC ReferenceItf :: get_pileups ( const NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err,
+                                     bool wants_primary, bool wants_secondary )
+    {
+        const ReferenceItf * self = Self ( iself );
+        try
+        {
+            PileupItf * val = self -> getPileups ( wants_primary, wants_secondary );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Pileup_v1 * CC ReferenceItf :: get_pileup_slice ( const NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err,
+                                          int64_t start, uint64_t length, bool wants_primary, bool wants_secondary )
+    {
+        const ReferenceItf * self = Self ( iself );
+        try
+        {
+            PileupItf * val = self -> getPileupSlice ( start, length, wants_primary, wants_secondary );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    bool CC ReferenceItf :: next ( NGS_Reference_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        ReferenceItf * self = Self ( iself );
+        try
+        {
+            return self -> nextReference ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return false;
+    }
+
+    NGS_Reference_v1_vt ReferenceItf :: ivt =
+    {
+        {
+            "ngs_adapt::ReferenceItf",
+            "NGS_Reference_v1",
+            0,
+            & OpaqueRefcount :: ivt . dad
+        },
+
+        get_cmn_name,
+        get_canon_name,
+        is_circular,
+        get_length,
+        get_ref_bases,
+        get_ref_chunk,
+        get_alignment,
+        get_alignments,
+        get_align_slice,
+        get_pileups,
+        get_pileup_slice,
+        next
+    };
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/StatisticsItf.cpp b/ngs-sdk/adapter/StatisticsItf.cpp
new file mode 100644
index 0000000..6997526
--- /dev/null
+++ b/ngs-sdk/adapter/StatisticsItf.cpp
@@ -0,0 +1,154 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/StatisticsItf.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/ErrorMsg.hpp>
+
+#include "ErrBlock.hpp"
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * StatisticsItf
+     */
+
+    StatisticsItf :: StatisticsItf ()
+        : Refcount < StatisticsItf, NGS_Statistics_v1 > ( & ivt . dad )
+    {
+    }
+
+    uint32_t CC StatisticsItf :: get_type ( const NGS_Statistics_v1 * iself, NGS_ErrBlock_v1 * err, const char * path )
+    {
+        const StatisticsItf * self = Self ( iself );
+        try
+        {
+            return self -> getValueType ( path );
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC StatisticsItf :: as_string ( const NGS_Statistics_v1 * iself, NGS_ErrBlock_v1 * err, const char * path )
+    {
+        const StatisticsItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> getAsString ( path );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    int64_t CC StatisticsItf :: as_I64 ( const NGS_Statistics_v1 * iself, NGS_ErrBlock_v1 * err, const char * path )
+    {
+        const StatisticsItf * self = Self ( iself );
+        try
+        {
+            return self -> getAsI64 ( path );
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    uint64_t CC StatisticsItf :: as_U64 ( const NGS_Statistics_v1 * iself, NGS_ErrBlock_v1 * err, const char * path )
+    {
+        const StatisticsItf * self = Self ( iself );
+        try
+        {
+            return self -> getAsU64 ( path );
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    double CC StatisticsItf :: as_F64 ( const NGS_Statistics_v1 * iself, NGS_ErrBlock_v1 * err, const char * path )
+    {
+        const StatisticsItf * self = Self ( iself );
+        try
+        {
+            return self -> getAsDouble ( path );
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0.0;
+    }
+
+    NGS_String_v1 * CC StatisticsItf :: next_path ( const NGS_Statistics_v1 * iself, NGS_ErrBlock_v1 * err, const char * path )
+    {
+        const StatisticsItf * self = Self ( iself );
+        try
+        {
+            StringItf * val = self -> nextPath ( path );
+            return val -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_Statistics_v1_vt StatisticsItf :: ivt =
+    {
+        {
+            "ngs_adapt::StatisticsItf",
+            "NGS_Statistics_v1",
+            0,
+            & OpaqueRefcount :: ivt . dad
+        },
+
+        get_type,
+        as_string,
+        as_I64,
+        as_U64,
+        as_F64,
+        next_path
+    };
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/StringItf.cpp b/ngs-sdk/adapter/StringItf.cpp
new file mode 100644
index 0000000..13a40a4
--- /dev/null
+++ b/ngs-sdk/adapter/StringItf.cpp
@@ -0,0 +1,146 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/ErrorMsg.hpp>
+
+#include "ErrBlock.hpp"
+
+namespace ngs_adapt
+{
+    /*----------------------------------------------------------------------
+     * StringItf
+     *  a simple reference to textual data
+     *  main purpose is to avoid copying
+     *  provides a cast operator to create a language-specific String
+     */
+
+    /* data
+     *  return character string
+     *  NOT necessarily NUL-terminated
+     */
+    const char * StringItf :: data () const
+    {
+        return str;
+    }
+
+    /* size
+     *   return size of string in bytes
+     */
+    size_t StringItf :: size () const
+    {
+        return sz;
+    }
+
+    /* substr
+     *  create a substring of the original
+     *  almost certainly NOT NUL-terminated
+     *  "offset" is zero-based
+     */
+    StringItf * StringItf :: substr ( size_t offset, size_t size ) const
+    {
+		return 0;
+    }
+
+    // C++ support
+    StringItf :: StringItf ( const char * data, size_t size )
+        : Refcount < StringItf, NGS_String_v1 > ( & ivt . dad )
+        , str ( data )
+        , sz ( size )
+    {
+        assert ( sz == 0 || str != 0 );
+    }
+
+    StringItf :: ~ StringItf ()
+    {
+        str = "<zombie-string>";
+        sz = 0;
+    }
+
+    const char * CC StringItf :: data_dispatch ( const NGS_String_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const StringItf * self = Self ( iself );
+        try
+        {
+            return self -> data ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return "";
+    }
+
+    size_t CC StringItf :: size_dispatch ( const NGS_String_v1 * iself, NGS_ErrBlock_v1 * err )
+    {
+        const StringItf * self = Self ( iself );
+        try
+        {
+            return self -> size ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+    NGS_String_v1 * CC StringItf :: substr_dispatch ( const NGS_String_v1 * iself, NGS_ErrBlock_v1 * err,
+            size_t offset, size_t size )
+    {
+        const StringItf * self = Self ( iself );
+        try
+        {
+            StringItf * sub = self -> substr ( offset, size );
+            return sub -> Cast ();
+        }
+        catch ( ... )
+        {
+            ErrBlockHandleException ( err );
+        }
+
+        return 0;
+    }
+
+
+    NGS_String_v1_vt StringItf :: ivt =
+    {
+        {
+            "ngs_adapt::StringItf",
+            "NGS_String_v1",
+            0,
+            & OpaqueRefcount :: ivt . dad
+        },
+
+        data_dispatch,
+        size_dispatch,
+        substr_dispatch
+    };
+
+
+} // namespace ngs_adapt
diff --git a/ngs-sdk/adapter/unix/i386/atomic32.h b/ngs-sdk/adapter/unix/i386/atomic32.h
new file mode 100644
index 0000000..506c5c6
--- /dev/null
+++ b/ngs-sdk/adapter/unix/i386/atomic32.h
@@ -0,0 +1,104 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_engine_atomic32_
+#define _h_ngs_engine_atomic32_
+
+#ifndef _h_ngs_adapter_defs_
+#include <ngs/adapter/defs.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* int atomic32_read ( const atomic32_t *v ); */
+#define atomic32_read( v ) \
+    ( ( v ) -> counter )
+
+/* void atomic32_set ( atomic32_t *v, int i ); */
+#define atomic32_set( v, i ) \
+    ( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
+
+/* add to v -> counter and return the prior value */
+static __inline__ int atomic32_read_and_add ( atomic32_t *v, int i )
+{
+    int rtn;
+    __asm__ __volatile__
+    (
+        "push %%ebx;"
+        "mov (%%ecx), %%eax;"
+        "mov %%edx, %%ebx;"
+        "add %%eax, %%ebx;"
+        "lock;"
+        "cmpxchg %%ebx, (%%ecx);"
+        "jne .-8;"
+        "pop %%ebx"
+        : "=a" ( rtn ), "=c" ( v )
+        : "c" ( v ), "d" ( i )
+    );
+    return rtn;
+}
+
+static __inline__ void atomic32_dec ( atomic32_t *v )
+{
+    __asm__ __volatile__
+    (
+        "lock;"
+        "decl %0"
+        :"=m" (v->counter)
+        :"m" (v->counter)
+    );
+}
+
+static __inline__
+int atomic32_read_and_add_gt ( atomic32_t *v, int i, int t )
+{
+    int rtn;
+    __asm__ __volatile__
+    (
+        "push %%ebx;"
+        "mov (%%ecx), %%eax;"
+        "cmp %%esi, %%eax;"
+        "mov %%edx, %%ebx;"
+        "jle .+10;"
+        "add %%eax, %%ebx;"
+        "lock;"
+        "cmpxchg %%ebx, (%%ecx);"
+        "jne .-12;"
+        "pop %%ebx"
+        : "=a" ( rtn ), "=c" ( v )
+        : "c" ( v ), "d" ( i ), "S" ( t )
+    );
+    return rtn;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_engine_atomic32_ */
diff --git a/ngs-sdk/adapter/unix/x86_64/atomic32.h b/ngs-sdk/adapter/unix/x86_64/atomic32.h
new file mode 100644
index 0000000..657a5e3
--- /dev/null
+++ b/ngs-sdk/adapter/unix/x86_64/atomic32.h
@@ -0,0 +1,101 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_engine_atomic32_
+#define _h_ngs_engine_atomic32_
+
+#ifndef _h_ngs_adapter_defs_
+#include <ngs/adapter/defs.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* int atomic32_read ( const atomic32_t *v ); */
+#define atomic32_read( v ) \
+    ( ( v ) -> counter )
+
+/* void atomic32_set ( atomic32_t *v, int i ); */
+#define atomic32_set( v, i ) \
+    ( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
+
+/* add to v -> counter and return the prior value */
+static __inline__ int atomic32_read_and_add ( atomic32_t *v, int i )
+{
+    int rtn;
+    __asm__ __volatile__
+    (
+        "mov (%%rdi), %%eax;"
+        "mov %%esi, %%ecx;"
+        "add %%eax, %%ecx;"
+        "lock;"
+        "cmpxchg %%ecx, (%%rdi);"
+        "jne .-8"
+        : "=a" ( rtn )
+        : "D" ( v ), "S" ( i )
+        : "%ecx"
+    );
+    return rtn;
+}
+
+static __inline__ void atomic32_dec ( atomic32_t *v )
+{
+    __asm__ __volatile__
+    (
+        "lock;"
+        "decl %0"
+        : "=m" ( v -> counter )
+        : "m" ( v -> counter )
+    );
+}
+
+static __inline__
+int atomic32_read_and_add_gt ( atomic32_t *v, int i, int t )
+{
+    int rtn;
+    __asm__ __volatile__
+    (
+        "mov (%%rdi), %%eax;"
+        "cmp %%edx, %%eax;"
+        "mov %%esi, %%ecx;"
+        "jle .+10;"
+        "add %%eax, %%ecx;"
+        "lock;"
+        "cmpxchg %%ecx, (%%rdi);"
+        "jne .-12"
+        : "=a" ( rtn )
+        : "D" ( v ), "S" ( i ), "d" ( t )
+        : "%ecx"
+    );
+    return rtn;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_engine_atomic32_ */
diff --git a/ngs-sdk/configure b/ngs-sdk/configure
new file mode 100755
index 0000000..3313aac
--- /dev/null
+++ b/ngs-sdk/configure
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+FILENAME="`basename $0`"
+CURDIR="`dirname $0`"
+
+if [ -z "$CURDIR" ]
+    then
+    echo configure: error: configure should be run as ./configure
+    exit 1
+fi
+
+if [ "$FILENAME" != configure -a ! -s konfigure.perl ]
+    then
+    echo configure: error: configure should be run as ./configure
+else
+    perl -v > /dev/null 2>&1 || { echo "checking for perl... no"; \
+        echo >&2 "configure: error: perl not found."; exit 1; }
+
+    cd $CURDIR
+    perl -w ./konfigure.perl $@
+fi
diff --git a/ngs-sdk/dispatch/AlignmentItf.cpp b/ngs-sdk/dispatch/AlignmentItf.cpp
new file mode 100644
index 0000000..1294870
--- /dev/null
+++ b/ngs-sdk/dispatch/AlignmentItf.cpp
@@ -0,0 +1,537 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/AlignmentItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+
+#include <ngs/itf/AlignmentItf.h>
+
+#include <ngs/Alignment.hpp>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * metadata
+     */
+    extern ItfTok NGS_Fragment_v1_tok;
+    ItfTok NGS_Alignment_v1_tok ( "NGS_Alignment_v1", NGS_Fragment_v1_tok );
+
+
+    /*----------------------------------------------------------------------
+     * access vtable
+     */
+    static inline
+    const NGS_Alignment_v1_vt * Access ( const NGS_VTable * vt )
+    {
+        const NGS_Alignment_v1_vt * out = static_cast < const NGS_Alignment_v1_vt* >
+            ( Cast ( vt, NGS_Alignment_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type NGS_Alignment_v1" );
+        return out;
+    }
+
+
+    /*----------------------------------------------------------------------
+     * AlignmentItf
+     */
+
+    StringItf * AlignmentItf :: getAlignmentId () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_id != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_id ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * AlignmentItf :: getReferenceSpec () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_ref_spec != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_ref_spec ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    int32_t AlignmentItf :: getMappingQuality () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_map_qual != 0 );
+        int32_t ret  = ( * vt -> get_map_qual ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    StringItf * AlignmentItf :: getReferenceBases () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_ref_bases != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_ref_bases ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * AlignmentItf :: getReadGroup () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_read_group != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_read_group ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * AlignmentItf :: getReadId () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_read_id != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_read_id ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * AlignmentItf :: getClippedFragmentBases () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_clipped_frag_bases != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_clipped_frag_bases ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * AlignmentItf :: getClippedFragmentQualities () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_clipped_frag_quals != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_clipped_frag_quals ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * AlignmentItf :: getAlignedFragmentBases () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_aligned_frag_bases != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_aligned_frag_bases ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    uint32_t AlignmentItf :: getAlignmentCategory () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> is_primary != 0 );
+        bool ret  = ( * vt -> is_primary ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret ? Alignment :: primaryAlignment : Alignment :: secondaryAlignment;
+    }
+
+    int64_t AlignmentItf :: getAlignmentPosition () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_align_pos != 0 );
+        int64_t ret  = ( * vt -> get_align_pos ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    uint64_t AlignmentItf :: getAlignmentLength () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_align_length != 0 );
+        uint64_t ret  = ( * vt -> get_align_length ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    bool AlignmentItf :: getIsReversedOrientation () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_is_reversed != 0 );
+        bool ret  = ( * vt -> get_is_reversed ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    int32_t AlignmentItf :: getSoftClip ( uint32_t edge ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_soft_clip != 0 );
+        int32_t ret  = ( * vt -> get_soft_clip ) ( self, & err, edge );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    uint64_t AlignmentItf :: getTemplateLength () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_template_len != 0 );
+        uint64_t ret  = ( * vt -> get_template_len ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    StringItf * AlignmentItf :: getShortCigar ( bool clipped ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_short_cigar != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_short_cigar ) ( self, & err, clipped );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * AlignmentItf :: getLongCigar ( bool clipped ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_long_cigar != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_long_cigar ) ( self, & err, clipped );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    bool AlignmentItf :: hasMate () const
+        throw ()
+    {
+        try
+        {
+            // the object is really from C
+            const NGS_Alignment_v1 * self = Test ();
+
+            // cast vtable to our level
+            const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+            // call through C vtable
+            ErrBlock err;
+            assert ( vt -> has_mate != 0 );
+            bool ret  = ( * vt -> has_mate ) ( self, & err );
+
+            // check for errors
+            err . Check ();
+
+            return ret;
+        }
+        catch ( ErrorMsg & x )
+        {
+            // warn
+        }
+        catch ( ... )
+        {
+            // warn
+        }
+
+        return false;
+    }
+
+    StringItf * AlignmentItf :: getMateAlignmentId () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_mate_id != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_mate_id ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    AlignmentItf * AlignmentItf :: getMateAlignment () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_mate_alignment != 0 );
+        NGS_Alignment_v1 * ret  = ( * vt -> get_mate_alignment ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return AlignmentItf :: Cast ( ret );
+    }
+
+    StringItf * AlignmentItf :: getMateReferenceSpec () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_mate_ref_spec != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_mate_ref_spec ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    bool AlignmentItf :: getMateIsReversedOrientation () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_mate_is_reversed != 0 );
+        bool ret  = ( * vt -> get_mate_is_reversed ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    bool AlignmentItf :: nextAlignment ()
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        NGS_Alignment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Alignment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> next != 0 );
+        bool ret  = ( * vt -> next ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+}
+
diff --git a/ngs-sdk/dispatch/ErrBlock.cpp b/ngs-sdk/dispatch/ErrBlock.cpp
new file mode 100644
index 0000000..880ed12
--- /dev/null
+++ b/ngs-sdk/dispatch/ErrBlock.cpp
@@ -0,0 +1,43 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/ErrBlock.hpp>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * ErrBlock
+     *  holds a message describing what happened
+     */
+
+    void ErrBlock :: Throw () const
+        throw ( ErrorMsg )
+    {
+        if ( xtype != xt_okay )
+            throw ErrorMsg ( msg );
+    }
+
+}
diff --git a/ngs-sdk/dispatch/ErrorMsg.cpp b/ngs-sdk/dispatch/ErrorMsg.cpp
new file mode 100644
index 0000000..eee5a5a
--- /dev/null
+++ b/ngs-sdk/dispatch/ErrorMsg.cpp
@@ -0,0 +1,96 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/ErrorMsg.hpp>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * ErrorMsg
+     *  a generic NGS error class
+     *  holds a message describing what happened
+     */
+
+    /* what ( for C++ )
+     *  what went wrong
+     */
+    const char * ErrorMsg :: what () const
+        throw ()
+    {
+        return msg . c_str ();
+    }
+
+    /* toMessage ( for Java )
+     *  returns the detailed message
+     */
+    const :: std :: string & ErrorMsg :: toMessage () const
+        throw ()
+    {
+        return msg;
+    }
+
+    /* toString ( for Java )
+     *  returns a short description
+     */
+    const :: std :: string & ErrorMsg :: toString () const
+        throw ()
+    {
+        return msg;
+    }
+
+    /* constructors
+     *  various means of constructing
+     */        
+    ErrorMsg :: ErrorMsg ()
+        throw ()
+    {
+    }
+    
+    ErrorMsg :: ErrorMsg ( const :: std :: string & message )
+            throw ()
+        : msg ( message )
+    {
+    }
+
+    ErrorMsg :: ErrorMsg ( const ErrorMsg & obj )
+            throw ()
+        : msg ( obj . msg )
+    {
+    }
+
+    ErrorMsg & ErrorMsg :: operator = ( const ErrorMsg & obj )
+        throw ()
+    {
+        this -> msg = obj . msg;
+        return * this;
+    }
+
+    ErrorMsg :: ~ ErrorMsg ()
+        throw ()
+    {
+    }
+
+}
diff --git a/ngs-sdk/dispatch/FragmentItf.cpp b/ngs-sdk/dispatch/FragmentItf.cpp
new file mode 100644
index 0000000..027587f
--- /dev/null
+++ b/ngs-sdk/dispatch/FragmentItf.cpp
@@ -0,0 +1,164 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/FragmentItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+
+#include <ngs/itf/FragmentItf.h>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * metadata
+     */
+    extern ItfTok NGS_Refcount_v1_tok;
+    ItfTok NGS_Fragment_v1_tok ( "NGS_Fragment_v1", NGS_Refcount_v1_tok );
+
+
+    /*----------------------------------------------------------------------
+     * access vtable
+     */
+    static inline
+    const NGS_Fragment_v1_vt * Access ( const NGS_VTable * vt )
+    {
+        const NGS_Fragment_v1_vt * out = static_cast < const NGS_Fragment_v1_vt* >
+            ( Cast ( vt, NGS_Fragment_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type NGS_Fragment_v1" );
+        return out;
+    }
+
+    /*----------------------------------------------------------------------
+     * FragmentItf
+     */
+
+    StringItf * FragmentItf :: getFragmentId () const
+            throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Fragment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Fragment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_id != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_id ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * FragmentItf :: getFragmentBases () const
+        throw ( ErrorMsg )
+    {
+        return this -> getFragmentBases ( 0, -1 );
+    }
+
+    StringItf * FragmentItf :: getFragmentBases ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    {
+        return this -> getFragmentBases ( offset, -1 );
+    }
+
+    StringItf * FragmentItf :: getFragmentBases ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Fragment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Fragment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_bases != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_bases ) ( self, & err, offset, length );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * FragmentItf :: getFragmentQualities () const
+        throw ( ErrorMsg )
+    {
+        return this -> getFragmentQualities ( 0, -1 );
+    }
+
+    StringItf * FragmentItf :: getFragmentQualities ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    {
+        return this -> getFragmentQualities ( offset, -1 );
+    }
+
+    StringItf * FragmentItf :: getFragmentQualities ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Fragment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Fragment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_quals != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_quals ) ( self, & err, offset, length );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    bool FragmentItf :: nextFragment ()
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        NGS_Fragment_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Fragment_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> next != 0 );
+        bool ret  = ( * vt -> next ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+} // namespace ngs
diff --git a/ngs-sdk/dispatch/Makefile b/ngs-sdk/dispatch/Makefile
new file mode 100644
index 0000000..f058943
--- /dev/null
+++ b/ngs-sdk/dispatch/Makefile
@@ -0,0 +1,73 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ..)
+include $(TOP)/Makefile.config
+
+INTLIBS = \
+	ngs-disp
+
+EXTLIBS =   \
+
+TARGETS =      \
+	$(INTLIBS) \
+	$(EXTLIBS)
+
+all std: $(TARGETS)
+
+clean:
+	rm -rf $(ILIBDIR)/$(LPFX)ngs-disp* $(OBJDIR)
+
+.PHONY: default all std $(TARGETS)
+
+ngs-disp: $(ILIBDIR) $(OBJDIR) $(ILIBDIR)/$(LPFX)ngs-disp.$(LIBX)
+
+# core dispatcher sources
+DISP_SRC =            \
+	ReadCollectionItf \
+	ReferenceItf      \
+	PileupItf         \
+	PileupEventItf    \
+	AlignmentItf      \
+	ReadGroupItf      \
+	ReadItf           \
+	FragmentItf       \
+	StatisticsItf     \
+	StringItf         \
+	Refcount          \
+	VTable            \
+	ErrBlock          \
+	ErrorMsg          \
+    VTable
+
+# core dispatcher object files
+DISP_OBJ = \
+	$(addprefix $(OBJDIR)/,$(addsuffix .$(LOBX),$(DISP_SRC)))
+
+# rule to produce the static dispatch library
+$(ILIBDIR)/$(LPFX)ngs-disp.$(LIBX): $(DISP_OBJ)
+	$(AR) $@ $^
diff --git a/ngs-sdk/dispatch/PileupEventItf.cpp b/ngs-sdk/dispatch/PileupEventItf.cpp
new file mode 100644
index 0000000..a8d349d
--- /dev/null
+++ b/ngs-sdk/dispatch/PileupEventItf.cpp
@@ -0,0 +1,362 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/PileupEventItf.hpp>
+#include <ngs/itf/AlignmentItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+
+#include <ngs/itf/PileupEventItf.h>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * metadata
+     */
+    extern ItfTok NGS_Refcount_v1_tok;
+    ItfTok NGS_PileupEvent_v1_tok ( "NGS_PileupEvent_v1", NGS_Refcount_v1_tok );
+
+
+    /*----------------------------------------------------------------------
+     * access vtable
+     */
+    static inline
+    const NGS_PileupEvent_v1_vt * Access ( const NGS_VTable * vt )
+    {
+        const NGS_PileupEvent_v1_vt * out = static_cast < const NGS_PileupEvent_v1_vt* >
+            ( Cast ( vt, NGS_PileupEvent_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type NGS_PileupEvent_v1" );
+        return out;
+    }
+
+
+    /*----------------------------------------------------------------------
+     * PileupEventItf
+     */
+
+    StringItf * PileupEventItf :: getReferenceSpec () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_ref_spec != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_ref_spec ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    int64_t PileupEventItf :: getReferencePosition () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_ref_pos != 0 );
+        int64_t ret  = ( * vt -> get_ref_pos ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    int32_t PileupEventItf :: getMappingQuality () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_map_qual != 0 );
+        int32_t ret  = ( * vt -> get_map_qual ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    StringItf * PileupEventItf :: getAlignmentId () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_align_id != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_align_id ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    AlignmentItf * PileupEventItf :: getAlignment () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_alignment != 0 );
+        NGS_Alignment_v1 * ret  = ( * vt -> get_alignment ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return AlignmentItf :: Cast ( ret );
+    }
+
+    int64_t PileupEventItf :: getAlignmentPosition () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_align_pos != 0 );
+        int64_t ret  = ( * vt -> get_align_pos ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    int64_t PileupEventItf :: getFirstAlignmentPosition () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_first_align_pos != 0 );
+        int64_t ret  = ( * vt -> get_first_align_pos ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    int64_t PileupEventItf :: getLastAlignmentPosition () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_last_align_pos != 0 );
+        int64_t ret  = ( * vt -> get_last_align_pos ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    uint32_t PileupEventItf :: getEventType () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_event_type != 0 );
+        uint32_t ret  = ( * vt -> get_event_type ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    char PileupEventItf :: getAlignmentBase () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_align_base != 0 );
+        char ret  = ( * vt -> get_align_base ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    char PileupEventItf :: getAlignmentQuality () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_align_qual != 0 );
+        char ret  = ( * vt -> get_align_qual ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    StringItf * PileupEventItf :: getInsertionBases () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_ins_bases != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_ins_bases ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * PileupEventItf :: getInsertionQualities () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_ins_quals != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_ins_quals ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    uint32_t PileupEventItf :: getDeletionCount () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_del_count != 0 );
+        uint32_t ret  = ( * vt -> get_del_count ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    bool PileupEventItf :: nextPileupEvent ()
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        NGS_PileupEvent_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_PileupEvent_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> next != 0 );
+        bool ret  = ( * vt -> next ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+}
+
diff --git a/ngs-sdk/dispatch/PileupItf.cpp b/ngs-sdk/dispatch/PileupItf.cpp
new file mode 100644
index 0000000..3dc00f4
--- /dev/null
+++ b/ngs-sdk/dispatch/PileupItf.cpp
@@ -0,0 +1,162 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/PileupItf.hpp>
+#include <ngs/itf/PileupEventItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+
+#include <ngs/itf/PileupItf.h>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * metadata
+     */
+    extern ItfTok NGS_Refcount_v1_tok;
+    ItfTok NGS_Pileup_v1_tok ( "NGS_Pileup_v1", NGS_Refcount_v1_tok );
+
+
+    /*----------------------------------------------------------------------
+     * access vtable
+     */
+    static inline
+    const NGS_Pileup_v1_vt * Access ( const NGS_VTable * vt )
+    {
+        const NGS_Pileup_v1_vt * out = static_cast < const NGS_Pileup_v1_vt* >
+            ( Cast ( vt, NGS_Pileup_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type NGS_Pileup_v1" );
+        return out;
+    }
+
+
+    /*----------------------------------------------------------------------
+     * PileupItf
+     */
+
+    StringItf * PileupItf :: getReferenceSpec () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Pileup_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Pileup_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_ref_spec != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_ref_spec ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    int64_t PileupItf :: getReferencePosition () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Pileup_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Pileup_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_ref_pos != 0 );
+        int64_t ret  = ( * vt -> get_ref_pos ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    PileupEventItf * PileupItf :: getPileupEvents () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Pileup_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Pileup_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_pileup_events != 0 );
+        NGS_PileupEvent_v1 * ret  = ( * vt -> get_pileup_events ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return PileupEventItf :: Cast ( ret );
+    }
+
+    uint32_t PileupItf :: getPileupDepth () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Pileup_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Pileup_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_pileup_depth != 0 );
+        uint32_t ret  = ( * vt -> get_pileup_depth ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    bool PileupItf :: nextPileup ()
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        NGS_Pileup_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Pileup_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> next != 0 );
+        bool ret  = ( * vt -> next ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+}
+
diff --git a/ngs-sdk/dispatch/ReadCollectionItf.cpp b/ngs-sdk/dispatch/ReadCollectionItf.cpp
new file mode 100644
index 0000000..bdc6c08
--- /dev/null
+++ b/ngs-sdk/dispatch/ReadCollectionItf.cpp
@@ -0,0 +1,365 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/ReadCollectionItf.hpp>
+
+#include <ngs/itf/StringItf.hpp>
+#include <ngs/itf/ReadItf.hpp>
+#include <ngs/itf/ReadGroupItf.hpp>
+#include <ngs/itf/ReferenceItf.hpp>
+#include <ngs/itf/AlignmentItf.hpp>
+#include <ngs/itf/StatisticsItf.hpp>
+
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+
+#include <ngs/itf/ReadCollectionItf.h>
+
+#include <ngs/Alignment.hpp>
+#include <ngs/Read.hpp>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * metadata
+     */
+    extern ItfTok NGS_Refcount_v1_tok;
+    ItfTok NGS_ReadCollection_v1_tok ( "NGS_ReadCollection_v1", NGS_Refcount_v1_tok );
+
+    /*----------------------------------------------------------------------
+     * access vtable
+     */
+    static inline
+    const NGS_ReadCollection_v1_vt * Access ( const NGS_VTable * vt )
+    {
+        const NGS_ReadCollection_v1_vt * out = static_cast < const NGS_ReadCollection_v1_vt* >
+            ( Cast ( vt, NGS_ReadCollection_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type NGS_ReadCollection_v1" );
+        return out;
+    }
+
+    /*----------------------------------------------------------------------
+     * ReadCollectionItf
+     */
+
+    StringItf * ReadCollectionItf :: getName () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_name != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_name ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    ReadGroupItf * ReadCollectionItf :: getReadGroups () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_read_groups != 0 );
+        NGS_ReadGroup_v1 * ret  = ( * vt -> get_read_groups ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ReadGroupItf :: Cast ( ret );
+    }
+
+    ReadGroupItf * ReadCollectionItf :: getReadGroup ( const char * spec ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_read_group != 0 );
+        NGS_ReadGroup_v1 * ret  = ( * vt -> get_read_group ) ( self, & err, spec );
+
+        // check for errors
+        err . Check ();
+
+        return ReadGroupItf :: Cast ( ret );
+    }
+
+    ReferenceItf * ReadCollectionItf :: getReferences () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_references != 0 );
+        NGS_Reference_v1 * ret  = ( * vt -> get_references ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ReferenceItf :: Cast ( ret );
+    }
+
+    ReferenceItf * ReadCollectionItf :: getReference ( const char * spec ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_reference != 0 );
+        NGS_Reference_v1 * ret  = ( * vt -> get_reference ) ( self, & err, spec );
+
+        // check for errors
+        err . Check ();
+
+        return ReferenceItf :: Cast ( ret );
+    }
+
+    AlignmentItf * ReadCollectionItf :: getAlignment ( const char * alignmentId ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_alignment != 0 );
+        NGS_Alignment_v1 * ret  = ( * vt -> get_alignment ) ( self, & err, alignmentId );
+
+        // check for errors
+        err . Check ();
+
+        return AlignmentItf :: Cast ( ret );
+    }
+
+    AlignmentItf * ReadCollectionItf :: getAlignments ( uint32_t categories ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_alignments != 0 );
+        bool wants_primary = ( categories & Alignment :: primaryAlignment );
+        bool wants_secondary = ( categories & Alignment :: secondaryAlignment );
+        NGS_Alignment_v1 * ret  = ( * vt -> get_alignments ) ( self, & err, wants_primary, wants_secondary );
+
+        // check for errors
+        err . Check ();
+
+        return AlignmentItf :: Cast ( ret );
+    }
+
+    uint64_t ReadCollectionItf :: getAlignmentCount ( uint32_t categories ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_align_count != 0 );
+        bool wants_primary = ( categories & Alignment :: primaryAlignment );
+        bool wants_secondary = ( categories & Alignment :: secondaryAlignment );
+        uint64_t ret  = ( * vt -> get_align_count ) ( self, & err, wants_primary, wants_secondary );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    AlignmentItf * ReadCollectionItf :: getAlignmentRange ( uint64_t first, uint64_t count, uint32_t categories ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_align_range != 0 );
+        bool wants_primary = ( categories & Alignment :: primaryAlignment );
+        bool wants_secondary = ( categories & Alignment :: secondaryAlignment );
+        NGS_Alignment_v1 * ret  = ( * vt -> get_align_range ) ( self, & err, first, count, wants_primary, wants_secondary );
+
+        // check for errors
+        err . Check ();
+
+        return AlignmentItf :: Cast ( ret );
+    }
+
+    ReadItf * ReadCollectionItf :: getRead ( const char * readId ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_read != 0 );
+        NGS_Read_v1 * ret  = ( * vt -> get_read ) ( self, & err, readId );
+
+        // check for errors
+        err . Check ();
+
+        return ReadItf :: Cast ( ret );
+    }
+
+    ReadItf * ReadCollectionItf :: getReads ( uint32_t categories ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_reads != 0 );
+        bool wants_full         = ( categories & Read :: fullyAligned ) != 0;
+        bool wants_partial      = ( categories & Read :: partiallyAligned ) != 0;
+        bool wants_unaligned    = ( categories & Read :: unaligned ) != 0;
+        NGS_Read_v1 * ret  = ( * vt -> get_reads ) ( self, & err, wants_full, wants_partial, wants_unaligned );
+
+        // check for errors
+        err . Check ();
+
+        return ReadItf :: Cast ( ret );
+    }
+
+    uint64_t ReadCollectionItf :: getReadCount ( uint32_t categories ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_read_count != 0 );
+        bool wants_full         = ( categories & Read :: fullyAligned ) != 0;
+        bool wants_partial      = ( categories & Read :: partiallyAligned ) != 0;
+        bool wants_unaligned    = ( categories & Read :: unaligned ) != 0;
+        uint64_t ret  = ( * vt -> get_read_count ) ( self, & err, wants_full, wants_partial, wants_unaligned );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+    
+    ReadItf * ReadCollectionItf :: getReadRange ( uint64_t first, uint64_t count ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_reads != 0 );
+        NGS_Read_v1 * ret  = ( * vt -> get_read_range ) ( self, & err, first, count, true, true, true );
+
+        // check for errors
+        err . Check ();
+
+        return ReadItf :: Cast ( ret );
+    }
+
+    ReadItf * ReadCollectionItf :: getReadRange ( uint64_t first, uint64_t count, uint32_t categories ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadCollection_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_reads != 0 );
+        bool wants_full         = ( categories & Read :: fullyAligned ) != 0;
+        bool wants_partial      = ( categories & Read :: partiallyAligned ) != 0;
+        bool wants_unaligned    = ( categories & Read :: unaligned ) != 0;
+        NGS_Read_v1 * ret  = ( * vt -> get_read_range ) ( self, & err, first, count, wants_full, wants_partial, wants_unaligned );
+
+        // check for errors
+        err . Check ();
+
+        return ReadItf :: Cast ( ret );
+    }
+
+
+} // namespace ngs
diff --git a/ngs-sdk/dispatch/ReadGroupItf.cpp b/ngs-sdk/dispatch/ReadGroupItf.cpp
new file mode 100644
index 0000000..d65557c
--- /dev/null
+++ b/ngs-sdk/dispatch/ReadGroupItf.cpp
@@ -0,0 +1,120 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/ReadGroupItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+#include <ngs/itf/StatisticsItf.hpp>
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+
+#include <ngs/itf/ReadGroupItf.h>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * metadata
+     */
+    extern ItfTok NGS_Refcount_v1_tok;
+    ItfTok NGS_ReadGroup_v1_tok ( "NGS_ReadGroup_v1", NGS_Refcount_v1_tok );
+
+    /*----------------------------------------------------------------------
+     * access vtable
+     */
+    static inline
+    const NGS_ReadGroup_v1_vt * Access ( const NGS_VTable * vt )
+    {
+        const NGS_ReadGroup_v1_vt * out = static_cast < const NGS_ReadGroup_v1_vt* >
+            ( Cast ( vt, NGS_ReadGroup_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type NGS_ReadGroup_v1" );
+        return out;
+    }
+
+    /*----------------------------------------------------------------------
+     * ReadGroupItf
+     */
+
+    StringItf * ReadGroupItf :: getName () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadGroup_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadGroup_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_name != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_name ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StatisticsItf * ReadGroupItf :: getStatistics () const 
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_ReadGroup_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadGroup_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_stats != 0 );
+        NGS_Statistics_v1 * ret  = ( * vt -> get_stats ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StatisticsItf :: Cast ( ret );
+    }
+
+    bool ReadGroupItf :: nextReadGroup ()
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        NGS_ReadGroup_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_ReadGroup_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> next != 0 );
+        bool ret  = ( * vt -> next ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+} // namespace ngs
diff --git a/ngs-sdk/dispatch/ReadItf.cpp b/ngs-sdk/dispatch/ReadItf.cpp
new file mode 100644
index 0000000..7c1c5b0
--- /dev/null
+++ b/ngs-sdk/dispatch/ReadItf.cpp
@@ -0,0 +1,244 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/ReadItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+
+#include <ngs/itf/ReadItf.h>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * metadata
+     */
+    extern ItfTok NGS_Fragment_v1_tok;
+    ItfTok NGS_Read_v1_tok ( "NGS_Read_v1", NGS_Fragment_v1_tok );
+
+
+    /*----------------------------------------------------------------------
+     * access vtable
+     */
+    static inline
+    const NGS_Read_v1_vt * Access ( const NGS_VTable * vt )
+    {
+        const NGS_Read_v1_vt * out = static_cast < const NGS_Read_v1_vt* >
+            ( Cast ( vt, NGS_Read_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type NGS_Read_v1" );
+        return out;
+    }
+
+    /*----------------------------------------------------------------------
+     * ReadItf
+     */
+
+    StringItf * ReadItf :: getReadId () const
+            throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Read_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Read_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_id != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_id ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    uint32_t ReadItf :: getNumFragments () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Read_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Read_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_num_frags != 0 );
+        uint32_t ret  = ( * vt -> get_num_frags ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    uint32_t ReadItf :: getReadCategory () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Read_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Read_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_category != 0 );
+        uint32_t ret  = ( * vt -> get_category ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    StringItf * ReadItf :: getReadGroup () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Read_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Read_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_read_group != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_read_group ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * ReadItf :: getReadName () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Read_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Read_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_name != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_name ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * ReadItf :: getReadBases () const
+        throw ( ErrorMsg )
+    {
+        return this -> getReadBases ( 0, -1 );
+    }
+
+    StringItf * ReadItf :: getReadBases ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    {
+        return this -> getReadBases ( offset, -1 );
+    }
+
+    StringItf * ReadItf :: getReadBases ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Read_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Read_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_bases != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_bases ) ( self, & err, offset, length );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * ReadItf :: getReadQualities () const
+        throw ( ErrorMsg )
+    {
+        return this -> getReadQualities ( 0, -1 );
+    }
+
+    StringItf * ReadItf :: getReadQualities ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    {
+        return this -> getReadQualities ( offset, -1 );
+    }
+
+    StringItf * ReadItf :: getReadQualities ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Read_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Read_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_quals != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_quals ) ( self, & err, offset, length );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    bool ReadItf :: nextRead ()
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        NGS_Read_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Read_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> next != 0 );
+        bool ret  = ( * vt -> next ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+} // namespace ngs
diff --git a/ngs-sdk/dispatch/Refcount.cpp b/ngs-sdk/dispatch/Refcount.cpp
new file mode 100644
index 0000000..805a10e
--- /dev/null
+++ b/ngs-sdk/dispatch/Refcount.cpp
@@ -0,0 +1,123 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/Refcount.hpp>
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+#include <ngs/itf/Refcount.h>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * Cast
+     *  cast vtable to proper type
+     */
+    ItfTok NGS_Refcount_v1_tok ( "NGS_Refcount_v1" );
+
+    inline
+    const NGS_Refcount_v1_vt * Cast ( const NGS_VTable * in )
+    {
+        const NGS_Refcount_v1_vt * out = static_cast < const NGS_Refcount_v1_vt* >
+            ( Cast ( in, NGS_Refcount_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type Refcount_v1" );
+        return out;
+    }
+
+    /*----------------------------------------------------------------------
+     * OpaqueRefcount
+     */
+
+    inline
+    NGS_Refcount_v1 * OpaqueRefcount :: Self ()
+    {
+        return reinterpret_cast < NGS_Refcount_v1* > ( this );
+    }
+
+    inline
+    const NGS_Refcount_v1 * OpaqueRefcount :: Self () const
+    {
+        return reinterpret_cast < const NGS_Refcount_v1* > ( this );
+    }
+
+    void OpaqueRefcount :: Release ()
+        throw ()
+    {
+        if ( this != 0 )
+        {
+            // cast to C object
+            NGS_Refcount_v1 * self = Self ();
+
+            try
+            {
+                // extract VTable
+                const NGS_Refcount_v1_vt * vt = Cast ( self -> vt );
+
+                // release object
+                ErrBlock err;
+                assert ( vt -> release != 0 );
+                ( * vt -> release ) ( self, & err );
+
+                // check for errors
+                err . Check ();
+            }
+            catch ( ErrorMsg & x )
+            {
+                // good place for a message to console or error log
+            }
+            catch ( ... )
+            {
+            }
+        }
+    }
+
+    void * OpaqueRefcount :: Duplicate () const
+        throw ( ErrorMsg )
+    {
+        if ( this != 0 )
+        {
+            // cast to C object
+            const NGS_Refcount_v1 * self = Self ();
+
+            // extract VTable
+            const NGS_Refcount_v1_vt * vt = Cast ( self -> vt );
+
+            // duplicate object reference
+            ErrBlock err;
+            assert ( vt -> duplicate != 0 );
+            void * dup = ( * vt -> duplicate ) ( self, & err );
+
+            // check for errors
+            err. Check ();
+
+            // return duplicated reference
+            assert ( dup != 0 );
+            return dup;
+        }
+
+        return 0;
+    }
+}
diff --git a/ngs-sdk/dispatch/ReferenceItf.cpp b/ngs-sdk/dispatch/ReferenceItf.cpp
new file mode 100644
index 0000000..72bcd58
--- /dev/null
+++ b/ngs-sdk/dispatch/ReferenceItf.cpp
@@ -0,0 +1,337 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/ReferenceItf.hpp>
+#include <ngs/itf/PileupItf.hpp>
+#include <ngs/itf/AlignmentItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+
+#include <ngs/itf/ReferenceItf.h>
+
+#include <ngs/Alignment.hpp>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * metadata
+     */
+    extern ItfTok NGS_Refcount_v1_tok;
+    ItfTok NGS_Reference_v1_tok ( "NGS_Reference_v1", NGS_Refcount_v1_tok );
+
+
+    /*----------------------------------------------------------------------
+     * access vtable
+     */
+    static inline
+    const NGS_Reference_v1_vt * Access ( const NGS_VTable * vt )
+    {
+        const NGS_Reference_v1_vt * out = static_cast < const NGS_Reference_v1_vt* >
+            ( Cast ( vt, NGS_Reference_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type NGS_Reference_v1" );
+        return out;
+    }
+
+
+    /*----------------------------------------------------------------------
+     * ReferenceItf
+     */
+
+    StringItf * ReferenceItf :: getCommonName () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_cmn_name != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_cmn_name ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * ReferenceItf :: getCanonicalName () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_canon_name != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_canon_name ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    bool ReferenceItf :: getIsCircular () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> is_circular != 0 );
+        bool ret  = ( * vt -> is_circular ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    uint64_t ReferenceItf :: getLength () const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_length != 0 );
+        uint64_t ret  = ( * vt -> get_length ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    StringItf * ReferenceItf :: getReferenceBases ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    {
+        return this -> getReferenceBases ( offset, -1 );
+    }
+
+    StringItf * ReferenceItf :: getReferenceBases ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_ref_bases != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_ref_bases ) ( self, & err, offset, length );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    StringItf * ReferenceItf :: getReferenceChunk ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    {
+        return this -> getReferenceChunk ( offset, -1 );
+    }
+
+    StringItf * ReferenceItf :: getReferenceChunk ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_ref_chunk != 0 );
+        NGS_String_v1 * ret  = ( * vt -> get_ref_chunk ) ( self, & err, offset, length );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    AlignmentItf * ReferenceItf :: getAlignment ( const char * alignmentId ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_alignment != 0 );
+        NGS_Alignment_v1 * ret  = ( * vt -> get_alignment ) ( self, & err, alignmentId );
+
+        // check for errors
+        err . Check ();
+
+        return AlignmentItf :: Cast ( ret );
+    }
+
+    AlignmentItf * ReferenceItf :: getAlignments ( uint32_t categories ) const
+    throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_alignments != 0 );
+        bool wants_primary      = ( categories & Alignment :: primaryAlignment ) != 0;
+        bool wants_secondary    = ( categories & Alignment :: secondaryAlignment ) != 0;
+        NGS_Alignment_v1 * ret  = ( * vt -> get_alignments ) ( self, & err, wants_primary, wants_secondary );
+
+        // check for errors
+        err . Check ();
+
+        return AlignmentItf :: Cast ( ret );
+    }
+
+    AlignmentItf * ReferenceItf :: getAlignmentSlice ( int64_t start, uint64_t length ) const
+        throw ( ErrorMsg )
+    {
+        return this -> getAlignmentSlice ( start, length, Alignment :: all );
+    }
+
+    AlignmentItf * ReferenceItf :: getAlignmentSlice ( int64_t start, uint64_t length, uint32_t categories ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_align_slice != 0 );
+        bool wants_primary      = ( categories & Alignment :: primaryAlignment ) != 0;
+        bool wants_secondary    = ( categories & Alignment :: secondaryAlignment ) != 0;
+        NGS_Alignment_v1 * ret  = ( * vt -> get_align_slice ) ( self, & err, start, length, wants_primary, wants_secondary );
+
+        // check for errors
+        err . Check ();
+
+        return AlignmentItf :: Cast ( ret );
+    }
+
+    PileupItf * ReferenceItf :: getPileups ( uint32_t categories ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_pileups != 0 );
+        bool wants_primary      = ( categories & Alignment :: primaryAlignment ) != 0;
+        bool wants_secondary    = ( categories & Alignment :: secondaryAlignment ) != 0;
+        NGS_Pileup_v1 * ret  = ( * vt -> get_pileups ) ( self, & err, wants_primary, wants_secondary );
+
+        // check for errors
+        err . Check ();
+
+        return PileupItf :: Cast ( ret );
+    }
+
+    PileupItf * ReferenceItf :: getPileupSlice ( int64_t start, uint64_t length ) const
+        throw ( ErrorMsg )
+    {
+        return this -> getPileupSlice ( start, length, Alignment :: all );
+    }
+
+    PileupItf * ReferenceItf :: getPileupSlice ( int64_t start, uint64_t length, uint32_t categories ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_pileup_slice != 0 );
+        bool wants_primary      = ( categories & Alignment :: primaryAlignment ) != 0;
+        bool wants_secondary    = ( categories & Alignment :: secondaryAlignment ) != 0;
+        NGS_Pileup_v1 * ret  = ( * vt -> get_pileup_slice ) ( self, & err, start, length, wants_primary, wants_secondary );
+
+        // check for errors
+        err . Check ();
+
+        return PileupItf :: Cast ( ret );
+    }
+    
+    bool ReferenceItf :: nextReference ()
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        NGS_Reference_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Reference_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> next != 0 );
+        bool ret  = ( * vt -> next ) ( self, & err );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+}
+
diff --git a/ngs-sdk/dispatch/StatisticsItf.cpp b/ngs-sdk/dispatch/StatisticsItf.cpp
new file mode 100644
index 0000000..d4fb044
--- /dev/null
+++ b/ngs-sdk/dispatch/StatisticsItf.cpp
@@ -0,0 +1,193 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/StatisticsItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+
+#include <ngs/itf/StatisticsItf.h>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * metadata
+     */
+    extern ItfTok NGS_Refcount_v1_tok;
+    ItfTok NGS_Statistics_v1_tok ( "NGS_Statistics_v1", NGS_Refcount_v1_tok );
+
+
+    /*----------------------------------------------------------------------
+     * access vtable
+     */
+    static inline
+    const NGS_Statistics_v1_vt * Access ( const NGS_VTable * vt )
+    {
+        const NGS_Statistics_v1_vt * out = static_cast < const NGS_Statistics_v1_vt* >
+            ( Cast ( vt, NGS_Statistics_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type NGS_Statistics_v1" );
+        return out;
+    }
+
+    /*----------------------------------------------------------------------
+     * StatisticsItf
+     */
+
+    uint32_t StatisticsItf :: getValueType ( const char * path ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Statistics_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Statistics_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> get_type != 0 );
+        uint32_t ret  = ( * vt -> get_type ) ( self, & err, path );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    StringItf * StatisticsItf :: getAsString ( const char * path ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Statistics_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Statistics_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> as_string != 0 );
+        NGS_String_v1 * ret  = ( * vt -> as_string ) ( self, & err, path );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+    int64_t StatisticsItf :: getAsI64 ( const char * path ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Statistics_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Statistics_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> as_I64 != 0 );
+        int64_t ret  = ( * vt -> as_I64 ) ( self, & err, path );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    uint64_t StatisticsItf :: getAsU64 ( const char * path ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Statistics_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Statistics_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> as_U64 != 0 );
+        uint64_t ret  = ( * vt -> as_U64 ) ( self, & err, path );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    double StatisticsItf :: getAsDouble ( const char * path ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_Statistics_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_Statistics_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> as_F64 != 0 );
+        double ret  = ( * vt -> as_F64 ) ( self, & err, path );
+
+        // check for errors
+        err . Check ();
+
+        return ret;
+    }
+
+    StringItf * StatisticsItf :: nextPath ( const char * path ) const
+        throw ()
+    {
+        try
+        {
+            // the object is really from C
+            const NGS_Statistics_v1 * self = Test ();
+
+            // cast vtable to our level
+            const NGS_Statistics_v1_vt * vt = Access ( self -> vt );
+
+            // call through C vtable
+            ErrBlock err;
+            assert ( vt -> next_path != 0 );
+            NGS_String_v1 * ret  = ( * vt -> next_path ) ( self, & err, path );
+
+            // check for errors
+            err . Check ();
+
+            return StringItf :: Cast ( ret );
+        }
+        catch ( ErrorMsg & x )
+        {
+            // warn
+        }
+        catch ( ... )
+        {
+            // warn
+        }
+
+        return 0;
+    }
+
+} // namespace ngs
diff --git a/ngs-sdk/dispatch/StringItf.cpp b/ngs-sdk/dispatch/StringItf.cpp
new file mode 100644
index 0000000..b0eafc9
--- /dev/null
+++ b/ngs-sdk/dispatch/StringItf.cpp
@@ -0,0 +1,156 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/StringItf.hpp>
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+
+#include <ngs/itf/StringItf.h>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * metadata
+     */
+    extern ItfTok NGS_Refcount_v1_tok;
+    static ItfTok NGS_String_v1_tok ( "NGS_String_v1", NGS_Refcount_v1_tok );
+
+    /*----------------------------------------------------------------------
+     * access vtable
+     */
+    static inline
+    const NGS_String_v1_vt * Access ( const NGS_VTable * vt )
+    {
+        const NGS_String_v1_vt * out = static_cast < const NGS_String_v1_vt* >
+            ( Cast ( vt, NGS_String_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type NGS_String_v1" );
+        return out;
+    }
+
+    /*----------------------------------------------------------------------
+     * StringItf
+     *  a dynamically allocated object representing a string reference
+     */
+
+    const char * StringItf :: data () const
+        throw ()
+    {
+        if ( this != 0 )
+        {
+            // the object is really from C
+            const NGS_String_v1 * self = Self ();
+
+            // cast vtable to our level
+            try
+            {
+                const NGS_String_v1_vt * vt = Access ( self -> vt );
+
+                // call through C vtable
+                ErrBlock err;
+                assert ( vt -> data != 0 );
+                const char * ret = ( * vt -> data ) ( self, & err );
+
+                // check for errors
+                err . Check ();
+
+                return ret;
+            }
+            catch ( ErrorMsg & x )
+            {
+                // report to console or log
+            }
+            catch ( ... )
+            {
+            }
+        }
+
+        return "";
+    }
+
+    size_t StringItf :: size () const
+        throw ()
+    {
+        if ( this != 0 )
+        {
+            // the object is really from C
+            const NGS_String_v1 * self = Self ();
+
+            // cast vtable to our level
+            try
+            {
+                const NGS_String_v1_vt * vt = Access ( self -> vt );
+
+                // call through C vtable
+                ErrBlock err;
+                assert ( vt -> size != 0 );
+                size_t ret  = ( * vt -> size ) ( self, & err );
+
+                // check for errors
+                err . Check ();
+
+                return ret;
+            }
+            catch ( ErrorMsg & x )
+            {
+                // report to console or log
+            }
+            catch ( ... )
+            {
+            }
+        }
+
+        return 0;
+    }
+
+    StringItf * StringItf :: substr ( size_t offset ) const
+        throw ( ErrorMsg )
+    {
+        return substr ( offset, -1 );
+    }
+
+    StringItf * StringItf :: substr ( size_t offset, size_t size ) const
+        throw ( ErrorMsg )
+    {
+        // the object is really from C
+        const NGS_String_v1 * self = Test ();
+
+        // cast vtable to our level
+        const NGS_String_v1_vt * vt = Access ( self -> vt );
+
+        // call through C vtable
+        ErrBlock err;
+        assert ( vt -> substr != 0 );
+        NGS_String_v1 * ret  = ( * vt -> substr ) ( self, & err, offset, size );
+
+        // check for errors
+        err . Check ();
+
+        return StringItf :: Cast ( ret );
+    }
+
+
+} // namespace ngs
diff --git a/ngs-sdk/dispatch/VTable.cpp b/ngs-sdk/dispatch/VTable.cpp
new file mode 100644
index 0000000..04451e1
--- /dev/null
+++ b/ngs-sdk/dispatch/VTable.cpp
@@ -0,0 +1,144 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/VTable.hpp>
+
+#include <stdlib.h>
+#include <string.h>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * Depth
+     *  recursively discovers depth of runtime VTable
+     *  marks depth in ItfTok
+     */
+    static
+    uint32_t ItfTokDepth ( const ItfTok * itf )
+    {
+        uint32_t depth = 1;
+
+        if ( itf -> parent != 0 )
+            depth = ItfTokDepth ( itf -> parent ) + 1;
+
+        if ( itf -> idx == 0 )
+            itf -> idx = depth;
+
+        assert ( itf -> itf_name != 0 );
+        assert ( itf -> itf_name [ 0 ] != 0 );
+        assert ( itf -> idx == depth );
+
+        return depth;
+    }
+
+    static
+    uint32_t VTableDepth ( const NGS_VTable * vt )
+    {
+        uint32_t depth = 1;
+
+        if ( vt -> parent != 0 )
+            depth = VTableDepth ( vt -> parent ) + 1;
+
+        assert ( vt -> itf_name != 0 );
+
+        return depth;
+    }
+
+    /*----------------------------------------------------------------------
+     * PopulateCache
+     */
+    static
+    void VTablePopulateCache ( const NGS_VTable * vt, uint32_t depth, const ItfTok * itf, NGS_HierCache * cache )
+    {
+        do
+        {
+            assert ( vt != 0 );
+            assert ( itf != 0 );
+            assert ( depth != 0 );
+            assert ( itf -> idx <= depth );
+
+            vt -> cache = cache;
+
+            if ( itf -> idx == depth -- )
+            {
+                assert ( strcmp ( vt -> itf_name, itf -> itf_name ) == 0 );
+                cache -> hier [ depth ] . itf_tok = ( const void* ) itf;
+                itf = itf -> parent;
+            }
+
+            cache -> hier [ depth ] . parent = vt;
+            vt = vt -> parent;
+        }
+        while ( vt != 0 );
+    }
+
+
+    /*----------------------------------------------------------------------
+     * Resolve
+     *  creates a cache of interface hierarchy
+     *  resolves array indices of itf tokens
+     */
+    void Resolve ( const ItfTok  & itf )
+        throw ()
+    {
+        // interfaces only support single-inheritance
+        // perform a one-shot runtime depth assignment
+        ItfTokDepth ( & itf );
+    }
+
+    void Resolve ( const NGS_VTable * vt, const ItfTok & itf )
+        throw ( ErrorMsg )
+    {
+        if ( vt != 0 )
+        {
+            // determine depth of hierarchy
+            uint32_t depth = VTableDepth ( vt );
+            if ( itf . idx > depth )
+                throw ErrorMsg ( "interface not supported" );
+
+            // check for existing cache object
+            NGS_HierCache * cache = const_cast < NGS_HierCache* > ( vt -> cache );
+            if ( cache == 0 )
+            {
+                // allocate a cache object
+                cache = ( NGS_HierCache* ) calloc ( 1, sizeof * cache
+                    - sizeof cache -> hier + sizeof cache -> hier [ 0 ] * depth );
+                if ( cache == 0 )
+                    throw ErrorMsg ( "out of memory allocating NGS_HierCache" );
+
+                cache -> length = depth;
+            }
+            else if ( cache -> length != depth )
+            {
+                throw ErrorMsg ( "corrupt vtable cache" );
+            }
+
+            // populate
+            VTablePopulateCache ( vt, depth, & itf, cache );
+        }
+    }
+
+}
diff --git a/ngs-sdk/examples/.gitignore b/ngs-sdk/examples/.gitignore
new file mode 100644
index 0000000..2f7b19a
--- /dev/null
+++ b/ngs-sdk/examples/.gitignore
@@ -0,0 +1,3 @@
+AlignSliceTest
+AlignTest
+FragTest
\ No newline at end of file
diff --git a/ngs-sdk/examples/AlignSliceTest.cpp b/ngs-sdk/examples/AlignSliceTest.cpp
new file mode 100644
index 0000000..dd5957e
--- /dev/null
+++ b/ngs-sdk/examples/AlignSliceTest.cpp
@@ -0,0 +1,98 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ncbi-vdb/NGS.hpp>
+#include <ngs/ErrorMsg.hpp>
+#include <ngs/ReadCollection.hpp>
+#include <ngs/Reference.hpp>
+#include <ngs/AlignmentIterator.hpp>
+#include <ngs/Alignment.hpp>
+
+#include <math.h>
+#include <iostream>
+
+using namespace ngs;
+using namespace std;
+
+class AlignSliceTest
+{
+public:
+
+    static void run ( String acc, String refname, int start, int stop )
+    {
+
+        // open requested accession using SRA implementation of the API
+        ReadCollection run = ncbi::NGS::openReadCollection ( acc );
+        String run_name = run.getName ();
+
+        // get requested reference
+        Reference ref = run.getReference ( refname );
+
+        // start iterator on requested range
+        long count = stop - start + 1;
+        AlignmentIterator it = ref.getAlignmentSlice ( start, count, Alignment::primaryAlignment );
+
+        long i;
+        for ( i = 0; it . nextAlignment (); ++ i )
+        {
+            cout         << it.getReadId ()
+                 << '\t' << it.getReferenceSpec ()
+                 << '\t' << it.getAlignmentPosition ()
+                 << '\t' << it.getLongCigar ( false )         // unclipped
+                 << '\t' << it.getAlignedFragmentBases ()
+                 << '\n';
+        }
+
+        cerr << "Read " <<  i <<  " alignments for " <<  run_name << '\n';
+    }
+};
+
+int main ( int argc, char const *argv[] )
+{
+    if ( argc != 5 )
+    {
+        cerr << "Usage: AlignSliceTest accession reference start stop\n";
+    }
+    else try
+    {
+        AlignSliceTest::run ( argv[1], argv[2], atoi ( argv[3] ), atoi ( argv[4] ) );
+        return 0;
+    }
+    catch ( ErrorMsg & x )
+    {
+        cerr <<  x.toString () << '\n';
+    }
+    catch ( exception & x )
+    {
+        cerr <<  x.what () << '\n';
+    }
+    catch ( ... )
+    {
+        cerr <<  "unknown exception\n";
+    }
+
+    return 10;
+}
diff --git a/ngs-sdk/examples/AlignTest.cpp b/ngs-sdk/examples/AlignTest.cpp
new file mode 100644
index 0000000..1a0a3c5
--- /dev/null
+++ b/ngs-sdk/examples/AlignTest.cpp
@@ -0,0 +1,103 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ncbi-vdb/NGS.hpp>
+#include <ngs/ErrorMsg.hpp>
+#include <ngs/ReadCollection.hpp>
+#include <ngs/AlignmentIterator.hpp>
+#include <ngs/Alignment.hpp>
+
+#include <math.h>
+#include <iostream>
+
+using namespace ngs;
+using namespace std;
+
+class AlignTest
+{
+public:
+
+    static void run ( String acc, int splitNum, int splitNo )
+    {
+
+        // open requested accession using SRA implementation of the API
+        ReadCollection run = ncbi::NGS::openReadCollection ( acc );
+        String run_name = run.getName ();
+
+        // compute window to iterate through
+        long MAX_ROW = run.getAlignmentCount (); 
+        double chunk = ( double ) MAX_ROW / splitNum;
+        long first = ( long ) round ( chunk * ( splitNo-1 ) );
+
+        long next_first = ( long ) round ( chunk * ( splitNo ) );
+        if ( next_first > MAX_ROW )
+            next_first = MAX_ROW;
+
+        //start iterator on reads
+        long count = next_first - first;
+        AlignmentIterator it = run.getAlignmentRange ( first+1, count, Alignment::primaryAlignment );
+
+        long i;
+        for ( i = 0; it.nextAlignment (); ++ i )
+        {
+            cout         << it.getReadId ()
+                 << '\t' << it.getReferenceSpec ()
+                 << '\t' << it.getAlignmentPosition ()
+                 << '\t' << it.getShortCigar ( false )  // unclipped
+                 << '\t' << it.getFragmentBases ()
+                 << '\n';
+        }
+
+        cerr << "Read " <<  i <<  " alignments for " <<  run_name << '\n';
+    }
+};
+
+int main ( int argc, char const *argv[] )
+{
+    if ( argc != 4 )
+    {
+        cerr << "Usage: AlignTest accession NumChunks ChunkNo\n";
+    }
+    else try
+    {
+        AlignTest::run (argv[1], atoi ( argv[2] ), atoi ( argv[3] ) );
+        return 0;
+    }
+    catch ( ErrorMsg & x )
+    {
+        cerr <<  x.toString () << '\n';
+    }
+    catch ( exception & x )
+    {
+        cerr <<  x.what () << '\n';
+    }
+    catch ( ... )
+    {
+        cerr <<  "unknown exception\n";
+    }
+
+    return 10;
+}
diff --git a/ngs-sdk/examples/FragTest.cpp b/ngs-sdk/examples/FragTest.cpp
new file mode 100644
index 0000000..7ac458e
--- /dev/null
+++ b/ngs-sdk/examples/FragTest.cpp
@@ -0,0 +1,105 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ncbi-vdb/NGS.hpp>
+#include <ngs/ErrorMsg.hpp>
+#include <ngs/ReadCollection.hpp>
+#include <ngs/ReadIterator.hpp>
+#include <ngs/Read.hpp>
+
+
+#include <math.h>
+#include <iostream>
+
+using namespace ngs;
+using namespace std;
+
+class FragTest
+{
+public:
+
+    static void run ( String acc, int splitNum, int splitNo )
+    {
+
+        // open requested accession using SRA implementation of the API
+        ReadCollection run = ncbi::NGS::openReadCollection ( acc );
+        String run_name = run.getName ();
+
+        // compute window to iterate through
+        long MAX_ROW = run.getReadCount (); 
+        double chunk = ( double ) MAX_ROW / splitNum;
+        long first = ( long ) round ( chunk * ( splitNo-1 ) );
+
+        long next_first = ( long ) round ( chunk * ( splitNo ) );
+        if ( next_first > MAX_ROW )
+            next_first = MAX_ROW;
+
+        //start iterator on reads
+        long count = next_first - first;
+        ReadIterator it = run.getReadRange ( first+1, count, Read::all );
+
+        long i;
+        for ( i = 0; it.nextRead (); ++ i )
+        {
+            cout << it.getReadId();
+
+            //iterate through fragments
+            while ( it.nextFragment () )
+                cout << '\t' <<  it.getFragmentBases ();
+
+            cout << '\n';
+        }
+
+        cerr << "Read " << i << " spots for " << run_name << '\n';
+    }
+};
+
+int main (int argc, char const *argv[])
+{
+    if ( argc != 4 )
+    {
+        cerr << "Usage: FragTest accession NumChunks ChunkNo\n";
+    }
+    else try
+    {
+        FragTest::run ( argv[1], atoi ( argv[2] ), atoi ( argv[3] ) );
+        return 0;
+    }
+    catch ( ErrorMsg & x )
+    {
+        cerr <<  x.toString () << '\n';
+    }
+    catch ( exception & x )
+    {
+        cerr <<  x.what () << '\n';
+    }
+    catch ( ... )
+    {
+        cerr <<  "unknown exception\n";
+    }
+
+    return 10;
+}
diff --git a/ngs-sdk/examples/Makefile b/ngs-sdk/examples/Makefile
new file mode 100644
index 0000000..8257cce
--- /dev/null
+++ b/ngs-sdk/examples/Makefile
@@ -0,0 +1,102 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+# ensure definition of paths, namely
+# NCBI_VDB_LIBDIR and NGS_LIBDIR
+include $(CURDIR)/Makefile.config
+
+TARGETS =         \
+    FragTest      \
+    AlignTest     \
+    AlignSliceTest
+
+# This rule triggers detection of the libraries and headers
+# in addition to building the examples
+std: $(NCBI_VDB_LIBDIR)/libncbi-vdb-static.a ncbi-headers \
+	 $(NGS_LIBDIR)/libngs-c++.a ngs-headers \
+	 $(TARGETS)
+
+clean:
+	rm -f $(TARGETS) *.o
+
+.PHONY: default std $(TARGETS)
+
+# C++ applications require two NGS libraries:
+#  1. ngs-c++ which contains the NGS "front-end" interfaces
+#  2. an NGS "back-end" engine such as ncbi-ngs-c++
+#     which in turn relies upon ncbi-vdb to access the SRA
+#
+TEST_LIBS =              \
+    -L$(NCBI_VDB_LIBDIR) \
+    -L$(NGS_LIBDIR)      \
+    -lncbi-ngs-c++       \
+    -lngs-c++            \
+    -lncbi-vdb-static    \
+    -lpthread            \
+    -ldl                 \
+    -lm
+
+# FragTest
+#  access read fragments
+FRAG_TEST_OBJ = \
+    FragTest.o
+
+FragTest: $(FRAG_TEST_OBJ)
+	g++ -o $@ $^ $(TEST_LIBS)
+
+# AlignTest
+#  access alignments
+ALIGN_TEST_OBJ = \
+    AlignTest.o
+
+AlignTest: $(ALIGN_TEST_OBJ)
+	g++ -o $@ $^ $(TEST_LIBS)
+
+# AlignSliceTest
+#  slice a ReadCollection and output alignments
+ALIGNSLICE_TEST_OBJ = \
+    AlignSliceTest.o
+
+AlignSliceTest: $(ALIGNSLICE_TEST_OBJ)
+	g++ -o $@ $^ $(TEST_LIBS)
+
+
+# ===========================================================================
+#
+# example runs
+
+run_frag:  FragTest
+	./$^ ERR225922 1 1
+
+run_align: AlignTest
+	./$^ ERR225922 1 1
+
+run_align_slice: AlignSliceTest
+	./$^ SRR1121656 1 10000 20000
+
+
+.PHONY: run_align run_align_slice run_frag
diff --git a/ngs-sdk/examples/Makefile.config b/ngs-sdk/examples/Makefile.config
new file mode 100644
index 0000000..973c7cf
--- /dev/null
+++ b/ngs-sdk/examples/Makefile.config
@@ -0,0 +1,85 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+# All of this section is to provide semi-automatic detection of
+# required libraries and headers. They SHOULD have been built and installed
+# already before building these examples.
+
+NCBI_VDB_LIBDIR ?= $(dir $(firstword $(shell find $(subst :, ,$(LD_LIBRARY_PATH) -maxdepth 1 -name libncbi-vdb-static.a) 2>/dev/null) ) )
+NGS_LIBDIR      ?= $(dir $(firstword $(shell find $(subst :, ,$(LD_LIBRARY_PATH) -maxdepth 1 -name libngs-c++.a) 2>/dev/null) ) )
+
+ifeq (,$(wildcard /usr/include/ncbi-vdb))
+    ifeq (,$(wildcard $(NCBI_VDB_LIBDIR)/../include))
+
+ncbi-headers:
+	@ echo "NCBI_VDB headers are not found (looking for /usr/include/ncbi-vdb or $(NCBI_VDB_LIBDIR)../include)"
+	@ false    
+
+    else
+
+CPPFLAGS += -I$(NCBI_VDB_LIBDIR)/../include
+ncbi-headers:
+	@ true
+
+    endif
+
+else
+
+# found in /usr/include
+ncbi-headers:
+	@ true
+endif
+
+ifeq (,$(wildcard /usr/include/ngs))
+    ifeq (,$(wildcard $(NGS_LIBDIR)/../include))
+
+ngs-headers:
+	@ echo "NGS headers are not found (looking for /usr/include/ngs or $(NGS_LIBDIR)../include)"
+	@ false    
+
+    else
+
+CPPFLAGS += -I$(NGS_LIBDIR)/../include
+ngs-headers:
+	@ true
+
+    endif
+
+else    
+
+# found in /usr/include
+ngs-headers:
+	@ true
+endif
+
+$(NCBI_VDB_LIBDIR)/libncbi-vdb-static.a:
+	@ echo "These example applications require $(@F). Please install ncbi-vdb libraries and add their location to LD_LIBRARY_PATH."
+	@ false
+
+$(NGS_LIBDIR)/libngs-c++.a:
+	@ echo "These example applications require $(@F). Please install ngs libraries and add their location to LD_LIBRARY_PATH."
+	@ false
+
+# END OF LIBRARY DETECTION
diff --git a/ngs-sdk/konfigure.perl b/ngs-sdk/konfigure.perl
new file mode 100644
index 0000000..2a7fde7
--- /dev/null
+++ b/ngs-sdk/konfigure.perl
@@ -0,0 +1,1210 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+use strict;
+
+sub println  { print @_; print "\n" }
+
+my ($filename, $directories, $suffix) = fileparse($0);
+if ($directories ne "./") {
+    println "configure: error: $filename should be run as ./$filename";
+    exit 1;
+}
+
+require 'package.pm';
+require 'os-arch.pm';
+
+use Cwd qw (abs_path getcwd);
+use File::Basename 'fileparse';
+use File::Spec 'catdir';
+use FindBin qw($Bin);
+use Getopt::Long 'GetOptions';
+
+check();
+
+my %PKG = PKG();
+
+my $PACKAGE_NAME = PACKAGE_NAME();
+my $OUT_MAKEFILE = 'Makefile.config';
+
+my $PACKAGE = PACKAGE();
+
+my $HOME = $ENV{HOME} || $ENV{USERPROFILE}
+    || $ENV{LOGDIR} || getcwd || (getpwuid($<))[7] || abs_path('.');
+
+$PKG{UPATH} =~ s/(\$\w+)/$1/eeg;
+
+my $OUTDIR = File::Spec->catdir($HOME, $PKG{OUT});
+
+my $package_default_prefix = $PKG{PATH};
+my $schema_default_dir = $PKG{SCHEMA_PATH} if ($PKG{SCHEMA_PATH});
+
+my @REQ = REQ();
+
+my @options = ( "arch=s",
+                "build=s",
+                "clean",
+                "debug",
+                "help",
+#               "output-makefile=s",
+                "prefix=s",
+                "status",
+                "with-debug",
+                "without-debug" );
+foreach my $href (@REQ) {
+    my %a = %$href;
+    push @options, "$a{option}=s";
+    push @options, "$a{boption}=s" if ($a{boption});
+    $href->{usrpath} =~ s/(\$\w+)/$1/eeg;
+}
+push @options, "shemadir" if ($PKG{SCHEMA_PATH});
+
+my %OPT;
+die "configure: error" unless (GetOptions(\%OPT, @options));
+
+if ($OPT{'help'}) {
+    help();
+    exit(0);
+} elsif ($OPT{'clean'}) {
+    {
+        foreach (glob(CONFIG_OUT() . '/Makefile.config*'),
+            File::Spec->catdir(CONFIG_OUT(), 'user.status'),
+            File::Spec->catdir(CONFIG_OUT(), 'Makefile.userconfig'))
+        {
+            my $f = $_;
+            print "removing $f... ";
+            if (-e $f) {
+                if (unlink $f) {
+                    println "ok";
+                } else {
+                    println "failed";
+                }
+            } else {
+                println "not found";
+            }
+        }
+    }
+    if (CONFIG_OUT() ne '.') {
+        foreach
+            (glob('Makefile.config*'), 'user.status', 'Makefile.userconfig')
+        {
+            my $f = $_;
+            print "removing $f... ";
+            if (-e $f) {
+                if (unlink $f) {
+                    println "ok";
+                } else {
+                    println "failed";
+                }
+            } else {
+                println "not found";
+            }
+        }
+    }
+    exit(0);
+} elsif ($OPT{'status'}) {
+    status(1);
+    exit(0);
+}
+$OPT{'prefix'} = $package_default_prefix unless ($OPT{'prefix'});
+
+my $AUTORUN = $OPT{status};
+print "checking system type... " unless ($AUTORUN);
+my ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+println $OSTYPE unless ($AUTORUN);
+
+{
+    $OPT{'prefix'} = expand($OPT{'prefix'});
+    my $prefix = $OPT{'prefix'};
+    $OPT{eprefix} = $prefix unless ($OPT{eprefix} || $OS eq 'win');
+    my $eprefix = $OPT{eprefix};
+    unless ($OPT{bindir} || $OS eq 'win') {
+        $OPT{bindir} = File::Spec->catdir($eprefix, 'bin') ;
+    }
+    unless ($OPT{libdir} || $OS eq 'win') {
+        $OPT{libdir} = File::Spec->catdir($eprefix, 'lib');
+    }
+    unless ($OPT{includedir} || $OS eq 'win') {
+        $OPT{includedir} = File::Spec->catdir($eprefix, 'include');
+    }
+    if ($PKG{LNG} eq 'PYTHON' && ! $OPT{pythondir} && $OS ne 'win') {
+        $OPT{pythondir} = $eprefix;
+    }
+    if ($PKG{LNG} eq 'JAVA' && ! $OPT{javadir} && $OS ne 'win') {
+        $OPT{javadir} = File::Spec->catdir($eprefix, 'jar');
+    }
+    if ($PKG{EXAMP} && ! $OPT{sharedir} && $OS ne 'win') {
+        $OPT{sharedir} = File::Spec->catdir($eprefix, 'share');
+    }
+}
+
+# initial values
+my $TARGDIR = File::Spec->catdir($OUTDIR, $PACKAGE);
+$TARGDIR = expand($OPT{'build'}) if ($OPT{'build'});
+
+my $BUILD = 'rel';
+
+# parse command line
+$BUILD = 'dbg' if ($OPT{'with-debug'});
+$BUILD = 'rel' if ($OPT{'without-debug'});
+
+my $BUILD_TYPE = "release";
+$BUILD_TYPE = "debug" if ( $BUILD eq "dbg" );
+
+$OPT{arch} = $ARCH if (@ARCHITECTURES && ! $OPT{arch});
+
+if ($OPT{arch}) {
+    my $found;
+    foreach (@ARCHITECTURES) {
+        if ($_ eq $OPT{arch}) {
+            ++$found;
+            last;
+        }
+    }
+    if ($found) {
+        $ARCH = $MARCH = $OPT{arch};
+        while (1) {
+            open F, ">Makefile.config.$OS.arch" or last;
+            print F "$ARCH\n";
+            close F;
+            last;
+        }
+    } else {
+        delete $OPT{arch};
+    }
+}
+
+$OUT_MAKEFILE .= ".$OS.$ARCH";
+$OUT_MAKEFILE = File::Spec->catdir(CONFIG_OUT(), $OUT_MAKEFILE);
+
+#my $OSTYPE = `uname -s`; chomp $OSTYPE;
+
+print "checking machine architecture... " unless ($AUTORUN);
+#my $MARCH = `uname -m`; chomp $MARCH;
+println $MARCH unless ($AUTORUN);
+
+my $TOOLS = "";
+$TOOLS = "jdk" if ($PKG{LNG} eq 'JAVA');
+
+print "checking $PACKAGE_NAME version... " unless ($AUTORUN);
+my $FULL_VERSION = VERSION();
+println $FULL_VERSION unless ($AUTORUN);
+
+# determine architecture
+
+print "checking for supported architecture... " unless ($AUTORUN);
+
+my $BITS;
+
+if ( $MARCH =~ m/x86_64/i )
+{
+    $BITS = 64;
+}
+elsif ( $MARCH =~ m/i?86/i )
+{
+    $BITS = 32;
+}
+else
+{
+    die "unrecognized Architecture - " . $ARCH;
+}
+println "$MARCH ($BITS bits) is supported" unless ($AUTORUN);
+
+# determine OS and related norms
+my ($LPFX, $OBJX, $LOBX, $LIBX, $SHLX, $EXEX, $OSINC);
+
+print "checking for supported OS... " unless ($AUTORUN);
+if ( $OSTYPE =~ m/linux/i )
+{
+    $LPFX = "lib";
+    $OBJX = "o";
+    $LOBX = "pic.o";
+    $LIBX = "a";
+    $SHLX = "so";
+    $EXEX = "";
+    $OSINC = "unix";
+    if ( $TOOLS eq "" )
+    {
+        $TOOLS = "gcc";
+    }
+}
+elsif ( $OSTYPE =~ m/darwin/i )
+{
+    $LPFX = "lib";
+    $OBJX = "o";
+    $LOBX = "pic.o";
+    $LIBX = "a";
+    $SHLX = "dylib";
+    $EXEX = "";
+    $OSINC = "unix";
+    if ( $TOOLS eq "" )
+    {
+        $TOOLS = "clang";
+    }
+} elsif ($OSTYPE eq 'win') {
+    $TOOLS = "vc++";
+} else
+{
+    die "unrecognized OS - " . $OSTYPE;
+}
+println "$OSTYPE ($OS) is supported" unless ($AUTORUN);
+
+# tool chain
+my ($CC, $CP, $AR, $ARX, $ARLS, $LD, $LP);
+my ($JAVAC, $JAVAH, $JAR);
+my ($DBG, $OPT, $PIC, $INC, $MD);
+
+print "checking for supported tool chain... " unless ($AUTORUN);
+if ( $TOOLS =~ m/gcc/i )
+{
+    $CC = "gcc -c";
+    $CP = "g++ -c";
+    $AR = "ar rc";
+    $ARX = "ar x";
+    $ARLS = "ar t";
+    $LD = "gcc";
+    $LP = "g++";
+
+    $DBG = "-g -DDEBUG";
+    $OPT = "-O3";
+    $PIC = "-fPIC";
+    $INC = "-I";
+    $MD  = "-MD";
+}
+elsif ( $TOOLS =~ m/clang/i )
+{
+    $CC = "clang -c";
+    $CP = "clang++ -c";
+    $AR = "ar rc";
+    $ARX = "ar x";
+    $ARLS = "ar t";
+    $LD = "clang";
+    $LP = "clang++";
+
+    $DBG = "-g -DDEBUG";
+    $OPT = "-O3";
+    $PIC = "-fPIC";
+    $INC = "-I";
+    $MD  = "-MD";
+}
+elsif ( $TOOLS =~ m/jdk/i )
+{
+    $JAVAC = "javac";
+    $JAVAH = "javah";
+    $JAR   = "jar cf";
+
+    $DBG = "-g";
+} elsif ($TOOLS eq 'vc++') {
+} else
+{
+    die "unrecognized tool chain - " . $TOOLS;
+}
+println "$TOOLS tool chain is supported" unless ($AUTORUN);
+
+if ($OS ne 'win') {
+    $TARGDIR = File::Spec->catdir($TARGDIR, $OS, $TOOLS, $ARCH, $BUILD);
+}
+
+my @dependencies;
+
+foreach my $href (DEPENDS()) {
+    $_ = $href->{name};
+    my ($I, $L) = ($href->{Include});
+    if ($OPT{"with-$_-prefix"}) {
+        $I = File::Spec->catdir($OPT{"with-$_-prefix"}, 'include'); 
+        $L = File::Spec->catdir($OPT{"with-$_-prefix"}, 'lib'); 
+    }
+    my ($i, $l) = find_lib($_, $I, $L);
+    if (defined $i || $l) {
+        my $d = 'HAVE_' . uc($_) . ' = 1';
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+    if ($i) {
+        my $d = uc($_) . "_INCDIR = $i";
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+    if ($l) {
+        my $d = uc($_) . "_LIBDIR = $l";
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+}
+
+foreach my $href (@REQ) {
+    $href->{bldpath} =~ s/(\$\w+)/$1/eeg if ($href->{bldpath});
+    my ($found_itf, $found_lib, $found_ilib);        # found directories
+    my %a = %$href;
+    my $is_optional = optional($a{type});
+    my $need_source = $a{type} =~ /S/;
+    my $need_build = $a{type} =~ /B/;
+    my $need_lib = $a{type} =~ /L/;
+    
+    my ($inc, $lib, $ilib) = ($a{include}, $a{lib}); # file names to check
+    $lib =~ s/(\$\w+)/$1/eeg;
+
+    if ($need_build) {
+        $ilib = $a{ilib};
+        ++$need_lib;
+    }
+    unless ($AUTORUN) {
+        if ($need_source && $need_build) {
+            println
+               "checking for $a{name} package source files and build results..."
+        } elsif ($need_source) {
+            println "checking for $a{name} package source files...";
+        } else {
+            println "checking for $a{name} package...";
+        }
+    }
+    my %has_option;
+    foreach my $option ($a{option}, $a{boption}) {
+        next unless ($option);
+        if ($OPT{$option}) {
+            my $try = expand($OPT{$option});
+            my ($i, $l, $il) = ($inc, $lib, $ilib);
+            if ($option =~ /-build$/) {
+                undef $i;
+                ++$has_option{build};
+            } elsif ($option =~ /-prefix$/) {
+                undef $il;
+                ++$has_option{prefix};
+            } elsif ($option =~ /-sources$/) {
+                undef $l;
+                undef $il;
+                ++$has_option{sources};
+            }
+            my ($fi, $fl, $fil) = find_in_dir($try, $i, $l, $il);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+            $found_ilib = $fil if (! $found_ilib && $fil);
+        }
+    }
+    if (! $found_itf && ! $has_option{sources} && $a{srcpath}) {
+        my $try = $a{srcpath};
+        ($found_itf) = find_in_dir($try, $inc);
+    }
+    if (! $has_option{prefix}) {
+        if (! $found_itf || ($need_lib && ! $found_lib)) {
+            my $try = $a{pkgpath};
+            my ($fi, $fl) = find_in_dir($try, $inc, $lib);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+        }
+
+        if (! $found_itf || ($need_lib && ! $found_lib)) {
+            my $try = $a{usrpath};
+            my ($fi, $fl) = find_in_dir($try, $inc, $lib);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+        }
+    }
+    if (! $has_option{build}) {
+        if (($need_build || ($need_lib && ! $found_lib)) && $a{bldpath}) {
+            my $try = $a{bldpath};
+            my (undef, $fl, $fil) = find_in_dir($try, undef, $lib, $ilib);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+            $found_ilib = $fil if (! $found_ilib && $fil);
+        }
+    }
+    if (! $found_itf || ($need_lib && ! $found_lib) || ($ilib && ! $found_ilib))
+    {
+        if ($is_optional) {
+            println "configure: optional $a{name} package not found: skipped.";
+        } else {
+            if ($OPT{'debug'}) {
+                $_ = "$a{name}: includes: ";
+                $found_itf = '' unless $found_itf;
+                $_ .= $found_itf;
+                unless ($need_lib) {
+                    $_ .= "; libs: not needed";
+                } else {
+                    $found_lib = '' unless $found_lib;
+                    $_ .= "; libs: " . $found_lib;
+                }
+                unless ($ilib) {
+                    $_ .= "; ilibs: not needed";
+                } else {
+                    $found_ilib = '' unless $found_ilib;
+                    $_ .= "; ilibs: " . $found_ilib;
+                }
+                println "\t\t$_";
+            }
+            println "configure: error: required $a{name} package not found.";
+            exit 1;
+        }
+    } else {
+        $found_itf = abs_path($found_itf);
+        push(@dependencies, "$a{namew}_INCDIR = $found_itf");
+        if ($found_lib) {
+            $found_lib = abs_path($found_lib);
+            push(@dependencies, "$a{namew}_LIBDIR = $found_lib");
+        }
+        if ($ilib && $found_ilib) {
+            $found_ilib = abs_path($found_ilib);
+            push(@dependencies, "$a{namew}_ILIBDIR = $found_ilib");
+        }
+    }
+}
+
+if ($OS ne 'win' && ! $OPT{'status'}) {
+    # create Makefile.config
+    println "configure: creating '$OUT_MAKEFILE'" unless ($AUTORUN);
+    open my $F, ">$OUT_MAKEFILE" or die "cannot open $OUT_MAKEFILE to write";
+
+    print $F <<EndText;
+### AUTO-GENERATED FILE ###
+
+OS_ARCH = \$(shell perl \$(TOP)/os-arch.perl)
+
+# install paths
+EndText
+
+    L($F, "INST_BINDIR = $OPT{bindir}"        ) if ($OPT{bindir});
+    L($F, "INST_LIBDIR = $OPT{libdir}"        ) if ($OPT{libdir});
+    L($F, "INST_INCDIR = $OPT{includedir}"    ) if ($OPT{includedir});
+    L($F, "INST_SCHEMADIR = $OPT{'shemadir'}" ) if ($OPT{'shemadir'});
+    L($F, "INST_SHAREDIR = $OPT{'sharedir'}"  ) if ($OPT{'sharedir'});
+    L($F, "INST_JARDIR = $OPT{'javadir'}"     ) if ($OPT{'javadir'});
+    L($F, "INST_PYTHONDIR = $OPT{'pythondir'}") if ($OPT{'pythondir'});
+
+    my ($VERSION_SHLX, $MAJMIN_SHLX, $MAJVERS_SHLX);
+    if ($OSTYPE =~ /darwin/i) {
+        $VERSION_SHLX = '$(VERSION).$(SHLX)';
+        $MAJMIN_SHLX  = '$(MAJMIN).$(SHLX)';
+        $MAJVERS_SHLX = '$(MAJVERS).$(SHLX)';
+    } else {
+        $VERSION_SHLX = '$(SHLX).$(VERSION)';
+        $MAJMIN_SHLX  = '$(SHLX).$(MAJMIN)';
+        $MAJVERS_SHLX = '$(SHLX).$(MAJVERS)';
+    }
+
+
+    print $F <<EndText;
+
+# build type
+BUILD = $BUILD
+
+# target OS
+OS    = $OS
+OSINC = $OSINC
+
+# prefix string for system libraries
+LPFX = $LPFX
+
+# suffix strings for system libraries
+LIBX = $LIBX
+VERSION_LIBX = \$(LIBX).\$(VERSION)
+MAJMIN_LIBX  = \$(LIBX).\$(MAJMIN)
+MAJVERS_LIBX = \$(LIBX).\$(MAJVERS)
+
+SHLX = $SHLX
+VERSION_SHLX = $VERSION_SHLX
+MAJMIN_SHLX  = $MAJMIN_SHLX
+MAJVERS_SHLX = $MAJVERS_SHLX
+
+# suffix strings for system object files
+OBJX = $OBJX
+LOBX = $LOBX
+
+# suffix string for system executable
+EXEX = $EXEX
+VERSION_EXEX = \$(EXEX).\$(VERSION)
+MAJMIN_EXEX  = \$(EXEX).\$(MAJMIN)
+MAJVERS_EXEX = \$(EXEX).\$(MAJVERS)
+
+# system architecture and wordsize
+ARCH = $ARCH
+EndText
+
+    L($F, "# ARCH = $ARCH ( $MARCH )") if ($ARCH ne $MARCH);
+
+    print $F <<EndText;
+BITS = $BITS
+
+# tools
+EndText
+
+    L($F, "CC    = $CC"   ) if ($CC);
+    L($F, "CP    = $CP"   ) if ($CP);
+    L($F, "AR    = $AR"   ) if ($AR);
+    L($F, "ARX   = $ARX"  ) if ($ARX);
+    L($F, "ARLS  = $ARLS" ) if ($ARLS);
+    L($F, "LD    = $LD"   ) if ($LD);
+    L($F, "LP    = $LP"   ) if ($LP);
+    L($F, "JAVAC = $JAVAC") if ($JAVAC);
+    L($F, "JAVAH = $JAVAH") if ($JAVAH);
+    L($F, "JAR   = $JAR"  ) if ($JAR);
+    L($F);
+
+    L($F, '# tool options');
+    if ($BUILD eq "dbg") {
+        L($F, "DBG     = $DBG");
+        L($F, "OPT     = ");
+    } else {
+        L($F, "DBG     = -DNDEBUG") if ($PKG{LNG} eq 'C');
+        L($F, "OPT     = $OPT"    ) if ($OPT);
+    }
+    L($F, "PIC     = $PIC") if ($PIC);
+    if ($PKG{LNG} eq 'C') {
+        if ($TOOLS =~ /clang/i) {
+   L($F, 'SONAME  = -install_name ' .
+               '$(INST_LIBDIR)$(BITS)/$(subst $(VERSION),$(MAJVERS),$(@F)) \\');
+   L($F, '    -compatibility_version $(MAJMIN) -current_version $(VERSION) \\');
+   L($F, '    -flat_namespace -undefined suppress');
+        } else {
+      L($F, 'SONAME = -Wl,-soname=$(subst $(VERSION),$(MAJVERS),$(@F))');
+     }
+     L($F, "SRCINC  = $INC. $INC\$(SRCDIR)");
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'SRCINC  = -sourcepath $(INCPATHS)');
+    }
+    L($F, "INCDIRS = \$(SRCINC) $INC\$(TOP)") if ($PIC);
+    if ($PKG{LNG} eq 'C') {
+        L($F, "CFLAGS  = \$(DBG) \$(OPT) \$(INCDIRS) $MD");
+    }
+
+    L($F, 'CLSPATH = -classpath $(CLSDIR)');
+    L($F);
+
+    # version information
+
+    my ($VERSION, $MAJMIN, $MAJVERS);
+
+    if ($FULL_VERSION =~ /(\d+)\.(\d+)\.(\d+)-?\w*\d*/) {
+        $VERSION = "$1.$2.$3";
+        $MAJMIN = "$1.$2";
+        $MAJVERS = $1;
+    } else {
+        die $VERSION;
+    }
+
+    print $F <<EndText;
+# $PACKAGE_NAME and library version
+VERSION = $VERSION
+MAJMIN  = $MAJMIN
+MAJVERS = $MAJVERS
+
+# output path
+TARGDIR = $TARGDIR
+
+# derived paths
+MODPATH  ?= \$(subst \$(TOP)/,,\$(CURDIR))
+SRCDIR   ?= \$(TOP)/\$(MODPATH)
+MAKEFILE ?= \$(abspath \$(firstword \$(MAKEFILE_LIST)))
+BINDIR    = \$(TARGDIR)/bin
+EndText
+
+    if ($PKG{LNG} eq 'C') {
+        L($F, 'LIBDIR    = $(TARGDIR)/lib');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'LIBDIR    = $(TARGDIR)/jar');
+    }
+
+    print $F <<EndText;
+ILIBDIR   = \$(TARGDIR)/ilib
+OBJDIR    = \$(TARGDIR)/obj/\$(MODPATH)
+CLSDIR    = \$(TARGDIR)/cls
+EndText
+
+    if ($PKG{LNG} eq 'JAVA') {
+        L($F,
+            "INCPATHS = \$(SRCDIR):\$(SRCDIR)/itf:\$(TOP)/gov/nih/nlm/ncbi/ngs")
+    }
+
+    print $F <<EndText;
+
+# exports
+export TOP
+export MODPATH
+export SRCDIR
+export MAKEFILE
+
+# auto-compilation rules
+EndText
+
+    if ($PKG{LNG} eq 'C') {
+        L($F, '$(OBJDIR)/%.$(OBJX): %.c');
+        T($F, '$(CC) -o $@ $< $(CFLAGS)');
+        L($F, '$(OBJDIR)/%.$(LOBX): %.c');
+        T($F, '$(CC) -o $@ $< $(PIC) $(CFLAGS)');
+    }
+    L($F, '$(OBJDIR)/%.$(OBJX): %.cpp');
+    T($F, '$(CP) -o $@ $< $(CFLAGS)');
+    L($F, '$(OBJDIR)/%.$(LOBX): %.cpp');
+    T($F, '$(CP) -o $@ $< $(PIC) $(CFLAGS)');
+    L($F);
+
+    # this is part of Makefile
+    L($F, 'VPATH = $(SRCDIR)');
+    L($F);
+
+    # we know how to find jni headers
+    if ($PKG{LNG} eq 'JAVA' and $OPT{'with-ngs-sdk-src'}) {
+        L($F, "JNIPATH = $OPT{'with-ngs-sdk-src'}/language/java");
+    }
+
+    L($F, '# directory rules');
+    if ($PKG{LNG} eq 'C') {
+        L($F, '$(BINDIR) $(LIBDIR) $(ILIBDIR) '
+            . '$(OBJDIR) $(INST_LIBDIR) $(INST_LIBDIR)$(BITS):');
+        T($F, 'mkdir -p $@');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        # test if we have jni header path
+        L($F, '$(LIBDIR) $(CLSDIR) $(INST_JARDIR):');
+        T($F, 'mkdir -p $@');
+    }
+    L($F);
+
+    L($F, '# not real targets');
+    L($F, '.PHONY: default clean install all std $(TARGETS)');
+    L($F);
+
+    L($F, '# dependencies');
+    if ($PKG{LNG} eq 'C') {
+        L($F, 'include $(wildcard $(OBJDIR)/*.d)');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'include $(wildcard $(CLSDIR)/*.d)');
+    }
+    L($F, $_) foreach (@dependencies);
+    L($F);
+
+    if ($OS eq 'linux' || $OS eq 'mac') {
+        L($F, '# installation rules');
+        L($F,
+        '$(INST_LIBDIR)$(BITS)/%.$(VERSION_LIBX): $(LIBDIR)/%.$(VERSION_LIBX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 644 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_LIBX),$(LIBX),$@) '
+                      . '$(subst .$(VERSION_LIBX),-static.$(LIBX),$@); \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_LIBX),$(LIBX),$@); \\');
+        T($F, '      ln -s $(subst $(VERSION_LIBX),$(LIBX),$(@F)) ' .
+       '$(INST_LIBDIR)$(BITS)/$(subst .$(VERSION_LIBX),-static.$(LIBX),$(@F));'
+                                                              . ' \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+        L($F);
+
+        L($F,
+        '$(INST_LIBDIR)$(BITS)/%.$(VERSION_SHLX): $(LIBDIR)/%.$(VERSION_SHLX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 755 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_SHLX),$(SHLX),$@);    \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_SHLX),$(SHLX),$@); \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+        L($F);
+
+        L($F, '$(INST_BINDIR)/%$(VERSION_EXEX): $(BINDIR)/%$(VERSION_EXEX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 755 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_EXEX),$(EXEX),$@);     \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_EXEX),$(EXEX),$@); \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+    }
+    close $F;
+}
+
+if (! $OPT{'status'} ) {
+    if ($OS eq 'win') {
+        my $OUT = File::Spec->catdir(CONFIG_OUT(), 'Makefile.config.win');
+        println "configure: creating '$OUT'";
+        open OUT, ">$OUT" or die "cannot open $OUT to write";
+        my $name = PACKAGE_NAMW();
+        my $outdir = $name . '_OUTDIR';
+        my $root = $name . '_ROOT';
+
+        print OUT <<EndText;
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
+  <PropertyGroup Label="Globals">
+    <$outdir>$TARGDIR/\</$outdir>
+EndText
+        foreach my $href (@REQ) {
+            my %a = %$href;
+            my $NGS_SDK_PREFIX = '';
+            $NGS_SDK_PREFIX = $a{found_itf} if ($a{found_itf});
+            if ($a{name} eq 'ngs-sdk') {
+                my $root = "$a{namew}_ROOT";
+                print OUT "    <$root>$NGS_SDK_PREFIX\/</$root>\n";
+                last;
+            }
+        }
+        print OUT <<EndText;
+    <$root>$Bin/\</$root>
+  </PropertyGroup>
+</Project>
+EndText
+        close OUT;
+    } else {
+        println "configure: creating 'Makefile.config'" unless ($AUTORUN);
+        my $CONFIG_OUT = CONFIG_OUT();
+        my $out = File::Spec->catdir($CONFIG_OUT, 'Makefile.config');
+        open COUT, ">$out" or die "cannot open $out to write";
+        print COUT "### AUTO-GENERATED FILE ###\n";
+        print COUT "\n";
+        print COUT "OS_ARCH = \$(shell perl \$(TOP)/os-arch.perl)\n";
+        print COUT "include \$(TOP)/$CONFIG_OUT/Makefile.config.\$(OS_ARCH)\n";
+        close COUT;
+    }
+}
+
+status() if ($OS ne 'win');
+
+unlink 'a.out';
+
+sub L { $_[1] = '' unless ($_[1]); print { $_[0] }   "$_[1]\n" }
+sub T {                            print { $_[0] } "\t$_[1]\n" }
+
+sub status {
+    my ($load) = @_;
+    if ($load) {
+        ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+        my $MAKEFILE
+            = File::Spec->catdir(CONFIG_OUT(), "$OUT_MAKEFILE.$OS.$ARCH");
+        println "\t\tloading $MAKEFILE" if ($OPT{'debug'});
+        unless (-e $MAKEFILE) {
+            print STDERR "configure: error: run ./configure [OPTIONS] first.\n";
+            exit 1;
+        }
+        open F, $MAKEFILE or die "cannot open $MAKEFILE";
+        foreach (<F>) {
+            chomp;
+            if (/BUILD = (.+)/) {
+                $BUILD_TYPE = $1;
+            } elsif (/BUILD \?= /) {
+                $BUILD_TYPE = $_ unless ($BUILD_TYPE);
+            }
+            elsif (/TARGDIR = /) {
+                $TARGDIR = $_;
+                println "\t\tgot $_" if ($OPT{'debug'});
+            } elsif (/TARGDIR \?= (.+)/) {
+                $TARGDIR = $1 unless ($TARGDIR);
+                println "\t\tgot $_" if ($OPT{'debug'});
+            }
+            elsif (/INST_INCDIR = (.+)/) {
+                $OPT{includedir} = $1;
+            }
+            elsif (/INST_BINDIR = (.+)/) {
+                $OPT{bindir} = $1;
+            }
+            elsif (/INST_LIBDIR = (.+)/) {
+                $OPT{libdir} = $1;
+            }
+        }
+    }
+
+    println "build type: $BUILD_TYPE";
+    println "build output path: $TARGDIR" if ($OS ne 'win');
+
+#   print "prefix: ";    print $OPT{'prefix'} if ($OS ne 'win');    println;
+#   print "eprefix: ";    print $OPT{'eprefix'} if ($OPT{'eprefix'});   println;
+
+    print "includedir: ";
+    print $OPT{'includedir'} if ($OPT{'includedir'});
+    println;
+
+    print "bindir: ";
+    print $OPT{'bindir'} if ($OPT{'bindir'});
+    println;
+
+    print "libdir: ";
+    print $OPT{'libdir'} if ($OPT{'libdir'});
+    println;
+
+    println "schemadir: $OPT{'shemadir'}" if ($OPT{'shemadir'});
+    println "sharedir: $OPT{'sharedir'}" if ($OPT{'sharedir'});
+    println "javadir: $OPT{'javadir'}" if ($OPT{'javadir'});
+    println "pythondir: $OPT{'pythondir'}" if ($OPT{'pythondir'});
+
+    println;
+}
+
+sub expand {
+    my ($filename) = @_;
+    return unless ($filename);
+    if ($filename =~ /^~/) {
+        $filename =~ s{ ^ ~ ( [^/]* ) }
+                      { $1
+                            ? (getpwnam($1))[7]
+                            : ( $ENV{HOME} || $ENV{USERPROFILE} || $ENV{LOGDIR}
+                                || (getpwuid($<))[7]
+                              )
+                      }ex;
+    }
+    my $a = abs_path($filename);
+    $filename = $a if ($a);
+    $filename;
+}
+
+sub find_in_dir {
+    my ($dir, $include, $lib, $ilib) = @_;
+    print "\t$dir... " unless ($AUTORUN);
+    unless (-d $dir) {
+        println "no" unless ($AUTORUN);
+        println "\t\tnot found $dir" if ($OPT{'debug'});
+        return;
+    }
+    print "[found] " if ($OPT{'debug'});
+    my ($found_inc, $found_lib, $found_ilib);
+    my $nl = 1;
+    if ($include) {
+        print "includes... " unless ($AUTORUN);
+        if (-e "$dir/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = $dir;
+        } elsif (-e "$dir/include/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = "$dir/include";
+        } elsif (-e "$dir/interfaces/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = "$dir/interfaces";
+        } else {
+            println 'no' unless ($AUTORUN);
+        }
+        $nl = 0;
+    }
+    if ($lib || $ilib) {
+        print "\n\t" if ($nl && !$AUTORUN);
+        print "libraries... " unless ($AUTORUN);
+        if ($lib) {
+            my $builddir = File::Spec->catdir($dir, $OS, $TOOLS, $ARCH, $BUILD);
+            my $libdir  = File::Spec->catdir($builddir, 'lib');
+            my $ilibdir = File::Spec->catdir($builddir, 'ilib');
+            my $f = File::Spec->catdir($libdir, $lib);
+            print "\n\t\tchecking $f\n\t" if ($OPT{'debug'});
+            my $found;
+            if (-e $f) {
+                $found_lib = $libdir;
+                if ($ilib) {
+                    my $f = File::Spec->catdir($ilibdir, $ilib);
+                    print "\tchecking $f\n\t" if ($OPT{'debug'});
+                    if (-e $f) {
+                        println 'yes';
+                        $found_ilib = $ilibdir;
+                    } else {
+                        println 'no' unless ($AUTORUN);
+                        return;
+                    }
+                } else {
+                    println 'yes';
+                }
+                ++$found;
+            }
+            if (! $found) {
+                my $libdir = File::Spec->catdir($dir, 'lib' . $BITS);
+                my $f = File::Spec->catdir($libdir, $lib);
+                print "\tchecking $f\n\t" if ($OPT{'debug'});
+                if (-e $f) {
+                    println 'yes';
+                    $found_lib = $libdir;
+                    ++$found;
+                }
+            }
+            if (! $found) {
+                my $builddir = File::Spec->catdir
+                    ($dir, $OS, $TOOLS, $ARCH, reverse_build($BUILD));
+                my $libdir  = File::Spec->catdir($builddir, 'lib');
+                my $ilibdir = File::Spec->catdir($builddir, 'ilib');
+                my $f = File::Spec->catdir($libdir, $lib);
+                print "\tchecking $f\n\t" if ($OPT{'debug'});
+                if (-e $f) {
+                    $found_lib = $libdir;
+                    if ($ilib) {
+                        my $f = File::Spec->catdir($ilibdir, $ilib);
+                        print "\tchecking $f\n\t" if ($OPT{'debug'});
+                        if (-e $f) {
+                            println 'yes';
+                            $found_ilib = $ilibdir;
+                        } else {
+                            println 'no' unless ($AUTORUN);
+                            return;
+                        }
+                    } else {
+                        println 'yes';
+                    }
+                    ++$found;
+                }
+            }
+        }
+        if ($found_lib && $ilib && ! $found_ilib) {
+            println "\n\t\tfound $found_lib but no ilib/" if ($OPT{'debug'});
+            print "\t" if ($OPT{'debug'});
+            println 'no' unless ($AUTORUN);
+            undef $found_lib;
+        }
+        ++$nl;
+    }
+    return ($found_inc, $found_lib, $found_ilib);
+}
+
+sub reverse_build {
+    ($_) = @_;
+    if ($_ eq 'rel') {
+        return 'dbg';
+    } elsif ($_ eq 'dbg') {
+        return 'rel';
+    } else {
+        die $_;
+    }
+}
+
+################################################################################
+
+sub find_lib {
+    my ($n, $i, $l) = @_;
+
+    print "checking for $n library... ";
+
+    while (1) {
+        my ($library, $log);
+
+        if ($n eq 'hdf5') {
+            $library = '-lhdf5';
+            $log = '#include <hdf5.h>            \n main() { H5close     (); }';
+        } elsif ($n eq 'xml2') {
+            $library = '-lxml2';
+            $log = '#include <libxml/xmlreader.h>\n main() { xmlInitParser();}';
+        } elsif ($n eq 'magic') {
+            $library = '-lmagic';
+            $log = '#include <magic.h>           \n main() { magic_open (0); }';
+        } else {
+            println 'unknown: skipped';
+            return;
+        }
+
+        if (($i && ! -d $i) || ($l && ! -d $l)) {
+            println 'no';
+            return;
+        }
+
+        my $cmd = $log;
+        $cmd =~ s/\\n/\n/g;
+
+        my $gcc = "| gcc -xc " . ($i ? "-I$i " : ' ')
+                               . ($l ? "-L$l " : ' ') . "- $library";
+        $gcc .= ' 2> /dev/null' unless ($OPT{'debug'});
+
+        open GCC, $gcc or last;
+        print "\n\t\trunning echo -e '$log' $gcc\n" if ($OPT{'debug'});
+        print GCC "$cmd" or last;
+        my $ok = close GCC;
+        print "\t" if ($OPT{'debug'});
+        println $ok ? 'yes' : 'no';
+
+        unlink 'a.out';
+
+        return if (!$ok);
+
+        return ($i, $l);
+    }
+
+    println 'cannot run gcc: skipped';
+}
+
+################################################################################
+
+sub check {
+    die "No CONFIG_OUT"   unless CONFIG_OUT();
+    die "No PACKAGE"      unless PACKAGE();
+    die "No PACKAGE_NAME" unless PACKAGE_NAME();
+    die "No PACKAGE_NAMW" unless PACKAGE_NAMW();
+    die "No PACKAGE_TYPE" unless PACKAGE_TYPE();
+    die "No VERSION"      unless VERSION();
+
+    my %PKG = PKG();
+
+    die "No LNG"   unless $PKG{LNG};
+    die "No OUT"   unless $PKG{OUT};
+    die "No PATH"  unless $PKG{PATH};
+    die "No UPATH" unless $PKG{UPATH};
+
+    foreach my $href (DEPENDS()) { die "No DEPENDS::name" unless $href->{name} }
+
+    foreach my $href (REQ()) {
+        die "No REQ::name" unless $href->{name};
+
+        my $origin = $href->{origin};
+        die  "No $href->{name}:origin"  unless $origin;
+        die  "No $href->{name}:include" unless $href->{include};
+        die  "No $href->{name}:lib"     unless $href->{lib};
+        die  "No $href->{name}:option"  unless $href->{option};
+        die  "No $href->{name}:pkgpath" unless $href->{pkgpath};
+        die  "No $href->{name}:type"    unless $href->{type};
+        die  "No $href->{name}:usrpath" unless $href->{usrpath};
+        if ($origin eq 'I') {
+         die "No $href->{name}:bldpath" unless $href->{bldpath};
+         die "No $href->{name}:ilib"    unless $href->{ilib};
+         die "No $href->{name}:namew"   unless $href->{namew};
+         die "No $href->{name}:srcpath" unless $href->{srcpath};
+        }
+    }
+}
+
+################################################################################
+
+sub optional { $_[0] =~ /^[LS]I$/ }
+
+sub help {
+#  --prefix=PREFIX         install architecture-independent files in PREFIX
+    print <<EndText;
+`configure' configures $PACKAGE_NAME to adapt to many kinds of systems.
+
+Usage: ./configure [OPTION]...
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+
+EndText
+
+    if ($^O ne 'MSWin32') {
+        print <<EndText;
+Installation directories:
+  --prefix=PREFIX         install all files in PREFIX
+                          [$package_default_prefix]
+
+EndText
+
+        my $other_prefix = $PKG{UPATH};
+        if ($PACKAGE eq 'sra-tools' && 0) {
+            print <<EndText;
+  --shemadir=DIR          install schema files in DIR
+                          [$schema_default_dir]
+
+EndText
+        }
+
+        print "By default, \`make install' will install all the files in\n";
+    
+        if (PACKAGE_TYPE() eq 'B') {
+            print "\`$package_default_prefix/bin', ";
+        } else {
+            print "\`$package_default_prefix/include', ";
+        }
+        println "\`$package_default_prefix/lib' etc.";
+
+        print <<EndText;
+You can specify an installation prefix other than \`$package_default_prefix'
+using \`--prefix', for instance \`--prefix=$other_prefix'.
+EndText
+    }
+
+    print <<EndText;
+
+For better control, use the options below.
+
+EndText
+
+    my ($required, $optional);
+    foreach my $href (@REQ) {
+        if (optional($href->{type})) {
+            ++$optional;
+        } else {
+            ++$required;
+        }
+    }
+
+    if ($required) {
+        print "Required Packages:\n";
+        foreach my $href (@REQ) {
+            next if (optional($href->{type}));
+            my %a = %$href;
+            if ($a{type} =~ /S/) {
+                println "  --$a{option}=DIR    search for $a{name} package";
+                println "                                 source files in DIR";
+            } else {
+                println
+                    "  --$a{option}=DIR      search for $a{name} package in DIR"
+            }
+            if ($a{boption}) {
+                println "  --$a{boption}=DIR      search for $a{name} package";
+                println "                                 build output in DIR";
+            }
+            println;
+        }
+    }
+    
+    if ($optional) {
+        print "Optional Packages:\n";
+        foreach my $href (@REQ) {
+            next unless (optional($href->{type}));
+            my %a = %$href;
+            if ($a{option} =~ /-sources$/) {
+                println "  --$a{option}=DIR    search for $a{name} package";
+                println "                                source files in DIR";
+            } else {
+                println "  --$a{option}=DIR    search for $a{name} files in DIR"
+            }
+        }
+        println;
+    }
+
+    print <<EndText if ($^O ne 'MSWin32');
+Build tuning:
+  --with-debug
+  --without-debug
+  --arch=name             specify the name of the target architecture
+
+  --build=DIR             generate build output into DIR directory
+                          [$OUTDIR]
+
+EndText
+
+    println "Miscellaneous:";
+    if ($^O ne 'MSWin32') {
+        println
+            "  --status                print current configuration information"
+    }
+    println "  --clean                 remove all configuration results";
+    println "  --debug                 print lots of debugging information";
+    println;
+}
+
+=pod
+################################################################################
+=cut
diff --git a/ngs-sdk/language/Makefile b/ngs-sdk/language/Makefile
new file mode 100644
index 0000000..d6067b3
--- /dev/null
+++ b/ngs-sdk/language/Makefile
@@ -0,0 +1,51 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: subdirs
+
+TOP ?= $(abspath ..)
+export TOP
+
+SUBDIRS =  \
+	c++    \
+	java   \
+	python
+
+SUBDIRS_CLN = \
+	$(addsuffix _cln,$(SUBDIRS))
+
+subdirs: $(SUBDIRS)
+
+install: $(SUBDIRS_INST)
+
+clean: $(SUBDIRS_CLN)
+
+$(SUBDIRS):
+	@ $(MAKE) -C $@
+
+$(SUBDIRS_CLN):
+	@ $(MAKE) -s -C $(subst _cln,,$@) clean
+
+.PHONY: subdirs $(SUBDIRS) $(SUBDIRS_CLN)
diff --git a/ngs-sdk/language/c++/Alignment.cpp b/ngs-sdk/language/c++/Alignment.cpp
new file mode 100644
index 0000000..6387ce5
--- /dev/null
+++ b/ngs-sdk/language/c++/Alignment.cpp
@@ -0,0 +1,55 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/Alignment.hpp>
+
+namespace ngs
+{
+    Alignment :: Alignment ( AlignmentRef ref )
+            throw ()
+        : Fragment ( ref )
+    {
+    }
+
+    Alignment & Alignment :: operator = ( const Alignment & obj )
+        throw ( ErrorMsg )
+    {
+        Fragment :: operator = ( obj );
+        return * this;
+    }
+
+    Alignment :: Alignment ( const Alignment & obj )
+            throw ( ErrorMsg )
+        : Fragment ( obj )
+    {
+    }
+    
+    Alignment :: ~ Alignment ()
+        throw ()
+    {
+    }
+
+}
diff --git a/ngs-sdk/language/c++/AlignmentIterator.cpp b/ngs-sdk/language/c++/AlignmentIterator.cpp
new file mode 100644
index 0000000..f0cc9ea
--- /dev/null
+++ b/ngs-sdk/language/c++/AlignmentIterator.cpp
@@ -0,0 +1,55 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/AlignmentIterator.hpp>
+
+namespace ngs
+{
+    AlignmentIterator :: AlignmentIterator ( AlignmentRef ref )
+            throw ()
+        : Alignment ( ref )
+    {
+    }
+
+    AlignmentIterator & AlignmentIterator :: operator = ( const AlignmentIterator & obj )
+        throw ( ErrorMsg )
+    {
+        Alignment :: operator = ( obj );
+        return * this;
+    }
+
+    AlignmentIterator :: AlignmentIterator ( const AlignmentIterator & obj )
+            throw ( ErrorMsg )
+        : Alignment ( obj )
+    {
+    }
+    
+    AlignmentIterator :: ~ AlignmentIterator ()
+        throw ()
+    {
+    }
+
+} // namespace ngs
\ No newline at end of file
diff --git a/ngs-sdk/language/c++/Fragment.cpp b/ngs-sdk/language/c++/Fragment.cpp
new file mode 100644
index 0000000..9ea490e
--- /dev/null
+++ b/ngs-sdk/language/c++/Fragment.cpp
@@ -0,0 +1,62 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/Fragment.hpp>
+
+namespace ngs
+{
+    Fragment :: Fragment ( FragmentRef ref )
+            throw ()
+        : self ( ref )
+    {
+        assert ( ref != 0 );
+    }
+
+    Fragment & Fragment :: operator = ( const Fragment & obj )
+        throw ( ErrorMsg )
+    {
+        assert ( obj . self != 0 );
+        FragmentRef new_ref = obj . self -> Duplicate ();
+        this -> self -> Release ();
+        this -> self = new_ref;
+        return * this;
+    }
+
+    Fragment :: Fragment ( const Fragment & obj )
+            throw ( ErrorMsg )
+        : self ( obj . self -> Duplicate () )
+    {
+        assert ( obj . self != 0 );
+    }
+    
+    Fragment :: ~ Fragment ()
+        throw ()
+    {
+        self -> Release ();
+        this -> self = 0;
+    }
+
+}
diff --git a/ngs-sdk/language/c++/FragmentIterator.cpp b/ngs-sdk/language/c++/FragmentIterator.cpp
new file mode 100644
index 0000000..938f926
--- /dev/null
+++ b/ngs-sdk/language/c++/FragmentIterator.cpp
@@ -0,0 +1,56 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/FragmentIterator.hpp>
+
+namespace ngs
+{
+
+    FragmentIterator :: FragmentIterator ( FragmentRef ref )
+            throw ()
+        : Fragment ( ref )
+    {
+    }
+
+    FragmentIterator & FragmentIterator :: operator = ( const FragmentIterator & obj )
+        throw ( ErrorMsg )
+    {
+        Fragment :: operator = ( obj );
+        return * this;
+    }
+
+    FragmentIterator :: FragmentIterator ( const FragmentIterator & obj )
+            throw ( ErrorMsg )
+        : Fragment ( obj )
+    {
+    }
+    
+    FragmentIterator :: ~ FragmentIterator ()
+        throw ()
+    {
+    }
+
+}
diff --git a/ngs-sdk/language/c++/Makefile b/ngs-sdk/language/c++/Makefile
new file mode 100644
index 0000000..cad6a86
--- /dev/null
+++ b/ngs-sdk/language/c++/Makefile
@@ -0,0 +1,77 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+include $(TOP)/Makefile.config
+
+INTLIBS = \
+	ngs-bind-c++
+
+EXTLIBS = \
+
+TARGETS =      \
+	$(INTLIBS) \
+	$(EXTLIBS)
+
+all std: $(TARGETS)
+
+clean:
+	rm -rf $(OBJDIR)
+	rm -f $(addprefix $(ILIBDIR)/$(LPFX),$(addsuffix *,$(INTLIBS)))
+	rm -f $(addprefix $(LIBDIR)/$(LPFX),$(addsuffix *,$(EXTLIBS)))
+
+.PHONY: default all std clean $(TARGETS)
+
+#-------------------------------------------------------------------------------
+# ngs-bind-c++
+#
+ngs-bind-c++: $(ILIBDIR) $(OBJDIR) $(ILIBDIR)/$(LPFX)ngs-bind-c++.$(LIBX)
+
+BIND_SRC =              \
+    ReadCollection      \
+    ReferenceIterator   \
+    Reference           \
+    PileupIterator      \
+    Pileup              \
+    PileupEventIterator \
+    PileupEvent         \
+    AlignmentIterator   \
+    Alignment           \
+    ReadGroupIterator   \
+    ReadGroup           \
+    ReadIterator        \
+    Read                \
+    FragmentIterator    \
+    Fragment            \
+    Statistics          \
+	StringRef
+
+BIND_OBJ = \
+	$(addprefix $(OBJDIR)/,$(addsuffix .$(LOBX),$(BIND_SRC)))
+
+$(ILIBDIR)/$(LPFX)ngs-bind-c++.$(LIBX): $(BIND_OBJ)
+	$(AR) $@ $^
diff --git a/ngs-sdk/language/c++/Pileup.cpp b/ngs-sdk/language/c++/Pileup.cpp
new file mode 100644
index 0000000..30d8a3a
--- /dev/null
+++ b/ngs-sdk/language/c++/Pileup.cpp
@@ -0,0 +1,61 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/Pileup.hpp>
+
+namespace ngs
+{
+    Pileup :: Pileup ( PileupRef ref )
+            throw ()
+        : self ( ref )
+    {
+        assert ( ref != 0 );
+    }
+
+    Pileup & Pileup :: operator = ( const Pileup & obj )
+        throw ( ErrorMsg )
+    {
+        assert ( obj . self != 0 );
+        PileupRef new_ref = obj . self -> Duplicate ();
+        this -> self -> Release ();
+        this -> self = new_ref;
+        return * this;
+    }
+
+    Pileup :: Pileup ( const Pileup & obj )
+            throw ( ErrorMsg )
+        : self ( obj . self == 0 ? 0 : obj . self -> Duplicate() )
+    {
+        assert ( obj . self != 0 );
+    }
+    
+    Pileup :: ~ Pileup ()
+        throw ()
+    {
+        this -> self -> Release ();
+        this -> self = 0;
+    }
+}
diff --git a/ngs-sdk/language/c++/PileupEvent.cpp b/ngs-sdk/language/c++/PileupEvent.cpp
new file mode 100644
index 0000000..1221683
--- /dev/null
+++ b/ngs-sdk/language/c++/PileupEvent.cpp
@@ -0,0 +1,62 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/PileupEvent.hpp>
+
+namespace ngs
+{
+    
+    PileupEvent :: PileupEvent ( PileupEventRef ref )
+            throw ()
+        : self ( ref )
+    {
+        assert ( ref != 0 );
+    }
+
+    PileupEvent & PileupEvent :: operator = ( const PileupEvent & obj )
+        throw ( ErrorMsg )
+    {
+        assert ( obj . self != 0 );
+        PileupEventRef new_ref = obj . self -> Duplicate ();
+        this -> self -> Release ();
+        this -> self = new_ref;
+        return * this;
+    }
+
+    PileupEvent :: PileupEvent ( const PileupEvent & obj )
+            throw ( ErrorMsg )
+        : self ( obj . self == 0 ? 0 : obj . self -> Duplicate() )
+    {
+        assert ( obj . self != 0 );
+    }
+    
+    PileupEvent :: ~ PileupEvent ()
+        throw ()
+    {
+        this -> self -> Release ();
+        this -> self = 0;
+    }
+}
diff --git a/ngs-sdk/language/c++/PileupEventIterator.cpp b/ngs-sdk/language/c++/PileupEventIterator.cpp
new file mode 100644
index 0000000..e4f9695
--- /dev/null
+++ b/ngs-sdk/language/c++/PileupEventIterator.cpp
@@ -0,0 +1,55 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/PileupEventIterator.hpp>
+
+namespace ngs
+{
+    PileupEventIterator :: PileupEventIterator ( PileupEventRef ref )
+            throw ()
+        : PileupEvent ( ref )
+    {
+    }
+
+    PileupEventIterator & PileupEventIterator :: operator = ( const PileupEventIterator & obj )
+        throw ( ErrorMsg )
+    {
+        PileupEvent :: operator = ( obj );
+        return * this;
+    }
+
+    PileupEventIterator :: PileupEventIterator ( const PileupEventIterator & obj )
+            throw ( ErrorMsg )
+        : PileupEvent ( obj )
+    {
+    }
+    
+    PileupEventIterator :: ~ PileupEventIterator ()
+        throw ()
+    {
+    }
+
+}
diff --git a/ngs-sdk/language/c++/PileupIterator.cpp b/ngs-sdk/language/c++/PileupIterator.cpp
new file mode 100644
index 0000000..d17b656
--- /dev/null
+++ b/ngs-sdk/language/c++/PileupIterator.cpp
@@ -0,0 +1,55 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/PileupIterator.hpp>
+
+namespace ngs
+{
+    PileupIterator :: PileupIterator ( PileupRef ref )
+            throw ()
+        : Pileup ( ref )
+    {
+    }
+
+    PileupIterator & PileupIterator :: operator = ( const PileupIterator & obj )
+        throw ( ErrorMsg )
+    {
+        Pileup :: operator = ( obj );
+        return * this;
+    }
+
+    PileupIterator :: PileupIterator ( const PileupIterator & obj )
+            throw ( ErrorMsg )
+        : Pileup ( obj )
+    {
+    }
+    
+    PileupIterator :: ~ PileupIterator ()
+        throw ()
+    {
+    }
+
+}
diff --git a/ngs-sdk/language/c++/Read.cpp b/ngs-sdk/language/c++/Read.cpp
new file mode 100644
index 0000000..87b1024
--- /dev/null
+++ b/ngs-sdk/language/c++/Read.cpp
@@ -0,0 +1,56 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/Read.hpp>
+
+namespace ngs
+{
+
+    Read :: Read ( ReadRef ref )
+            throw ()
+        : FragmentIterator ( ( FragmentRef ) ref )
+    {
+    }
+
+    Read & Read :: operator = ( const Read & obj )
+        throw ( ErrorMsg )
+    {
+        FragmentIterator :: operator = ( obj );
+        return * this;
+    }
+
+    Read :: Read ( const Read & obj )
+            throw ( ErrorMsg )
+        : FragmentIterator ( obj )
+    {
+    }
+    
+    Read :: ~ Read ()
+        throw ()
+    {
+    }
+
+} // namespace ngs
\ No newline at end of file
diff --git a/ngs-sdk/language/c++/ReadCollection.cpp b/ngs-sdk/language/c++/ReadCollection.cpp
new file mode 100644
index 0000000..0438684
--- /dev/null
+++ b/ngs-sdk/language/c++/ReadCollection.cpp
@@ -0,0 +1,69 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/ReadCollection.hpp>
+
+namespace ngs
+{
+
+    ReadCollection & ReadCollection :: operator = ( ReadCollectionRef ref )
+        throw ()
+    {
+        self -> Release ();
+        self = ref;
+
+        return * this;
+    }
+
+    ReadCollection :: ReadCollection ( ReadCollectionRef ref )
+            throw ()
+        : self ( ref )
+    {
+    }
+
+    ReadCollection & ReadCollection :: operator = ( const ReadCollection & obj )
+        throw ()
+    {
+        self -> Release ();
+        self = obj . self -> Duplicate ();
+
+        return * this;
+    }
+
+    ReadCollection :: ReadCollection ( const ReadCollection & obj )
+            throw ()
+        : self ( obj . self -> Duplicate () )
+    {
+    }
+
+    ReadCollection :: ~ ReadCollection ()
+        throw ()
+    {
+        self -> Release ();
+        self = 0;
+    }
+
+} // namespace ngs
\ No newline at end of file
diff --git a/ngs-sdk/language/c++/ReadGroup.cpp b/ngs-sdk/language/c++/ReadGroup.cpp
new file mode 100644
index 0000000..42d47d1
--- /dev/null
+++ b/ngs-sdk/language/c++/ReadGroup.cpp
@@ -0,0 +1,69 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/ReadGroup.hpp>
+
+namespace ngs
+{
+
+    ReadGroup & ReadGroup :: operator = ( ReadGroupRef ref )
+        throw ()
+    {
+        self -> Release ();
+        self = ref;
+
+        return * this;
+    }
+        
+    ReadGroup :: ReadGroup ( ReadGroupRef ref )
+            throw ()
+        : self ( ref )
+    {
+    }
+
+    ReadGroup & ReadGroup :: operator = ( const ReadGroup & obj )
+        throw ()
+    {
+        self -> Release ();
+        self = obj . self -> Duplicate ();
+
+        return * this;
+    }
+        
+    ReadGroup :: ReadGroup ( const ReadGroup & obj )
+            throw ()
+        : self ( obj . self -> Duplicate () )
+    {
+    }
+
+    ReadGroup :: ~ ReadGroup ()
+        throw ()
+    {
+        self -> Release ();
+        self = 0;
+    }
+
+} // namespace ngs
\ No newline at end of file
diff --git a/ngs-sdk/language/c++/ReadGroupIterator.cpp b/ngs-sdk/language/c++/ReadGroupIterator.cpp
new file mode 100644
index 0000000..96ec5ee
--- /dev/null
+++ b/ngs-sdk/language/c++/ReadGroupIterator.cpp
@@ -0,0 +1,56 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/ReadGroupIterator.hpp>
+
+namespace ngs
+{
+
+    ReadGroupIterator :: ReadGroupIterator ( ReadGroupRef ref )
+            throw ()
+        : ReadGroup ( ref )
+    {
+    }
+
+    ReadGroupIterator & ReadGroupIterator :: operator = ( const ReadGroupIterator & obj )
+        throw ( ErrorMsg )
+    {
+        ReadGroup :: operator = ( obj );
+        return * this;
+    }
+
+    ReadGroupIterator :: ReadGroupIterator ( const ReadGroupIterator & obj )
+            throw ( ErrorMsg )
+        : ReadGroup ( obj )
+    {
+    }
+    
+    ReadGroupIterator :: ~ ReadGroupIterator ()
+        throw ()
+    {
+    }
+
+} // namespace ngs
\ No newline at end of file
diff --git a/ngs-sdk/language/c++/ReadIterator.cpp b/ngs-sdk/language/c++/ReadIterator.cpp
new file mode 100644
index 0000000..aad041e
--- /dev/null
+++ b/ngs-sdk/language/c++/ReadIterator.cpp
@@ -0,0 +1,56 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/ReadIterator.hpp>
+
+namespace ngs
+{
+
+    ReadIterator :: ReadIterator ( ReadRef ref )
+            throw ()
+        : Read ( ref )
+    {
+    }
+
+    ReadIterator & ReadIterator :: operator = ( const ReadIterator & obj )
+        throw ( ErrorMsg )
+    {
+        Read :: operator = ( obj );
+        return * this;
+    }
+
+    ReadIterator :: ReadIterator ( const ReadIterator & obj )
+            throw ( ErrorMsg )
+        : Read ( obj )
+    {
+    }
+    
+    ReadIterator :: ~ ReadIterator ()
+        throw ()
+    {
+    }
+
+} // namespace ngs
\ No newline at end of file
diff --git a/ngs-sdk/language/c++/Refcount.cpp b/ngs-sdk/language/c++/Refcount.cpp
new file mode 100644
index 0000000..805a10e
--- /dev/null
+++ b/ngs-sdk/language/c++/Refcount.cpp
@@ -0,0 +1,123 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/itf/Refcount.hpp>
+#include <ngs/itf/ErrBlock.hpp>
+#include <ngs/itf/VTable.hpp>
+#include <ngs/itf/Refcount.h>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * Cast
+     *  cast vtable to proper type
+     */
+    ItfTok NGS_Refcount_v1_tok ( "NGS_Refcount_v1" );
+
+    inline
+    const NGS_Refcount_v1_vt * Cast ( const NGS_VTable * in )
+    {
+        const NGS_Refcount_v1_vt * out = static_cast < const NGS_Refcount_v1_vt* >
+            ( Cast ( in, NGS_Refcount_v1_tok ) );
+        if ( out == 0 )
+            throw ErrorMsg ( "object is not of type Refcount_v1" );
+        return out;
+    }
+
+    /*----------------------------------------------------------------------
+     * OpaqueRefcount
+     */
+
+    inline
+    NGS_Refcount_v1 * OpaqueRefcount :: Self ()
+    {
+        return reinterpret_cast < NGS_Refcount_v1* > ( this );
+    }
+
+    inline
+    const NGS_Refcount_v1 * OpaqueRefcount :: Self () const
+    {
+        return reinterpret_cast < const NGS_Refcount_v1* > ( this );
+    }
+
+    void OpaqueRefcount :: Release ()
+        throw ()
+    {
+        if ( this != 0 )
+        {
+            // cast to C object
+            NGS_Refcount_v1 * self = Self ();
+
+            try
+            {
+                // extract VTable
+                const NGS_Refcount_v1_vt * vt = Cast ( self -> vt );
+
+                // release object
+                ErrBlock err;
+                assert ( vt -> release != 0 );
+                ( * vt -> release ) ( self, & err );
+
+                // check for errors
+                err . Check ();
+            }
+            catch ( ErrorMsg & x )
+            {
+                // good place for a message to console or error log
+            }
+            catch ( ... )
+            {
+            }
+        }
+    }
+
+    void * OpaqueRefcount :: Duplicate () const
+        throw ( ErrorMsg )
+    {
+        if ( this != 0 )
+        {
+            // cast to C object
+            const NGS_Refcount_v1 * self = Self ();
+
+            // extract VTable
+            const NGS_Refcount_v1_vt * vt = Cast ( self -> vt );
+
+            // duplicate object reference
+            ErrBlock err;
+            assert ( vt -> duplicate != 0 );
+            void * dup = ( * vt -> duplicate ) ( self, & err );
+
+            // check for errors
+            err. Check ();
+
+            // return duplicated reference
+            assert ( dup != 0 );
+            return dup;
+        }
+
+        return 0;
+    }
+}
diff --git a/ngs-sdk/language/c++/Reference.cpp b/ngs-sdk/language/c++/Reference.cpp
new file mode 100644
index 0000000..1638cba
--- /dev/null
+++ b/ngs-sdk/language/c++/Reference.cpp
@@ -0,0 +1,63 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/Reference.hpp>
+
+namespace ngs
+{
+
+    Reference :: Reference ( ReferenceRef ref )
+            throw ()
+        : self ( ref )
+    {
+        assert ( ref != 0 );
+    }
+
+    Reference & Reference :: operator = ( const Reference & obj )
+        throw ( ErrorMsg )
+    {
+        assert ( obj . self != 0 );
+        ReferenceRef new_ref = obj . self -> Duplicate ();
+        this -> self -> Release ();
+        this -> self = new_ref;
+        return * this;
+    }
+
+    Reference :: Reference ( const Reference & obj )
+            throw ( ErrorMsg )
+        : self ( obj . self == 0 ? 0 : obj . self -> Duplicate() )
+    {
+        assert ( obj . self != 0 );
+    }
+    
+    Reference :: ~ Reference ()
+        throw ()
+    {
+        this -> self -> Release ();
+        this -> self = 0;
+    }
+
+} // namespace ngs
\ No newline at end of file
diff --git a/ngs-sdk/language/c++/ReferenceIterator.cpp b/ngs-sdk/language/c++/ReferenceIterator.cpp
new file mode 100644
index 0000000..86a535f
--- /dev/null
+++ b/ngs-sdk/language/c++/ReferenceIterator.cpp
@@ -0,0 +1,56 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/ReferenceIterator.hpp>
+
+namespace ngs
+{
+
+    ReferenceIterator :: ReferenceIterator ( ReferenceRef ref )
+            throw ()
+        : Reference ( ref )
+    {
+    }
+
+    ReferenceIterator & ReferenceIterator :: operator = ( const ReferenceIterator & obj )
+        throw ( ErrorMsg )
+    {
+        Reference :: operator = ( obj );
+        return * this;
+    }
+
+    ReferenceIterator :: ReferenceIterator ( const ReferenceIterator & obj )
+            throw ( ErrorMsg )
+        : Reference ( obj )
+    {
+    }
+    
+    ReferenceIterator :: ~ ReferenceIterator ()
+        throw ()
+    {
+    }
+
+} // namespace ngs
\ No newline at end of file
diff --git a/ngs-sdk/language/c++/Statistics.cpp b/ngs-sdk/language/c++/Statistics.cpp
new file mode 100644
index 0000000..4f359b6
--- /dev/null
+++ b/ngs-sdk/language/c++/Statistics.cpp
@@ -0,0 +1,60 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/Statistics.hpp>
+
+namespace ngs
+{
+    Statistics :: Statistics ( StatisticsRef ref )
+            throw ()
+        : self ( ref )
+    {
+        assert ( ref != 0 );
+    }
+
+    Statistics & Statistics :: operator = ( const Statistics & obj )
+        throw ( ErrorMsg )
+    {
+        self -> Release ();
+        self = obj . self -> Duplicate ();
+
+        return * this;
+    }
+        
+    Statistics :: Statistics ( const Statistics & obj )
+            throw ( ErrorMsg )
+        : self ( obj . self -> Duplicate () )
+    {
+    }
+
+    Statistics :: ~ Statistics ()
+        throw ()
+    {
+        self -> Release ();
+        self = 0;
+    }
+        
+}
diff --git a/ngs-sdk/language/c++/StringRef.cpp b/ngs-sdk/language/c++/StringRef.cpp
new file mode 100644
index 0000000..f16dd3c
--- /dev/null
+++ b/ngs-sdk/language/c++/StringRef.cpp
@@ -0,0 +1,115 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <ngs/StringRef.hpp>
+#include <ngs/itf/StringItf.h>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * StringRef
+     */
+
+    String StringRef :: toString () const
+        throw ( ErrorMsg )
+    {
+        const char * str = self -> data ();
+        size_t sz = self -> size ();
+
+        return String ( str, sz );
+    }
+
+    String StringRef :: toString ( size_t offset ) const
+        throw ( ErrorMsg )
+    {
+        const char * str = self -> data ();
+        size_t sz = self -> size ();
+
+        if ( offset > sz )
+            offset = sz;
+
+        return String ( str + offset, sz - offset );
+    }
+
+    String StringRef :: toString ( size_t offset, size_t size ) const
+        throw ( ErrorMsg )
+    {
+        const char * str = self -> data ();
+        size_t sz = self -> size ();
+
+        if ( offset >= sz )
+        {
+            offset = sz;
+            size = 0;
+        }
+        else if ( offset + size > sz )
+        {
+            size = sz - offset;
+        }
+
+        return String ( str + offset, size );
+    }
+
+
+    // C++ support
+    StringRef :: StringRef ( StringItf * ref )
+            throw ()
+        : self ( ref )
+    {
+        assert ( self != 0 );
+    }
+
+    StringRef :: StringRef ( const StringRef & obj )
+            throw ()
+        : self ( obj . self -> Duplicate () )
+    {
+        assert ( self != 0 );
+    }
+
+    StringRef & StringRef :: operator = ( const StringRef & obj )
+        throw ()
+    {
+        StringItf * new_self = obj . self -> Duplicate ();
+        self -> Release ();
+        self = new_self;
+
+        return * this;
+    }
+
+    StringRef :: ~ StringRef ()
+        throw ()
+    {
+        self -> Release ();
+        self = 0;
+    }
+
+    :: std :: ostream & operator << ( :: std :: ostream & s, const StringRef & str )
+    {
+        return s . write ( str . data (), str . size () );
+    }
+
+
+} // namespace ngs
diff --git a/ngs-sdk/language/java/.gitignore b/ngs-sdk/language/java/.gitignore
new file mode 100644
index 0000000..116806e
--- /dev/null
+++ b/ngs-sdk/language/java/.gitignore
@@ -0,0 +1 @@
+headers-generated
diff --git a/ngs-sdk/language/java/Makefile b/ngs-sdk/language/java/Makefile
new file mode 100644
index 0000000..44940ec
--- /dev/null
+++ b/ngs-sdk/language/java/Makefile
@@ -0,0 +1,76 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: std
+
+TOP ?= $(abspath ../..)
+include $(TOP)/Makefile.config
+
+INT_LIBS = \
+	ngs-bind-java
+
+EXT_LIBS = \
+
+TARGETS =       \
+	$(INT_LIBS) \
+	$(EXT_LIBS)
+
+all std: $(TARGETS)
+
+clean:
+	rm -rf $(ILIBDIR)/$(LPFX)ngs-bind-java* $(OBJDIR)
+
+.PHONY: default all std $(TARGETS)
+
+#-------------------------------------------------------------------------------
+# ngs-bind-java
+#
+ngs-bind-java: $(ILIBDIR) $(OBJDIR) $(ILIBDIR)/$(LPFX)ngs-bind-java.$(LIBX)
+
+BIND_SRC =      	       \
+	ReadCollectionItf      \
+	ReferenceIteratorItf   \
+	ReferenceItf           \
+	PileupIteratorItf      \
+	PileupItf              \
+	PileupEventIteratorItf \
+	PileupEventItf         \
+	AlignmentIteratorItf   \
+	AlignmentItf           \
+	ReadGroupIteratorItf   \
+	ReadGroupItf           \
+	ReadIteratorItf        \
+	ReadItf                \
+	FragmentItf            \
+	StatisticsItf          \
+	String                 \
+	Refcount               \
+	ErrorMsg
+
+
+BIND_OBJ = \
+	$(addprefix $(OBJDIR)/,$(addsuffix .$(LOBX),$(addprefix jni_,$(BIND_SRC))))
+
+$(ILIBDIR)/$(LPFX)ngs-bind-java.$(LIBX): $(BIND_OBJ)
+	$(AR) $@ $^
diff --git a/ngs-sdk/language/java/jni.h b/ngs-sdk/language/java/jni.h
new file mode 100644
index 0000000..8ed7366
--- /dev/null
+++ b/ngs-sdk/language/java/jni.h
@@ -0,0 +1,1944 @@
+/*
+ * %W% %E%
+ *
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL.  Use is subject to license terms.
+ */
+
+/*
+ * We used part of Netscape's Java Runtime Interface (JRI) as the starting
+ * point of our design and implementation.
+ */
+
+/******************************************************************************
+ * Java Runtime Interface
+ * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
+ *****************************************************************************/
+
+#ifndef _JAVASOFT_JNI_H_
+#define _JAVASOFT_JNI_H_
+
+#include <stdio.h>
+#include <stdarg.h>
+
+/* jni_md.h contains the machine-dependent typedefs for jbyte, jint
+   and jlong */
+
+#include "jni_md.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * JNI Types
+ */
+
+#ifndef JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H
+
+typedef unsigned char	jboolean;
+typedef unsigned short	jchar;
+typedef short		jshort;
+typedef float		jfloat;
+typedef double		jdouble;
+
+typedef jint            jsize;
+
+#ifdef __cplusplus
+
+class _jobject {};
+class _jclass : public _jobject {};
+class _jthrowable : public _jobject {};
+class _jstring : public _jobject {};
+class _jarray : public _jobject {};
+class _jbooleanArray : public _jarray {};
+class _jbyteArray : public _jarray {};
+class _jcharArray : public _jarray {};
+class _jshortArray : public _jarray {};
+class _jintArray : public _jarray {};
+class _jlongArray : public _jarray {};
+class _jfloatArray : public _jarray {};
+class _jdoubleArray : public _jarray {};
+class _jobjectArray : public _jarray {};
+
+typedef _jobject *jobject;
+typedef _jclass *jclass;
+typedef _jthrowable *jthrowable;
+typedef _jstring *jstring;
+typedef _jarray *jarray;
+typedef _jbooleanArray *jbooleanArray;
+typedef _jbyteArray *jbyteArray;
+typedef _jcharArray *jcharArray;
+typedef _jshortArray *jshortArray;
+typedef _jintArray *jintArray;
+typedef _jlongArray *jlongArray;
+typedef _jfloatArray *jfloatArray;
+typedef _jdoubleArray *jdoubleArray;
+typedef _jobjectArray *jobjectArray;
+
+#else
+
+struct _jobject;
+
+typedef struct _jobject *jobject;
+typedef jobject jclass;
+typedef jobject jthrowable;
+typedef jobject jstring;
+typedef jobject jarray;
+typedef jarray jbooleanArray;
+typedef jarray jbyteArray;
+typedef jarray jcharArray;
+typedef jarray jshortArray;
+typedef jarray jintArray;
+typedef jarray jlongArray;
+typedef jarray jfloatArray;
+typedef jarray jdoubleArray;
+typedef jarray jobjectArray;
+
+#endif
+
+typedef jobject jweak;
+
+typedef union jvalue {
+    jboolean z;
+    jbyte    b;
+    jchar    c;
+    jshort   s;
+    jint     i;
+    jlong    j;
+    jfloat   f;
+    jdouble  d;
+    jobject  l;
+} jvalue;
+
+struct _jfieldID;
+typedef struct _jfieldID *jfieldID;
+
+struct _jmethodID;
+typedef struct _jmethodID *jmethodID;
+
+/* Return values from jobjectRefType */
+typedef enum _jobjectType {
+     JNIInvalidRefType    = 0,
+     JNILocalRefType      = 1,
+     JNIGlobalRefType     = 2,
+     JNIWeakGlobalRefType = 3 
+} jobjectRefType;
+
+
+#endif /* JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H */
+
+/*
+ * jboolean constants
+ */
+
+#define JNI_FALSE 0
+#define JNI_TRUE 1
+
+/*
+ * possible return values for JNI functions.
+ */
+
+#define JNI_OK           0                 /* success */
+#define JNI_ERR          (-1)              /* unknown error */
+#define JNI_EDETACHED    (-2)              /* thread detached from the VM */
+#define JNI_EVERSION     (-3)              /* JNI version error */
+#define JNI_ENOMEM       (-4)              /* not enough memory */
+#define JNI_EEXIST       (-5)              /* VM already created */
+#define JNI_EINVAL       (-6)              /* invalid arguments */
+
+/*
+ * used in ReleaseScalarArrayElements
+ */
+
+#define JNI_COMMIT 1
+#define JNI_ABORT 2
+
+/*
+ * used in RegisterNatives to describe native method name, signature,
+ * and function pointer.
+ */
+
+typedef struct {
+    char *name;
+    char *signature;
+    void *fnPtr;
+} JNINativeMethod;
+
+/*
+ * JNI Native Method Interface.
+ */
+
+struct JNINativeInterface_;
+
+struct JNIEnv_;
+
+#ifdef __cplusplus
+typedef JNIEnv_ JNIEnv;
+#else
+typedef const struct JNINativeInterface_ *JNIEnv;
+#endif
+
+/*
+ * JNI Invocation Interface.
+ */
+
+struct JNIInvokeInterface_;
+
+struct JavaVM_;
+
+#ifdef __cplusplus
+typedef JavaVM_ JavaVM;
+#else
+typedef const struct JNIInvokeInterface_ *JavaVM;
+#endif
+
+struct JNINativeInterface_ {
+    void *reserved0;
+    void *reserved1;
+    void *reserved2;
+
+    void *reserved3;
+    jint (JNICALL *GetVersion)(JNIEnv *env);
+
+    jclass (JNICALL *DefineClass)
+      (JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
+       jsize len);
+    jclass (JNICALL *FindClass)
+      (JNIEnv *env, const char *name);
+
+    jmethodID (JNICALL *FromReflectedMethod)
+      (JNIEnv *env, jobject method);
+    jfieldID (JNICALL *FromReflectedField)
+      (JNIEnv *env, jobject field);
+
+    jobject (JNICALL *ToReflectedMethod)
+      (JNIEnv *env, jclass cls, jmethodID methodID, jboolean isStatic);
+
+    jclass (JNICALL *GetSuperclass)
+      (JNIEnv *env, jclass sub);
+    jboolean (JNICALL *IsAssignableFrom)
+      (JNIEnv *env, jclass sub, jclass sup);
+
+    jobject (JNICALL *ToReflectedField)
+      (JNIEnv *env, jclass cls, jfieldID fieldID, jboolean isStatic);
+
+    jint (JNICALL *Throw)
+      (JNIEnv *env, jthrowable obj);
+    jint (JNICALL *ThrowNew)
+      (JNIEnv *env, jclass clazz, const char *msg);
+    jthrowable (JNICALL *ExceptionOccurred)
+      (JNIEnv *env);
+    void (JNICALL *ExceptionDescribe)
+      (JNIEnv *env);
+    void (JNICALL *ExceptionClear)
+      (JNIEnv *env);
+    void (JNICALL *FatalError)
+      (JNIEnv *env, const char *msg);
+
+    jint (JNICALL *PushLocalFrame)
+      (JNIEnv *env, jint capacity);
+    jobject (JNICALL *PopLocalFrame)
+      (JNIEnv *env, jobject result);
+
+    jobject (JNICALL *NewGlobalRef)
+      (JNIEnv *env, jobject lobj);
+    void (JNICALL *DeleteGlobalRef)
+      (JNIEnv *env, jobject gref);
+    void (JNICALL *DeleteLocalRef)
+      (JNIEnv *env, jobject obj);
+    jboolean (JNICALL *IsSameObject)
+      (JNIEnv *env, jobject obj1, jobject obj2);
+    jobject (JNICALL *NewLocalRef)
+      (JNIEnv *env, jobject ref);
+    jint (JNICALL *EnsureLocalCapacity)
+      (JNIEnv *env, jint capacity);
+
+    jobject (JNICALL *AllocObject)
+      (JNIEnv *env, jclass clazz);
+    jobject (JNICALL *NewObject)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+    jobject (JNICALL *NewObjectV)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+    jobject (JNICALL *NewObjectA)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+    jclass (JNICALL *GetObjectClass)
+      (JNIEnv *env, jobject obj);
+    jboolean (JNICALL *IsInstanceOf)
+      (JNIEnv *env, jobject obj, jclass clazz);
+
+    jmethodID (JNICALL *GetMethodID)
+      (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+    jobject (JNICALL *CallObjectMethod)
+      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+    jobject (JNICALL *CallObjectMethodV)
+      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+    jobject (JNICALL *CallObjectMethodA)
+      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+    jboolean (JNICALL *CallBooleanMethod)
+      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+    jboolean (JNICALL *CallBooleanMethodV)
+      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+    jboolean (JNICALL *CallBooleanMethodA)
+      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+    jbyte (JNICALL *CallByteMethod)
+      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+    jbyte (JNICALL *CallByteMethodV)
+      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+    jbyte (JNICALL *CallByteMethodA)
+      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+    jchar (JNICALL *CallCharMethod)
+      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+    jchar (JNICALL *CallCharMethodV)
+      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+    jchar (JNICALL *CallCharMethodA)
+      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+    jshort (JNICALL *CallShortMethod)
+      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+    jshort (JNICALL *CallShortMethodV)
+      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+    jshort (JNICALL *CallShortMethodA)
+      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+    jint (JNICALL *CallIntMethod)
+      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+    jint (JNICALL *CallIntMethodV)
+      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+    jint (JNICALL *CallIntMethodA)
+      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+    jlong (JNICALL *CallLongMethod)
+      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+    jlong (JNICALL *CallLongMethodV)
+      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+    jlong (JNICALL *CallLongMethodA)
+      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+    jfloat (JNICALL *CallFloatMethod)
+      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+    jfloat (JNICALL *CallFloatMethodV)
+      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+    jfloat (JNICALL *CallFloatMethodA)
+      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+    jdouble (JNICALL *CallDoubleMethod)
+      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+    jdouble (JNICALL *CallDoubleMethodV)
+      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+    jdouble (JNICALL *CallDoubleMethodA)
+      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+    void (JNICALL *CallVoidMethod)
+      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+    void (JNICALL *CallVoidMethodV)
+      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+    void (JNICALL *CallVoidMethodA)
+      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+    jobject (JNICALL *CallNonvirtualObjectMethod)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+    jobject (JNICALL *CallNonvirtualObjectMethodV)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       va_list args);
+    jobject (JNICALL *CallNonvirtualObjectMethodA)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       const jvalue * args);
+
+    jboolean (JNICALL *CallNonvirtualBooleanMethod)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+    jboolean (JNICALL *CallNonvirtualBooleanMethodV)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       va_list args);
+    jboolean (JNICALL *CallNonvirtualBooleanMethodA)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       const jvalue * args);
+
+    jbyte (JNICALL *CallNonvirtualByteMethod)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+    jbyte (JNICALL *CallNonvirtualByteMethodV)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       va_list args);
+    jbyte (JNICALL *CallNonvirtualByteMethodA)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       const jvalue *args);
+
+    jchar (JNICALL *CallNonvirtualCharMethod)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+    jchar (JNICALL *CallNonvirtualCharMethodV)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       va_list args);
+    jchar (JNICALL *CallNonvirtualCharMethodA)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       const jvalue *args);
+
+    jshort (JNICALL *CallNonvirtualShortMethod)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+    jshort (JNICALL *CallNonvirtualShortMethodV)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       va_list args);
+    jshort (JNICALL *CallNonvirtualShortMethodA)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       const jvalue *args);
+
+    jint (JNICALL *CallNonvirtualIntMethod)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+    jint (JNICALL *CallNonvirtualIntMethodV)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       va_list args);
+    jint (JNICALL *CallNonvirtualIntMethodA)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       const jvalue *args);
+
+    jlong (JNICALL *CallNonvirtualLongMethod)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+    jlong (JNICALL *CallNonvirtualLongMethodV)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       va_list args);
+    jlong (JNICALL *CallNonvirtualLongMethodA)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       const jvalue *args);
+
+    jfloat (JNICALL *CallNonvirtualFloatMethod)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+    jfloat (JNICALL *CallNonvirtualFloatMethodV)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       va_list args);
+    jfloat (JNICALL *CallNonvirtualFloatMethodA)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       const jvalue *args);
+
+    jdouble (JNICALL *CallNonvirtualDoubleMethod)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+    jdouble (JNICALL *CallNonvirtualDoubleMethodV)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       va_list args);
+    jdouble (JNICALL *CallNonvirtualDoubleMethodA)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       const jvalue *args);
+
+    void (JNICALL *CallNonvirtualVoidMethod)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+    void (JNICALL *CallNonvirtualVoidMethodV)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       va_list args);
+    void (JNICALL *CallNonvirtualVoidMethodA)
+      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+       const jvalue * args);
+
+    jfieldID (JNICALL *GetFieldID)
+      (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+    jobject (JNICALL *GetObjectField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID);
+    jboolean (JNICALL *GetBooleanField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID);
+    jbyte (JNICALL *GetByteField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID);
+    jchar (JNICALL *GetCharField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID);
+    jshort (JNICALL *GetShortField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID);
+    jint (JNICALL *GetIntField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID);
+    jlong (JNICALL *GetLongField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID);
+    jfloat (JNICALL *GetFloatField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID);
+    jdouble (JNICALL *GetDoubleField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID);
+
+    void (JNICALL *SetObjectField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID, jobject val);
+    void (JNICALL *SetBooleanField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID, jboolean val);
+    void (JNICALL *SetByteField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID, jbyte val);
+    void (JNICALL *SetCharField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID, jchar val);
+    void (JNICALL *SetShortField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID, jshort val);
+    void (JNICALL *SetIntField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID, jint val);
+    void (JNICALL *SetLongField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID, jlong val);
+    void (JNICALL *SetFloatField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID, jfloat val);
+    void (JNICALL *SetDoubleField)
+      (JNIEnv *env, jobject obj, jfieldID fieldID, jdouble val);
+
+    jmethodID (JNICALL *GetStaticMethodID)
+      (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+    jobject (JNICALL *CallStaticObjectMethod)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+    jobject (JNICALL *CallStaticObjectMethodV)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+    jobject (JNICALL *CallStaticObjectMethodA)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+    jboolean (JNICALL *CallStaticBooleanMethod)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+    jboolean (JNICALL *CallStaticBooleanMethodV)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+    jboolean (JNICALL *CallStaticBooleanMethodA)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+    jbyte (JNICALL *CallStaticByteMethod)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+    jbyte (JNICALL *CallStaticByteMethodV)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+    jbyte (JNICALL *CallStaticByteMethodA)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+    jchar (JNICALL *CallStaticCharMethod)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+    jchar (JNICALL *CallStaticCharMethodV)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+    jchar (JNICALL *CallStaticCharMethodA)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+    jshort (JNICALL *CallStaticShortMethod)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+    jshort (JNICALL *CallStaticShortMethodV)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+    jshort (JNICALL *CallStaticShortMethodA)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+    jint (JNICALL *CallStaticIntMethod)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+    jint (JNICALL *CallStaticIntMethodV)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+    jint (JNICALL *CallStaticIntMethodA)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+    jlong (JNICALL *CallStaticLongMethod)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+    jlong (JNICALL *CallStaticLongMethodV)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+    jlong (JNICALL *CallStaticLongMethodA)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+    jfloat (JNICALL *CallStaticFloatMethod)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+    jfloat (JNICALL *CallStaticFloatMethodV)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+    jfloat (JNICALL *CallStaticFloatMethodA)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+    jdouble (JNICALL *CallStaticDoubleMethod)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+    jdouble (JNICALL *CallStaticDoubleMethodV)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+    jdouble (JNICALL *CallStaticDoubleMethodA)
+      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+    void (JNICALL *CallStaticVoidMethod)
+      (JNIEnv *env, jclass cls, jmethodID methodID, ...);
+    void (JNICALL *CallStaticVoidMethodV)
+      (JNIEnv *env, jclass cls, jmethodID methodID, va_list args);
+    void (JNICALL *CallStaticVoidMethodA)
+      (JNIEnv *env, jclass cls, jmethodID methodID, const jvalue * args);
+
+    jfieldID (JNICALL *GetStaticFieldID)
+      (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+    jobject (JNICALL *GetStaticObjectField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID);
+    jboolean (JNICALL *GetStaticBooleanField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID);
+    jbyte (JNICALL *GetStaticByteField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID);
+    jchar (JNICALL *GetStaticCharField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID);
+    jshort (JNICALL *GetStaticShortField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID);
+    jint (JNICALL *GetStaticIntField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID);
+    jlong (JNICALL *GetStaticLongField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID);
+    jfloat (JNICALL *GetStaticFloatField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID);
+    jdouble (JNICALL *GetStaticDoubleField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID);
+
+    void (JNICALL *SetStaticObjectField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value);
+    void (JNICALL *SetStaticBooleanField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value);
+    void (JNICALL *SetStaticByteField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value);
+    void (JNICALL *SetStaticCharField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value);
+    void (JNICALL *SetStaticShortField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value);
+    void (JNICALL *SetStaticIntField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value);
+    void (JNICALL *SetStaticLongField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value);
+    void (JNICALL *SetStaticFloatField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value);
+    void (JNICALL *SetStaticDoubleField)
+      (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value);
+
+    jstring (JNICALL *NewString)
+      (JNIEnv *env, const jchar *unicode, jsize len);
+    jsize (JNICALL *GetStringLength)
+      (JNIEnv *env, jstring str);
+    const jchar *(JNICALL *GetStringChars)
+      (JNIEnv *env, jstring str, jboolean *isCopy);
+    void (JNICALL *ReleaseStringChars)
+      (JNIEnv *env, jstring str, const jchar *chars);
+
+    jstring (JNICALL *NewStringUTF)
+      (JNIEnv *env, const char *utf);
+    jsize (JNICALL *GetStringUTFLength)
+      (JNIEnv *env, jstring str);
+    const char* (JNICALL *GetStringUTFChars)
+      (JNIEnv *env, jstring str, jboolean *isCopy);
+    void (JNICALL *ReleaseStringUTFChars)
+      (JNIEnv *env, jstring str, const char* chars);
+
+
+    jsize (JNICALL *GetArrayLength)
+      (JNIEnv *env, jarray array);
+
+    jobjectArray (JNICALL *NewObjectArray)
+      (JNIEnv *env, jsize len, jclass clazz, jobject init);
+    jobject (JNICALL *GetObjectArrayElement)
+      (JNIEnv *env, jobjectArray array, jsize index);
+    void (JNICALL *SetObjectArrayElement)
+      (JNIEnv *env, jobjectArray array, jsize index, jobject val);
+
+    jbooleanArray (JNICALL *NewBooleanArray)
+      (JNIEnv *env, jsize len);
+    jbyteArray (JNICALL *NewByteArray)
+      (JNIEnv *env, jsize len);
+    jcharArray (JNICALL *NewCharArray)
+      (JNIEnv *env, jsize len);
+    jshortArray (JNICALL *NewShortArray)
+      (JNIEnv *env, jsize len);
+    jintArray (JNICALL *NewIntArray)
+      (JNIEnv *env, jsize len);
+    jlongArray (JNICALL *NewLongArray)
+      (JNIEnv *env, jsize len);
+    jfloatArray (JNICALL *NewFloatArray)
+      (JNIEnv *env, jsize len);
+    jdoubleArray (JNICALL *NewDoubleArray)
+      (JNIEnv *env, jsize len);
+
+    jboolean * (JNICALL *GetBooleanArrayElements)
+      (JNIEnv *env, jbooleanArray array, jboolean *isCopy);
+    jbyte * (JNICALL *GetByteArrayElements)
+      (JNIEnv *env, jbyteArray array, jboolean *isCopy);
+    jchar * (JNICALL *GetCharArrayElements)
+      (JNIEnv *env, jcharArray array, jboolean *isCopy);
+    jshort * (JNICALL *GetShortArrayElements)
+      (JNIEnv *env, jshortArray array, jboolean *isCopy);
+    jint * (JNICALL *GetIntArrayElements)
+      (JNIEnv *env, jintArray array, jboolean *isCopy);
+    jlong * (JNICALL *GetLongArrayElements)
+      (JNIEnv *env, jlongArray array, jboolean *isCopy);
+    jfloat * (JNICALL *GetFloatArrayElements)
+      (JNIEnv *env, jfloatArray array, jboolean *isCopy);
+    jdouble * (JNICALL *GetDoubleArrayElements)
+      (JNIEnv *env, jdoubleArray array, jboolean *isCopy);
+
+    void (JNICALL *ReleaseBooleanArrayElements)
+      (JNIEnv *env, jbooleanArray array, jboolean *elems, jint mode);
+    void (JNICALL *ReleaseByteArrayElements)
+      (JNIEnv *env, jbyteArray array, jbyte *elems, jint mode);
+    void (JNICALL *ReleaseCharArrayElements)
+      (JNIEnv *env, jcharArray array, jchar *elems, jint mode);
+    void (JNICALL *ReleaseShortArrayElements)
+      (JNIEnv *env, jshortArray array, jshort *elems, jint mode);
+    void (JNICALL *ReleaseIntArrayElements)
+      (JNIEnv *env, jintArray array, jint *elems, jint mode);
+    void (JNICALL *ReleaseLongArrayElements)
+      (JNIEnv *env, jlongArray array, jlong *elems, jint mode);
+    void (JNICALL *ReleaseFloatArrayElements)
+      (JNIEnv *env, jfloatArray array, jfloat *elems, jint mode);
+    void (JNICALL *ReleaseDoubleArrayElements)
+      (JNIEnv *env, jdoubleArray array, jdouble *elems, jint mode);
+
+    void (JNICALL *GetBooleanArrayRegion)
+      (JNIEnv *env, jbooleanArray array, jsize start, jsize l, jboolean *buf);
+    void (JNICALL *GetByteArrayRegion)
+      (JNIEnv *env, jbyteArray array, jsize start, jsize len, jbyte *buf);
+    void (JNICALL *GetCharArrayRegion)
+      (JNIEnv *env, jcharArray array, jsize start, jsize len, jchar *buf);
+    void (JNICALL *GetShortArrayRegion)
+      (JNIEnv *env, jshortArray array, jsize start, jsize len, jshort *buf);
+    void (JNICALL *GetIntArrayRegion)
+      (JNIEnv *env, jintArray array, jsize start, jsize len, jint *buf);
+    void (JNICALL *GetLongArrayRegion)
+      (JNIEnv *env, jlongArray array, jsize start, jsize len, jlong *buf);
+    void (JNICALL *GetFloatArrayRegion)
+      (JNIEnv *env, jfloatArray array, jsize start, jsize len, jfloat *buf);
+    void (JNICALL *GetDoubleArrayRegion)
+      (JNIEnv *env, jdoubleArray array, jsize start, jsize len, jdouble *buf);
+
+    void (JNICALL *SetBooleanArrayRegion)
+      (JNIEnv *env, jbooleanArray array, jsize start, jsize l, const jboolean *buf);
+    void (JNICALL *SetByteArrayRegion)
+      (JNIEnv *env, jbyteArray array, jsize start, jsize len, const jbyte *buf);
+    void (JNICALL *SetCharArrayRegion)
+      (JNIEnv *env, jcharArray array, jsize start, jsize len, const jchar *buf);
+    void (JNICALL *SetShortArrayRegion)
+      (JNIEnv *env, jshortArray array, jsize start, jsize len, const jshort *buf);
+    void (JNICALL *SetIntArrayRegion)
+      (JNIEnv *env, jintArray array, jsize start, jsize len, const jint *buf);
+    void (JNICALL *SetLongArrayRegion)
+      (JNIEnv *env, jlongArray array, jsize start, jsize len, const jlong *buf);
+    void (JNICALL *SetFloatArrayRegion)
+      (JNIEnv *env, jfloatArray array, jsize start, jsize len, const jfloat *buf);
+    void (JNICALL *SetDoubleArrayRegion)
+      (JNIEnv *env, jdoubleArray array, jsize start, jsize len, const jdouble *buf);
+
+    jint (JNICALL *RegisterNatives)
+      (JNIEnv *env, jclass clazz, const JNINativeMethod *methods,
+       jint nMethods);
+    jint (JNICALL *UnregisterNatives)
+      (JNIEnv *env, jclass clazz);
+
+    jint (JNICALL *MonitorEnter)
+      (JNIEnv *env, jobject obj);
+    jint (JNICALL *MonitorExit)
+      (JNIEnv *env, jobject obj);
+
+    jint (JNICALL *GetJavaVM)
+      (JNIEnv *env, JavaVM **vm);
+
+    void (JNICALL *GetStringRegion)
+      (JNIEnv *env, jstring str, jsize start, jsize len, jchar *buf);
+    void (JNICALL *GetStringUTFRegion)
+      (JNIEnv *env, jstring str, jsize start, jsize len, char *buf);
+
+    void * (JNICALL *GetPrimitiveArrayCritical)
+      (JNIEnv *env, jarray array, jboolean *isCopy);
+    void (JNICALL *ReleasePrimitiveArrayCritical)
+      (JNIEnv *env, jarray array, void *carray, jint mode);
+
+    const jchar * (JNICALL *GetStringCritical)
+      (JNIEnv *env, jstring string, jboolean *isCopy);
+    void (JNICALL *ReleaseStringCritical)
+      (JNIEnv *env, jstring string, const jchar *cstring);
+
+    jweak (JNICALL *NewWeakGlobalRef)
+       (JNIEnv *env, jobject obj);
+    void (JNICALL *DeleteWeakGlobalRef)
+       (JNIEnv *env, jweak ref);
+
+    jboolean (JNICALL *ExceptionCheck)
+       (JNIEnv *env);
+
+    jobject (JNICALL *NewDirectByteBuffer)
+       (JNIEnv* env, void* address, jlong capacity);
+    void* (JNICALL *GetDirectBufferAddress)
+       (JNIEnv* env, jobject buf);
+    jlong (JNICALL *GetDirectBufferCapacity)
+       (JNIEnv* env, jobject buf);
+
+    /* New JNI 1.6 Features */
+
+    jobjectRefType (JNICALL *GetObjectRefType)
+        (JNIEnv* env, jobject obj);
+};
+
+/*
+ * We use inlined functions for C++ so that programmers can write:
+ *
+ *    env->FindClass("java/lang/String")
+ *
+ * in C++ rather than:
+ *
+ *    (*env)->FindClass(env, "java/lang/String")
+ *
+ * in C.
+ */
+
+struct JNIEnv_ {
+    const struct JNINativeInterface_ *functions;
+#ifdef __cplusplus
+
+    jint GetVersion() {
+        return functions->GetVersion(this);
+    }
+    jclass DefineClass(const char *name, jobject loader, const jbyte *buf,
+		       jsize len) {
+        return functions->DefineClass(this, name, loader, buf, len);
+    }
+    jclass FindClass(const char *name) {
+        return functions->FindClass(this, name);
+    }
+    jmethodID FromReflectedMethod(jobject method) {
+        return functions->FromReflectedMethod(this,method);
+    }
+    jfieldID FromReflectedField(jobject field) {
+        return functions->FromReflectedField(this,field);
+    }
+
+    jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic) {
+        return functions->ToReflectedMethod(this, cls, methodID, isStatic);
+    }
+
+    jclass GetSuperclass(jclass sub) {
+        return functions->GetSuperclass(this, sub);
+    }
+    jboolean IsAssignableFrom(jclass sub, jclass sup) {
+        return functions->IsAssignableFrom(this, sub, sup);
+    }
+
+    jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic) {
+        return functions->ToReflectedField(this,cls,fieldID,isStatic);
+    }
+
+    jint Throw(jthrowable obj) {
+        return functions->Throw(this, obj);
+    }
+    jint ThrowNew(jclass clazz, const char *msg) {
+        return functions->ThrowNew(this, clazz, msg);
+    }
+    jthrowable ExceptionOccurred() {
+        return functions->ExceptionOccurred(this);
+    }
+    void ExceptionDescribe() {
+        functions->ExceptionDescribe(this);
+    }
+    void ExceptionClear() {
+        functions->ExceptionClear(this);
+    }
+    void FatalError(const char *msg) {
+        functions->FatalError(this, msg);
+    }
+
+    jint PushLocalFrame(jint capacity) {
+        return functions->PushLocalFrame(this,capacity);
+    }
+    jobject PopLocalFrame(jobject result) {
+        return functions->PopLocalFrame(this,result);
+    }
+
+    jobject NewGlobalRef(jobject lobj) {
+        return functions->NewGlobalRef(this,lobj);
+    }
+    void DeleteGlobalRef(jobject gref) {
+        functions->DeleteGlobalRef(this,gref);
+    }
+    void DeleteLocalRef(jobject obj) {
+        functions->DeleteLocalRef(this, obj);
+    }
+
+    jboolean IsSameObject(jobject obj1, jobject obj2) {
+        return functions->IsSameObject(this,obj1,obj2);
+    }
+
+    jobject NewLocalRef(jobject ref) {
+        return functions->NewLocalRef(this,ref);
+    }
+    jint EnsureLocalCapacity(jint capacity) {
+        return functions->EnsureLocalCapacity(this,capacity);
+    }
+
+    jobject AllocObject(jclass clazz) {
+        return functions->AllocObject(this,clazz);
+    }
+    jobject NewObject(jclass clazz, jmethodID methodID, ...) {
+        va_list args;
+	jobject result;
+	va_start(args, methodID);
+        result = functions->NewObjectV(this,clazz,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jobject NewObjectV(jclass clazz, jmethodID methodID,
+		       va_list args) {
+        return functions->NewObjectV(this,clazz,methodID,args);
+    }
+    jobject NewObjectA(jclass clazz, jmethodID methodID,
+		       const jvalue *args) {
+        return functions->NewObjectA(this,clazz,methodID,args);
+    }
+
+    jclass GetObjectClass(jobject obj) {
+        return functions->GetObjectClass(this,obj);
+    }
+    jboolean IsInstanceOf(jobject obj, jclass clazz) {
+        return functions->IsInstanceOf(this,obj,clazz);
+    }
+
+    jmethodID GetMethodID(jclass clazz, const char *name,
+			  const char *sig) {
+        return functions->GetMethodID(this,clazz,name,sig);
+    }
+
+    jobject CallObjectMethod(jobject obj, jmethodID methodID, ...) {
+        va_list args;
+	jobject result;
+	va_start(args,methodID);
+	result = functions->CallObjectMethodV(this,obj,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jobject CallObjectMethodV(jobject obj, jmethodID methodID,
+			va_list args) {
+        return functions->CallObjectMethodV(this,obj,methodID,args);
+    }
+    jobject CallObjectMethodA(jobject obj, jmethodID methodID,
+			const jvalue * args) {
+        return functions->CallObjectMethodA(this,obj,methodID,args);
+    }
+
+    jboolean CallBooleanMethod(jobject obj,
+			       jmethodID methodID, ...) {
+        va_list args;
+	jboolean result;
+	va_start(args,methodID);
+	result = functions->CallBooleanMethodV(this,obj,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jboolean CallBooleanMethodV(jobject obj, jmethodID methodID,
+				va_list args) {
+        return functions->CallBooleanMethodV(this,obj,methodID,args);
+    }
+    jboolean CallBooleanMethodA(jobject obj, jmethodID methodID,
+				const jvalue * args) {
+        return functions->CallBooleanMethodA(this,obj,methodID, args);
+    }
+
+    jbyte CallByteMethod(jobject obj, jmethodID methodID, ...) {
+        va_list args;
+	jbyte result;
+	va_start(args,methodID);
+	result = functions->CallByteMethodV(this,obj,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jbyte CallByteMethodV(jobject obj, jmethodID methodID,
+			  va_list args) {
+        return functions->CallByteMethodV(this,obj,methodID,args);
+    }
+    jbyte CallByteMethodA(jobject obj, jmethodID methodID,
+			  const jvalue * args) {
+        return functions->CallByteMethodA(this,obj,methodID,args);
+    }
+
+    jchar CallCharMethod(jobject obj, jmethodID methodID, ...) {
+        va_list args;
+	jchar result;
+	va_start(args,methodID);
+	result = functions->CallCharMethodV(this,obj,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jchar CallCharMethodV(jobject obj, jmethodID methodID,
+			  va_list args) {
+        return functions->CallCharMethodV(this,obj,methodID,args);
+    }
+    jchar CallCharMethodA(jobject obj, jmethodID methodID,
+			  const jvalue * args) {
+        return functions->CallCharMethodA(this,obj,methodID,args);
+    }
+
+    jshort CallShortMethod(jobject obj, jmethodID methodID, ...) {
+        va_list args;
+	jshort result;
+	va_start(args,methodID);
+	result = functions->CallShortMethodV(this,obj,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jshort CallShortMethodV(jobject obj, jmethodID methodID,
+			    va_list args) {
+        return functions->CallShortMethodV(this,obj,methodID,args);
+    }
+    jshort CallShortMethodA(jobject obj, jmethodID methodID,
+			    const jvalue * args) {
+        return functions->CallShortMethodA(this,obj,methodID,args);
+    }
+
+    jint CallIntMethod(jobject obj, jmethodID methodID, ...) {
+        va_list args;
+	jint result;
+	va_start(args,methodID);
+	result = functions->CallIntMethodV(this,obj,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jint CallIntMethodV(jobject obj, jmethodID methodID,
+			va_list args) {
+        return functions->CallIntMethodV(this,obj,methodID,args);
+    }
+    jint CallIntMethodA(jobject obj, jmethodID methodID,
+			const jvalue * args) {
+        return functions->CallIntMethodA(this,obj,methodID,args);
+    }
+
+    jlong CallLongMethod(jobject obj, jmethodID methodID, ...) {
+        va_list args;
+	jlong result;
+	va_start(args,methodID);
+	result = functions->CallLongMethodV(this,obj,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jlong CallLongMethodV(jobject obj, jmethodID methodID,
+			  va_list args) {
+        return functions->CallLongMethodV(this,obj,methodID,args);
+    }
+    jlong CallLongMethodA(jobject obj, jmethodID methodID,
+			  const jvalue * args) {
+        return functions->CallLongMethodA(this,obj,methodID,args);
+    }
+
+    jfloat CallFloatMethod(jobject obj, jmethodID methodID, ...) {
+        va_list args;
+	jfloat result;
+	va_start(args,methodID);
+	result = functions->CallFloatMethodV(this,obj,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jfloat CallFloatMethodV(jobject obj, jmethodID methodID,
+			    va_list args) {
+        return functions->CallFloatMethodV(this,obj,methodID,args);
+    }
+    jfloat CallFloatMethodA(jobject obj, jmethodID methodID,
+			    const jvalue * args) {
+        return functions->CallFloatMethodA(this,obj,methodID,args);
+    }
+
+    jdouble CallDoubleMethod(jobject obj, jmethodID methodID, ...) {
+        va_list args;
+	jdouble result;
+	va_start(args,methodID);
+	result = functions->CallDoubleMethodV(this,obj,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jdouble CallDoubleMethodV(jobject obj, jmethodID methodID,
+			va_list args) {
+        return functions->CallDoubleMethodV(this,obj,methodID,args);
+    }
+    jdouble CallDoubleMethodA(jobject obj, jmethodID methodID,
+			const jvalue * args) {
+        return functions->CallDoubleMethodA(this,obj,methodID,args);
+    }
+
+    void CallVoidMethod(jobject obj, jmethodID methodID, ...) {
+        va_list args;
+	va_start(args,methodID);
+	functions->CallVoidMethodV(this,obj,methodID,args);
+	va_end(args);
+    }
+    void CallVoidMethodV(jobject obj, jmethodID methodID,
+			 va_list args) {
+        functions->CallVoidMethodV(this,obj,methodID,args);
+    }
+    void CallVoidMethodA(jobject obj, jmethodID methodID,
+			 const jvalue * args) {
+        functions->CallVoidMethodA(this,obj,methodID,args);
+    }
+
+    jobject CallNonvirtualObjectMethod(jobject obj, jclass clazz,
+				       jmethodID methodID, ...) {
+        va_list args;
+	jobject result;
+	va_start(args,methodID);
+	result = functions->CallNonvirtualObjectMethodV(this,obj,clazz,
+							methodID,args);
+	va_end(args);
+	return result;
+    }
+    jobject CallNonvirtualObjectMethodV(jobject obj, jclass clazz,
+					jmethodID methodID, va_list args) {
+        return functions->CallNonvirtualObjectMethodV(this,obj,clazz,
+						      methodID,args);
+    }
+    jobject CallNonvirtualObjectMethodA(jobject obj, jclass clazz,
+					jmethodID methodID, const jvalue * args) {
+        return functions->CallNonvirtualObjectMethodA(this,obj,clazz,
+						      methodID,args);
+    }
+
+    jboolean CallNonvirtualBooleanMethod(jobject obj, jclass clazz,
+					 jmethodID methodID, ...) {
+        va_list args;
+	jboolean result;
+	va_start(args,methodID);
+	result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
+							 methodID,args);
+	va_end(args);
+	return result;
+    }
+    jboolean CallNonvirtualBooleanMethodV(jobject obj, jclass clazz,
+					  jmethodID methodID, va_list args) {
+        return functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
+						       methodID,args);
+    }
+    jboolean CallNonvirtualBooleanMethodA(jobject obj, jclass clazz,
+					  jmethodID methodID, const jvalue * args) {
+        return functions->CallNonvirtualBooleanMethodA(this,obj,clazz,
+						       methodID, args);
+    }
+
+    jbyte CallNonvirtualByteMethod(jobject obj, jclass clazz,
+				   jmethodID methodID, ...) {
+        va_list args;
+	jbyte result;
+	va_start(args,methodID);
+	result = functions->CallNonvirtualByteMethodV(this,obj,clazz,
+						      methodID,args);
+	va_end(args);
+	return result;
+    }
+    jbyte CallNonvirtualByteMethodV(jobject obj, jclass clazz,
+				    jmethodID methodID, va_list args) {
+        return functions->CallNonvirtualByteMethodV(this,obj,clazz,
+						    methodID,args);
+    }
+    jbyte CallNonvirtualByteMethodA(jobject obj, jclass clazz,
+				    jmethodID methodID, const jvalue * args) {
+        return functions->CallNonvirtualByteMethodA(this,obj,clazz,
+						    methodID,args);
+    }
+
+    jchar CallNonvirtualCharMethod(jobject obj, jclass clazz,
+				   jmethodID methodID, ...) {
+        va_list args;
+	jchar result;
+	va_start(args,methodID);
+	result = functions->CallNonvirtualCharMethodV(this,obj,clazz,
+						      methodID,args);
+	va_end(args);
+	return result;
+    }
+    jchar CallNonvirtualCharMethodV(jobject obj, jclass clazz,
+				    jmethodID methodID, va_list args) {
+        return functions->CallNonvirtualCharMethodV(this,obj,clazz,
+						    methodID,args);
+    }
+    jchar CallNonvirtualCharMethodA(jobject obj, jclass clazz,
+				    jmethodID methodID, const jvalue * args) {
+        return functions->CallNonvirtualCharMethodA(this,obj,clazz,
+						    methodID,args);
+    }
+
+    jshort CallNonvirtualShortMethod(jobject obj, jclass clazz,
+				     jmethodID methodID, ...) {
+        va_list args;
+	jshort result;
+	va_start(args,methodID);
+	result = functions->CallNonvirtualShortMethodV(this,obj,clazz,
+						       methodID,args);
+	va_end(args);
+	return result;
+    }
+    jshort CallNonvirtualShortMethodV(jobject obj, jclass clazz,
+				      jmethodID methodID, va_list args) {
+        return functions->CallNonvirtualShortMethodV(this,obj,clazz,
+						     methodID,args);
+    }
+    jshort CallNonvirtualShortMethodA(jobject obj, jclass clazz,
+				      jmethodID methodID, const jvalue * args) {
+        return functions->CallNonvirtualShortMethodA(this,obj,clazz,
+						     methodID,args);
+    }
+
+    jint CallNonvirtualIntMethod(jobject obj, jclass clazz,
+				 jmethodID methodID, ...) {
+        va_list args;
+	jint result;
+	va_start(args,methodID);
+	result = functions->CallNonvirtualIntMethodV(this,obj,clazz,
+						     methodID,args);
+	va_end(args);
+	return result;
+    }
+    jint CallNonvirtualIntMethodV(jobject obj, jclass clazz,
+				  jmethodID methodID, va_list args) {
+        return functions->CallNonvirtualIntMethodV(this,obj,clazz,
+						   methodID,args);
+    }
+    jint CallNonvirtualIntMethodA(jobject obj, jclass clazz,
+				  jmethodID methodID, const jvalue * args) {
+        return functions->CallNonvirtualIntMethodA(this,obj,clazz,
+						   methodID,args);
+    }
+
+    jlong CallNonvirtualLongMethod(jobject obj, jclass clazz,
+				   jmethodID methodID, ...) {
+        va_list args;
+	jlong result;
+	va_start(args,methodID);
+	result = functions->CallNonvirtualLongMethodV(this,obj,clazz,
+						      methodID,args);
+	va_end(args);
+	return result;
+    }
+    jlong CallNonvirtualLongMethodV(jobject obj, jclass clazz,
+				    jmethodID methodID, va_list args) {
+        return functions->CallNonvirtualLongMethodV(this,obj,clazz,
+						    methodID,args);
+    }
+    jlong CallNonvirtualLongMethodA(jobject obj, jclass clazz,
+				    jmethodID methodID, const jvalue * args) {
+        return functions->CallNonvirtualLongMethodA(this,obj,clazz,
+						    methodID,args);
+    }
+
+    jfloat CallNonvirtualFloatMethod(jobject obj, jclass clazz,
+				     jmethodID methodID, ...) {
+        va_list args;
+	jfloat result;
+	va_start(args,methodID);
+	result = functions->CallNonvirtualFloatMethodV(this,obj,clazz,
+						       methodID,args);
+	va_end(args);
+	return result;
+    }
+    jfloat CallNonvirtualFloatMethodV(jobject obj, jclass clazz,
+				      jmethodID methodID,
+				      va_list args) {
+        return functions->CallNonvirtualFloatMethodV(this,obj,clazz,
+						     methodID,args);
+    }
+    jfloat CallNonvirtualFloatMethodA(jobject obj, jclass clazz,
+				      jmethodID methodID,
+				      const jvalue * args) {
+        return functions->CallNonvirtualFloatMethodA(this,obj,clazz,
+						     methodID,args);
+    }
+
+    jdouble CallNonvirtualDoubleMethod(jobject obj, jclass clazz,
+				       jmethodID methodID, ...) {
+        va_list args;
+	jdouble result;
+	va_start(args,methodID);
+	result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
+							methodID,args);
+	va_end(args);
+	return result;
+    }
+    jdouble CallNonvirtualDoubleMethodV(jobject obj, jclass clazz,
+					jmethodID methodID,
+					va_list args) {
+        return functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
+						      methodID,args);
+    }
+    jdouble CallNonvirtualDoubleMethodA(jobject obj, jclass clazz,
+					jmethodID methodID,
+					const jvalue * args) {
+        return functions->CallNonvirtualDoubleMethodA(this,obj,clazz,
+						      methodID,args);
+    }
+
+    void CallNonvirtualVoidMethod(jobject obj, jclass clazz,
+				  jmethodID methodID, ...) {
+        va_list args;
+	va_start(args,methodID);
+	functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
+	va_end(args);
+    }
+    void CallNonvirtualVoidMethodV(jobject obj, jclass clazz,
+				   jmethodID methodID,
+				   va_list args) {
+        functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
+    }
+    void CallNonvirtualVoidMethodA(jobject obj, jclass clazz,
+				   jmethodID methodID,
+				   const jvalue * args) {
+        functions->CallNonvirtualVoidMethodA(this,obj,clazz,methodID,args);
+    }
+
+    jfieldID GetFieldID(jclass clazz, const char *name,
+			const char *sig) {
+        return functions->GetFieldID(this,clazz,name,sig);
+    }
+
+    jobject GetObjectField(jobject obj, jfieldID fieldID) {
+        return functions->GetObjectField(this,obj,fieldID);
+    }
+    jboolean GetBooleanField(jobject obj, jfieldID fieldID) {
+        return functions->GetBooleanField(this,obj,fieldID);
+    }
+    jbyte GetByteField(jobject obj, jfieldID fieldID) {
+        return functions->GetByteField(this,obj,fieldID);
+    }
+    jchar GetCharField(jobject obj, jfieldID fieldID) {
+        return functions->GetCharField(this,obj,fieldID);
+    }
+    jshort GetShortField(jobject obj, jfieldID fieldID) {
+        return functions->GetShortField(this,obj,fieldID);
+    }
+    jint GetIntField(jobject obj, jfieldID fieldID) {
+        return functions->GetIntField(this,obj,fieldID);
+    }
+    jlong GetLongField(jobject obj, jfieldID fieldID) {
+        return functions->GetLongField(this,obj,fieldID);
+    }
+    jfloat GetFloatField(jobject obj, jfieldID fieldID) {
+        return functions->GetFloatField(this,obj,fieldID);
+    }
+    jdouble GetDoubleField(jobject obj, jfieldID fieldID) {
+        return functions->GetDoubleField(this,obj,fieldID);
+    }
+
+    void SetObjectField(jobject obj, jfieldID fieldID, jobject val) {
+        functions->SetObjectField(this,obj,fieldID,val);
+    }
+    void SetBooleanField(jobject obj, jfieldID fieldID,
+			 jboolean val) {
+        functions->SetBooleanField(this,obj,fieldID,val);
+    }
+    void SetByteField(jobject obj, jfieldID fieldID,
+		      jbyte val) {
+        functions->SetByteField(this,obj,fieldID,val);
+    }
+    void SetCharField(jobject obj, jfieldID fieldID,
+		      jchar val) {
+        functions->SetCharField(this,obj,fieldID,val);
+    }
+    void SetShortField(jobject obj, jfieldID fieldID,
+		       jshort val) {
+        functions->SetShortField(this,obj,fieldID,val);
+    }
+    void SetIntField(jobject obj, jfieldID fieldID,
+		     jint val) {
+        functions->SetIntField(this,obj,fieldID,val);
+    }
+    void SetLongField(jobject obj, jfieldID fieldID,
+		      jlong val) {
+        functions->SetLongField(this,obj,fieldID,val);
+    }
+    void SetFloatField(jobject obj, jfieldID fieldID,
+		       jfloat val) {
+        functions->SetFloatField(this,obj,fieldID,val);
+    }
+    void SetDoubleField(jobject obj, jfieldID fieldID,
+			jdouble val) {
+        functions->SetDoubleField(this,obj,fieldID,val);
+    }
+
+    jmethodID GetStaticMethodID(jclass clazz, const char *name,
+				const char *sig) {
+        return functions->GetStaticMethodID(this,clazz,name,sig);
+    }
+
+    jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID,
+			     ...) {
+        va_list args;
+	jobject result;
+	va_start(args,methodID);
+	result = functions->CallStaticObjectMethodV(this,clazz,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jobject CallStaticObjectMethodV(jclass clazz, jmethodID methodID,
+			      va_list args) {
+        return functions->CallStaticObjectMethodV(this,clazz,methodID,args);
+    }
+    jobject CallStaticObjectMethodA(jclass clazz, jmethodID methodID,
+			      const jvalue *args) {
+        return functions->CallStaticObjectMethodA(this,clazz,methodID,args);
+    }
+
+    jboolean CallStaticBooleanMethod(jclass clazz,
+				     jmethodID methodID, ...) {
+        va_list args;
+	jboolean result;
+	va_start(args,methodID);
+	result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jboolean CallStaticBooleanMethodV(jclass clazz,
+				      jmethodID methodID, va_list args) {
+        return functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
+    }
+    jboolean CallStaticBooleanMethodA(jclass clazz,
+				      jmethodID methodID, const jvalue *args) {
+        return functions->CallStaticBooleanMethodA(this,clazz,methodID,args);
+    }
+
+    jbyte CallStaticByteMethod(jclass clazz,
+			       jmethodID methodID, ...) {
+        va_list args;
+	jbyte result;
+	va_start(args,methodID);
+	result = functions->CallStaticByteMethodV(this,clazz,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jbyte CallStaticByteMethodV(jclass clazz,
+				jmethodID methodID, va_list args) {
+        return functions->CallStaticByteMethodV(this,clazz,methodID,args);
+    }
+    jbyte CallStaticByteMethodA(jclass clazz,
+				jmethodID methodID, const jvalue *args) {
+        return functions->CallStaticByteMethodA(this,clazz,methodID,args);
+    }
+
+    jchar CallStaticCharMethod(jclass clazz,
+			       jmethodID methodID, ...) {
+        va_list args;
+	jchar result;
+	va_start(args,methodID);
+	result = functions->CallStaticCharMethodV(this,clazz,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jchar CallStaticCharMethodV(jclass clazz,
+				jmethodID methodID, va_list args) {
+        return functions->CallStaticCharMethodV(this,clazz,methodID,args);
+    }
+    jchar CallStaticCharMethodA(jclass clazz,
+				jmethodID methodID, const jvalue *args) {
+        return functions->CallStaticCharMethodA(this,clazz,methodID,args);
+    }
+
+    jshort CallStaticShortMethod(jclass clazz,
+				 jmethodID methodID, ...) {
+        va_list args;
+	jshort result;
+	va_start(args,methodID);
+	result = functions->CallStaticShortMethodV(this,clazz,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jshort CallStaticShortMethodV(jclass clazz,
+				  jmethodID methodID, va_list args) {
+        return functions->CallStaticShortMethodV(this,clazz,methodID,args);
+    }
+    jshort CallStaticShortMethodA(jclass clazz,
+				  jmethodID methodID, const jvalue *args) {
+        return functions->CallStaticShortMethodA(this,clazz,methodID,args);
+    }
+
+    jint CallStaticIntMethod(jclass clazz,
+			     jmethodID methodID, ...) {
+        va_list args;
+	jint result;
+	va_start(args,methodID);
+	result = functions->CallStaticIntMethodV(this,clazz,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jint CallStaticIntMethodV(jclass clazz,
+			      jmethodID methodID, va_list args) {
+        return functions->CallStaticIntMethodV(this,clazz,methodID,args);
+    }
+    jint CallStaticIntMethodA(jclass clazz,
+			      jmethodID methodID, const jvalue *args) {
+        return functions->CallStaticIntMethodA(this,clazz,methodID,args);
+    }
+
+    jlong CallStaticLongMethod(jclass clazz,
+			       jmethodID methodID, ...) {
+        va_list args;
+	jlong result;
+	va_start(args,methodID);
+	result = functions->CallStaticLongMethodV(this,clazz,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jlong CallStaticLongMethodV(jclass clazz,
+				jmethodID methodID, va_list args) {
+        return functions->CallStaticLongMethodV(this,clazz,methodID,args);
+    }
+    jlong CallStaticLongMethodA(jclass clazz,
+				jmethodID methodID, const jvalue *args) {
+        return functions->CallStaticLongMethodA(this,clazz,methodID,args);
+    }
+
+    jfloat CallStaticFloatMethod(jclass clazz,
+				 jmethodID methodID, ...) {
+        va_list args;
+	jfloat result;
+	va_start(args,methodID);
+	result = functions->CallStaticFloatMethodV(this,clazz,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jfloat CallStaticFloatMethodV(jclass clazz,
+				  jmethodID methodID, va_list args) {
+        return functions->CallStaticFloatMethodV(this,clazz,methodID,args);
+    }
+    jfloat CallStaticFloatMethodA(jclass clazz,
+				  jmethodID methodID, const jvalue *args) {
+        return functions->CallStaticFloatMethodA(this,clazz,methodID,args);
+    }
+
+    jdouble CallStaticDoubleMethod(jclass clazz,
+				   jmethodID methodID, ...) {
+        va_list args;
+	jdouble result;
+	va_start(args,methodID);
+	result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
+	va_end(args);
+	return result;
+    }
+    jdouble CallStaticDoubleMethodV(jclass clazz,
+				    jmethodID methodID, va_list args) {
+        return functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
+    }
+    jdouble CallStaticDoubleMethodA(jclass clazz,
+				    jmethodID methodID, const jvalue *args) {
+        return functions->CallStaticDoubleMethodA(this,clazz,methodID,args);
+    }
+
+    void CallStaticVoidMethod(jclass cls, jmethodID methodID, ...) {
+        va_list args;
+	va_start(args,methodID);
+	functions->CallStaticVoidMethodV(this,cls,methodID,args);
+	va_end(args);
+    }
+    void CallStaticVoidMethodV(jclass cls, jmethodID methodID,
+			       va_list args) {
+        functions->CallStaticVoidMethodV(this,cls,methodID,args);
+    }
+    void CallStaticVoidMethodA(jclass cls, jmethodID methodID,
+			       const jvalue * args) {
+        functions->CallStaticVoidMethodA(this,cls,methodID,args);
+    }
+
+    jfieldID GetStaticFieldID(jclass clazz, const char *name,
+			      const char *sig) {
+        return functions->GetStaticFieldID(this,clazz,name,sig);
+    }
+    jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) {
+        return functions->GetStaticObjectField(this,clazz,fieldID);
+    }
+    jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) {
+        return functions->GetStaticBooleanField(this,clazz,fieldID);
+    }
+    jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) {
+        return functions->GetStaticByteField(this,clazz,fieldID);
+    }
+    jchar GetStaticCharField(jclass clazz, jfieldID fieldID) {
+        return functions->GetStaticCharField(this,clazz,fieldID);
+    }
+    jshort GetStaticShortField(jclass clazz, jfieldID fieldID) {
+        return functions->GetStaticShortField(this,clazz,fieldID);
+    }
+    jint GetStaticIntField(jclass clazz, jfieldID fieldID) {
+        return functions->GetStaticIntField(this,clazz,fieldID);
+    }
+    jlong GetStaticLongField(jclass clazz, jfieldID fieldID) {
+        return functions->GetStaticLongField(this,clazz,fieldID);
+    }
+    jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) {
+        return functions->GetStaticFloatField(this,clazz,fieldID);
+    }
+    jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) {
+        return functions->GetStaticDoubleField(this,clazz,fieldID);
+    }
+
+    void SetStaticObjectField(jclass clazz, jfieldID fieldID,
+			jobject value) {
+      functions->SetStaticObjectField(this,clazz,fieldID,value);
+    }
+    void SetStaticBooleanField(jclass clazz, jfieldID fieldID,
+			jboolean value) {
+      functions->SetStaticBooleanField(this,clazz,fieldID,value);
+    }
+    void SetStaticByteField(jclass clazz, jfieldID fieldID,
+			jbyte value) {
+      functions->SetStaticByteField(this,clazz,fieldID,value);
+    }
+    void SetStaticCharField(jclass clazz, jfieldID fieldID,
+			jchar value) {
+      functions->SetStaticCharField(this,clazz,fieldID,value);
+    }
+    void SetStaticShortField(jclass clazz, jfieldID fieldID,
+			jshort value) {
+      functions->SetStaticShortField(this,clazz,fieldID,value);
+    }
+    void SetStaticIntField(jclass clazz, jfieldID fieldID,
+			jint value) {
+      functions->SetStaticIntField(this,clazz,fieldID,value);
+    }
+    void SetStaticLongField(jclass clazz, jfieldID fieldID,
+			jlong value) {
+      functions->SetStaticLongField(this,clazz,fieldID,value);
+    }
+    void SetStaticFloatField(jclass clazz, jfieldID fieldID,
+			jfloat value) {
+      functions->SetStaticFloatField(this,clazz,fieldID,value);
+    }
+    void SetStaticDoubleField(jclass clazz, jfieldID fieldID,
+			jdouble value) {
+      functions->SetStaticDoubleField(this,clazz,fieldID,value);
+    }
+
+    jstring NewString(const jchar *unicode, jsize len) {
+        return functions->NewString(this,unicode,len);
+    }
+    jsize GetStringLength(jstring str) {
+        return functions->GetStringLength(this,str);
+    }
+    const jchar *GetStringChars(jstring str, jboolean *isCopy) {
+        return functions->GetStringChars(this,str,isCopy);
+    }
+    void ReleaseStringChars(jstring str, const jchar *chars) {
+        functions->ReleaseStringChars(this,str,chars);
+    }
+
+    jstring NewStringUTF(const char *utf) {
+        return functions->NewStringUTF(this,utf);
+    }
+    jsize GetStringUTFLength(jstring str) {
+        return functions->GetStringUTFLength(this,str);
+    }
+    const char* GetStringUTFChars(jstring str, jboolean *isCopy) {
+        return functions->GetStringUTFChars(this,str,isCopy);
+    }
+    void ReleaseStringUTFChars(jstring str, const char* chars) {
+        functions->ReleaseStringUTFChars(this,str,chars);
+    }
+
+    jsize GetArrayLength(jarray array) {
+        return functions->GetArrayLength(this,array);
+    }
+
+    jobjectArray NewObjectArray(jsize len, jclass clazz,
+				jobject init) {
+        return functions->NewObjectArray(this,len,clazz,init);
+    }
+    jobject GetObjectArrayElement(jobjectArray array, jsize index) {
+        return functions->GetObjectArrayElement(this,array,index);
+    }
+    void SetObjectArrayElement(jobjectArray array, jsize index,
+			       jobject val) {
+        functions->SetObjectArrayElement(this,array,index,val);
+    }
+
+    jbooleanArray NewBooleanArray(jsize len) {
+        return functions->NewBooleanArray(this,len);
+    }
+    jbyteArray NewByteArray(jsize len) {
+        return functions->NewByteArray(this,len);
+    }
+    jcharArray NewCharArray(jsize len) {
+        return functions->NewCharArray(this,len);
+    }
+    jshortArray NewShortArray(jsize len) {
+        return functions->NewShortArray(this,len);
+    }
+    jintArray NewIntArray(jsize len) {
+        return functions->NewIntArray(this,len);
+    }
+    jlongArray NewLongArray(jsize len) {
+        return functions->NewLongArray(this,len);
+    }
+    jfloatArray NewFloatArray(jsize len) {
+        return functions->NewFloatArray(this,len);
+    }
+    jdoubleArray NewDoubleArray(jsize len) {
+        return functions->NewDoubleArray(this,len);
+    }
+
+    jboolean * GetBooleanArrayElements(jbooleanArray array, jboolean *isCopy) {
+        return functions->GetBooleanArrayElements(this,array,isCopy);
+    }
+    jbyte * GetByteArrayElements(jbyteArray array, jboolean *isCopy) {
+        return functions->GetByteArrayElements(this,array,isCopy);
+    }
+    jchar * GetCharArrayElements(jcharArray array, jboolean *isCopy) {
+        return functions->GetCharArrayElements(this,array,isCopy);
+    }
+    jshort * GetShortArrayElements(jshortArray array, jboolean *isCopy) {
+        return functions->GetShortArrayElements(this,array,isCopy);
+    }
+    jint * GetIntArrayElements(jintArray array, jboolean *isCopy) {
+        return functions->GetIntArrayElements(this,array,isCopy);
+    }
+    jlong * GetLongArrayElements(jlongArray array, jboolean *isCopy) {
+        return functions->GetLongArrayElements(this,array,isCopy);
+    }
+    jfloat * GetFloatArrayElements(jfloatArray array, jboolean *isCopy) {
+        return functions->GetFloatArrayElements(this,array,isCopy);
+    }
+    jdouble * GetDoubleArrayElements(jdoubleArray array, jboolean *isCopy) {
+        return functions->GetDoubleArrayElements(this,array,isCopy);
+    }
+
+    void ReleaseBooleanArrayElements(jbooleanArray array,
+				     jboolean *elems,
+				     jint mode) {
+        functions->ReleaseBooleanArrayElements(this,array,elems,mode);
+    }
+    void ReleaseByteArrayElements(jbyteArray array,
+				  jbyte *elems,
+				  jint mode) {
+        functions->ReleaseByteArrayElements(this,array,elems,mode);
+    }
+    void ReleaseCharArrayElements(jcharArray array,
+				  jchar *elems,
+				  jint mode) {
+        functions->ReleaseCharArrayElements(this,array,elems,mode);
+    }
+    void ReleaseShortArrayElements(jshortArray array,
+				   jshort *elems,
+				   jint mode) {
+        functions->ReleaseShortArrayElements(this,array,elems,mode);
+    }
+    void ReleaseIntArrayElements(jintArray array,
+				 jint *elems,
+				 jint mode) {
+        functions->ReleaseIntArrayElements(this,array,elems,mode);
+    }
+    void ReleaseLongArrayElements(jlongArray array,
+				  jlong *elems,
+				  jint mode) {
+        functions->ReleaseLongArrayElements(this,array,elems,mode);
+    }
+    void ReleaseFloatArrayElements(jfloatArray array,
+				   jfloat *elems,
+				   jint mode) {
+        functions->ReleaseFloatArrayElements(this,array,elems,mode);
+    }
+    void ReleaseDoubleArrayElements(jdoubleArray array,
+				    jdouble *elems,
+				    jint mode) {
+        functions->ReleaseDoubleArrayElements(this,array,elems,mode);
+    }
+
+    void GetBooleanArrayRegion(jbooleanArray array,
+			       jsize start, jsize len, jboolean *buf) {
+        functions->GetBooleanArrayRegion(this,array,start,len,buf);
+    }
+    void GetByteArrayRegion(jbyteArray array,
+			    jsize start, jsize len, jbyte *buf) {
+        functions->GetByteArrayRegion(this,array,start,len,buf);
+    }
+    void GetCharArrayRegion(jcharArray array,
+			    jsize start, jsize len, jchar *buf) {
+        functions->GetCharArrayRegion(this,array,start,len,buf);
+    }
+    void GetShortArrayRegion(jshortArray array,
+			     jsize start, jsize len, jshort *buf) {
+        functions->GetShortArrayRegion(this,array,start,len,buf);
+    }
+    void GetIntArrayRegion(jintArray array,
+			   jsize start, jsize len, jint *buf) {
+        functions->GetIntArrayRegion(this,array,start,len,buf);
+    }
+    void GetLongArrayRegion(jlongArray array,
+			    jsize start, jsize len, jlong *buf) {
+        functions->GetLongArrayRegion(this,array,start,len,buf);
+    }
+    void GetFloatArrayRegion(jfloatArray array,
+			     jsize start, jsize len, jfloat *buf) {
+        functions->GetFloatArrayRegion(this,array,start,len,buf);
+    }
+    void GetDoubleArrayRegion(jdoubleArray array,
+			      jsize start, jsize len, jdouble *buf) {
+        functions->GetDoubleArrayRegion(this,array,start,len,buf);
+    }
+
+    void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len,
+			       const jboolean *buf) {
+        functions->SetBooleanArrayRegion(this,array,start,len,buf);
+    }
+    void SetByteArrayRegion(jbyteArray array, jsize start, jsize len,
+			    const jbyte *buf) {
+        functions->SetByteArrayRegion(this,array,start,len,buf);
+    }
+    void SetCharArrayRegion(jcharArray array, jsize start, jsize len,
+			    const jchar *buf) {
+        functions->SetCharArrayRegion(this,array,start,len,buf);
+    }
+    void SetShortArrayRegion(jshortArray array, jsize start, jsize len,
+			     const jshort *buf) {
+        functions->SetShortArrayRegion(this,array,start,len,buf);
+    }
+    void SetIntArrayRegion(jintArray array, jsize start, jsize len,
+			   const jint *buf) {
+        functions->SetIntArrayRegion(this,array,start,len,buf);
+    }
+    void SetLongArrayRegion(jlongArray array, jsize start, jsize len,
+			    const jlong *buf) {
+        functions->SetLongArrayRegion(this,array,start,len,buf);
+    }
+    void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len,
+			     const jfloat *buf) {
+        functions->SetFloatArrayRegion(this,array,start,len,buf);
+    }
+    void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len,
+			      const jdouble *buf) {
+        functions->SetDoubleArrayRegion(this,array,start,len,buf);
+    }
+
+    jint RegisterNatives(jclass clazz, const JNINativeMethod *methods,
+			 jint nMethods) {
+        return functions->RegisterNatives(this,clazz,methods,nMethods);
+    }
+    jint UnregisterNatives(jclass clazz) {
+        return functions->UnregisterNatives(this,clazz);
+    }
+
+    jint MonitorEnter(jobject obj) {
+        return functions->MonitorEnter(this,obj);
+    }
+    jint MonitorExit(jobject obj) {
+        return functions->MonitorExit(this,obj);
+    }
+
+    jint GetJavaVM(JavaVM **vm) {
+        return functions->GetJavaVM(this,vm);
+    }
+
+    void GetStringRegion(jstring str, jsize start, jsize len, jchar *buf) {
+        functions->GetStringRegion(this,str,start,len,buf);
+    }
+    void GetStringUTFRegion(jstring str, jsize start, jsize len, char *buf) {
+        functions->GetStringUTFRegion(this,str,start,len,buf);
+    }
+
+    void * GetPrimitiveArrayCritical(jarray array, jboolean *isCopy) {
+        return functions->GetPrimitiveArrayCritical(this,array,isCopy);
+    }
+    void ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode) {
+        functions->ReleasePrimitiveArrayCritical(this,array,carray,mode);
+    }
+
+    const jchar * GetStringCritical(jstring string, jboolean *isCopy) {
+        return functions->GetStringCritical(this,string,isCopy);
+    }
+    void ReleaseStringCritical(jstring string, const jchar *cstring) {
+        functions->ReleaseStringCritical(this,string,cstring);
+    }
+
+    jweak NewWeakGlobalRef(jobject obj) {
+        return functions->NewWeakGlobalRef(this,obj);
+    }
+    void DeleteWeakGlobalRef(jweak ref) {
+        functions->DeleteWeakGlobalRef(this,ref);
+    }
+
+    jboolean ExceptionCheck() {
+	return functions->ExceptionCheck(this);
+    }
+
+    jobject NewDirectByteBuffer(void* address, jlong capacity) {
+        return functions->NewDirectByteBuffer(this, address, capacity);
+    }
+    void* GetDirectBufferAddress(jobject buf) {
+        return functions->GetDirectBufferAddress(this, buf);
+    }
+    jlong GetDirectBufferCapacity(jobject buf) {
+        return functions->GetDirectBufferCapacity(this, buf);
+    }
+    jobjectRefType GetObjectRefType(jobject obj) {
+        return functions->GetObjectRefType(this, obj);
+    }
+
+#endif /* __cplusplus */
+};
+
+typedef struct JavaVMOption {
+    char *optionString;
+    void *extraInfo;
+} JavaVMOption;
+
+typedef struct JavaVMInitArgs {
+    jint version;
+
+    jint nOptions;
+    JavaVMOption *options;
+    jboolean ignoreUnrecognized;
+} JavaVMInitArgs;
+
+typedef struct JavaVMAttachArgs {
+    jint version;
+
+    char *name;
+    jobject group;
+} JavaVMAttachArgs;
+
+/* These will be VM-specific. */
+
+#define JDK1_2
+#define JDK1_4
+
+/* End VM-specific. */
+
+struct JNIInvokeInterface_ {
+    void *reserved0;
+    void *reserved1;
+    void *reserved2;
+
+    jint (JNICALL *DestroyJavaVM)(JavaVM *vm);
+
+    jint (JNICALL *AttachCurrentThread)(JavaVM *vm, void **penv, void *args);
+
+    jint (JNICALL *DetachCurrentThread)(JavaVM *vm);
+
+    jint (JNICALL *GetEnv)(JavaVM *vm, void **penv, jint version);
+
+    jint (JNICALL *AttachCurrentThreadAsDaemon)(JavaVM *vm, void **penv, void *args);
+};
+
+struct JavaVM_ {
+    const struct JNIInvokeInterface_ *functions;
+#ifdef __cplusplus
+
+    jint DestroyJavaVM() {
+        return functions->DestroyJavaVM(this);
+    }
+    jint AttachCurrentThread(void **penv, void *args) {
+        return functions->AttachCurrentThread(this, penv, args);
+    }
+    jint DetachCurrentThread() {
+        return functions->DetachCurrentThread(this);
+    }
+
+    jint GetEnv(void **penv, jint version) {
+        return functions->GetEnv(this, penv, version);
+    }
+    jint AttachCurrentThreadAsDaemon(void **penv, void *args) {
+        return functions->AttachCurrentThreadAsDaemon(this, penv, args);
+    }
+#endif
+};
+
+#ifdef _JNI_IMPLEMENTATION_
+#define _JNI_IMPORT_OR_EXPORT_ JNIEXPORT
+#else
+#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT
+#endif
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_GetDefaultJavaVMInitArgs(void *args);
+
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
+
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
+
+/* Defined by native libraries. */
+JNIEXPORT jint JNICALL
+JNI_OnLoad(JavaVM *vm, void *reserved);
+
+JNIEXPORT void JNICALL
+JNI_OnUnload(JavaVM *vm, void *reserved);
+
+#define JNI_VERSION_1_1 0x00010001
+#define JNI_VERSION_1_2 0x00010002
+#define JNI_VERSION_1_4 0x00010004
+#define JNI_VERSION_1_6 0x00010006
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* !_JAVASOFT_JNI_H_ */
+
+
+
diff --git a/ngs-sdk/language/java/jni_AlignmentIteratorItf.cpp b/ngs-sdk/language/java/jni_AlignmentIteratorItf.cpp
new file mode 100644
index 0000000..e606501
--- /dev/null
+++ b/ngs-sdk/language/java/jni_AlignmentIteratorItf.cpp
@@ -0,0 +1,72 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_AlignmentIteratorItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/FragmentItf.hpp>
+#include <ngs/itf/AlignmentItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+
+using namespace ngs;
+
+static
+AlignmentItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( AlignmentItf* ) jself;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentIteratorItf
+ * Method:    NextAlignment
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_AlignmentIteratorItf_NextAlignment
+  ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jboolean ) Self ( jself ) -> nextAlignment ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return false;
+}
diff --git a/ngs-sdk/language/java/jni_AlignmentIteratorItf.h b/ngs-sdk/language/java/jni_AlignmentIteratorItf.h
new file mode 100644
index 0000000..9630177
--- /dev/null
+++ b/ngs-sdk/language/java/jni_AlignmentIteratorItf.h
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_AlignmentIteratorItf */
+
+#ifndef _Included_ngs_itf_AlignmentIteratorItf
+#define _Included_ngs_itf_AlignmentIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_AlignmentIteratorItf
+ * Method:    NextAlignment
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_AlignmentIteratorItf_NextAlignment
+  (JNIEnv *, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_AlignmentItf.cpp b/ngs-sdk/language/java/jni_AlignmentItf.cpp
new file mode 100644
index 0000000..6a2192b
--- /dev/null
+++ b/ngs-sdk/language/java/jni_AlignmentItf.cpp
@@ -0,0 +1,774 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_AlignmentItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/FragmentItf.hpp>
+#include <ngs/itf/AlignmentItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+
+using namespace ngs;
+
+static
+FragmentItf * Frag ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( FragmentItf* ) jself;
+}
+
+#define Self( jself ) Frag ( jself )
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetFragmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetFragmentId
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getFragmentId ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetFragmentBases
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetFragmentBases
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length )
+{
+    try
+    {
+        ErrorMsgAssertUnsignedLong ( jenv, offset );
+        StringItf * new_ref = Self ( jself ) -> getFragmentBases ( offset, length );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetFragmentQualities
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetFragmentQualities
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length )
+{
+    try
+    {
+        ErrorMsgAssertUnsignedLong ( jenv, offset );
+        StringItf * new_ref = Self ( jself ) -> getFragmentQualities ( offset, length );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+#undef Self
+
+static
+AlignmentItf * Align ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( AlignmentItf* ) jself;
+}
+
+#define Self( jself ) Align ( jself )
+
+static
+jlong Cast ( AlignmentItf * obj )
+{
+    return ( jlong ) ( size_t ) obj;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetAlignmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetAlignmentId
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getAlignmentId ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetReferenceSpec
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetReferenceSpec
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getReferenceSpec ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetMappingQuality
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_AlignmentItf_GetMappingQuality
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jint ) Self ( jself ) -> getMappingQuality ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetReferenceBases
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetReferenceBases
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getReferenceBases ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetReadGroup
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetReadGroup
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getReadGroup ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetReadId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetReadId
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getReadId ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetClippedFragmentBases
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetClippedFragmentBases
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getClippedFragmentBases ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetClippedFragmentQualities
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetClippedFragmentQualities
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getClippedFragmentQualities ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetAlignedFragmentBases
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetAlignedFragmentBases
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getAlignedFragmentBases ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}  
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetAlignmentCategory
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_AlignmentItf_GetAlignmentCategory
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jint ) Self ( jself ) -> getAlignmentCategory ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetAlignmentPosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_AlignmentItf_GetAlignmentPosition
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jlong ) Self ( jself ) -> getAlignmentPosition ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetAlignmentLength
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_AlignmentItf_GetAlignmentLength
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jlong ) Self ( jself ) -> getAlignmentLength ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetIsReversedOrientation
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_AlignmentItf_GetIsReversedOrientation
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jboolean ) Self ( jself ) -> getIsReversedOrientation ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return false;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetSoftClip
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_AlignmentItf_GetSoftClip
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jint edge )
+{
+    try
+    {
+        return ( jint ) Self ( jself ) -> getSoftClip ( edge );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetTemplateLength
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_AlignmentItf_GetTemplateLength
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jlong ) Self ( jself ) -> getTemplateLength ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetShortCigar
+ * Signature: (JZ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetShortCigar
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jboolean clipped )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getShortCigar ( clipped ? true : false );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetLongCigar
+ * Signature: (JZ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetLongCigar
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jboolean clipped )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getLongCigar ( clipped ? true : false );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    HasMate
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_AlignmentItf_HasMate
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jboolean ) Self ( jself ) -> hasMate ();
+    }
+    catch ( ... )
+    {
+    }
+
+    return false;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetMateAlignmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetMateAlignmentId
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getMateAlignmentId ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetMateAlignment
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_AlignmentItf_GetMateAlignment
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        AlignmentItf * new_ref = Self ( jself ) -> getMateAlignment ();
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetMateReferenceSpec
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetMateReferenceSpec
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getMateReferenceSpec ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetMateIsReversedOrientation
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_AlignmentItf_GetMateIsReversedOrientation
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jboolean ) Self ( jself ) -> getMateIsReversedOrientation ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return false;
+}
diff --git a/ngs-sdk/language/java/jni_AlignmentItf.h b/ngs-sdk/language/java/jni_AlignmentItf.h
new file mode 100644
index 0000000..9a315e8
--- /dev/null
+++ b/ngs-sdk/language/java/jni_AlignmentItf.h
@@ -0,0 +1,213 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_AlignmentItf */
+
+#ifndef _Included_ngs_itf_AlignmentItf
+#define _Included_ngs_itf_AlignmentItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetFragmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetFragmentId
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetFragmentBases
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetFragmentBases
+  (JNIEnv *, jobject, jlong, jlong, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetFragmentQualities
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetFragmentQualities
+  (JNIEnv *, jobject, jlong, jlong, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetAlignmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetAlignmentId
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetReferenceSpec
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetReferenceSpec
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetMappingQuality
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_AlignmentItf_GetMappingQuality
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetReferenceBases
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetReferenceBases
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetReadGroup
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetReadGroup
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetReadId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetReadId
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetClippedFragmentBases
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetClippedFragmentBases
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetClippedFragmentQualities
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetClippedFragmentQualities
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetAlignedFragmentBases
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetAlignedFragmentBases
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetAlignmentCategory
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_AlignmentItf_GetAlignmentCategory
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetAlignmentPosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_AlignmentItf_GetAlignmentPosition
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetAlignmentLength
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_AlignmentItf_GetAlignmentLength
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetIsReversedOrientation
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_AlignmentItf_GetIsReversedOrientation
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetSoftClip
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_AlignmentItf_GetSoftClip
+  (JNIEnv *, jobject, jlong, jint);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetTemplateLength
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_AlignmentItf_GetTemplateLength
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetShortCigar
+ * Signature: (JZ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetShortCigar
+  (JNIEnv *, jobject, jlong, jboolean);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetLongCigar
+ * Signature: (JZ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetLongCigar
+  (JNIEnv *, jobject, jlong, jboolean);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    HasMate
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_AlignmentItf_HasMate
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetMateAlignmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetMateAlignmentId
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetMateAlignment
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_AlignmentItf_GetMateAlignment
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetMateReferenceSpec
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_AlignmentItf_GetMateReferenceSpec
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_AlignmentItf
+ * Method:    GetMateIsReversedOrientation
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_AlignmentItf_GetMateIsReversedOrientation
+  (JNIEnv *, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_ErrorMsg.cpp b/ngs-sdk/language/java/jni_ErrorMsg.cpp
new file mode 100644
index 0000000..cbcb35c
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ErrorMsg.cpp
@@ -0,0 +1,142 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_ErrorMsg.hpp"
+
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+
+/*--------------------------------------------------------------------------
+ * ErrorMsg
+ */
+
+/* Throw
+ */
+static
+void ErrorMsgThrow ( JNIEnv * jenv, jclass jexcept_cls, const char * fmt, va_list args )
+    throw ()
+{
+    // expand message into buffer
+    char msg [ 4096 ];
+    int size = vsnprintf ( msg, sizeof msg, fmt, args );
+
+    // ignore overruns
+    if ( size < 0 || ( size_t ) size >= sizeof msg )
+        strcpy ( & msg [ sizeof msg - 4 ], "..." );
+
+    // create error object, put JVM thread into Exception state
+    jenv -> ThrowNew ( jexcept_cls, msg );
+}
+
+
+/* Throw
+ */
+static
+void ErrorMsgThrow ( JNIEnv * jenv, uint32_t type, const char * fmt, va_list args )
+    throw ()
+{
+    jclass jexcept_cls = 0;
+
+    switch ( type )
+    {
+    case xt_error_msg:
+        jexcept_cls = jenv -> FindClass ( "ngs/ErrorMsg" );
+        break;
+    }
+
+    if ( jexcept_cls == 0 )
+        jexcept_cls = jenv -> FindClass ( "java/lang/RuntimeException" );
+
+    ErrorMsgThrow ( jenv, jexcept_cls, fmt, args );
+}
+
+
+/* Throw
+ *  throw a Java ngs.ErrorMsg object taken from the C context block
+ *  may temporarily take information from point of throw
+ */
+void ErrorMsgThrow ( JNIEnv * jenv, uint32_t type, const char *fmt, ... )
+    throw ()
+{
+    va_list args;
+    va_start ( args, fmt );
+
+    ErrorMsgThrow ( jenv, type, fmt, args );
+
+    va_end ( args );
+}
+
+
+void RuntimeExceptionThrow ( JNIEnv * jenv, const char *fmt, ... )
+    throw ()
+{
+    va_list args;
+    va_start ( args, fmt );
+
+    ErrorMsgThrow ( jenv, xt_runtime, fmt, args );
+
+    va_end ( args );
+}
+
+
+/* INTERNAL_ERROR
+ */
+void JNI_INTERNAL_ERROR ( JNIEnv * jenv, const char * fmt, ... )
+    throw ()
+{
+    va_list args;
+    va_start ( args, fmt );
+
+    char msg [ 4096 ];
+    int psize = snprintf ( msg, sizeof msg, "INTERNAL ERROR: " );
+    int size = vsnprintf ( & msg [ psize ], sizeof msg - psize, fmt, args );
+    if ( size < 0 || ( size_t ) size >= sizeof msg - psize )
+        strcpy ( & msg [ sizeof msg - 4 ], "..." );
+
+    ErrorMsgThrow ( jenv, xt_runtime, "%s", msg );
+
+    va_end ( args );
+}
+
+
+/* AssertU32
+ * AssertU64
+ */
+void ErrorMsgAssertU32 ( JNIEnv * jenv, jint i )
+    throw ()
+{
+    if ( i < 0 )
+        ErrorMsgThrow ( jenv, xt_error_msg, "integer sign violation" );
+}
+
+void ErrorMsgAssertU64 ( JNIEnv * jenv, jlong i )
+    throw ()
+{
+    if ( i < 0 )
+        ErrorMsgThrow ( jenv, xt_error_msg, "integer sign violation" );
+}
diff --git a/ngs-sdk/language/java/jni_ErrorMsg.hpp b/ngs-sdk/language/java/jni_ErrorMsg.hpp
new file mode 100644
index 0000000..a5b266a
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ErrorMsg.hpp
@@ -0,0 +1,112 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_jni_ErrorMsg_
+#define _hpp_jni_ErrorMsg_
+
+#ifndef _h_ngs_itf_err_block_
+#include <ngs/itf/ErrBlock.h>
+#endif
+
+#include "jni.h"
+
+
+/*--------------------------------------------------------------------------
+ * ErrorMsg
+ */
+
+
+/* Throw
+ *  throw a Java ngs.ErrorMsg object taken from the C++ exception
+ *
+ *  NB - this doesn't actually "throw" anything, but rather
+ *  sets state within "jenv" such that an exception is thrown
+ *  upon return from JNI
+ */
+void ErrorMsgThrow ( JNIEnv * jenv, uint32_t type, const char *msg, ... )
+    throw ();
+
+
+/* AssertUnsignedInt
+ *  since Java doesn't support unsigned integers,
+ *  use this to assert that a signed integer is >= 0
+ */
+void ErrorMsgAssertU32 ( JNIEnv * jenv, jint i )
+    throw ();
+
+inline
+void ErrorMsgAssertUnsignedInt ( JNIEnv * jenv, jint i )
+    throw ()
+{
+    if ( i < 0 )
+        ErrorMsgAssertU32 ( jenv, i );
+};
+
+/* AssertUnsignedLong
+ *  since Java doesn't support unsigned integers,
+ *  use this to assert that a signed integer is >= 0
+ */
+void ErrorMsgAssertU64 ( JNIEnv * jenv, jlong i )
+    throw ();
+
+inline
+void ErrorMsgAssertUnsignedLong ( JNIEnv * jenv, jlong i )
+    throw ()
+{
+    if ( i < 0 )
+        ErrorMsgAssertU64 ( jenv, i );
+}
+
+
+/*--------------------------------------------------------------------------
+ * RuntimeException
+ */
+
+
+/* Throw
+ *  throw a Java RuntimeException object taken from the C context block
+ */
+void RuntimeExceptionThrow ( JNIEnv * jenv, const char *msg, ... )
+    throw ();
+
+
+/* INTERNAL_ERROR
+ */
+void JNI_INTERNAL_ERROR ( JNIEnv * jenv, const char * fmt, ... )
+    throw ();
+
+
+/* UNIMPLEMENTED
+ *  while the stubs are being brought up
+ */
+inline
+void JNI_UNIMPLEMENTED ( JNIEnv * jenv )
+    throw ()
+{
+    RuntimeExceptionThrow ( jenv, "UNIMPLEMENTED" );
+}
+
+#endif /* _hpp_jni_ErrorMsg_ */
diff --git a/ngs-sdk/language/java/jni_FragmentItf.cpp b/ngs-sdk/language/java/jni_FragmentItf.cpp
new file mode 100644
index 0000000..ae50ef3
--- /dev/null
+++ b/ngs-sdk/language/java/jni_FragmentItf.cpp
@@ -0,0 +1,133 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_FragmentItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/FragmentItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+
+using namespace ngs;
+
+static
+FragmentItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( FragmentItf* ) jself;
+}
+
+/*
+ * Class:     ngs_itf_FragmentItf
+ * Method:    GetFragmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_FragmentItf_GetFragmentId
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getFragmentId ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_FragmentItf
+ * Method:    GetFragmentBases
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_FragmentItf_GetFragmentBases
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length )
+{
+    try
+    {
+        ErrorMsgAssertUnsignedLong ( jenv, offset );
+        StringItf * new_ref = Self ( jself ) -> getFragmentBases ( offset, length );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_FragmentItf
+ * Method:    GetFragmentQualities
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_FragmentItf_GetFragmentQualities
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length )
+{
+    try
+    {
+        ErrorMsgAssertUnsignedLong ( jenv, offset );
+        StringItf * new_ref = Self ( jself ) -> getFragmentQualities ( offset, length );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
diff --git a/ngs-sdk/language/java/jni_FragmentItf.h b/ngs-sdk/language/java/jni_FragmentItf.h
new file mode 100644
index 0000000..a807a61
--- /dev/null
+++ b/ngs-sdk/language/java/jni_FragmentItf.h
@@ -0,0 +1,37 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_FragmentItf */
+
+#ifndef _Included_ngs_itf_FragmentItf
+#define _Included_ngs_itf_FragmentItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_FragmentItf
+ * Method:    GetFragmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_FragmentItf_GetFragmentId
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_FragmentItf
+ * Method:    GetFragmentBases
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_FragmentItf_GetFragmentBases
+  (JNIEnv *, jobject, jlong, jlong, jlong);
+
+/*
+ * Class:     ngs_itf_FragmentItf
+ * Method:    GetFragmentQualities
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_FragmentItf_GetFragmentQualities
+  (JNIEnv *, jobject, jlong, jlong, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_PileupEventIteratorItf.cpp b/ngs-sdk/language/java/jni_PileupEventIteratorItf.cpp
new file mode 100644
index 0000000..028e02d
--- /dev/null
+++ b/ngs-sdk/language/java/jni_PileupEventIteratorItf.cpp
@@ -0,0 +1,71 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_PileupEventIteratorItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/PileupEventItf.hpp>
+
+using namespace ngs;
+
+static
+PileupEventItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( PileupEventItf* ) jself;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventIteratorItf
+ * Method:    NextPileupEvent
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_PileupEventIteratorItf_NextPileupEvent
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jboolean ) Self ( jself ) -> nextPileupEvent ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return false;
+}
+
diff --git a/ngs-sdk/language/java/jni_PileupEventIteratorItf.h b/ngs-sdk/language/java/jni_PileupEventIteratorItf.h
new file mode 100644
index 0000000..8e45dec
--- /dev/null
+++ b/ngs-sdk/language/java/jni_PileupEventIteratorItf.h
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_PileupEventIteratorItf */
+
+#ifndef _Included_ngs_itf_PileupEventIteratorItf
+#define _Included_ngs_itf_PileupEventIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_PileupEventIteratorItf
+ * Method:    NextPileupEvent
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_PileupEventIteratorItf_NextPileupEvent
+  (JNIEnv *, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_PileupEventItf.cpp b/ngs-sdk/language/java/jni_PileupEventItf.cpp
new file mode 100644
index 0000000..74b9602
--- /dev/null
+++ b/ngs-sdk/language/java/jni_PileupEventItf.cpp
@@ -0,0 +1,447 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_PileupEventItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/PileupEventItf.hpp>
+#include <ngs/itf/AlignmentItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+
+using namespace ngs;
+
+static
+PileupEventItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( PileupEventItf* ) jself;
+}
+
+static
+jlong Cast ( AlignmentItf * obj )
+{
+    return ( jlong ) ( size_t ) obj;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetReferenceSpec
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_PileupEventItf_GetReferenceSpec
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getReferenceSpec ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetReferencePosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupEventItf_GetReferencePosition
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jlong ) Self ( jself ) -> getReferencePosition ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetMappingQuality
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_PileupEventItf_GetMappingQuality
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jint ) Self ( jself ) -> getMappingQuality ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetAlignmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_PileupEventItf_GetAlignmentId
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getAlignmentId ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetAlignment
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupEventItf_GetAlignment
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        AlignmentItf * new_ref = Self ( jself ) -> getAlignment ();
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetAlignmentPosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupEventItf_GetAlignmentPosition
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jlong ) Self ( jself ) -> getAlignmentPosition ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetFirstAlignmentPosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupEventItf_GetFirstAlignmentPosition
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jlong ) Self ( jself ) -> getFirstAlignmentPosition ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetLastAlignmentPosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupEventItf_GetLastAlignmentPosition
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jlong ) Self ( jself ) -> getLastAlignmentPosition ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetEventType
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_PileupEventItf_GetEventType
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jint ) Self ( jself ) -> getEventType ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetAlignmentBase
+ * Signature: (J)C
+ */
+JNIEXPORT jchar JNICALL Java_ngs_itf_PileupEventItf_GetAlignmentBase
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jchar ) Self ( jself ) -> getAlignmentBase ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetAlignmentQuality
+ * Signature: (J)C
+ */
+JNIEXPORT jchar JNICALL Java_ngs_itf_PileupEventItf_GetAlignmentQuality
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jchar ) Self ( jself ) -> getAlignmentQuality ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetInsertionBases
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_PileupEventItf_GetInsertionBases
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getInsertionBases ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetInsertionQualities
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_PileupEventItf_GetInsertionQualities
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getInsertionQualities ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetDeletionCount
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_PileupEventItf_GetDeletionCount
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jint ) Self ( jself ) -> getDeletionCount ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
diff --git a/ngs-sdk/language/java/jni_PileupEventItf.h b/ngs-sdk/language/java/jni_PileupEventItf.h
new file mode 100644
index 0000000..47d91b3
--- /dev/null
+++ b/ngs-sdk/language/java/jni_PileupEventItf.h
@@ -0,0 +1,125 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_PileupEventItf */
+
+#ifndef _Included_ngs_itf_PileupEventItf
+#define _Included_ngs_itf_PileupEventItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetReferenceSpec
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_PileupEventItf_GetReferenceSpec
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetReferencePosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupEventItf_GetReferencePosition
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetMappingQuality
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_PileupEventItf_GetMappingQuality
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetAlignmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_PileupEventItf_GetAlignmentId
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetAlignment
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupEventItf_GetAlignment
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetAlignmentPosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupEventItf_GetAlignmentPosition
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetFirstAlignmentPosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupEventItf_GetFirstAlignmentPosition
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetLastAlignmentPosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupEventItf_GetLastAlignmentPosition
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetEventType
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_PileupEventItf_GetEventType
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetAlignmentBase
+ * Signature: (J)C
+ */
+JNIEXPORT jchar JNICALL Java_ngs_itf_PileupEventItf_GetAlignmentBase
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetAlignmentQuality
+ * Signature: (J)C
+ */
+JNIEXPORT jchar JNICALL Java_ngs_itf_PileupEventItf_GetAlignmentQuality
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetInsertionBases
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_PileupEventItf_GetInsertionBases
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetInsertionQualities
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_PileupEventItf_GetInsertionQualities
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupEventItf
+ * Method:    GetDeletionCount
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_PileupEventItf_GetDeletionCount
+  (JNIEnv *, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_PileupIteratorItf.cpp b/ngs-sdk/language/java/jni_PileupIteratorItf.cpp
new file mode 100644
index 0000000..d65335f
--- /dev/null
+++ b/ngs-sdk/language/java/jni_PileupIteratorItf.cpp
@@ -0,0 +1,70 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_PileupIteratorItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/PileupItf.hpp>
+
+using namespace ngs;
+
+static
+PileupItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( PileupItf* ) jself;
+}
+
+/*
+ * Class:     ngs_itf_PileupIteratorItf
+ * Method:    NextPileup
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_PileupIteratorItf_NextPileup
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jboolean ) Self ( jself ) -> nextPileup ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return false;
+}
diff --git a/ngs-sdk/language/java/jni_PileupIteratorItf.h b/ngs-sdk/language/java/jni_PileupIteratorItf.h
new file mode 100644
index 0000000..17c7549
--- /dev/null
+++ b/ngs-sdk/language/java/jni_PileupIteratorItf.h
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_PileupIteratorItf */
+
+#ifndef _Included_ngs_itf_PileupIteratorItf
+#define _Included_ngs_itf_PileupIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_PileupIteratorItf
+ * Method:    NextPileup
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_PileupIteratorItf_NextPileup
+  (JNIEnv *, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_PileupItf.cpp b/ngs-sdk/language/java/jni_PileupItf.cpp
new file mode 100644
index 0000000..43d1d05
--- /dev/null
+++ b/ngs-sdk/language/java/jni_PileupItf.cpp
@@ -0,0 +1,164 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_PileupItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/PileupItf.hpp>
+#include <ngs/itf/PileupEventItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+
+using namespace ngs;
+
+static
+PileupItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( PileupItf* ) jself;
+}
+
+static
+jlong Cast ( PileupEventItf * obj )
+{
+    return ( jlong ) ( size_t ) obj;
+}
+
+/*
+ * Class:     ngs_itf_PileupItf
+ * Method:    GetReferenceSpec
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_PileupItf_GetReferenceSpec
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getReferenceSpec ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupItf
+ * Method:    GetReferencePosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupItf_GetReferencePosition
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jlong ) Self ( jself ) -> getReferencePosition ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupItf
+ * Method:    GetPileupEvents
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupItf_GetPileupEvents
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        PileupEventItf * new_ref = Self ( jself ) -> getPileupEvents ();
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_PileupItf
+ * Method:    GetPileupDepth
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_PileupItf_GetPileupDepth
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jint ) Self ( jself ) -> getPileupDepth ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
diff --git a/ngs-sdk/language/java/jni_PileupItf.h b/ngs-sdk/language/java/jni_PileupItf.h
new file mode 100644
index 0000000..f8e8012
--- /dev/null
+++ b/ngs-sdk/language/java/jni_PileupItf.h
@@ -0,0 +1,45 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_PileupItf */
+
+#ifndef _Included_ngs_itf_PileupItf
+#define _Included_ngs_itf_PileupItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_PileupItf
+ * Method:    GetReferenceSpec
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_PileupItf_GetReferenceSpec
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupItf
+ * Method:    GetReferencePosition
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupItf_GetReferencePosition
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupItf
+ * Method:    GetPileupEvents
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_PileupItf_GetPileupEvents
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_PileupItf
+ * Method:    GetPileupDepth
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_PileupItf_GetPileupDepth
+  (JNIEnv *, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_ReadCollectionItf.cpp b/ngs-sdk/language/java/jni_ReadCollectionItf.cpp
new file mode 100644
index 0000000..e1a3854
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReadCollectionItf.cpp
@@ -0,0 +1,492 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_ReadCollectionItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/ReadCollectionItf.hpp>
+#include <ngs/itf/ReferenceItf.hpp>
+#include <ngs/itf/AlignmentItf.hpp>
+#include <ngs/itf/ReadGroupItf.hpp>
+#include <ngs/itf/ReadItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+
+using namespace ngs;
+
+static
+ReadCollectionItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( ReadCollectionItf* ) jself;
+}
+
+inline
+jlong Cast ( ReferenceItf * obj )
+{
+    return ( jlong ) ( size_t ) obj;
+}
+
+inline
+jlong Cast ( AlignmentItf * obj )
+{
+    return ( jlong ) ( size_t ) obj;
+}
+
+inline
+jlong Cast ( ReadGroupItf * obj )
+{
+    return ( jlong ) ( size_t ) obj;
+}
+
+inline
+jlong Cast ( ReadItf * obj )
+{
+    return ( jlong ) ( size_t ) obj;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetName
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadCollectionItf_GetName
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getName ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReadGroups
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReadGroups
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        ReadGroupItf * new_ref = Self ( jself ) -> getReadGroups ();
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReadGroup
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReadGroup
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring jspec )
+{
+    try
+    {
+        const char * spec = JStringData ( jspec, jenv );
+        try
+        {
+            ReadGroupItf * new_ref = Self ( jself ) -> getReadGroup ( spec );
+            JStringReleaseData ( jspec, jenv, spec );
+            return Cast ( new_ref );
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( jspec, jenv, spec );
+            throw;
+        }
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReferences
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReferences
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        ReferenceItf * new_ref = Self ( jself ) -> getReferences ();
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReference
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReference
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring jspec )
+{
+    try
+    {
+        const char * spec = JStringData ( jspec, jenv );
+        try
+        {
+            ReferenceItf * new_ref = Self ( jself ) -> getReference ( spec );
+            JStringReleaseData ( jspec, jenv, spec );
+            return Cast ( new_ref );
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( jspec, jenv, spec );
+            throw;
+        }
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetAlignment
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetAlignment
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring jspec )
+{
+    try
+    {
+        const char * spec = JStringData ( jspec, jenv );
+        try
+        {
+            AlignmentItf * new_ref = Self ( jself ) -> getAlignment ( spec );
+            JStringReleaseData ( jspec, jenv, spec );
+            return Cast ( new_ref );
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( jspec, jenv, spec );
+            throw;
+        }
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetAlignments
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetAlignments
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jint categories )
+{
+    try
+    {
+        AlignmentItf * new_ref = Self ( jself ) -> getAlignments ( categories );
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetAlignmentCount
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetAlignmentCount
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jint categories )
+{
+    try
+    {
+        return ( jlong ) Self ( jself ) -> getAlignmentCount ( categories );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetAlignmentRange
+ * Signature: (JIJJ)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetAlignmentRange
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong first, jlong count, jint categories )
+{
+    try
+    {
+        ErrorMsgAssertU64 ( jenv, first );
+        ErrorMsgAssertU64 ( jenv, count );
+
+        AlignmentItf * new_ref = Self ( jself ) -> getAlignmentRange ( first, count, categories );
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetRead
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetRead
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring jspec )
+{
+    try
+    {
+        const char * spec = JStringData ( jspec, jenv );
+        try
+        {
+            ReadItf * new_ref = Self ( jself ) -> getRead ( spec );
+            JStringReleaseData ( jspec, jenv, spec );
+            return Cast ( new_ref );
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( jspec, jenv, spec );
+            throw;
+        }
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReads
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReads
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jint categories )
+{
+    try
+    {
+        ReadItf * new_ref = Self ( jself ) -> getReads ( categories );
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReadCount
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReadCount
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jint categories )
+{
+    try
+    {
+        return ( jlong ) Self ( jself ) -> getReadCount ( categories );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetRead2Range
+ * Signature: (JIJJ)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReadRange
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong first, jlong count, jint categories )
+{
+    try
+    {
+        ErrorMsgAssertU64 ( jenv, first );
+        ErrorMsgAssertU64 ( jenv, count );
+
+        ReadItf * new_ref = Self ( jself ) -> getReadRange ( first, count, categories );
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
diff --git a/ngs-sdk/language/java/jni_ReadCollectionItf.h b/ngs-sdk/language/java/jni_ReadCollectionItf.h
new file mode 100644
index 0000000..d5d4309
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReadCollectionItf.h
@@ -0,0 +1,117 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_ReadCollectionItf */
+
+#ifndef _Included_ngs_itf_ReadCollectionItf
+#define _Included_ngs_itf_ReadCollectionItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetName
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadCollectionItf_GetName
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReadGroups
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReadGroups
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReadGroup
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReadGroup
+  (JNIEnv *, jobject, jlong, jstring);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReferences
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReferences
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReference
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReference
+  (JNIEnv *, jobject, jlong, jstring);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetAlignment
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetAlignment
+  (JNIEnv *, jobject, jlong, jstring);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetAlignments
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetAlignments
+  (JNIEnv *, jobject, jlong, jint);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetAlignmentCount
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetAlignmentCount
+  (JNIEnv *, jobject, jlong, jint);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetAlignmentRange
+ * Signature: (JJJI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetAlignmentRange
+  (JNIEnv *, jobject, jlong, jlong, jlong, jint);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetRead
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetRead
+  (JNIEnv *, jobject, jlong, jstring);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReads
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReads
+  (JNIEnv *, jobject, jlong, jint);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReadCount
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReadCount
+  (JNIEnv *, jobject, jlong, jint);
+
+/*
+ * Class:     ngs_itf_ReadCollectionItf
+ * Method:    GetReadRange
+ * Signature: (JJJI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadCollectionItf_GetReadRange
+  (JNIEnv *, jobject, jlong, jlong, jlong, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_ReadGroupIteratorItf.cpp b/ngs-sdk/language/java/jni_ReadGroupIteratorItf.cpp
new file mode 100644
index 0000000..08477ab
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReadGroupIteratorItf.cpp
@@ -0,0 +1,69 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_ReadGroupIteratorItf.h"
+#include "jni_ErrorMsg.hpp"
+
+#include <ngs/itf/ReadGroupItf.hpp>
+
+using namespace ngs;
+
+static
+ReadGroupItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( ReadGroupItf* ) jself;
+}
+
+/*
+ * Class:     ngs_itf_ReadGroupIteratorItf
+ * Method:    NextReadGroup
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_ReadGroupIteratorItf_NextReadGroup
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jboolean ) Self ( jself ) -> nextReadGroup ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return false;
+}
diff --git a/ngs-sdk/language/java/jni_ReadGroupIteratorItf.h b/ngs-sdk/language/java/jni_ReadGroupIteratorItf.h
new file mode 100644
index 0000000..61a8041
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReadGroupIteratorItf.h
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_ReadGroupIteratorItf */
+
+#ifndef _Included_ngs_itf_ReadGroupIteratorItf
+#define _Included_ngs_itf_ReadGroupIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_ReadGroupIteratorItf
+ * Method:    NextReadGroup
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_ReadGroupIteratorItf_NextReadGroup
+  (JNIEnv *, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_ReadGroupItf.cpp b/ngs-sdk/language/java/jni_ReadGroupItf.cpp
new file mode 100644
index 0000000..a5c291e
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReadGroupItf.cpp
@@ -0,0 +1,153 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_ReadGroupItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/ReadGroupItf.hpp>
+#include <ngs/itf/ReadItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+
+using namespace ngs;
+
+static
+ReadGroupItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( ReadGroupItf* ) jself;
+}
+
+#if READ_GROUP_SUPPORTS_READS
+inline
+jlong Cast ( ReadItf * obj )
+{
+    return ( jlong ) ( size_t ) obj;
+}
+#endif
+    
+/*
+ * Class:     ngs_itf_ReadGroupItf
+ * Method:    GetName
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadGroupItf_GetName
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getName ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+#if READ_GROUP_SUPPORTS_READS
+
+/*
+ * Class:     ngs_itf_ReadGroupItf
+ * Method:    GetRead
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadGroupItf_GetRead
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring jreadId )
+{
+    try
+    {
+        const char * readId = JStringData ( jreadId, jenv );
+        try
+        {
+            ReadItf * new_ref = Self ( jself ) -> getRead ( readId );
+            JStringReleaseData ( jreadId, jenv, readId );
+            return Cast ( new_ref );
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( jreadId, jenv, readId );
+            throw;
+        }
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadGroupItf
+ * Method:    GetReads
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadGroupItf_GetReads
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jint categories )
+{
+    try
+    {
+        ReadItf * new_ref = Self ( jself ) -> getReads ( categories );
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+#endif
diff --git a/ngs-sdk/language/java/jni_ReadGroupItf.h b/ngs-sdk/language/java/jni_ReadGroupItf.h
new file mode 100644
index 0000000..be3533a
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReadGroupItf.h
@@ -0,0 +1,29 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_ReadGroupItf */
+
+#ifndef _Included_ngs_itf_ReadGroupItf
+#define _Included_ngs_itf_ReadGroupItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_ReadGroupItf
+ * Method:    GetName
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadGroupItf_GetName
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReadGroupItf
+ * Method:    GetStatistics
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReadGroupItf_GetStatistics
+  (JNIEnv *, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_ReadIteratorItf.cpp b/ngs-sdk/language/java/jni_ReadIteratorItf.cpp
new file mode 100644
index 0000000..dba29e2
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReadIteratorItf.cpp
@@ -0,0 +1,70 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_ReadIteratorItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/ReadItf.hpp>
+
+using namespace ngs;
+
+static
+ReadItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( ReadItf* ) jself;
+}
+
+/*
+ * Class:     ngs_itf_ReadIteratorItf
+ * Method:    NextRead
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_ReadIteratorItf_NextRead
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return Self ( jself ) -> nextRead ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return false;
+}
diff --git a/ngs-sdk/language/java/jni_ReadIteratorItf.h b/ngs-sdk/language/java/jni_ReadIteratorItf.h
new file mode 100644
index 0000000..095f6d7
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReadIteratorItf.h
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_ReadIteratorItf */
+
+#ifndef _Included_ngs_itf_ReadIteratorItf
+#define _Included_ngs_itf_ReadIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_ReadIteratorItf
+ * Method:    NextRead
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_ReadIteratorItf_NextRead
+  (JNIEnv *, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_ReadItf.cpp b/ngs-sdk/language/java/jni_ReadItf.cpp
new file mode 100644
index 0000000..cee860b
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReadItf.cpp
@@ -0,0 +1,381 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_ReadItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/FragmentItf.hpp>
+#include <ngs/itf/ReadItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+
+using namespace ngs;
+
+static
+FragmentItf * Frag ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( FragmentItf* ) jself;
+}
+
+#define Self( jself ) Frag ( jself )
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetFragmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetFragmentId
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getFragmentId ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetFragmentBases
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetFragmentBases
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length )
+{
+    try
+    {
+        ErrorMsgAssertUnsignedLong ( jenv, offset );
+        StringItf * new_ref = Self ( jself ) -> getFragmentBases ( offset, length );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetFragmentQualities
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetFragmentQualities
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length )
+{
+    try
+    {
+        ErrorMsgAssertUnsignedLong ( jenv, offset );
+        StringItf * new_ref = Self ( jself ) -> getFragmentQualities ( offset, length );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    NextFragment
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_ReadItf_NextFragment
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jboolean ) Self ( jself ) -> nextFragment ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return false;
+}
+
+#undef Self
+
+static
+ReadItf * Read ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( ReadItf* ) jself;
+}
+
+#define Self( jself ) Read ( jself )
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetReadId
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getReadId ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetNumFragments
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_ReadItf_GetNumFragments
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jint ) Self ( jself ) -> getNumFragments ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadCategory
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_ReadItf_GetReadCategory
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jint ) Self ( jself ) -> getReadCategory ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadGroup
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetReadGroup
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getReadGroup ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadName
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetReadName
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getReadName ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadBases
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetReadBases
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length )
+{
+    try
+    {
+        ErrorMsgAssertUnsignedLong ( jenv, offset );
+        StringItf * new_ref = Self ( jself ) -> getReadBases ( offset, length );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadQualities
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetReadQualities
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length )
+{
+    try
+    {
+        ErrorMsgAssertUnsignedLong ( jenv, offset );
+        StringItf * new_ref = Self ( jself ) -> getReadQualities ( offset, length );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+#undef Self
diff --git a/ngs-sdk/language/java/jni_ReadItf.h b/ngs-sdk/language/java/jni_ReadItf.h
new file mode 100644
index 0000000..18b8fea
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReadItf.h
@@ -0,0 +1,101 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_ReadItf */
+
+#ifndef _Included_ngs_itf_ReadItf
+#define _Included_ngs_itf_ReadItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetFragmentId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetFragmentId
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetFragmentBases
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetFragmentBases
+  (JNIEnv *, jobject, jlong, jlong, jlong);
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetFragmentQualities
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetFragmentQualities
+  (JNIEnv *, jobject, jlong, jlong, jlong);
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    NextFragment
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_ReadItf_NextFragment
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetReadId
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetNumFragments
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_ReadItf_GetNumFragments
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadCategory
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_ReadItf_GetReadCategory
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadGroup
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetReadGroup
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadName
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetReadName
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadBases
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetReadBases
+  (JNIEnv *, jobject, jlong, jlong, jlong);
+
+/*
+ * Class:     ngs_itf_ReadItf
+ * Method:    GetReadQualities
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReadItf_GetReadQualities
+  (JNIEnv *, jobject, jlong, jlong, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_Refcount.cpp b/ngs-sdk/language/java/jni_Refcount.cpp
new file mode 100644
index 0000000..fe792a6
--- /dev/null
+++ b/ngs-sdk/language/java/jni_Refcount.cpp
@@ -0,0 +1,137 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_Refcount.h"
+#include "jni_ErrorMsg.hpp"
+
+#include <ngs/itf/Refcount.hpp>
+
+using namespace ngs;
+
+inline
+OpaqueRefcount * Self ( size_t jself )
+{
+    return reinterpret_cast <  OpaqueRefcount* > ( jself );
+}
+
+inline
+jlong Cast ( void * obj )
+{
+    return ( jlong ) ( size_t ) obj;
+}
+
+/*
+ * Class:     ngs_itf_Refcount
+ * Method:    Duplicate
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_Refcount_Duplicate
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    if ( jself != 0 )
+    {
+        try
+        {
+            OpaqueRefcount * self = Self ( jself );
+            void * val = self -> Duplicate ();
+            return Cast ( val );
+        }
+        catch ( ErrorMsg & x )
+        {
+            ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+        }
+        catch ( std :: exception & x )
+        {
+            ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+        }
+        catch ( ... )
+        {
+            ErrorMsgThrow ( jenv, xt_error_msg, "unknown error" );
+        }
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_Refcount
+ * Method:    Release
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_ngs_itf_Refcount_Release
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    if ( jself != 0 )
+    {
+        try
+        {
+            OpaqueRefcount * self = Self ( jself );
+            self -> Release ();
+        }
+        catch ( ErrorMsg & x )
+        {
+            ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+        }
+        catch ( std :: exception & x )
+        {
+            ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+        }
+        catch ( ... )
+        {
+            ErrorMsgThrow ( jenv, xt_error_msg, "unknown error" );
+        }
+    }
+}
+
+/*
+ * Class:     ngs_itf_Refcount
+ * Method:    ReleaseRef
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_ngs_itf_Refcount_ReleaseRef
+    ( JNIEnv * jenv, jclass jcls, jlong jref )
+{
+    if ( jref != 0 )
+    {
+        try
+        {
+            OpaqueRefcount * ref = Self ( jref );
+            ref -> Release ();
+        }
+        catch ( ErrorMsg & x )
+        {
+            ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+        }
+        catch ( std :: exception & x )
+        {
+            ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+        }
+        catch ( ... )
+        {
+            ErrorMsgThrow ( jenv, xt_error_msg, "unknown error" );
+        }
+    }
+}
diff --git a/ngs-sdk/language/java/jni_Refcount.h b/ngs-sdk/language/java/jni_Refcount.h
new file mode 100644
index 0000000..f8a301a
--- /dev/null
+++ b/ngs-sdk/language/java/jni_Refcount.h
@@ -0,0 +1,37 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_Refcount */
+
+#ifndef _Included_ngs_itf_Refcount
+#define _Included_ngs_itf_Refcount
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_Refcount
+ * Method:    Duplicate
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_Refcount_Duplicate
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_Refcount
+ * Method:    Release
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_ngs_itf_Refcount_Release
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_Refcount
+ * Method:    ReleaseRef
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_ngs_itf_Refcount_ReleaseRef
+  (JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_ReferenceIteratorItf.cpp b/ngs-sdk/language/java/jni_ReferenceIteratorItf.cpp
new file mode 100644
index 0000000..6bdb2ef
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReferenceIteratorItf.cpp
@@ -0,0 +1,71 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_ReferenceIteratorItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/ReferenceItf.hpp>
+
+using namespace ngs;
+
+static
+ReferenceItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( ReferenceItf* ) jself;
+}
+    
+/*
+ * Class:     ngs_itf_ReferenceIteratorItf
+ * Method:    NextReference
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_ReferenceIteratorItf_NextReference
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jboolean ) Self ( jself ) -> nextReference ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return false;
+}
+
diff --git a/ngs-sdk/language/java/jni_ReferenceIteratorItf.h b/ngs-sdk/language/java/jni_ReferenceIteratorItf.h
new file mode 100644
index 0000000..c50c669
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReferenceIteratorItf.h
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_ReferenceIteratorItf */
+
+#ifndef _Included_ngs_itf_ReferenceIteratorItf
+#define _Included_ngs_itf_ReferenceIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_ReferenceIteratorItf
+ * Method:    NextReference
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_ReferenceIteratorItf_NextReference
+  (JNIEnv *, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_ReferenceItf.cpp b/ngs-sdk/language/java/jni_ReferenceItf.cpp
new file mode 100644
index 0000000..41842c2
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReferenceItf.cpp
@@ -0,0 +1,387 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_ReferenceItf.h"
+#include "jni_ErrorMsg.hpp"
+#include "jni_String.hpp"
+
+#include <ngs/itf/ReferenceItf.hpp>
+#include <ngs/itf/AlignmentItf.hpp>
+#include <ngs/itf/PileupItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+
+using namespace ngs;
+
+static
+ReferenceItf * Self ( size_t jself )
+{
+    if ( jself == 0 )
+        throw ErrorMsg ( "NULL self parameter" );
+
+    return ( ReferenceItf* ) jself;
+}
+
+inline
+jlong Cast ( AlignmentItf * obj )
+{
+    return ( jlong ) ( size_t ) obj;
+}
+
+inline
+jlong Cast ( PileupItf * obj )
+{
+    return ( jlong ) ( size_t ) obj;
+}
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetCommonName
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReferenceItf_GetCommonName
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getCommonName ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetCanonicalName
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReferenceItf_GetCanonicalName
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        StringItf * new_ref = Self ( jself ) -> getCanonicalName ();
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetIsCircular
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_ReferenceItf_GetIsCircular
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jboolean ) Self ( jself ) -> getIsCircular ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return false;
+}
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetLength
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetLength
+    ( JNIEnv * jenv, jobject jthis, jlong jself )
+{
+    try
+    {
+        return ( jlong ) Self ( jself ) -> getLength ();
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetReferenceBases
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReferenceItf_GetReferenceBases
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length )
+{
+    try
+    {
+        ErrorMsgAssertUnsignedLong ( jenv, offset );
+        StringItf * new_ref = Self ( jself ) -> getReferenceBases ( offset, length );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetReferenceChunk
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReferenceItf_GetReferenceChunk
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length )
+{
+    try
+    {
+        ErrorMsgAssertUnsignedLong ( jenv, offset );
+        StringItf * new_ref = Self ( jself ) -> getReferenceChunk ( offset, length );
+        return StringItfConvertToJString ( new_ref, jenv );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetAlignment
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetAlignment
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring alignmentId )
+{
+    try
+    {
+        const char * id = JStringData ( alignmentId, jenv );
+        try
+        {
+            AlignmentItf * new_ref = Self ( jself ) -> getAlignment ( id );
+            JStringReleaseData ( alignmentId, jenv, id );
+            return Cast ( new_ref );
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( alignmentId, jenv, id );
+            throw;
+        }
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetAlignments
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetAlignments
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jint categories )
+{
+    try
+    {
+        AlignmentItf * new_ref = Self ( jself ) -> getAlignments ( categories );
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetAlignmentSlice
+ * Signature: (JIJJ)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetAlignmentSlice
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length, jint categories )
+{
+    try
+    {
+        AlignmentItf * new_ref = Self ( jself ) -> getAlignmentSlice ( offset, length, categories );
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetPileups
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetPileups
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jint categories )
+{
+    try
+    {
+        PileupItf * new_ref = Self ( jself ) -> getPileups ( categories );
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetPileupSlice
+ * Signature: (JIJJ)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetPileupSlice
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jlong offset, jlong length, jint categories )
+{
+    try
+    {
+        PileupItf * new_ref = Self ( jself ) -> getPileupSlice ( offset, length, categories );
+        return Cast ( new_ref );
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
diff --git a/ngs-sdk/language/java/jni_ReferenceItf.h b/ngs-sdk/language/java/jni_ReferenceItf.h
new file mode 100644
index 0000000..8c71855
--- /dev/null
+++ b/ngs-sdk/language/java/jni_ReferenceItf.h
@@ -0,0 +1,109 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_ReferenceItf */
+
+#ifndef _Included_ngs_itf_ReferenceItf
+#define _Included_ngs_itf_ReferenceItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetCommonName
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReferenceItf_GetCommonName
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetCanonicalName
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReferenceItf_GetCanonicalName
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetIsCircular
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_ngs_itf_ReferenceItf_GetIsCircular
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetLength
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetLength
+  (JNIEnv *, jobject, jlong);
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetReferenceBases
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReferenceItf_GetReferenceBases
+  (JNIEnv *, jobject, jlong, jlong, jlong);
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetReferenceChunk
+ * Signature: (JJJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_ReferenceItf_GetReferenceChunk
+  (JNIEnv *, jobject, jlong, jlong, jlong);
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetAlignment
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetAlignment
+  (JNIEnv *, jobject, jlong, jstring);
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetAlignments
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetAlignments
+  (JNIEnv *, jobject, jlong, jint);
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetAlignmentCount
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetAlignmentCount
+  (JNIEnv *, jobject, jlong, jint);
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetAlignmentSlice
+ * Signature: (JJJI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetAlignmentSlice
+  (JNIEnv *, jobject, jlong, jlong, jlong, jint);
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetPileups
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetPileups
+  (JNIEnv *, jobject, jlong, jint);
+
+/*
+ * Class:     ngs_itf_ReferenceItf
+ * Method:    GetPileupSlice
+ * Signature: (JJJI)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_ReferenceItf_GetPileupSlice
+  (JNIEnv *, jobject, jlong, jlong, jlong, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_StatisticsItf.cpp b/ngs-sdk/language/java/jni_StatisticsItf.cpp
new file mode 100644
index 0000000..3ed2c1d
--- /dev/null
+++ b/ngs-sdk/language/java/jni_StatisticsItf.cpp
@@ -0,0 +1,267 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_StatisticsItf.h"
+#include "jni_String.hpp"
+#include "jni_ErrorMsg.hpp"
+
+#include <ngs/itf/StatisticsItf.hpp>
+#include <ngs/itf/StringItf.hpp>
+
+using namespace ngs;
+
+inline
+StatisticsItf * Self ( size_t jself )
+{
+    return reinterpret_cast <  StatisticsItf* > ( jself );
+}
+
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    GetValueType
+ * Signature: (JLjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_StatisticsItf_GetValueType
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring jpath )
+{
+    try
+    {
+        const char * path = JStringData ( jpath, jenv );
+        try
+        {
+            uint32_t val = Self ( jself ) -> getValueType ( path );
+            JStringReleaseData ( jpath, jenv, path );
+            return ( jint ) val;
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( jpath, jenv, path );
+            throw;
+        }
+    }
+    catch ( ... )
+    {
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    GetAsString
+ * Signature: (JLjava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_StatisticsItf_GetAsString
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring jpath )
+{
+    try
+    {
+        const char * path = JStringData ( jpath, jenv );
+        try
+        {
+            StringItf * new_ref = Self ( jself ) -> getAsString ( path );
+            JStringReleaseData ( jpath, jenv, path );
+            return StringItfConvertToJString ( new_ref, jenv );
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( jpath, jenv, path );
+            throw;
+        }
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    GetAsI64
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_StatisticsItf_GetAsI64
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring jpath )
+{
+    try
+    {
+        const char * path = JStringData ( jpath, jenv );
+        try
+        {
+            int64_t val = Self ( jself ) -> getAsI64 ( path );
+            JStringReleaseData ( jpath, jenv, path );
+            return ( jlong ) val;
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( jpath, jenv, path );
+            throw;
+        }
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    GetAsU64
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_StatisticsItf_GetAsU64
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring jpath )
+{
+    try
+    {
+        const char * path = JStringData ( jpath, jenv );
+        try
+        {
+            uint64_t val = Self ( jself ) -> getAsU64 ( path );
+            if ( ( int64_t ) val < 0 )
+                throw ErrorMsg ( "unsigned value too large for Java long" );
+            JStringReleaseData ( jpath, jenv, path );
+            return ( jlong ) val;
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( jpath, jenv, path );
+            throw;
+        }
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    GetAsDouble
+ * Signature: (JLjava/lang/String;)D
+ */
+JNIEXPORT jdouble JNICALL Java_ngs_itf_StatisticsItf_GetAsDouble
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring jpath )
+{
+    try
+    {
+        const char * path = JStringData ( jpath, jenv );
+        try
+        {
+            double val = Self ( jself ) -> getAsDouble ( path );
+            JStringReleaseData ( jpath, jenv, path );
+            return ( jdouble ) val;
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( jpath, jenv, path );
+            throw;
+        }
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
+
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    NextPath
+ * Signature: (JLjava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_StatisticsItf_NextPath
+    ( JNIEnv * jenv, jobject jthis, jlong jself, jstring jpath )
+{
+    try
+    {
+        const char * path = jpath ? JStringData ( jpath, jenv ) : "";
+        try
+        {
+            StringItf * new_ref = Self ( jself ) -> nextPath ( path );
+            JStringReleaseData ( jpath, jenv, path );
+            return new_ref ? StringItfConvertToJString ( new_ref, jenv ) : 0;
+        }
+        catch ( ... )
+        {
+            JStringReleaseData ( jpath, jenv, path );
+            throw;
+        }
+    }
+    catch ( ErrorMsg & x )
+    {
+        ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
+    }
+    catch ( std :: exception & x )
+    {
+        ErrorMsgThrow ( jenv, xt_runtime, x . what () );
+    }
+    catch ( ... )
+    {
+        JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
+    }
+
+    return 0;
+}
diff --git a/ngs-sdk/language/java/jni_StatisticsItf.h b/ngs-sdk/language/java/jni_StatisticsItf.h
new file mode 100644
index 0000000..2443363
--- /dev/null
+++ b/ngs-sdk/language/java/jni_StatisticsItf.h
@@ -0,0 +1,61 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ngs_itf_StatisticsItf */
+
+#ifndef _Included_ngs_itf_StatisticsItf
+#define _Included_ngs_itf_StatisticsItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    GetValueType
+ * Signature: (JLjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_ngs_itf_StatisticsItf_GetValueType
+  (JNIEnv *, jobject, jlong, jstring);
+
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    GetAsString
+ * Signature: (JLjava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_StatisticsItf_GetAsString
+  (JNIEnv *, jobject, jlong, jstring);
+
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    GetAsI64
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_StatisticsItf_GetAsI64
+  (JNIEnv *, jobject, jlong, jstring);
+
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    GetAsU64
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_ngs_itf_StatisticsItf_GetAsU64
+  (JNIEnv *, jobject, jlong, jstring);
+
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    GetAsDouble
+ * Signature: (JLjava/lang/String;)D
+ */
+JNIEXPORT jdouble JNICALL Java_ngs_itf_StatisticsItf_GetAsDouble
+  (JNIEnv *, jobject, jlong, jstring);
+
+/*
+ * Class:     ngs_itf_StatisticsItf
+ * Method:    NextPath
+ * Signature: (JLjava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_ngs_itf_StatisticsItf_NextPath
+  (JNIEnv *, jobject, jlong, jstring);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/ngs-sdk/language/java/jni_String.cpp b/ngs-sdk/language/java/jni_String.cpp
new file mode 100644
index 0000000..48b9588
--- /dev/null
+++ b/ngs-sdk/language/java/jni_String.cpp
@@ -0,0 +1,161 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "jni_String.hpp"
+#include "jni_ErrorMsg.hpp"
+
+#include <ngs/itf/StringItf.hpp>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+
+
+using namespace ngs;
+
+
+/*--------------------------------------------------------------------------
+ * JString
+ * StringItf
+ */
+
+
+
+/* Make
+ *  make with string_printf format
+ */
+jstring JStringMake ( JNIEnv * jenv, const char * fmt, ... )
+{
+    jstring jstr;
+
+    va_list args;
+    va_start ( args, fmt );
+
+    jstr = JStringVMake ( jenv, fmt, args );
+
+    va_end ( args );
+
+    return jstr;
+}
+
+jstring JStringVMake ( JNIEnv * jenv, const char * fmt, va_list args )
+{
+    assert ( jenv != 0 );
+
+    /* if the format string is NULL or empty */
+    if ( fmt == 0 || fmt [ 0 ] == 0 )
+        return jenv -> NewStringUTF ( "" );
+
+    char buffer [ 4096 ];
+    int size = snprintf ( buffer, sizeof buffer, fmt, args );
+    if ( size < 0 )
+        JNI_INTERNAL_ERROR ( jenv, "failed to make a String ( bad format or string too long )" );
+    else if ( ( size_t ) size >= sizeof buffer )
+        JNI_INTERNAL_ERROR ( jenv, "failed to make a String ( string too long )" );
+    else
+        return jenv -> NewStringUTF ( buffer );
+
+    return 0;
+}
+
+
+/* Data
+ *  access Java String data
+ */
+const char * JStringData ( jstring jself, JNIEnv * jenv )
+{
+    jboolean is_copy;
+    return jenv -> GetStringUTFChars ( jself, & is_copy );
+}
+
+
+/* ReleaseData
+ *  release Java String data
+ */
+void JStringReleaseData ( jstring jself, JNIEnv * jenv, const char * data )
+{
+    jenv -> ReleaseStringUTFChars ( jself, data );
+}
+
+/* CopyToJString
+ *  copy a Java String from an NGS_String
+ */
+jstring StringItfCopyToJString ( const ngs :: StringItf * self, JNIEnv * jenv )
+{
+    assert ( jenv != 0 );
+
+    /* if the NGS_String is NULL */
+    if ( self == 0 )
+        return jenv -> NewStringUTF ( "" );
+
+    size_t size = self -> size ();
+    if ( size == 0 )
+        return jenv -> NewStringUTF ( "" );
+
+    const char * data = self -> data ();
+
+    /* the Java gods did not see fit to provide a version
+       of NewString that takes a pointer and a length,
+       at least when it comes to UTF-8 character sets... */
+
+    /* an awful, but effective, test to see if the string
+       is already NUL terminated. */
+    if ( ( ( ( size_t ) & data [ size ] ) & 0xFFF ) != 0 )
+    {
+        /* we can read this address without fear of a seg-fault.
+           if it's NUL, then we can send the string in directly. */
+        if ( data [ size ] == 0 )
+            return jenv -> NewStringUTF ( data );
+    }
+
+    /* create a copy for the benefit of our Java friends */
+    char * copy = ( char* ) malloc ( size + 1 );
+    if ( copy == 0 )
+    {
+        RuntimeExceptionThrow ( jenv, "failed to make a String ( out of memory )" );
+        return 0;
+    }
+
+    memcpy ( copy, data, size );
+    copy [ size ] = 0;
+
+    jstring jstr = jenv -> NewStringUTF ( copy );
+
+    free ( ( void* ) copy );
+
+    return jstr;
+}
+
+/* ConvertToJavaString
+ *  make a Java String from an NGS_String
+ */
+jstring StringItfConvertToJString ( ngs :: StringItf * self, JNIEnv * jenv )
+{
+    jstring jstr = StringItfCopyToJString ( self, jenv );
+    self -> Release ();
+    return jstr;
+}
diff --git a/ngs-sdk/language/java/jni_String.hpp b/ngs-sdk/language/java/jni_String.hpp
new file mode 100644
index 0000000..f5abdda
--- /dev/null
+++ b/ngs-sdk/language/java/jni_String.hpp
@@ -0,0 +1,84 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_jni_String_
+#define _hpp_jni_String_
+
+#ifndef _h_ngs_itf_defs_
+#include <ngs/itf/defs.h>
+#endif
+
+#include "jni.h"
+
+#include <stdarg.h>
+
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+namespace ngs
+{
+    class StringItf;
+}
+
+/*--------------------------------------------------------------------------
+ * JString
+ * NGS_String
+ */
+
+
+/* Make
+ *  make with string_printf format
+ */
+jstring JStringMake ( JNIEnv * jenv, const char * fmt, ... );
+jstring JStringVMake ( JNIEnv * jenv, const char * fmt, va_list args );
+
+
+/* Data
+ *  access Java String data
+ */
+const char * JStringData ( jstring jself, JNIEnv * jenv );
+
+
+/* ReleaseData
+ *  release Java String data
+ */
+void JStringReleaseData ( jstring jself, JNIEnv * jenv, const char * data );
+
+
+/* CopyToJString
+ *  copy a Java String from a StringItf
+ */
+jstring StringItfCopyToJString ( const ngs :: StringItf * self, JNIEnv * jenv  );
+
+
+/* ConvertToJavaString
+ *  make a Java String from a StringItf
+ */
+jstring StringItfConvertToJString ( ngs :: StringItf * self, JNIEnv * jenv );
+
+
+#endif /* _hpp_jni_ErrorMsg_ */
diff --git a/ngs-sdk/language/java/jni_md.h b/ngs-sdk/language/java/jni_md.h
new file mode 100644
index 0000000..84c392a
--- /dev/null
+++ b/ngs-sdk/language/java/jni_md.h
@@ -0,0 +1,28 @@
+/*
+ * %W% %E%
+ *
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+#ifndef _JAVASOFT_JNI_MD_H_
+#define _JAVASOFT_JNI_MD_H_
+
+/* TEMPORARY - THIS MAY NEED TO BE ON A PER-SYSTEM BASIS */
+#include <stdint.h>
+
+#ifdef _WIN32_WINNT
+    #define JNIEXPORT __declspec(dllexport)
+    #define JNIIMPORT __declspec(dllimport)
+    #define JNICALL __stdcall
+#else
+    #define JNIEXPORT 
+    #define JNIIMPORT 
+    #define JNICALL   
+#endif
+
+typedef int8_t jbyte;
+typedef int32_t jint;
+typedef int64_t jlong;
+
+#endif /* !_JAVASOFT_JNI_MD_H_ */
diff --git a/ngs-sdk/language/java/libngs-java-ncbi.vers b/ngs-sdk/language/java/libngs-java-ncbi.vers
new file mode 100644
index 0000000..3eefcb9
--- /dev/null
+++ b/ngs-sdk/language/java/libngs-java-ncbi.vers
@@ -0,0 +1 @@
+1.0.0
diff --git a/ngs-sdk/language/python/Makefile b/ngs-sdk/language/python/Makefile
new file mode 100644
index 0000000..d1a61bc
--- /dev/null
+++ b/ngs-sdk/language/python/Makefile
@@ -0,0 +1,77 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: std
+
+TOP ?= $(abspath ../..)
+include $(TOP)/Makefile.config
+
+INT_LIBS = \
+	ngs-bind-python
+
+EXT_LIBS = \
+
+TARGETS =       \
+	$(INT_LIBS) \
+	$(EXT_LIBS)
+
+all std: $(TARGETS)
+
+clean:
+	rm -rf $(ILIBDIR)/$(LPFX)ngs-bind-python* $(OBJDIR)
+
+.PHONY: default all std $(TARGETS)
+
+#-------------------------------------------------------------------------------
+# ngs-bind-python
+#
+ngs-bind-python: $(ILIBDIR) $(OBJDIR) $(ILIBDIR)/$(LPFX)ngs-bind-python.$(LIBX)
+
+BIND_SRC =                  \
+	AlignmentItf            \
+	AlignmentIteratorItf    \
+	ErrorMsg                \
+	FragmentItf             \
+	FragmentIteratorItf     \
+	PileupEventItf          \
+	PileupEventIteratorItf  \
+	PileupItf               \
+	PileupIteratorItf       \
+	ReadCollectionItf       \
+	ReadGroupItf            \
+	ReadGroupIteratorItf    \
+	ReadItf                 \
+	ReadIteratorItf         \
+	ReferenceItf            \
+	ReferenceIteratorItf    \
+	StatisticsItf           \
+	Refcount                \
+	StringItf
+
+
+BIND_OBJ = \
+	$(addprefix $(OBJDIR)/,$(addsuffix .$(LOBX),$(addprefix py_,$(BIND_SRC))))
+
+$(ILIBDIR)/$(LPFX)ngs-bind-python.$(LIBX): $(BIND_OBJ)
+	$(AR) $@ $^
diff --git a/ngs-sdk/language/python/py_AlignmentIteratorItf.cpp b/ngs-sdk/language/python/py_AlignmentIteratorItf.cpp
new file mode 100644
index 0000000..11b4e41
--- /dev/null
+++ b/ngs-sdk/language/python/py_AlignmentIteratorItf.cpp
@@ -0,0 +1,32 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_AlignmentIteratorItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/AlignmentItf.hpp>
+
+GEN_PY_ITERATOR_NEXT ( Alignment )
diff --git a/ngs-sdk/language/python/py_AlignmentIteratorItf.h b/ngs-sdk/language/python/py_AlignmentIteratorItf.h
new file mode 100644
index 0000000..b84786d
--- /dev/null
+++ b/ngs-sdk/language/python/py_AlignmentIteratorItf.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_AlignmentIteratorItf
+#define _Included_py_ngs_itf_AlignmentIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_AlignmentIteratorNext(void* pRef, int* pRet, void** ppNGSStrError);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_AlignmentIteratorItf */
diff --git a/ngs-sdk/language/python/py_AlignmentItf.cpp b/ngs-sdk/language/python/py_AlignmentItf.cpp
new file mode 100644
index 0000000..2c3561b
--- /dev/null
+++ b/ngs-sdk/language/python/py_AlignmentItf.cpp
@@ -0,0 +1,63 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_AlignmentItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/AlignmentItf.hpp>
+#include <ngs/itf/FragmentItf.hpp>
+
+/*
+GEN_PY_FUNC_GET_STRING_CAST             ( Alignment, FragmentId,        Fragment )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_2_CAST ( Alignment, FragmentBases,     Fragment, uint64_t, offset, uint64_t, length )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_2_CAST ( Alignment, FragmentQualities, Fragment, uint64_t, offset, uint64_t, length )
+*/
+
+GEN_PY_FUNC_GET_STRING                  ( Alignment, AlignmentId )
+GEN_PY_FUNC_GET_STRING                  ( Alignment, ReferenceSpec )
+GEN_PY_FUNC_GET                         ( Alignment, MappingQuality, int32_t )
+GEN_PY_FUNC_GET_STRING                  ( Alignment, ReferenceBases )
+GEN_PY_FUNC_GET_STRING                  ( Alignment, ReadGroup )
+GEN_PY_FUNC_GET_STRING                  ( Alignment, ReadId )
+GEN_PY_FUNC_GET_STRING                  ( Alignment, ClippedFragmentBases )
+GEN_PY_FUNC_GET_STRING                  ( Alignment, ClippedFragmentQualities )
+GEN_PY_FUNC_GET_STRING                  ( Alignment, AlignedFragmentBases )
+GEN_PY_FUNC_GET                         ( Alignment, AlignmentCategory, uint32_t )
+GEN_PY_FUNC_GET                         ( Alignment, AlignmentPosition, int64_t )
+GEN_PY_FUNC_GET                         ( Alignment, AlignmentLength, uint64_t )
+GEN_PY_FUNC_GET                         ( Alignment, IsReversedOrientation, bool )
+GEN_PY_FUNC_GET_BY_PARAMS_1             ( Alignment, SoftClip, int32_t, uint32_t, edge )
+GEN_PY_FUNC_GET                         ( Alignment, TemplateLength, uint64_t )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_1      ( Alignment, ShortCigar, bool, clipped )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_1      ( Alignment, LongCigar, bool, clipped )
+//GEN_PY_FUNC_GET                         ( Alignment, HasMate, bool ) // TODO: decide what to do with non-standard names
+GEN_PY_FUNC_GET_EXPLICIT_NAMES          ( Alignment, bool, PY_NGS_AlignmentHasMate, hasMate )
+GEN_PY_FUNC_GET_STRING                  ( Alignment, MateAlignmentId )
+GEN_PY_FUNC_GET                         ( Alignment, MateAlignment, ngs::AlignmentItf* )
+GEN_PY_FUNC_GET_STRING                  ( Alignment, MateReferenceSpec )
+GEN_PY_FUNC_GET                         ( Alignment, MateIsReversedOrientation, bool )
+
+
diff --git a/ngs-sdk/language/python/py_AlignmentItf.h b/ngs-sdk/language/python/py_AlignmentItf.h
new file mode 100644
index 0000000..f72880b
--- /dev/null
+++ b/ngs-sdk/language/python/py_AlignmentItf.h
@@ -0,0 +1,68 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_AlignmentItf
+#define _Included_py_ngs_itf_AlignmentItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+/* TODO: it looks like CAST-functions are not actually needed, they are implemented on the python level, see ReadItf as well */
+/*PY_RES_TYPE PY_NGS_AlignmentGetFragmentId                ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetFragmentBases             ( void* pRef, uint64_t offset, uint64_t length, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetFragmentQualities         ( void* pRef, uint64_t offset, uint64_t length, void** ppNGSStringBuf, void** ppNGSStrError );
+*/
+
+PY_RES_TYPE PY_NGS_AlignmentGetAlignmentId               ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetReferenceSpec             ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetMappingQuality            ( void* pRef, int32_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetReferenceBases            ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetReadGroup                 ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetReadId                    ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetClippedFragmentBases      ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetClippedFragmentQualities  ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetAlignedFragmentBases      ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetAlignmentCategory         ( void* pRef, uint32_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetAlignmentPosition         ( void* pRef, int64_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetAlignmentLength           ( void* pRef, uint64_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetIsReversedOrientation     ( void* pRef, int* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetSoftClip                  ( void* pRef, uint32_t edge, int32_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetTemplateLength            ( void* pRef, uint64_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetShortCigar                ( void* pRef, int clipped, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetLongCigar                 ( void* pRef, int clipped, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentHasMate                      ( void* pRef, int* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetMateAlignmentId           ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetMateAlignment             ( void* pRef, void** ppRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetMateReferenceSpec         ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_AlignmentGetMateIsReversedOrientation ( void* pRef, int* pRet, void** ppNGSStrError );
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_AlignmentItf */
diff --git a/ngs-sdk/language/python/py_ErrorMsg.cpp b/ngs-sdk/language/python/py_ErrorMsg.cpp
new file mode 100644
index 0000000..20d98bf
--- /dev/null
+++ b/ngs-sdk/language/python/py_ErrorMsg.cpp
@@ -0,0 +1,27 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_ErrorMsg.hpp"
\ No newline at end of file
diff --git a/ngs-sdk/language/python/py_ErrorMsg.hpp b/ngs-sdk/language/python/py_ErrorMsg.hpp
new file mode 100644
index 0000000..77f97e4
--- /dev/null
+++ b/ngs-sdk/language/python/py_ErrorMsg.hpp
@@ -0,0 +1,330 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_ErrorMsg
+#define _Included_py_ngs_itf_ErrorMsg
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+//#include <string>
+#include <string.h>
+
+#include <assert.h>
+
+#include <ngs/itf/ErrorMsg.hpp>
+
+namespace ngs
+{
+    class StringItf;
+    
+    class AlignmentItf;
+    class FragmentItf;
+    class ReadItf;
+    class ReadGroupItf;
+    class ReferenceItf;
+    class PileupItf;
+    class PileupEventItf;
+    class ReadGroupItf;
+    class StatisticsItf;
+}
+
+namespace
+{
+    template < typename T >
+    T CheckedCast ( void* pRef )
+    {
+        if ( !pRef )
+            throw ngs::ErrorMsg ( "NULL pRef parameter" );
+
+        return ( T ) pRef;
+    }
+
+    template <typename T> struct c_type
+    {
+        typedef T type_c;
+        typedef T type_cpp;
+        //static type_cpp& cast_to_cpp (type_c& x) { return (type_cpp) x; }
+    };
+
+#define MAP_CPP_TO_C_TYPE( cpp_t, c_t )\
+    template <> struct c_type<cpp_t>\
+    {\
+        typedef c_t   type_c;\
+        typedef cpp_t type_cpp;\
+    };
+
+    MAP_CPP_TO_C_TYPE ( bool,                 int )
+    MAP_CPP_TO_C_TYPE ( ngs::StringItf*,      void* )
+    MAP_CPP_TO_C_TYPE ( ngs::AlignmentItf*,   void* )
+    MAP_CPP_TO_C_TYPE ( ngs::FragmentItf*,    void* )
+    MAP_CPP_TO_C_TYPE ( ngs::PileupItf*,      void* )
+    MAP_CPP_TO_C_TYPE ( ngs::PileupEventItf*, void* )
+    MAP_CPP_TO_C_TYPE ( ngs::ReadItf*,        void* )
+    MAP_CPP_TO_C_TYPE ( ngs::ReadGroupItf*,   void* )
+    MAP_CPP_TO_C_TYPE ( ngs::ReferenceItf*,   void* )
+    MAP_CPP_TO_C_TYPE ( ngs::StatisticsItf*,  void* )
+
+#undef MAP_CPP_TO_C_TYPE
+
+    template < typename E >
+    PY_RES_TYPE ExceptionHandler (E& x, void** ppNGSStrError)
+    {
+        assert(ppNGSStrError);
+
+        char const* error_descr = x.what();
+        size_t len = strlen ( error_descr );
+        char* error_copy = new char [ len + 1 ];
+        ::memcpy ( error_copy, error_descr, len + 1 );
+        *((char**)ppNGSStrError) = error_copy;
+
+        return PY_RES_ERROR;
+    }
+
+    PY_RES_TYPE ExceptionHandler ( void** ppNGSStrError )
+    {
+        char const error_text_constant[] = "INTERNAL ERROR";
+        char* error_copy = new char [ sizeof error_text_constant ];
+        ::memcpy ( error_copy, error_text_constant, sizeof error_text_constant );
+        *((char**)ppNGSStrError) = error_copy;
+
+        return PY_RES_ERROR;
+    }
+
+    template < typename TRef, typename TVal_cpp, typename TVal_c >
+    PY_RES_TYPE PY_NGS_GetValue(void* pRef, TVal_c* pRet, void** ppNGSStrError, TVal_cpp (TRef::*pfn)() const)
+    {
+        PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
+        try
+        {
+            TVal_cpp res = (CheckedCast< TRef* >(pRef) ->* pfn)();
+            assert(pRet != NULL);
+            *pRet = (TVal_c)res;
+            ret = PY_RES_OK;
+        }
+        catch ( ngs::ErrorMsg & x )
+        {
+            ret = ExceptionHandler ( x, ppNGSStrError );
+        }
+        catch ( std::exception & x )
+        {
+            ret = ExceptionHandler ( x, ppNGSStrError );
+        }
+        catch ( ... )
+        {
+            ret = ExceptionHandler ( ppNGSStrError );
+        }
+
+        return ret;
+    }
+
+    template < typename TRef, typename TVal_cpp, typename TVal_c, typename T1 >
+    PY_RES_TYPE PY_NGS_GetValueByParams1(void* pRef, T1 p1, TVal_c* pRet, void** ppNGSStrError, TVal_cpp (TRef::*pfn)(T1) const)
+    {
+        PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
+        try
+        {
+            TVal_cpp res = (CheckedCast< TRef* >(pRef) ->* pfn)( p1 );
+            assert(pRet != NULL);
+            *pRet = (TVal_c)res;
+            ret = PY_RES_OK;
+        }
+        catch ( ngs::ErrorMsg & x )
+        {
+            ret = ExceptionHandler ( x, ppNGSStrError );
+        }
+        catch ( std::exception & x )
+        {
+            ret = ExceptionHandler ( x, ppNGSStrError );
+        }
+        catch ( ... )
+        {
+            ret = ExceptionHandler ( ppNGSStrError );
+        }
+
+        return ret;
+    }
+
+    template < typename TRef, typename TVal_cpp, typename TVal_c, typename T1, typename T2 >
+    PY_RES_TYPE PY_NGS_GetValueByParams2(void* pRef, T1 p1, T2 p2, TVal_c* pRet, void** ppNGSStrError, TVal_cpp (TRef::*pfn)(T1, T2) const)
+    {
+        PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
+        try
+        {
+            TVal_cpp res = (CheckedCast< TRef* >(pRef) ->* pfn)( p1, p2 );
+            assert(pRet != NULL);
+            *pRet = (TVal_c)res;
+            ret = PY_RES_OK;
+        }
+        catch ( ngs::ErrorMsg & x )
+        {
+            ret = ExceptionHandler ( x, ppNGSStrError );
+        }
+        catch ( std::exception & x )
+        {
+            ret = ExceptionHandler ( x, ppNGSStrError );
+        }
+        catch ( ... )
+        {
+            ret = ExceptionHandler ( ppNGSStrError );
+        }
+
+        return ret;
+    }
+
+    template < typename TRef, typename TVal_cpp, typename TVal_c, typename T1, typename T2, typename T3 >
+    PY_RES_TYPE PY_NGS_GetValueByParams3(void* pRef, T1 p1, T2 p2, T3 p3, TVal_c* pRet, void** ppNGSStrError, TVal_cpp (TRef::*pfn)(T1, T2, T3) const)
+    {
+        PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
+        try
+        {
+            TVal_cpp res = (CheckedCast< TRef* >(pRef) ->* pfn)( p1, p2, p3 );
+            assert(pRet != NULL);
+            *pRet = (TVal_c)res;
+            ret = PY_RES_OK;
+        }
+        catch ( ngs::ErrorMsg & x )
+        {
+            ret = ExceptionHandler ( x, ppNGSStrError );
+        }
+        catch ( std::exception & x )
+        {
+            ret = ExceptionHandler ( x, ppNGSStrError );
+        }
+        catch ( ... )
+        {
+            ret = ExceptionHandler ( ppNGSStrError );
+        }
+
+        return ret;
+    }
+}
+
+/////////////////// Macros generating getters for any type of values ///////////////////////
+#define GEN_PY_FUNC_GET( object_name, func_sub_name, value_type )\
+PY_RES_TYPE PY_NGS_##object_name##Get##func_sub_name(void* pRef, c_type<value_type>::type_c* pRet, void** ppNGSStrError)\
+{\
+    return PY_NGS_GetValue <ngs::object_name##Itf, value_type, c_type<value_type>::type_c> ( pRef, pRet, ppNGSStrError, & ngs::object_name##Itf::get##func_sub_name );\
+}
+
+// TODO: this function is for special cases when Itf method names do not adhere common pattern.
+#define GEN_PY_FUNC_GET_EXPLICIT_NAMES( object_name, value_type, generated_function_name, itf_function_name )\
+PY_RES_TYPE generated_function_name(void* pRef, c_type<value_type>::type_c* pRet, void** ppNGSStrError)\
+{\
+    return PY_NGS_GetValue <ngs::object_name##Itf, value_type, c_type<value_type>::type_c> ( pRef, pRet, ppNGSStrError, & ngs::object_name##Itf::itf_function_name );\
+}
+
+#define GEN_PY_FUNC_GET_BY_PARAMS_1( object_name, func_sub_name, value_type, param_type1, p1 )\
+PY_RES_TYPE PY_NGS_##object_name##Get##func_sub_name(void* pRef, c_type<param_type1>::type_c p1, c_type<value_type>::type_c* pRet, void** ppNGSStrError)\
+{\
+    return PY_NGS_GetValueByParams1 <ngs::object_name##Itf, value_type, c_type<value_type>::type_c> ( pRef, (c_type<param_type1>::type_cpp)(p1), pRet, ppNGSStrError, & ngs::object_name##Itf::get##func_sub_name );\
+}
+
+// TODO: this function is for special cases when Itf method names do not adhere common pattern.
+#define GEN_PY_FUNC_GET_BY_PARAMS_1_EXPLICIT_NAMES( object_name, value_type, param_type1, p1, generated_function_name, itf_function_name )\
+PY_RES_TYPE generated_function_name(void* pRef, c_type<param_type1>::type_c p1, c_type<value_type>::type_c* pRet, void** ppNGSStrError)\
+{\
+    return PY_NGS_GetValueByParams1 <ngs::object_name##Itf, value_type, c_type<value_type>::type_c> ( pRef, (c_type<param_type1>::type_cpp)(p1), pRet, ppNGSStrError, & ngs::object_name##Itf::itf_function_name );\
+}
+
+#define GEN_PY_FUNC_GET_BY_PARAMS_2( object_name, func_sub_name, value_type, param_type1, p1, param_type2, p2 )\
+PY_RES_TYPE PY_NGS_##object_name##Get##func_sub_name(void* pRef, c_type<param_type1>::type_c p1, c_type<param_type2>::type_c p2, c_type<value_type>::type_c* pRet, void** ppNGSStrError)\
+{\
+    return PY_NGS_GetValueByParams2 <ngs::object_name##Itf, value_type, c_type<value_type>::type_c> ( pRef, (c_type<param_type1>::type_cpp)(p1), (c_type<param_type2>::type_cpp)(p2), pRet, ppNGSStrError, & ngs::object_name##Itf::get##func_sub_name );\
+}
+
+// TODO: this function is for special cases when Itf method names do not adhere common pattern.
+#define GEN_PY_FUNC_GET_BY_PARAMS_2_EXPLICIT_NAMES( object_name, value_type, param_type1, p1, param_type2, p2, generated_function_name, itf_function_name )\
+PY_RES_TYPE generated_function_name(void* pRef, c_type<param_type1>::type_c p1, c_type<param_type2>::type_c p2, c_type<value_type>::type_c* pRet, void** ppNGSStrError)\
+{\
+    return PY_NGS_GetValueByParams2 <ngs::object_name##Itf, value_type, c_type<value_type>::type_c> ( pRef, (c_type<param_type1>::type_cpp)(p1), (c_type<param_type2>::type_cpp)(p2), pRet, ppNGSStrError, & ngs::object_name##Itf::itf_function_name );\
+}
+
+
+#define GEN_PY_FUNC_GET_BY_PARAMS_3( object_name, func_sub_name, value_type, param_type1, p1, param_type2, p2, param_type3, p3 )\
+PY_RES_TYPE PY_NGS_##object_name##Get##func_sub_name(void* pRef, c_type<param_type1>::type_c p1, c_type<param_type2>::type_c p2, c_type<param_type3>::type_c p3, c_type<value_type>::type_c* pRet, void** ppNGSStrError)\
+{\
+    return PY_NGS_GetValueByParams3 <ngs::object_name##Itf, value_type, c_type<value_type>::type_c> ( pRef, (c_type<param_type1>::type_cpp)(p1), (c_type<param_type2>::type_cpp)(p2), (c_type<param_type3>::type_cpp)(p3), pRet, ppNGSStrError, & ngs::object_name##Itf::get##func_sub_name );\
+}
+
+/////////////////// Specialized macros to generate getters returning Strings ////////////////
+
+#define GEN_PY_FUNC_GET_STRING( object_name, func_sub_name ) GEN_PY_FUNC_GET( object_name, func_sub_name, ngs::StringItf* )
+#define GEN_PY_FUNC_GET_STRING_BY_PARAMS_1( object_name, func_sub_name, param_type1, p1 ) GEN_PY_FUNC_GET_BY_PARAMS_1( object_name, func_sub_name, ngs::StringItf*, param_type1, p1 )
+#define GEN_PY_FUNC_GET_STRING_BY_PARAMS_2( object_name, func_sub_name, param_type1, p1, param_type2, p2 ) GEN_PY_FUNC_GET_BY_PARAMS_2( object_name, func_sub_name, ngs::StringItf*, param_type1, p1, param_type2, p2 )
+
+/////////////////// Specialized macros to generate getters returning Strings and reinterpretting pRef as different type ///////////////
+
+//#define GEN_PY_FUNC_GET_STRING_CAST( object_name, func_sub_name, object_reinterpret_name )\
+//PY_RES_TYPE PY_NGS_##object_name##Get##func_sub_name(void* pRef, void** pRet, void** ppNGSStrError)\
+//{\
+//    return PY_NGS_GetValue <ngs::object_reinterpret_name##Itf, ngs::StringItf*, c_type<ngs::StringItf*>::type_c> ( pRef, pRet, ppNGSStrError, & ngs::object_reinterpret_name##Itf::get##func_sub_name );\
+//}
+//
+//#define GEN_PY_FUNC_GET_STRING_BY_PARAMS_2_CAST( object_name, func_sub_name, object_reinterpret_name, param_type1, p1, param_type2, p2 )\
+//PY_RES_TYPE PY_NGS_##object_name##Get##func_sub_name(void* pRef, c_type<param_type1>::type_c p1, c_type<param_type2>::type_c p2, void** pRet, void** ppNGSStrError)\
+//{\
+//    return PY_NGS_GetValueByParams2 <ngs::object_reinterpret_name##Itf> ( pRef, (c_type<param_type1>::type_cpp)(p1), (c_type<param_type2>::type_cpp)(p2), pRet, ppNGSStrError, & ngs::object_reinterpret_name##Itf::get##func_sub_name );\
+//}
+
+///////////////// Separate macro to generate iterator-next functions /////////////////////
+
+#define GEN_PY_ITERATOR_NEXT_IMPL(object_name, generated_function_name)\
+PY_RES_TYPE generated_function_name ( void* pRef, int* pRet, void** ppNGSStrError )\
+{\
+    PY_RES_TYPE ret = PY_RES_ERROR;\
+    try\
+    {\
+        bool res = CheckedCast< ngs::object_name##Itf* >(pRef) -> next##object_name();\
+        assert(pRet != NULL);\
+        *pRet = (int)res;\
+        ret = PY_RES_OK;\
+    }\
+    catch ( ngs::ErrorMsg & x )\
+    {\
+        ret = ExceptionHandler ( x, ppNGSStrError );\
+    }\
+    catch ( std::exception & x )\
+    {\
+        ret = ExceptionHandler ( x, ppNGSStrError );\
+    }\
+    catch ( ... )\
+    {\
+        ret = ExceptionHandler ( ppNGSStrError );\
+    }\
+    return ret;\
+}
+
+#define GEN_PY_ITERATOR_NEXT(object_name) GEN_PY_ITERATOR_NEXT_IMPL(object_name, PY_NGS_##object_name##IteratorNext )
+#define GEN_PY_ITERATOR_NEXT_EXPLICIT_NAMES(object_name, generated_function_name) GEN_PY_ITERATOR_NEXT_IMPL(object_name, generated_function_name )
+
+#endif /* _Included_py_ngs_itf_ErrorMsg */
diff --git a/ngs-sdk/language/python/py_FragmentIteratorItf.cpp b/ngs-sdk/language/python/py_FragmentIteratorItf.cpp
new file mode 100644
index 0000000..7bf9240
--- /dev/null
+++ b/ngs-sdk/language/python/py_FragmentIteratorItf.cpp
@@ -0,0 +1,32 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_FragmentIteratorItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/FragmentItf.hpp>
+
+GEN_PY_ITERATOR_NEXT ( Fragment )
diff --git a/ngs-sdk/language/python/py_FragmentIteratorItf.h b/ngs-sdk/language/python/py_FragmentIteratorItf.h
new file mode 100644
index 0000000..b5929b1
--- /dev/null
+++ b/ngs-sdk/language/python/py_FragmentIteratorItf.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_FragmentIteratorItf
+#define _Included_py_ngs_itf_FragmentIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_FragmentIteratorNext(void* pRef, int* pRet, void** ppNGSStrError);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_FragmentIteratorItf */
diff --git a/ngs-sdk/language/python/py_FragmentItf.cpp b/ngs-sdk/language/python/py_FragmentItf.cpp
new file mode 100644
index 0000000..5f70081
--- /dev/null
+++ b/ngs-sdk/language/python/py_FragmentItf.cpp
@@ -0,0 +1,34 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_FragmentItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/FragmentItf.hpp>
+
+GEN_PY_FUNC_GET_STRING                  ( Fragment, FragmentId )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_2      ( Fragment, FragmentBases,     uint64_t, offset, uint64_t, length )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_2      ( Fragment, FragmentQualities, uint64_t, offset, uint64_t, length )
diff --git a/ngs-sdk/language/python/py_FragmentItf.h b/ngs-sdk/language/python/py_FragmentItf.h
new file mode 100644
index 0000000..e58dd4c
--- /dev/null
+++ b/ngs-sdk/language/python/py_FragmentItf.h
@@ -0,0 +1,44 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_FragmentItf
+#define _Included_py_ngs_itf_FragmentItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+/* TODO: names has changed, fix it in python */
+
+PY_RES_TYPE PY_NGS_FragmentGetFragmentId(void* pRef, void** ppNGSStringBuf, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_FragmentGetFragmentBases(void* pRef, uint64_t offset, uint64_t length, void** ppNGSStringBuf, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_FragmentGetFragmentQualities(void* pRef, uint64_t offset, uint64_t length, void** ppNGSStringBuf, void** ppNGSStrError);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_FragmentItf */
diff --git a/ngs-sdk/language/python/py_PileupEventIteratorItf.cpp b/ngs-sdk/language/python/py_PileupEventIteratorItf.cpp
new file mode 100644
index 0000000..5d6e012
--- /dev/null
+++ b/ngs-sdk/language/python/py_PileupEventIteratorItf.cpp
@@ -0,0 +1,32 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_PileupEventIteratorItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/PileupEventItf.hpp>
+
+GEN_PY_ITERATOR_NEXT ( PileupEvent )
diff --git a/ngs-sdk/language/python/py_PileupEventIteratorItf.h b/ngs-sdk/language/python/py_PileupEventIteratorItf.h
new file mode 100644
index 0000000..ab8a515
--- /dev/null
+++ b/ngs-sdk/language/python/py_PileupEventIteratorItf.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_PileupEventIteratorItf
+#define _Included_py_ngs_itf_PileupEventIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_PileupEventIteratorNext(void* pRef, int* pRet, void** ppNGSStrError);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_PileupEventIteratorItf */
diff --git a/ngs-sdk/language/python/py_PileupEventItf.cpp b/ngs-sdk/language/python/py_PileupEventItf.cpp
new file mode 100644
index 0000000..8108751
--- /dev/null
+++ b/ngs-sdk/language/python/py_PileupEventItf.cpp
@@ -0,0 +1,45 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_PileupEventItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/PileupEventItf.hpp>
+
+GEN_PY_FUNC_GET_STRING                  ( PileupEvent, ReferenceSpec )
+GEN_PY_FUNC_GET                         ( PileupEvent, ReferencePosition,      int64_t )
+GEN_PY_FUNC_GET                         ( PileupEvent, MappingQuality,         int32_t )
+GEN_PY_FUNC_GET_STRING                  ( PileupEvent, AlignmentId )
+GEN_PY_FUNC_GET                         ( PileupEvent, Alignment,              ngs::AlignmentItf* )
+GEN_PY_FUNC_GET                         ( PileupEvent, AlignmentPosition,      int64_t )
+GEN_PY_FUNC_GET                         ( PileupEvent, FirstAlignmentPosition, int64_t )
+GEN_PY_FUNC_GET                         ( PileupEvent, LastAlignmentPosition,  int64_t )
+GEN_PY_FUNC_GET                         ( PileupEvent, EventType,              uint32_t )
+GEN_PY_FUNC_GET                         ( PileupEvent, AlignmentBase,          char )
+GEN_PY_FUNC_GET                         ( PileupEvent, AlignmentQuality,       char )
+GEN_PY_FUNC_GET_STRING                  ( PileupEvent, InsertionBases )
+GEN_PY_FUNC_GET_STRING                  ( PileupEvent, InsertionQualities )
+GEN_PY_FUNC_GET                         ( PileupEvent, DeletionCount,          uint32_t )
diff --git a/ngs-sdk/language/python/py_PileupEventItf.h b/ngs-sdk/language/python/py_PileupEventItf.h
new file mode 100644
index 0000000..aaefeb2
--- /dev/null
+++ b/ngs-sdk/language/python/py_PileupEventItf.h
@@ -0,0 +1,53 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_PileupEventItf
+#define _Included_py_ngs_itf_PileupEventItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_PileupEventGetReferenceSpec ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetReferencePosition ( void* pRef, int64_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetMappingQuality ( void* pRef, int32_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetAlignmentId ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetAlignment ( void* pRef, void** pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetAlignmentPosition ( void* pRef, int64_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetFirstAlignmentPosition ( void* pRef, int64_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetLastAlignmentPosition ( void* pRef, int64_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetEventType ( void* pRef, uint32_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetAlignmentBase ( void* pRef, char* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetAlignmentQuality ( void* pRef, char* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetInsertionBases ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetInsertionQualities ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupEventGetDeletionCount ( void* pRef, uint32_t* pRet, void** ppNGSStrError );
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_PileupEventItf */
diff --git a/ngs-sdk/language/python/py_PileupIteratorItf.cpp b/ngs-sdk/language/python/py_PileupIteratorItf.cpp
new file mode 100644
index 0000000..2116522
--- /dev/null
+++ b/ngs-sdk/language/python/py_PileupIteratorItf.cpp
@@ -0,0 +1,32 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_PileupIteratorItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/PileupItf.hpp>
+
+GEN_PY_ITERATOR_NEXT ( Pileup )
diff --git a/ngs-sdk/language/python/py_PileupIteratorItf.h b/ngs-sdk/language/python/py_PileupIteratorItf.h
new file mode 100644
index 0000000..e2f4676
--- /dev/null
+++ b/ngs-sdk/language/python/py_PileupIteratorItf.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_PileupIteratorItf
+#define _Included_py_ngs_itf_PileupIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_PileupIteratorNext(void* pRef, int* pRet, void** ppNGSStrError);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_PileupIteratorItf */
diff --git a/ngs-sdk/language/python/py_PileupItf.cpp b/ngs-sdk/language/python/py_PileupItf.cpp
new file mode 100644
index 0000000..c912842
--- /dev/null
+++ b/ngs-sdk/language/python/py_PileupItf.cpp
@@ -0,0 +1,35 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_PileupItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/PileupItf.hpp>
+
+GEN_PY_FUNC_GET_STRING                  ( Pileup, ReferenceSpec )
+GEN_PY_FUNC_GET                         ( Pileup, ReferencePosition, int64_t )
+GEN_PY_FUNC_GET                         ( Pileup, PileupEvents,      ngs::PileupEventItf* )
+GEN_PY_FUNC_GET                         ( Pileup, PileupDepth,       uint32_t )
diff --git a/ngs-sdk/language/python/py_PileupItf.h b/ngs-sdk/language/python/py_PileupItf.h
new file mode 100644
index 0000000..afc8ae8
--- /dev/null
+++ b/ngs-sdk/language/python/py_PileupItf.h
@@ -0,0 +1,43 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_PileupItf
+#define _Included_py_ngs_itf_PileupItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_PileupGetReferenceSpec     ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupGetReferencePosition ( void* pRef, int64_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupGetPileupEvents      ( void* pRef, void** ppRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_PileupGetPileupDepth       ( void* pRef, uint32_t* pRet, void** ppNGSStrError );
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_PileupItf */
diff --git a/ngs-sdk/language/python/py_ReadCollectionItf.cpp b/ngs-sdk/language/python/py_ReadCollectionItf.cpp
new file mode 100644
index 0000000..728fc9a
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReadCollectionItf.cpp
@@ -0,0 +1,44 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_ReadCollectionItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/ReadCollectionItf.hpp>
+
+GEN_PY_FUNC_GET_STRING                  ( ReadCollection, Name )
+GEN_PY_FUNC_GET                         ( ReadCollection, ReadGroups,     ngs::ReadGroupItf* )
+GEN_PY_FUNC_GET_BY_PARAMS_1             ( ReadCollection, ReadGroup,      ngs::ReadGroupItf*, char const*, spec )
+GEN_PY_FUNC_GET                         ( ReadCollection, References,     ngs::ReferenceItf* )
+GEN_PY_FUNC_GET_BY_PARAMS_1             ( ReadCollection, Reference,      ngs::ReferenceItf*, char const*, spec )
+GEN_PY_FUNC_GET_BY_PARAMS_1             ( ReadCollection, Alignment,      ngs::AlignmentItf*, char const*, alignmentId )
+GEN_PY_FUNC_GET_BY_PARAMS_1             ( ReadCollection, Alignments,     ngs::AlignmentItf*, uint32_t, categories )
+GEN_PY_FUNC_GET_BY_PARAMS_1             ( ReadCollection, AlignmentCount, uint64_t, uint32_t, categories )
+GEN_PY_FUNC_GET_BY_PARAMS_3             ( ReadCollection, AlignmentRange, ngs::AlignmentItf*, uint64_t, first, uint64_t, count, uint32_t, categories  )
+GEN_PY_FUNC_GET_BY_PARAMS_1             ( ReadCollection, Read,           ngs::ReadItf*, char const*, readId )
+GEN_PY_FUNC_GET_BY_PARAMS_1             ( ReadCollection, Reads,          ngs::ReadItf*, uint32_t, categories )
+GEN_PY_FUNC_GET_BY_PARAMS_1             ( ReadCollection, ReadCount,      uint64_t, uint32_t, categories )
+GEN_PY_FUNC_GET_BY_PARAMS_3             ( ReadCollection, ReadRange,      ngs::ReadItf*, uint64_t, first, uint64_t, count, uint32_t, categories )
diff --git a/ngs-sdk/language/python/py_ReadCollectionItf.h b/ngs-sdk/language/python/py_ReadCollectionItf.h
new file mode 100644
index 0000000..9ffcb35
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReadCollectionItf.h
@@ -0,0 +1,52 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_ReadCollectionItf
+#define _Included_py_ngs_itf_ReadCollectionItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_ReadCollectionGetName           (void* pRef, void** ppNGSStringBuf, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetReadGroups     (void* pRef, void** pRet, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetReadGroup      (void* pRef, char const* spec, void** pRet, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetReferences     (void* pRef, void** pRet, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetReference      (void* pRef, char const* spec, void** pRet, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetAlignment      (void* pRef, char const* alignmentId, void** pRet, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetAlignments     (void* pRef, uint32_t categories, void** pRet, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetAlignmentCount (void* pRef, uint32_t categories, uint64_t* pRet, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetAlignmentRange (void* pRef, uint64_t first, uint64_t count, uint32_t categories, void** pRet, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetRead           (void* pRef, char const* readId, void** pRet, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetReads          (void* pRef, uint32_t categories, void** pRet, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetReadCount      (void* pRef, uint32_t categories, uint64_t* pRet, void** ppNGSStrError);
+PY_RES_TYPE PY_NGS_ReadCollectionGetReadRange      (void* pRef, uint64_t first, uint64_t count, uint32_t categories, void** pRet, void** ppNGSStrError);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_ReadCollectionItf */
diff --git a/ngs-sdk/language/python/py_ReadGroupIteratorItf.cpp b/ngs-sdk/language/python/py_ReadGroupIteratorItf.cpp
new file mode 100644
index 0000000..ad00313
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReadGroupIteratorItf.cpp
@@ -0,0 +1,32 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_ReadGroupIteratorItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/ReadGroupItf.hpp>
+
+GEN_PY_ITERATOR_NEXT ( ReadGroup )
diff --git a/ngs-sdk/language/python/py_ReadGroupIteratorItf.h b/ngs-sdk/language/python/py_ReadGroupIteratorItf.h
new file mode 100644
index 0000000..37b0d6d
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReadGroupIteratorItf.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_ReadGroupIteratorItf
+#define _Included_py_ngs_itf_ReadGroupIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_ReadGroupIteratorNext(void* pRef, int* pRet, void** ppNGSStrError);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_ReadGroupIteratorItf */
diff --git a/ngs-sdk/language/python/py_ReadGroupItf.cpp b/ngs-sdk/language/python/py_ReadGroupItf.cpp
new file mode 100644
index 0000000..1c40d61
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReadGroupItf.cpp
@@ -0,0 +1,38 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_ReadGroupItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/ReadGroupItf.hpp>
+
+GEN_PY_FUNC_GET_STRING           ( ReadGroup, Name )
+
+#if READ_GROUP_SUPPORTS_READS
+    GEN_PY_FUNC_GET_BY_PARAMS1   ( ReadGroup, Read, ngs::ReadItf*, char const*, readId )
+    GEN_PY_FUNC_GET_BY_PARAMS1   ( ReadGroup, Reads, ngs::ReadItf*, uint32_t, categories )
+#endif
+    GEN_PY_FUNC_GET              ( ReadGroup, Statistics, ngs::StatisticsItf* )
diff --git a/ngs-sdk/language/python/py_ReadGroupItf.h b/ngs-sdk/language/python/py_ReadGroupItf.h
new file mode 100644
index 0000000..4171b27
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReadGroupItf.h
@@ -0,0 +1,47 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_ReadGroupItf
+#define _Included_py_ngs_itf_ReadGroupItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_ReadGroupGetName       ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+
+#if READ_GROUP_SUPPORTS_READS
+    PY_RES_TYPE PY_NGS_ReadGroupGetRead   ( void* pRef, char const* readId, void** pRet, void** ppNGSStrError );
+    PY_RES_TYPE PY_NGS_ReadGroupGetReads  ( void* pRef, uint32_t categories, void** pRet, void** ppNGSStrError );
+#endif
+
+PY_RES_TYPE PY_NGS_ReadGroupGetStatistics ( void* pRef, void** pRet, void** ppNGSStrError );
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_ReadGroupItf */
diff --git a/ngs-sdk/language/python/py_ReadIteratorItf.cpp b/ngs-sdk/language/python/py_ReadIteratorItf.cpp
new file mode 100644
index 0000000..e81f195
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReadIteratorItf.cpp
@@ -0,0 +1,32 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_ReadIteratorItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/ReadItf.hpp>
+
+GEN_PY_ITERATOR_NEXT ( Read )
diff --git a/ngs-sdk/language/python/py_ReadIteratorItf.h b/ngs-sdk/language/python/py_ReadIteratorItf.h
new file mode 100644
index 0000000..0f87bbc
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReadIteratorItf.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_ReadIteratorItf
+#define _Included_py_ngs_itf_ReadIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_ReadIteratorNext(void* pRef, int* pRet, void** ppNGSStrError);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_ReadIteratorItf */
diff --git a/ngs-sdk/language/python/py_ReadItf.cpp b/ngs-sdk/language/python/py_ReadItf.cpp
new file mode 100644
index 0000000..2005b16
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReadItf.cpp
@@ -0,0 +1,44 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_ReadItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/ReadItf.hpp>
+#include <ngs/itf/FragmentItf.hpp>
+
+/*GEN_PY_FUNC_GET_STRING_CAST             ( Read, FragmentId,        Fragment )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_2_CAST ( Read, FragmentBases,     Fragment, uint64_t, offset, uint64_t, length )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_2_CAST ( Read, FragmentQualities, Fragment, uint64_t, offset, uint64_t, length )
+GEN_PY_ITERATOR_NEXT_EXPLICIT_NAMES     ( Fragment, PY_NGS_ReadNextFragment )*/
+
+GEN_PY_FUNC_GET_STRING                  ( Read, ReadId )
+GEN_PY_FUNC_GET                         ( Read, NumFragments, uint32_t )
+GEN_PY_FUNC_GET                         ( Read, ReadCategory, uint32_t )
+GEN_PY_FUNC_GET_STRING                  ( Read, ReadGroup )
+GEN_PY_FUNC_GET_STRING                  ( Read, ReadName )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_2      ( Read, ReadBases, uint64_t, offset, uint64_t, length )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_2      ( Read, ReadQualities, uint64_t, offset, uint64_t, length )
diff --git a/ngs-sdk/language/python/py_ReadItf.h b/ngs-sdk/language/python/py_ReadItf.h
new file mode 100644
index 0000000..a9f6790
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReadItf.h
@@ -0,0 +1,53 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_ReadItf
+#define _Included_py_ngs_itf_ReadItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+/* TODO: ? Remove cast-functions */
+/*PY_RES_TYPE PY_NGS_ReadGetFragmentId        ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReadGetFragmentBases     ( void* pRef, uint64_t offset, uint64_t length, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReadGetFragmentQualities ( void* pRef, uint64_t offset, uint64_t length, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReadNextFragment         ( void* pRef, int* pRet, void** ppNGSStrError );*/
+
+PY_RES_TYPE PY_NGS_ReadGetReadId        ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReadGetNumFragments  ( void* pRef, uint32_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReadGetReadCategory  ( void* pRef, uint32_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReadGetReadGroup     ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReadGetReadName      ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReadGetReadBases     ( void* pRef, uint64_t offset, uint64_t length, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReadGetReadQualities ( void* pRef, uint64_t offset, uint64_t length, void** ppNGSStringBuf, void** ppNGSStrError );
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_ReadItf */
+
diff --git a/ngs-sdk/language/python/py_Refcount.cpp b/ngs-sdk/language/python/py_Refcount.cpp
new file mode 100644
index 0000000..a2bc1bd
--- /dev/null
+++ b/ngs-sdk/language/python/py_Refcount.cpp
@@ -0,0 +1,105 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_Refcount.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/Refcount.hpp>
+
+PY_RES_TYPE PY_NGS_RefcountRelease ( void* pRef, void** ppNGSStrError )
+{
+    PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
+    try
+    {
+        (( ngs::OpaqueRefcount* ) pRef) -> Release ();
+        ret = PY_RES_OK;
+    }
+    catch ( ngs::ErrorMsg & x )
+    {
+        ret = ExceptionHandler ( x, ppNGSStrError );
+    }
+    catch ( std::exception & x )
+    {
+        ret = ExceptionHandler ( x, ppNGSStrError );
+    }
+    catch ( ... )
+    {
+        ret = ExceptionHandler ( ppNGSStrError );
+    }
+
+    return ret;
+}
+
+PY_RES_TYPE PY_NGS_RefcountDuplicate ( void* pRef, void** pRet, void** ppNGSStrError )
+{
+    PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
+
+    if ( pRet )
+    {
+        try
+        {
+            void* res = (( ngs::OpaqueRefcount* ) pRef) -> Duplicate ();
+            assert(pRet != NULL);
+            *pRet = res;
+            ret = PY_RES_OK;
+        }
+        catch ( ngs::ErrorMsg & x )
+        {
+            ret = ExceptionHandler ( x, ppNGSStrError );
+        }
+        catch ( std::exception & x )
+        {
+            ret = ExceptionHandler ( x, ppNGSStrError );
+        }
+        catch ( ... )
+        {
+            ret = ExceptionHandler ( ppNGSStrError );
+        }
+    }
+
+    return ret;
+}
+
+PY_RES_TYPE PY_NGS_RawStringRelease  ( void* pRef, void** ppNGSStrError )
+{
+    PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
+    try
+    {
+        char* p = (char*)pRef;
+        delete[]p;
+        ret = PY_RES_OK;
+    }
+    catch ( std::exception & x )
+    {
+        ret = ExceptionHandler ( x, ppNGSStrError );
+    }
+    catch ( ... )
+    {
+        ret = ExceptionHandler ( ppNGSStrError );
+    }
+
+    return ret;
+}
diff --git a/ngs-sdk/language/python/py_Refcount.h b/ngs-sdk/language/python/py_Refcount.h
new file mode 100644
index 0000000..8e73a30
--- /dev/null
+++ b/ngs-sdk/language/python/py_Refcount.h
@@ -0,0 +1,42 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_Refcount
+#define _Included_py_ngs_itf_Refcount
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_RefcountRelease   ( void* pRef, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_RefcountDuplicate ( void* pRef, void** pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_RawStringRelease  ( void* pRef, void** ppNGSStrError );
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_Refcount */
diff --git a/ngs-sdk/language/python/py_ReferenceIteratorItf.cpp b/ngs-sdk/language/python/py_ReferenceIteratorItf.cpp
new file mode 100644
index 0000000..265f91d
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReferenceIteratorItf.cpp
@@ -0,0 +1,32 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_ReferenceIteratorItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/ReferenceItf.hpp>
+
+GEN_PY_ITERATOR_NEXT ( Reference )
diff --git a/ngs-sdk/language/python/py_ReferenceIteratorItf.h b/ngs-sdk/language/python/py_ReferenceIteratorItf.h
new file mode 100644
index 0000000..393021e
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReferenceIteratorItf.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_ReferenceIteratorItf
+#define _Included_py_ngs_itf_ReferenceIteratorItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_ReferenceIteratorNext(void* pRef, int* pRet, void** ppNGSStrError);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_ReferenceIteratorItf */
diff --git a/ngs-sdk/language/python/py_ReferenceItf.cpp b/ngs-sdk/language/python/py_ReferenceItf.cpp
new file mode 100644
index 0000000..9cdc55a
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReferenceItf.cpp
@@ -0,0 +1,42 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_ReferenceItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/ReferenceItf.hpp>
+
+GEN_PY_FUNC_GET_STRING             ( Reference, CommonName )
+GEN_PY_FUNC_GET_STRING             ( Reference, CanonicalName )
+GEN_PY_FUNC_GET                    ( Reference, IsCircular,     bool )
+GEN_PY_FUNC_GET                    ( Reference, Length,         uint64_t )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_2 ( Reference, ReferenceBases, uint64_t, offset, uint64_t, length )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_2 ( Reference, ReferenceChunk, uint64_t, offset, uint64_t, length )
+GEN_PY_FUNC_GET_BY_PARAMS_1        ( Reference, Alignment,      ngs::AlignmentItf*, char const*, alignmentId )
+GEN_PY_FUNC_GET_BY_PARAMS_1        ( Reference, Alignments,     ngs::AlignmentItf*, uint32_t, categories )
+GEN_PY_FUNC_GET_BY_PARAMS_3        ( Reference, AlignmentSlice, ngs::AlignmentItf*, int64_t, start, uint64_t, length, uint32_t, categories )
+GEN_PY_FUNC_GET_BY_PARAMS_1        ( Reference, Pileups,        ngs::PileupItf*, uint32_t, categories )
+GEN_PY_FUNC_GET_BY_PARAMS_3        ( Reference, PileupSlice,    ngs::PileupItf*, int64_t, start, uint64_t, length, uint32_t, categories )
diff --git a/ngs-sdk/language/python/py_ReferenceItf.h b/ngs-sdk/language/python/py_ReferenceItf.h
new file mode 100644
index 0000000..3265819
--- /dev/null
+++ b/ngs-sdk/language/python/py_ReferenceItf.h
@@ -0,0 +1,50 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_ReferenceItf
+#define _Included_py_ngs_itf_ReferenceItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_ReferenceGetCommonName     ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReferenceGetCanonicalName  ( void* pRef, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReferenceGetIsCircular     ( void* pRef, int* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReferenceGetLength         ( void* pRef, uint64_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReferenceGetReferenceBases ( void* pRef, uint64_t offset, uint64_t length, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReferenceGetReferenceChunk ( void* pRef, uint64_t offset, uint64_t length, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReferenceGetAlignment      ( void* pRef, char const* alignmentId, void** pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReferenceGetAlignments     ( void* pRef, uint32_t categories, void** pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReferenceGetAlignmentSlice ( void* pRef, int64_t start, uint64_t length, uint32_t categories, void** pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReferenceGetPileups        ( void* pRef, uint32_t categories, void** pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_ReferenceGetPileupSlice    ( void* pRef, int64_t start, uint64_t length, uint32_t categories, void** pRet, void** ppNGSStrError );
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_ReferenceItf */
diff --git a/ngs-sdk/language/python/py_StatisticsItf.cpp b/ngs-sdk/language/python/py_StatisticsItf.cpp
new file mode 100644
index 0000000..1d53f13
--- /dev/null
+++ b/ngs-sdk/language/python/py_StatisticsItf.cpp
@@ -0,0 +1,37 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_StatisticsItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/StatisticsItf.hpp>
+
+GEN_PY_FUNC_GET_BY_PARAMS_1                ( Statistics, ValueType, uint32_t, char const*, path )
+GEN_PY_FUNC_GET_STRING_BY_PARAMS_1         ( Statistics, AsString, char const*, path )
+GEN_PY_FUNC_GET_BY_PARAMS_1                ( Statistics, AsI64,     int64_t, char const*, path )
+GEN_PY_FUNC_GET_BY_PARAMS_1                ( Statistics, AsU64,     uint64_t, char const*, path )
+GEN_PY_FUNC_GET_BY_PARAMS_1                ( Statistics, AsDouble,  double, char const*, path )
+GEN_PY_FUNC_GET_BY_PARAMS_1_EXPLICIT_NAMES ( Statistics, ngs::StringItf*, char const*, path, PY_NGS_StatisticsGetNextPath, nextPath )
diff --git a/ngs-sdk/language/python/py_StatisticsItf.h b/ngs-sdk/language/python/py_StatisticsItf.h
new file mode 100644
index 0000000..dd13d25
--- /dev/null
+++ b/ngs-sdk/language/python/py_StatisticsItf.h
@@ -0,0 +1,45 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_StatisticsItf
+#define _Included_py_ngs_itf_StatisticsItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+
+PY_RES_TYPE PY_NGS_StatisticsGetValueType ( void* pRef, char const* path, uint32_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_StatisticsGetAsString  ( void* pRef, char const* path, void** ppNGSStringBuf, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_StatisticsGetAsI64     ( void* pRef, char const* path, int64_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_StatisticsGetAsU64     ( void* pRef, char const* path, uint64_t* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_StatisticsGetAsDouble  ( void* pRef, char const* path, double* pRet, void** ppNGSStrError );
+PY_RES_TYPE PY_NGS_StatisticsGetNextPath  ( void* pRef, char const* path, void** ppNGSStringBuf, void** ppNGSStrError );
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_StatisticsItf */
diff --git a/ngs-sdk/language/python/py_StringItf.cpp b/ngs-sdk/language/python/py_StringItf.cpp
new file mode 100644
index 0000000..729ffa2
--- /dev/null
+++ b/ngs-sdk/language/python/py_StringItf.cpp
@@ -0,0 +1,48 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "py_StringItf.h"
+#include "py_ErrorMsg.hpp"
+
+#include <ngs/itf/StringItf.hpp>
+
+GEN_PY_FUNC_GET_BY_PARAMS_2_EXPLICIT_NAMES ( String, ngs::StringItf*, size_t, offset, size_t, size, PY_NGS_StringGetSubstring, substr )
+
+PY_RES_TYPE PY_NGS_StringGetData ( void* pRef, char const** pRet )
+{
+    assert ( pRef );
+    assert ( pRet );
+    *pRet = ((ngs::StringItf const*)pRef) -> data ();
+    return PY_RES_OK;
+}
+
+PY_RES_TYPE PY_NGS_StringGetSize ( void* pRef, size_t* pRet )
+{
+    assert ( pRef );
+    assert ( pRet );
+    *pRet = ((ngs::StringItf const*)pRef) -> size ();
+    return PY_RES_OK;
+}
diff --git a/ngs-sdk/language/python/py_StringItf.h b/ngs-sdk/language/python/py_StringItf.h
new file mode 100644
index 0000000..970ed15
--- /dev/null
+++ b/ngs-sdk/language/python/py_StringItf.h
@@ -0,0 +1,43 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _Included_py_ngs_itf_StringItf
+#define _Included_py_ngs_itf_StringItf
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "py_ngs_defs.h"
+#include <stddef.h>
+
+PY_RES_TYPE PY_NGS_StringGetData      ( void* pRef, char const** pRet );
+PY_RES_TYPE PY_NGS_StringGetSize      ( void* pRef, size_t* pRet );
+PY_RES_TYPE PY_NGS_StringGetSubstring ( void* pRef, size_t offset, size_t size, void** ppNGSStringBuf, void** ppNGSStrError );
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _Included_py_ngs_itf_StringItf */
diff --git a/ngs-sdk/language/python/py_ngs_defs.h b/ngs-sdk/language/python/py_ngs_defs.h
new file mode 100644
index 0000000..f5fa9ac
--- /dev/null
+++ b/ngs-sdk/language/python/py_ngs_defs.h
@@ -0,0 +1,39 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+/* py_ngs_defs.h */
+
+#ifndef _h_ngs_defs_
+#define _h_ngs_defs_
+
+#define PY_RES_TYPE   int
+#define PY_RES_OK     0
+#define PY_RES_ERROR  1
+
+#include <stdint.h>
+
+#endif
+
diff --git a/ngs-sdk/ngs/Alignment.hpp b/ngs-sdk/ngs/Alignment.hpp
new file mode 100644
index 0000000..e76dd36
--- /dev/null
+++ b/ngs-sdk/ngs/Alignment.hpp
@@ -0,0 +1,245 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_alignment_
+#define _hpp_ngs_alignment_
+
+#ifndef _hpp_ngs_fragment_
+#include <ngs/Fragment.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards and typedefs
+     */
+    typedef FragmentRef AlignmentRef;
+
+
+    /*======================================================================
+     * Alignment
+     *  represents an alignment between a Fragment and Reference sub-sequence
+     *  provides a path to Read and mate Alignment
+     */
+    class NGS_EXTERN Alignment : public Fragment
+    {
+    public:
+
+        /* getAlignmentId
+         *  retrieve an identifying String that can be used for later access.
+         *  the id will be unique within ReadCollection.
+         */
+        StringRef getAlignmentId () const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * Reference
+         */
+
+        /* getReferenceSpec
+         */
+        String getReferenceSpec () const
+            throw ( ErrorMsg );
+
+        /* getMappingQuality 
+         */
+        int getMappingQuality () const
+            throw ( ErrorMsg );
+
+        /* getReferenceBases
+         *  return reference bases
+         */
+        StringRef getReferenceBases () const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * Fragment
+         */
+
+        /* getReadGroup
+         */
+        String getReadGroup () const
+            throw ( ErrorMsg );
+
+        /* getReadId
+         */
+        StringRef getReadId () const
+            throw ( ErrorMsg );
+
+        /* getClippedFragmentBases
+         *  return fragment bases
+         */
+        StringRef getClippedFragmentBases () const
+            throw ( ErrorMsg );
+
+        /* getClippedFragmentQualities
+         *  return fragment phred quality values
+         *  using ASCII offset of 33
+         */
+        StringRef getClippedFragmentQualities () const
+            throw ( ErrorMsg );
+
+        /* getAlignedpedFragmentBases
+         *  return fragment bases in their aligned orientation
+         */
+        StringRef getAlignedFragmentBases () const
+            throw ( ErrorMsg );
+
+        /*------------------------------------------------------------------
+         * details of this alignment
+         */
+
+        /* AlignmentCategory
+         */
+        enum AlignmentCategory
+        {
+            primaryAlignment = 1,
+            secondaryAlignment = 2,
+            all = primaryAlignment | secondaryAlignment
+        };
+        
+        /* getAlignmentCategory
+         *  alignments are categorized as primary or secondary (alternate).
+         *  return an AlignmentCategory
+         *  throws ErrorMsg if the property cannot be retrieved
+         */
+        AlignmentCategory getAlignmentCategory () const
+            throw ( ErrorMsg );
+
+        /* getAlignmentPosition
+         *  retrieve the Alignment's starting position on the Reference
+         *  return 0-based offset from start of Reference
+         *  throws ErrorMsg if the property cannot be retrieved
+         */
+        int64_t getAlignmentPosition () const
+            throw ( ErrorMsg );
+
+        /* getAligmentLength
+         *  retrieve the projected length of an Alignment projected upon Reference.
+         *  return unsigned length of projection
+         *  throws ErrorMsg if the property cannot be retrieved
+         */
+        uint64_t getAlignmentLength () const
+            throw ( ErrorMsg );
+
+        /* getIsReversedOrientation
+         *  test if orientation is reversed with respect to the Reference sequence.
+         *  return true if reversed
+         *  throws ErrorMsg if the property cannot be retrieved
+         */
+        bool getIsReversedOrientation () const
+            throw ( ErrorMsg );
+
+        /* ClipEdge
+         */
+        enum ClipEdge
+        {
+            clipLeft  = 0,
+            clipRight = 1
+        };
+
+        /* getSoftClip
+         */
+        int getSoftClip ( ClipEdge edge ) const
+            throw ( ErrorMsg );
+
+        /* getTemplateLength
+         */
+        uint64_t getTemplateLength () const
+            throw ( ErrorMsg );
+
+        /* getShortCigar
+         *  returns a text string describing alignment details
+         */
+        StringRef getShortCigar ( bool clipped ) const
+            throw ( ErrorMsg );
+
+        /* getLongCigar
+         *  returns a text string describing alignment details
+         */
+        StringRef getLongCigar ( bool clipped ) const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * details of mate alignment
+         */
+         
+        /* hasMate
+         */
+        bool hasMate () const
+            throw ();
+
+        /* getMateAlignmentId
+         */
+        StringRef getMateAlignmentId () const
+            throw ( ErrorMsg );
+
+        /* getMateAlignment
+         */
+        Alignment getMateAlignment () const
+            throw ( ErrorMsg );
+
+        /* getMateReferenceSpec
+         */
+        String getMateReferenceSpec () const
+            throw ( ErrorMsg );
+
+        /* getMateIsReversedOrientation
+         */
+        bool getMateIsReversedOrientation () const
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        Alignment & operator = ( AlignmentRef ref )
+            throw ();
+        Alignment ( AlignmentRef ref )
+            throw ();
+
+        Alignment & operator = ( const Alignment & obj )
+            throw ( ErrorMsg );
+        Alignment ( const Alignment & obj )
+            throw ( ErrorMsg );
+
+        ~ Alignment ()
+            throw ();
+    };
+
+} // namespace ngs
+
+
+// inlines
+#ifndef _inl_ngs_alignment_
+#include <ngs/inl/Alignment.hpp>
+#endif
+
+#endif // _hpp_ngs_alignment_
diff --git a/ngs-sdk/ngs/AlignmentIterator.hpp b/ngs-sdk/ngs/AlignmentIterator.hpp
new file mode 100644
index 0000000..c0915bb
--- /dev/null
+++ b/ngs-sdk/ngs/AlignmentIterator.hpp
@@ -0,0 +1,85 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_alignment_iterator_
+#define _hpp_ngs_alignment_iterator_
+
+#ifndef _hpp_ngs_alignment_
+#include <ngs/Alignment.hpp>
+#endif
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * AlignmentIterator
+     *  iterates across a list of Alignments
+     */
+    class NGS_EXTERN AlignmentIterator : public Alignment
+    {
+    public:
+
+        /* nextAlignment
+         *  advance to first alignment on initial invocation
+         *  advance to next Alignment subsequently
+         *  returns false if no more Alignments are available.
+         *  throws exception if more Alignments should be available,
+         *  but could not be accessed.
+         */
+        bool nextAlignment ()
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        AlignmentIterator ( AlignmentRef ref )
+            throw ();
+
+        AlignmentIterator & operator = ( const AlignmentIterator & obj )
+            throw ( ErrorMsg );
+        AlignmentIterator ( const AlignmentIterator & obj )
+            throw ( ErrorMsg );
+
+        ~ AlignmentIterator ()
+            throw ();
+
+    private:
+
+        Alignment & operator = ( const Alignment & obj )
+            throw ( ErrorMsg );
+        AlignmentIterator & operator = ( AlignmentRef ref )
+            throw ();
+    };
+
+} // namespace ngs
+
+
+// inlines
+#ifndef _inl_ngs_alignment_iterator_
+#include <ngs/inl/AlignmentIterator.hpp>
+#endif
+
+#endif // _hpp_ngs_alignment_iterator_
diff --git a/ngs-sdk/ngs/ErrorMsg.hpp b/ngs-sdk/ngs/ErrorMsg.hpp
new file mode 100644
index 0000000..296845d
--- /dev/null
+++ b/ngs-sdk/ngs/ErrorMsg.hpp
@@ -0,0 +1,34 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_error_msg_
+#define _hpp_ngs_error_msg_
+
+#ifndef _hpp_ngs_itf_error_msg_
+#include <ngs/itf/ErrorMsg.hpp>
+#endif
+
+#endif // _hpp_ngs_error_msg_
diff --git a/ngs-sdk/ngs/Fragment.hpp b/ngs-sdk/ngs/Fragment.hpp
new file mode 100644
index 0000000..fd6b0c9
--- /dev/null
+++ b/ngs-sdk/ngs/Fragment.hpp
@@ -0,0 +1,126 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_fragment_
+#define _hpp_ngs_fragment_
+
+#ifndef _hpp_ngs_error_msg_
+#include <ngs/ErrorMsg.hpp>
+#endif
+
+#ifndef _hpp_ngs_stringref_
+#include <ngs/StringRef.hpp>
+#endif
+
+#include <stdint.h>
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards and typedefs
+     */
+    typedef class FragmentItf * FragmentRef;
+
+
+    /*======================================================================
+     * Fragment
+     *  represents an NGS biological fragment
+     */
+    class NGS_EXTERN Fragment
+    {
+    public:
+
+        /* getFragmentId
+         *  returns an unique id within the context of the ReadCollection
+         *  representing a single biological fragment
+         */
+        StringRef getFragmentId () const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * fragment details
+         */
+
+        /* getFragmentBases
+         *  return sequence bases
+         *  "offset" is zero-based
+         */
+        StringRef getFragmentBases () const
+            throw ( ErrorMsg );
+        StringRef getFragmentBases ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        StringRef getFragmentBases ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+
+
+        /* getFragmentQualities
+         *  return phred quality values
+         *  using ASCII offset of 33
+         *  "offset" is zero-based
+         */
+        StringRef getFragmentQualities () const
+            throw ( ErrorMsg );
+        StringRef getFragmentQualities ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        StringRef getFragmentQualities ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        Fragment ( FragmentRef ref )
+            throw ();
+
+        Fragment & operator = ( const Fragment & obj )
+            throw ( ErrorMsg );
+        Fragment ( const Fragment & obj )
+            throw ( ErrorMsg );
+
+        ~ Fragment ()
+            throw ();
+
+    private:
+
+        Fragment & operator = ( FragmentRef ref )
+            throw ();
+
+    protected:
+
+        FragmentRef self;
+    };
+
+} // namespace ngs
+
+
+// inlines
+#ifndef _inl_ngs_fragment_
+#include <ngs/inl/Fragment.hpp>
+#endif
+
+#endif // _hpp_ngs_fragment_
diff --git a/ngs-sdk/ngs/FragmentIterator.hpp b/ngs-sdk/ngs/FragmentIterator.hpp
new file mode 100644
index 0000000..942b515
--- /dev/null
+++ b/ngs-sdk/ngs/FragmentIterator.hpp
@@ -0,0 +1,84 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_fragment_iterator_
+#define _hpp_ngs_fragment_iterator_
+
+#ifndef _hpp_ngs_fragment_
+#include <ngs/Fragment.hpp>
+#endif
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * FragmentIterator
+     *  iterates across a list of Fragments
+     */
+    class NGS_EXTERN FragmentIterator : public Fragment
+    {
+    public:
+
+        /* nextFragment
+         *  advance to next Fragment
+         *  returns false if no more Fragments are available.
+         *  throws exception if more Fragments should be available,
+         *  but could not be accessed.
+         */
+        bool nextFragment ()
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        FragmentIterator ( FragmentRef ref )
+            throw ();
+
+        FragmentIterator & operator = ( const FragmentIterator & obj )
+            throw ( ErrorMsg );
+        FragmentIterator ( const FragmentIterator & obj )
+            throw ( ErrorMsg );
+
+        ~ FragmentIterator ()
+            throw ();
+
+    private:
+
+        Fragment & operator = ( const Fragment & obj )
+            throw ( ErrorMsg );
+        FragmentIterator & operator = ( FragmentRef ref )
+            throw ();
+    };
+
+} // namespace ngs
+
+
+// inlines
+#ifndef _inl_ngs_fragment_iterator_
+#include <ngs/inl/FragmentIterator.hpp>
+#endif
+
+#endif // _hpp_ngs_fragment_iterator_
diff --git a/ngs-sdk/ngs/Pileup.hpp b/ngs-sdk/ngs/Pileup.hpp
new file mode 100644
index 0000000..970a97e
--- /dev/null
+++ b/ngs-sdk/ngs/Pileup.hpp
@@ -0,0 +1,117 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_pileup_
+#define _hpp_ngs_pileup_
+
+#ifndef _hpp_ngs_pileup_event_iterator_
+#include <ngs/PileupEventIterator.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards and typedefs
+     */
+    typedef class PileupItf * PileupRef;
+    
+
+    /*======================================================================
+     * Pileup
+     *  represents a slice through a stack of Alignments
+     *  at a given position on the Reference
+     */
+    class NGS_EXTERN Pileup
+    {
+    public:
+
+        /*------------------------------------------------------------------
+         * Reference
+         */
+
+        /* getReferenceSpec
+         */
+        String getReferenceSpec () const
+            throw ( ErrorMsg );
+
+        /* getReferencePosition
+         */
+        int64_t getReferencePosition () const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * PileupEvent
+         */
+
+        /* getPileupEvents
+         */
+        PileupEventIterator getPileupEvents () const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * details of this pileup row
+         */
+
+        /* getPileupDepth
+         *  returns the coverage depth
+         *  at the current reference position
+         */
+        uint32_t getPileupDepth () const
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        Pileup & operator = ( PileupRef ref )
+            throw ();
+        Pileup ( PileupRef ref )
+            throw ();
+
+        Pileup & operator = ( const Pileup & obj )
+            throw ( ErrorMsg );
+        Pileup ( const Pileup & obj )
+            throw ( ErrorMsg );
+
+        ~ Pileup ()
+            throw ();
+
+    protected:
+
+        PileupRef self;
+    };
+
+} // namespace ngs
+
+
+#ifndef _inl_ngs_pileup_
+#include <ngs/inl/Pileup.hpp>
+#endif
+
+#endif // _hpp_ngs_pileup_
diff --git a/ngs-sdk/ngs/PileupEvent.hpp b/ngs-sdk/ngs/PileupEvent.hpp
new file mode 100644
index 0000000..400944c
--- /dev/null
+++ b/ngs-sdk/ngs/PileupEvent.hpp
@@ -0,0 +1,194 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_pileup_event_
+#define _hpp_ngs_pileup_event_
+
+#ifndef _hpp_ngs_alignment_
+#include <ngs/Alignment.hpp>
+#endif
+
+#include <stdint.h>
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards and typedefs
+     */
+    typedef class PileupEventItf * PileupEventRef;
+    
+
+    /*======================================================================
+     * PileupEvent
+     *  represents a single cell of a sparse 2D matrix
+     *  with Reference coordinates on one axis
+     *  and stacked Alignments on the other axis
+     */
+    class NGS_EXTERN PileupEvent
+    {
+    public:
+
+        /*------------------------------------------------------------------
+         * Reference
+         */
+
+        /* getReferenceSpec
+         */
+        String getReferenceSpec () const
+            throw ( ErrorMsg );
+
+        /* getReferencePosition
+         */
+        int64_t getReferencePosition () const
+            throw ( ErrorMsg );
+
+        /* getMappingQuality
+         */
+        int getMappingQuality () const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * Alignment
+         */
+
+        /* getAlignmentId
+         *  unique within ReadCollection
+         */
+        StringRef getAlignmentId () const
+            throw ( ErrorMsg );
+
+        /* getAlignment
+         */
+        Alignment getAlignment () const
+            throw ( ErrorMsg );
+
+        /* getAlignmentPosition
+         */
+        int64_t getAlignmentPosition () const
+            throw ( ErrorMsg );
+
+        /* getFirstAlignmentPosition
+         *  returns the position of this Alignment's first event
+         *  in Reference coordinates
+         */
+        int64_t getFirstAlignmentPosition () const
+            throw ( ErrorMsg );
+
+        /* getLastAlignmentPosition
+         *  returns the position of this Alignment's last event
+         *  in INCLUSIVE Reference coordinates
+         */
+        int64_t getLastAlignmentPosition () const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * event details
+         */
+         
+        /* EventType
+         */
+        enum PileupEventType
+        {
+            match     = 0,
+            mismatch  = 1,
+            insertion = 2,
+            deletion  = 3
+        };         
+
+        /* getEventType
+         *  the type of event being represented
+         */
+        PileupEventType getEventType () const
+            throw ( ErrorMsg );
+
+        /* getAlignmentBase
+         *  retrieves base aligned at current Reference position
+         *  throws exception if event is an insertion or deletion
+         */
+        char getAlignmentBase () const
+            throw ( ErrorMsg );
+
+        /* getAlignmentQuality
+         *  retrieves base aligned at current Reference position
+         *  throws exception if event is an insertion or deletion
+         */
+        char getAlignmentQuality () const
+            throw ( ErrorMsg );
+
+
+        /* getInsertionBases
+         *  returns bases corresponding to insertion event
+         */
+        StringRef getInsertionBases () const
+            throw ( ErrorMsg );
+
+        /* getInsertionQualities
+         *  returns qualities corresponding to insertion event
+         */
+        StringRef getInsertionQualities () const
+            throw ( ErrorMsg );
+
+        /* getDeletionCount
+         *  returns the number of bases remaining in deletion event
+         *  i.e. the number of Reference base positions remaining
+         *  until the next non-deletion event in this alignment.
+         */
+        uint32_t getDeletionCount () const
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        PileupEvent & operator = ( PileupEventRef ref )
+            throw ();
+        PileupEvent ( PileupEventRef ref )
+            throw ();
+
+        PileupEvent & operator = ( const PileupEvent & obj )
+            throw ( ErrorMsg );
+        PileupEvent ( const PileupEvent & obj )
+            throw ( ErrorMsg );
+
+        ~ PileupEvent ()
+            throw ();
+
+    protected:
+
+        PileupEventRef self;
+    };
+
+} // namespace ngs
+
+
+#ifndef _inl_ngs_pileup_event_
+#include <ngs/inl/PileupEvent.hpp>
+#endif
+
+#endif // _hpp_ngs_pileup_event_
diff --git a/ngs-sdk/ngs/PileupEventIterator.hpp b/ngs-sdk/ngs/PileupEventIterator.hpp
new file mode 100644
index 0000000..6b70307
--- /dev/null
+++ b/ngs-sdk/ngs/PileupEventIterator.hpp
@@ -0,0 +1,84 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_pileup_event_iterator_
+#define _hpp_ngs_pileup_event_iterator_
+
+#ifndef _hpp_ngs_pileup_event_
+#include <ngs/PileupEvent.hpp>
+#endif
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * PileupEventIterator
+     *  iterates across a list of PileupEvents
+     */
+    class NGS_EXTERN PileupEventIterator : public PileupEvent
+    {
+    public:
+
+        /* nextPileupEvent
+         *  advance to first PileupEvent on initial invocation
+         *  advance to next PileupEvent subsequently
+         *  returns false if no more PileupEvents are available.
+         *  throws exception if more PileupEvents should be available,
+         *  but could not be accessed.
+         */
+        bool nextPileupEvent ()
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        PileupEventIterator ( PileupEventRef ref )
+            throw ();
+
+        PileupEventIterator & operator = ( const PileupEventIterator & obj )
+            throw ( ErrorMsg );
+        PileupEventIterator ( const PileupEventIterator & obj )
+            throw ( ErrorMsg );
+
+        ~ PileupEventIterator ()
+            throw ();
+
+    private:
+
+        PileupEvent & operator = ( const PileupEvent & obj )
+            throw ( ErrorMsg );
+        PileupEventIterator & operator = ( PileupEventRef ref )
+            throw ();
+    };
+
+} // namespace ngs
+
+
+#ifndef _inl_ngs_pileup_event_iterator_
+#include <ngs/inl/PileupEventIterator.hpp>
+#endif
+
+#endif // _hpp_ngs_pileup_event_iterator_
diff --git a/ngs-sdk/ngs/PileupIterator.hpp b/ngs-sdk/ngs/PileupIterator.hpp
new file mode 100644
index 0000000..da9cbcc
--- /dev/null
+++ b/ngs-sdk/ngs/PileupIterator.hpp
@@ -0,0 +1,84 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_pileup_iterator_
+#define _hpp_ngs_pileup_iterator_
+
+#ifndef _hpp_ngs_pileup_
+#include <ngs/Pileup.hpp>
+#endif
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * PileupIterator
+     *  iterates across a list of Pileups
+     */
+    class NGS_EXTERN PileupIterator : public Pileup
+    {
+    public:
+
+        /* nextPileup
+         *  advance to first Pileup on initial invocation
+         *  advance to next Pileup subsequently
+         *  returns false if no more Pileups are available.
+         *  throws exception if more Pileups should be available,
+         *  but could not be accessed.
+         */
+        bool nextPileup ()
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        PileupIterator ( PileupRef ref )
+            throw ();
+
+        PileupIterator & operator = ( const PileupIterator & obj )
+            throw ( ErrorMsg );
+        PileupIterator ( const PileupIterator & obj )
+            throw ( ErrorMsg );
+
+        ~ PileupIterator ()
+            throw ();
+
+    private:
+
+        Pileup & operator = ( const Pileup & obj )
+            throw ( ErrorMsg );
+        PileupIterator & operator = ( PileupRef ref )
+            throw ();
+    };
+
+} // namespace ngs
+
+
+#ifndef _inl_ngs_pileup_iterator_
+#include <ngs/inl/PileupIterator.hpp>
+#endif
+
+#endif // _hpp_ngs_pileup_iterator_
diff --git a/ngs-sdk/ngs/Read.hpp b/ngs-sdk/ngs/Read.hpp
new file mode 100644
index 0000000..ad361a5
--- /dev/null
+++ b/ngs-sdk/ngs/Read.hpp
@@ -0,0 +1,148 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_read_
+#define _hpp_ngs_read_
+
+#ifndef _hpp_ngs_fragment_iterator_
+#include <ngs/FragmentIterator.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards and typedefs
+     */
+    typedef FragmentRef ReadRef;
+
+
+    /*======================================================================
+     * Read
+     *  represents an NGS machine read
+     *  having some number of biological Fragments
+     */
+    class NGS_EXTERN Read : public FragmentIterator
+    {
+    public:
+
+        /* getReadId
+         */
+        StringRef getReadId () const
+            throw ( ErrorMsg );
+
+        /**
+         * getNumFragments
+         * the number of biological Fragments contained in the read
+         */
+        uint32_t getNumFragments () const
+            throw ( ErrorMsg );
+            
+        /*------------------------------------------------------------------
+         * read details
+         */
+
+        /* ReadCategory
+         */
+        enum ReadCategory
+        {
+            fullyAligned     = 1,
+            partiallyAligned = 2,
+            aligned          = fullyAligned | partiallyAligned,
+            unaligned        = 4,
+            all              = aligned | unaligned
+        };
+
+        /* getReadCategory
+         */
+        ReadCategory getReadCategory () const
+            throw ( ErrorMsg );
+
+        /* getReadGroup
+         */
+        String getReadGroup () const
+            throw ( ErrorMsg );
+
+        /* getReadName
+         */
+        StringRef getReadName () const
+            throw ( ErrorMsg );
+
+
+        /* getReadBases
+         *  return sequence bases
+         *  "offset" is zero-based
+         */
+        StringRef getReadBases () const
+            throw ( ErrorMsg );
+        StringRef getReadBases ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        StringRef getReadBases ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+
+
+        /* getReadQualities
+         *  return phred quality values
+         *  using ASCII offset of 33
+         *  "offset" is zero-based
+         */
+        StringRef getReadQualities () const
+            throw ( ErrorMsg );
+        StringRef getReadQualities ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        StringRef getReadQualities ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        Read ( ReadRef ref )
+            throw ();
+
+        Read & operator = ( const Read & obj )
+            throw ( ErrorMsg );
+        Read ( const Read & obj )
+            throw ( ErrorMsg );
+
+        ~ Read ()
+            throw ();
+
+    private:
+
+        Read & operator = ( ReadRef ref )
+            throw ();
+    };
+
+} // namespace ngs
+
+
+// inlines
+#ifndef _inl_ngs_read_
+#include <ngs/inl/Read.hpp>
+#endif
+
+#endif // _hpp_ngs_read_
diff --git a/ngs-sdk/ngs/ReadCollection.hpp b/ngs-sdk/ngs/ReadCollection.hpp
new file mode 100644
index 0000000..3185283
--- /dev/null
+++ b/ngs-sdk/ngs/ReadCollection.hpp
@@ -0,0 +1,210 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_read_collection_
+#define _hpp_ngs_read_collection_
+
+#ifndef _hpp_ngs_read_group_iterator_
+#include <ngs/ReadGroupIterator.hpp>
+#endif
+
+#ifndef _hpp_ngs_reference_iterator_
+#include <ngs/ReferenceIterator.hpp>
+#endif
+
+#ifndef _hpp_ngs_alignment_iterator_
+#include <ngs/AlignmentIterator.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards and typedefs
+     */
+    typedef class ReadCollectionItf * ReadCollectionRef;
+
+
+    /*======================================================================
+     * ReadCollection
+     *  represents an NGS-capable object with a collection of Reads
+     */
+    class NGS_EXTERN ReadCollection
+    {
+    public:
+        
+        /* getName
+         *  returns the simple name of the read collection
+         *  this name is generally extracted from the "spec"
+         *  used to create the object, but may also be mapped
+         *  to a canonical name if one may be determined and
+         *  differs from that given in the spec.
+         *
+         *  if the name is extracted from "spec" and contains
+         *  well-known file extensions that do not form part of
+         *  a canonical name (e.g. ".sra"), they will be removed.
+         */
+        String getName () const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * READ GROUPS
+         */
+
+        /* getReadGroups
+         *  returns an iterator of all ReadGroups used
+         */
+        ReadGroupIterator getReadGroups () const
+            throw ( ErrorMsg );
+
+        /* getReadGroup
+         */
+        ReadGroup getReadGroup ( const String & spec ) const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * REFERENCES
+         */
+
+        /* getReferences
+         *  returns an iterator of all References used
+         *  iterator will be empty if no Reads are aligned
+         */
+        ReferenceIterator getReferences () const
+            throw ( ErrorMsg );
+
+        /* getReference
+         */
+        Reference getReference ( const String & spec ) const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * ALIGNMENTS
+         */
+
+        /* getAlignment
+         *  returns an individual Alignment
+         *  throws ErrorMsg if Alignment does not exist
+         */
+        Alignment getAlignment ( const String & alignmentId ) const
+            throw ( ErrorMsg );
+
+        /* getAlignments
+         *  returns an iterator of all Alignments from specified categories
+         */
+        AlignmentIterator getAlignments ( Alignment :: AlignmentCategory categories ) const
+            throw ( ErrorMsg );
+
+        /* getAlignmentCount
+         *  returns count of all alignments
+         *  "categories" provides a means of filtering by AlignmentCategory
+         */
+        uint64_t getAlignmentCount () const
+            throw ( ErrorMsg );
+        uint64_t getAlignmentCount ( Alignment :: AlignmentCategory categories ) const
+            throw ( ErrorMsg );
+
+        /* getAlignmentRange
+         *  returns an iterator across a range of Alignments
+         *  "first" is an ordinal into set
+         *  "categories" provides a means of filtering by AlignmentCategory
+         */
+        AlignmentIterator getAlignmentRange ( uint64_t first, uint64_t count ) const
+            throw ( ErrorMsg );
+        AlignmentIterator getAlignmentRange ( uint64_t first, uint64_t count, Alignment :: AlignmentCategory categories ) const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * READS
+         */
+
+        /* getRead
+         *  returns an individual Read
+         *  throws ErrorMsg if Read does not exist
+         */
+        Read getRead ( const String & readId ) const
+            throw ( ErrorMsg );
+
+        /* getReads
+         *  returns an iterator of all contained machine Reads
+         *  "categories" provides a means of filtering by ReadCategory
+         */
+        ReadIterator getReads ( Read :: ReadCategory categories ) const
+            throw ( ErrorMsg );
+
+        /* getReadCount
+         *  returns the number of reads in the collection
+         *  "categories" provides an optional means of filtering by ReadCategory
+         */
+        uint64_t getReadCount () const
+            throw ( ErrorMsg );
+        uint64_t getReadCount ( Read :: ReadCategory categories ) const
+            throw ( ErrorMsg );
+
+        /* getReadRange
+         *  returns an iterator across a range of Reads
+         *  "first" is an ordinal into set
+         *  "categories" provides an optional means of filtering by ReadCategory
+         */
+        ReadIterator getReadRange ( uint64_t first, uint64_t count ) const
+            throw ( ErrorMsg );
+        ReadIterator getReadRange ( uint64_t first, uint64_t count, Read :: ReadCategory categories ) const
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        ReadCollection & operator = ( ReadCollectionRef ref )
+            throw ();
+        ReadCollection ( ReadCollectionRef ref )
+            throw ();
+
+        ReadCollection & operator = ( const ReadCollection & obj )
+            throw ();
+        ReadCollection ( const ReadCollection & obj )
+            throw ();
+
+        ~ ReadCollection ()
+            throw ();
+
+    protected:
+
+        ReadCollectionRef self;
+    };
+
+} // namespace ngs
+
+
+#ifndef _inl_ngs_read_collection_
+#include <ngs/inl/ReadCollection.hpp>
+#endif
+
+#endif // _hpp_ngs_read_collection_
diff --git a/ngs-sdk/ngs/ReadGroup.hpp b/ngs-sdk/ngs/ReadGroup.hpp
new file mode 100644
index 0000000..c832d2d
--- /dev/null
+++ b/ngs-sdk/ngs/ReadGroup.hpp
@@ -0,0 +1,99 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_read_group_
+#define _hpp_ngs_read_group_
+
+#ifndef _hpp_ngs_read_iterator_
+#include <ngs/ReadIterator.hpp>
+#endif
+
+#ifndef _hpp_ngs_statistics_
+#include <ngs/Statistics.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards and typedefs
+     */
+    typedef class ReadGroupItf * ReadGroupRef;
+
+
+    /*======================================================================
+     * ReadGroup
+     *  represents an NGS-capable object with a group of Reads
+     */
+    class NGS_EXTERN ReadGroup
+    {
+    public:
+
+        /* getName
+         *  returns the simple name of the read group
+         */
+        String getName () const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * STATISTICS
+         */
+		 
+		Statistics getStatistics () const 
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        ReadGroup & operator = ( ReadGroupRef ref )
+            throw ();
+        ReadGroup ( ReadGroupRef ref )
+            throw ();
+
+        ReadGroup & operator = ( const ReadGroup & obj )
+            throw ();
+        ReadGroup ( const ReadGroup & obj )
+            throw ();
+
+        ~ ReadGroup ()
+            throw ();
+
+    protected:
+
+        ReadGroupRef self;
+    };
+
+} // namespace ngs
+
+
+// inlines
+#ifndef _inl_ngs_read_group_
+#include <ngs/inl/ReadGroup.hpp>
+#endif
+
+#endif // _hpp_ngs_read_group_
diff --git a/ngs-sdk/ngs/ReadGroupIterator.hpp b/ngs-sdk/ngs/ReadGroupIterator.hpp
new file mode 100644
index 0000000..e677332
--- /dev/null
+++ b/ngs-sdk/ngs/ReadGroupIterator.hpp
@@ -0,0 +1,85 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_read_group_iterator_
+#define _hpp_ngs_read_group_iterator_
+
+#ifndef _hpp_ngs_read_group_
+#include <ngs/ReadGroup.hpp>
+#endif
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * ReadGroupIterator
+     *  iterates across a list of ReadGroups
+     */
+    class NGS_EXTERN ReadGroupIterator : public ReadGroup
+    {
+    public:
+
+        /* nextReadGroup
+         *  advance to first ReadGroup on initial invocation
+         *  advance to next ReadGroup subsequently
+         *  returns false if no more ReadGroups are available.
+         *  throws exception if more ReadGroups should be available,
+         *  but could not be accessed.
+         */
+        bool nextReadGroup ()
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        ReadGroupIterator ( ReadGroupRef ref )
+            throw ();
+
+        ReadGroupIterator & operator = ( const ReadGroupIterator & obj )
+            throw ( ErrorMsg );
+        ReadGroupIterator ( const ReadGroupIterator & obj )
+            throw ( ErrorMsg );
+
+        ~ ReadGroupIterator ()
+            throw ();
+
+    private:
+
+        ReadGroup & operator = ( const ReadGroup & obj )
+            throw ( ErrorMsg );
+        ReadGroupIterator & operator = ( ReadGroupRef ref )
+            throw ();
+    };
+
+} // namespace ngs
+
+
+// inlines
+#ifndef _inl_ngs_read_group_iterator_
+#include <ngs/inl/ReadGroupIterator.hpp>
+#endif
+
+#endif // _hpp_ngs_read_group_iterator_
diff --git a/ngs-sdk/ngs/ReadIterator.hpp b/ngs-sdk/ngs/ReadIterator.hpp
new file mode 100644
index 0000000..a7c64df
--- /dev/null
+++ b/ngs-sdk/ngs/ReadIterator.hpp
@@ -0,0 +1,85 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_read_iterator_
+#define _hpp_ngs_read_iterator_
+
+#ifndef _hpp_ngs_read_
+#include <ngs/Read.hpp>
+#endif
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * ReadIterator
+     *  iterates across a list of Reads
+     */
+    class NGS_EXTERN ReadIterator : public Read
+    {
+    public:
+
+        /* nextRead
+         *  advance to first Read on initial invocation
+         *  advance to next Read subsequently
+         *  returns false if no more Reads are available.
+         *  throws exception if more Reads should be available,
+         *  but could not be accessed.
+         */
+        bool nextRead ()
+            throw ( ErrorMsg );
+            
+    public:
+
+        // C++ support
+
+        ReadIterator ( ReadRef ref )
+            throw ();
+
+        ReadIterator & operator = ( const ReadIterator & obj )
+            throw ( ErrorMsg );
+        ReadIterator ( const ReadIterator & obj )
+            throw ( ErrorMsg );
+
+        ~ ReadIterator ()
+            throw ();
+
+    private:
+
+        Read & operator = ( const Read & obj )
+            throw ( ErrorMsg );
+        ReadIterator & operator = ( ReadRef ref )
+            throw ();
+    };
+
+} // namespace ngs
+
+
+// inlines
+#ifndef _inl_ngs_read_iterator_
+#include <ngs/inl/ReadIterator.hpp>
+#endif
+
+#endif // _hpp_ngs_read_iterator_
diff --git a/ngs-sdk/ngs/Reference.hpp b/ngs-sdk/ngs/Reference.hpp
new file mode 100644
index 0000000..a51e2f4
--- /dev/null
+++ b/ngs-sdk/ngs/Reference.hpp
@@ -0,0 +1,190 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_reference_
+#define _hpp_ngs_reference_
+
+#ifndef _hpp_ngs_alignment_iterator_
+#include <ngs/AlignmentIterator.hpp>
+#endif
+
+#ifndef _hpp_ngs_pileup_iterator_
+#include <ngs/PileupIterator.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards and typedefs
+     */
+    typedef class ReferenceItf * ReferenceRef;
+
+
+    /*======================================================================
+     * Reference
+     *  represents a reference sequence
+     */
+    class NGS_EXTERN Reference
+    {
+    public:
+
+        /* getCommonName
+         *  returns the common name of reference, e.g. "chr1"
+         */
+        String getCommonName () const
+            throw ( ErrorMsg );
+
+        /* getCanonicalName
+         *  returns the accessioned name of reference, e.g. "NC_000001.11"
+         */
+        String getCanonicalName () const
+            throw ( ErrorMsg );
+
+
+        /* getIsCircular
+         *  returns true if reference is circular
+         */
+        bool getIsCircular () const
+            throw ( ErrorMsg );
+
+
+        /* getLength
+         *  returns the length of the reference sequence
+         */
+        uint64_t getLength () const
+            throw ( ErrorMsg );
+
+
+        /* getReferenceBases
+         *  return sub-sequence bases for Reference
+         *  "offset" is zero-based
+         */
+        String getReferenceBases ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        String getReferenceBases ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+
+        /* getReferenceChunk
+         *  return largest contiguous chunk available of
+         *  sub-sequence bases for Reference
+         *  "offset" is zero-based
+         *
+         * NB - actual returned sequence may be shorter
+         *  than requested.
+         */
+        StringRef getReferenceChunk ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        StringRef getReferenceChunk ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * ALIGNMENTS
+         */
+
+        /* getAlignment
+         *  returns an individual Alignment
+         *  throws ErrorMsg if Alignment does not exist
+         *  or is not part of this Reference
+         */
+        Alignment getAlignment ( const String & alignmentId ) const
+            throw ( ErrorMsg );
+
+        /* getAlignments
+         *  returns an iterator of contained alignments
+         */
+        AlignmentIterator getAlignments ( Alignment :: AlignmentCategory categories ) const
+            throw ( ErrorMsg );
+
+        /* getAlignmentSlice
+         *  returns an iterator across a slice of the Reference
+         *
+         *  "start" is a 0-based signed offset from the start of the Reference
+         *
+         *  "length" is the length of the slice.
+         *   will be truncated to the right edge of a non-circular Reference
+         *   or to the total length of a circular Reference.
+         *
+         *  "categories" provides a means of filtering by AlignmentCategory
+         */
+        AlignmentIterator getAlignmentSlice ( int64_t start, uint64_t length ) const
+            throw ( ErrorMsg );
+        AlignmentIterator getAlignmentSlice ( int64_t start, uint64_t length, Alignment :: AlignmentCategory categories ) const
+            throw ( ErrorMsg );
+
+
+        /*------------------------------------------------------------------
+         * PILEUP
+         */
+
+        /* getPileups
+         *  returns an iterator of contained Pileups
+         */
+        PileupIterator getPileups ( Alignment :: AlignmentCategory categories ) const
+            throw ( ErrorMsg );
+
+        /* getPileupSlice
+         *  creates a PileupIterator on a slice (window) of reference
+         *  "start" is the signed starting position on reference
+         *  "length" is the number of bases in the window
+         *  "categories" provides a means of filtering by AlignmentCategory
+         */
+        PileupIterator getPileupSlice ( int64_t start, uint64_t length ) const
+            throw ( ErrorMsg );
+        PileupIterator getPileupSlice ( int64_t start, uint64_t length, Alignment :: AlignmentCategory categories ) const
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        Reference & operator = ( ReferenceRef ref )
+            throw ();
+        Reference ( ReferenceRef ref )
+            throw ();
+
+        Reference & operator = ( const Reference & obj )
+            throw ( ErrorMsg );
+        Reference ( const Reference & obj )
+            throw ( ErrorMsg );
+
+        ~ Reference ()
+            throw ();
+
+    protected:
+
+        ReferenceRef self;
+    };
+
+} // namespace ngs
+
+
+#ifndef _inl_ngs_reference_
+#include <ngs/inl/Reference.hpp>
+#endif
+
+#endif // _hpp_ngs_reference_
diff --git a/ngs-sdk/ngs/ReferenceIterator.hpp b/ngs-sdk/ngs/ReferenceIterator.hpp
new file mode 100644
index 0000000..9e281ed
--- /dev/null
+++ b/ngs-sdk/ngs/ReferenceIterator.hpp
@@ -0,0 +1,84 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_reference_iterator_
+#define _hpp_ngs_reference_iterator_
+
+#ifndef _hpp_ngs_reference_
+#include <ngs/Reference.hpp>
+#endif
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * ReferenceIterator
+     *  iterates across a list of References
+     */
+    class NGS_EXTERN ReferenceIterator : public Reference
+    {
+    public:
+
+        /* nextReference
+         *  advance to first Reference on initial invocation
+         *  advance to next Reference subsequently
+         *  returns false if no more References are available.
+         *  throws exception if more References should be available,
+         *  but could not be accessed.
+         */
+        bool nextReference ()
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+
+        ReferenceIterator ( ReferenceRef ref )
+            throw ();
+
+        ReferenceIterator & operator = ( const ReferenceIterator & obj )
+            throw ( ErrorMsg );
+        ReferenceIterator ( const ReferenceIterator & obj )
+            throw ( ErrorMsg );
+
+        ~ ReferenceIterator ()
+            throw ();
+
+    private:
+
+        Reference & operator = ( const Reference & obj )
+            throw ( ErrorMsg );
+        ReferenceIterator & operator = ( ReferenceRef ref )
+            throw ();
+    };
+
+} // namespace ngs
+
+
+#ifndef _inl_ngs_reference_iterator_
+#include <ngs/inl/ReferenceIterator.hpp>
+#endif
+
+#endif // _hpp_ngs_reference_iterator_
diff --git a/ngs-sdk/ngs/Statistics.hpp b/ngs-sdk/ngs/Statistics.hpp
new file mode 100644
index 0000000..46ec1d8
--- /dev/null
+++ b/ngs-sdk/ngs/Statistics.hpp
@@ -0,0 +1,136 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_statistics_
+#define _hpp_ngs_statistics_
+
+#ifndef _hpp_ngs_error_msg_
+#include <ngs/ErrorMsg.hpp>
+#endif
+
+#ifndef _hpp_ngs_stringref_
+#include <ngs/StringRef.hpp>
+#endif
+
+#include <stdint.h>
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards and typedefs
+     */
+    typedef class StatisticsItf * StatisticsRef;
+
+
+    /*======================================================================
+     * Statistics
+     *  represents a set of statistics as a collection of path/value pairs
+     */
+    class NGS_EXTERN Statistics 
+    {
+    public:
+
+        enum ValueType
+        {
+            none,
+            string,
+            int64,
+            uint64,
+            real
+        };
+    
+        /* getValueType
+         */
+        ValueType getValueType ( const String & path ) const
+            throw ();
+    
+        /* getAsString
+         */
+        String getAsString ( const String & path ) const
+            throw ( ErrorMsg );
+
+        /* other int types ? */
+        
+        /* getAsI64
+         *  returns a signed 64-bit integer
+         */
+        int64_t getAsI64 ( const String & path ) const
+            throw ( ErrorMsg );
+            
+        /* getAsU64
+         *  returns an unsigned 64-bit integer
+         */
+        uint64_t getAsU64 ( const String & path ) const
+            throw ( ErrorMsg );
+        
+        /* getAsDouble
+         *  returns a 64-bit floating point
+         */
+        double getAsDouble ( const String & path ) const
+            throw ( ErrorMsg );
+            
+        /* nextPath 
+         *  advance to next path in container
+         *
+         * param path is NULL or empty to request first path, or a valid path string
+         * returns an empty string if no more paths, or the next valid path string
+         */
+        String nextPath ( const String & path ) const
+            throw ();
+            
+    public:
+
+        // C++ support
+
+        Statistics ( StatisticsRef ref )
+            throw ();
+
+        Statistics & operator = ( const Statistics & obj )
+            throw ( ErrorMsg );
+        Statistics ( const Statistics & obj )
+            throw ( ErrorMsg );
+
+        ~ Statistics ()
+            throw ();
+
+    private:
+        Statistics & operator = ( StatisticsRef ref )
+            throw ();
+            
+    protected:
+
+        StatisticsRef self;            
+    };
+
+} // namespace ngs
+
+
+#ifndef _inl_ngs_statistics_
+#include <ngs/inl/Statistics.hpp>
+#endif
+
+#endif // _hpp_ngs_statistics_
diff --git a/ngs-sdk/ngs/StringRef.hpp b/ngs-sdk/ngs/StringRef.hpp
new file mode 100644
index 0000000..7627659
--- /dev/null
+++ b/ngs-sdk/ngs/StringRef.hpp
@@ -0,0 +1,129 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_stringref_
+#define _hpp_ngs_stringref_
+
+#ifndef _h_ngs_defs_
+#include <ngs/defs.h>
+#endif
+
+#ifndef _hpp_ngs_error_msg_
+#include <ngs/ErrorMsg.hpp>
+#endif
+
+#include <string>
+#include <cstdlib>
+#include <iostream>
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * forwards and typedefs
+     */
+    class StringItf;
+    typedef :: std :: string String;
+
+
+    /*----------------------------------------------------------------------
+     * StringRef
+     *  a simple reference to textual data
+     *  main purpose is to avoid copying
+     *  provides a cast operator to create a language-specific String
+     */
+    class NGS_EXTERN  StringRef
+    {
+    public:
+
+        /* data
+         *  return character string
+         *  NOT necessarily NUL-terminated
+         */
+        const char * data () const
+            throw ();
+
+        /* size
+         *   return size of string in bytes
+         */
+        size_t size () const
+            throw ();
+
+        /* substr
+         *  create a substring of the original
+         *  almost certainly NOT NUL-terminated
+         *  "offset" is zero-based
+         */
+        StringRef substr ( size_t offset ) const
+            throw ( ErrorMsg );
+        StringRef substr ( size_t offset, size_t size ) const
+            throw ( ErrorMsg );
+
+        /* toString
+         *  create a normal C++ string
+         *  copies data
+         *  "offset" is zero-based
+         */
+        String toString () const
+            throw ( ErrorMsg );
+        String toString ( size_t offset ) const
+            throw ( ErrorMsg );
+        String toString ( size_t offset, size_t size ) const
+            throw ( ErrorMsg );
+
+    public:
+
+        // C++ support
+        StringRef ( StringItf * ref )
+            throw ();
+
+        StringRef ( const StringRef & obj )
+            throw ();
+        StringRef & operator = ( const StringRef & obj )
+            throw ();
+
+        ~ StringRef ()
+            throw ();
+
+    private:
+
+        StringRef & operator = ( StringItf * ref )
+            throw ();
+
+        StringItf * self;
+    };
+
+    // support for C++ ostream
+      NGS_EXTERN :: std :: ostream & operator << ( :: std :: ostream & s, const StringRef & str );
+
+} // namespace ngs
+
+
+// inlines
+#ifndef _inl_ngs_stringref_
+#include <ngs/inl/StringRef.hpp>
+#endif
+
+#endif // _hpp_ngs_stringref_
diff --git a/ngs-sdk/ngs/adapter/AlignmentItf.hpp b/ngs-sdk/ngs/adapter/AlignmentItf.hpp
new file mode 100644
index 0000000..e449fd6
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/AlignmentItf.hpp
@@ -0,0 +1,128 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_alignment_
+#define _hpp_ngs_adapt_alignment_
+
+#ifndef _hpp_ngs_adapt_fragmentitf
+#include <ngs/adapter/FragmentItf.hpp>
+#endif
+
+#ifndef _h_ngs_itf_alignment_
+#include <ngs/itf/AlignmentItf.h>
+#endif
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+
+    /*----------------------------------------------------------------------
+     * AlignmentItf
+     */
+    class AlignmentItf : public FragmentItf
+    {
+    public:
+
+        virtual StringItf * getAlignmentId () const = 0;
+        virtual StringItf * getReferenceSpec () const = 0;
+        virtual int32_t getMappingQuality () const = 0;
+        virtual StringItf * getReferenceBases () const = 0;
+        virtual StringItf * getReadGroup () const = 0;
+        virtual StringItf * getReadId () const = 0;
+        virtual StringItf * getClippedFragmentBases () const = 0;
+        virtual StringItf * getClippedFragmentQualities () const = 0;
+        virtual StringItf * getAlignedFragmentBases () const = 0;
+        virtual bool isPrimary () const = 0;
+        virtual int64_t getAlignmentPosition () const = 0;
+        virtual uint64_t getAlignmentLength () const = 0;
+        virtual bool getIsReversedOrientation () const = 0;
+        virtual int32_t getSoftClip ( uint32_t edge ) const = 0;
+        virtual uint64_t getTemplateLength () const = 0;
+        virtual StringItf * getShortCigar ( bool clipped ) const = 0;
+        virtual StringItf * getLongCigar ( bool clipped ) const = 0;
+        virtual bool hasMate () const = 0;
+        virtual StringItf * getMateAlignmentId () const = 0;
+        virtual AlignmentItf * getMateAlignment () const = 0;
+        virtual StringItf * getMateReferenceSpec () const = 0;
+        virtual bool getMateIsReversedOrientation () const = 0;
+        virtual bool nextAlignment () = 0;
+
+        inline NGS_Alignment_v1 * Cast ()
+        { return static_cast < NGS_Alignment_v1* > ( OpaqueRefcount :: offset_this () ); }
+
+        inline const NGS_Alignment_v1 * Cast () const
+        { return static_cast < const NGS_Alignment_v1* > ( OpaqueRefcount :: offset_this () ); }
+
+        // assistance for C objects
+        static inline AlignmentItf * Self ( NGS_Alignment_v1 * obj )
+        { return static_cast < AlignmentItf* > ( OpaqueRefcount :: offset_cobj ( obj ) ); }
+
+        static inline const AlignmentItf * Self ( const NGS_Alignment_v1 * obj )
+        { return static_cast < const AlignmentItf* > ( OpaqueRefcount :: offset_cobj ( obj ) ); }
+
+    protected:
+
+        AlignmentItf ();
+        static NGS_Alignment_v1_vt ivt;
+
+    private:
+
+        // throws ErrorMsg because it's not applicable here
+        virtual bool nextFragment ();
+
+        static NGS_String_v1 * CC get_id ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_ref_spec ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static int32_t CC get_map_qual ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_ref_bases ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_read_group ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_read_id ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_clipped_frag_bases ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_clipped_frag_quals ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_aligned_frag_bases ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static bool CC is_primary ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static int64_t CC get_align_pos ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static uint64_t CC get_align_length ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static bool CC get_is_reversed ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static int32_t CC get_soft_clip ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err, uint32_t edge );
+        static uint64_t CC get_template_len ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_short_cigar ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err, bool clipped );
+        static NGS_String_v1 * CC get_long_cigar ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err, bool clipped );
+        static bool CC has_mate ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_mate_id ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_Alignment_v1 * CC get_mate_alignment ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_mate_ref_spec ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static bool CC get_mate_is_reversed ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+        static bool CC next ( NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+
+    };
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_alignment_
diff --git a/ngs-sdk/ngs/adapter/ErrorMsg.hpp b/ngs-sdk/ngs/adapter/ErrorMsg.hpp
new file mode 100644
index 0000000..69cc15a
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/ErrorMsg.hpp
@@ -0,0 +1,90 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_error_msg_
+#define _hpp_ngs_adapt_error_msg_
+
+#include <exception>
+#include <string>
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * ErrorMsg
+     *  a generic NGS error class
+     *  holds a message describing what happened
+     */
+    class ErrorMsg : public :: std :: exception
+    {
+    public:
+
+        /* what ( for C++ )
+         *  what went wrong
+         */
+        virtual const char * what () const
+            throw ();
+
+        /* toMessage ( for Java )
+         *  returns the detailed message
+         */
+        virtual const :: std :: string & toMessage () const
+            throw ();
+
+        /* toString ( for Java )
+         *  returns a short description
+         */
+        virtual const :: std :: string & toString () const
+            throw ();
+
+        /* constructors
+         *  various means of constructing
+         */        
+        ErrorMsg ()
+            throw ();
+        ErrorMsg ( const :: std :: string & message )
+            throw ();
+
+    public:
+
+        // C++ support
+
+        ErrorMsg ( const ErrorMsg & obj )
+            throw ();
+        ErrorMsg & operator = ( const ErrorMsg & obj )
+            throw ();
+
+        virtual ~ ErrorMsg ()
+            throw ();
+
+    private:
+
+        :: std :: string msg;
+    };
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_error_msg_
diff --git a/ngs-sdk/ngs/adapter/FragmentItf.hpp b/ngs-sdk/ngs/adapter/FragmentItf.hpp
new file mode 100644
index 0000000..3bc830a
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/FragmentItf.hpp
@@ -0,0 +1,78 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_fragmentitf_
+#define _hpp_ngs_adapt_fragmentitf_
+
+#ifndef _hpp_ngs_adapt_refcount_
+#include <ngs/adapter/Refcount.hpp>
+#endif
+
+#ifndef _h_ngs_itf_fragmentitf_
+#include <ngs/itf/FragmentItf.h>
+#endif
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+
+    /*----------------------------------------------------------------------
+     * FragmentItf
+     */
+    class FragmentItf : public Refcount < FragmentItf, NGS_Fragment_v1 >
+    {
+    public:
+
+        virtual StringItf * getFragmentId () const = 0;
+        virtual StringItf * getFragmentBases ( uint64_t offset, uint64_t length ) const = 0;
+        virtual StringItf * getFragmentQualities ( uint64_t offset, uint64_t length ) const = 0;
+        virtual bool nextFragment () = 0;
+
+    protected:
+
+        // support for C vtable
+        FragmentItf ( const NGS_VTable * vt );
+        static NGS_Fragment_v1_vt ivt;
+
+    private:
+
+        static NGS_String_v1 * CC get_id ( const NGS_Fragment_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_bases ( const NGS_Fragment_v1 * self, NGS_ErrBlock_v1 * err,
+            uint64_t offset, uint64_t length );
+        static NGS_String_v1 * CC get_quals ( const NGS_Fragment_v1 * self, NGS_ErrBlock_v1 * err,
+            uint64_t offset, uint64_t length );
+        static bool next ( NGS_Fragment_v1 * self, NGS_ErrBlock_v1 * err );
+
+    };
+
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_fragmentitf_
diff --git a/ngs-sdk/ngs/adapter/PileupEventItf.hpp b/ngs-sdk/ngs/adapter/PileupEventItf.hpp
new file mode 100644
index 0000000..5d85150
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/PileupEventItf.hpp
@@ -0,0 +1,96 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_pileup_eventitf_
+#define _hpp_ngs_adapt_pileup_eventitf_
+
+#ifndef _hpp_ngs_adapt_refcount_
+#include <ngs/adapter/Refcount.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_pileup_eventitf_
+#include <ngs/itf/PileupEventItf.h>
+#endif
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+    class AlignmentItf;
+
+    /*----------------------------------------------------------------------
+     * PileupEventItf
+     */
+    class PileupEventItf : public Refcount < PileupEventItf, NGS_PileupEvent_v1 >
+    {
+    public:
+
+        virtual StringItf * getReferenceSpec () const = 0;
+        virtual int64_t getReferencePosition () const = 0;
+        virtual int32_t getMappingQuality () const = 0;
+        virtual StringItf * getAlignmentId () const = 0;
+        virtual AlignmentItf * getAlignment () const = 0;
+        virtual int64_t getAlignmentPosition () const = 0;
+        virtual int64_t getFirstAlignmentPosition () const = 0;
+        virtual int64_t getLastAlignmentPosition () const = 0;
+        virtual uint32_t getEventType () const = 0;
+        virtual char getAlignmentBase () const = 0;
+        virtual char getAlignmentQuality () const = 0;
+        virtual StringItf * getInsertionBases () const = 0;
+        virtual StringItf * getInsertionQualities () const = 0;
+        virtual uint32_t getDeletionCount () const = 0;
+        virtual bool nextPileupEvent () = 0;
+
+    protected:
+
+        PileupEventItf ();
+        static struct NGS_PileupEvent_v1_vt ivt;
+
+    private:
+
+        static NGS_String_v1 * CC get_ref_spec ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static int64_t CC get_ref_pos ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static int32_t CC get_map_qual ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_align_id ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_Alignment_v1 * CC get_alignment ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static int64_t CC get_align_pos ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static int64_t CC get_first_align_pos ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static int64_t CC get_last_align_pos ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static uint32_t CC get_event_type ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static char CC get_align_base ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static char CC get_align_qual ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_ins_bases ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_ins_quals ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static uint32_t CC get_del_count ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+        static bool CC next ( NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    };
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_pileup_eventitf_
diff --git a/ngs-sdk/ngs/adapter/PileupItf.hpp b/ngs-sdk/ngs/adapter/PileupItf.hpp
new file mode 100644
index 0000000..7734b0e
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/PileupItf.hpp
@@ -0,0 +1,77 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_pileupitf_
+#define _hpp_ngs_adapt_pileupitf_
+
+#ifndef _hpp_ngs_adapt_refcount_
+#include <ngs/adapter/Refcount.hpp>
+#endif
+
+#ifndef _h_ngs_itf_pileupitf_
+#include <ngs/itf/PileupItf.h>
+#endif
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+    class PileupEventItf;
+
+    /*----------------------------------------------------------------------
+     * PileupItf
+     */
+    class PileupItf : public Refcount < PileupItf, NGS_Pileup_v1 >
+    {
+    public:
+
+        virtual StringItf * getReferenceSpec () const = 0;
+        virtual int64_t getReferencePosition () const = 0;
+        virtual PileupEventItf * getPileupEvents () const = 0;
+        virtual uint32_t getPileupDepth () const = 0;
+        virtual bool nextPileup () = 0;
+
+    protected:
+
+        PileupItf ();
+        static NGS_Pileup_v1_vt ivt;
+
+    private:
+
+        static NGS_String_v1 * CC get_ref_spec ( const NGS_Pileup_v1 * self, NGS_ErrBlock_v1 * err );
+        static int64_t CC get_ref_pos ( const NGS_Pileup_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_PileupEvent_v1 * CC get_pileup_events ( const NGS_Pileup_v1 * self, NGS_ErrBlock_v1 * err );
+        static uint32_t CC get_pileup_depth ( const NGS_Pileup_v1 * self, NGS_ErrBlock_v1 * err );
+        static bool CC next ( NGS_Pileup_v1 * self, NGS_ErrBlock_v1 * err );
+
+    };
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_pileupitf_
diff --git a/ngs-sdk/ngs/adapter/ReadCollectionItf.hpp b/ngs-sdk/ngs/adapter/ReadCollectionItf.hpp
new file mode 100644
index 0000000..99c709d
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/ReadCollectionItf.hpp
@@ -0,0 +1,106 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_read_collectionitf_
+#define _hpp_ngs_adapt_read_collectionitf_
+
+#ifndef _hpp_ngs_adapt_refcount_
+#include <ngs/adapter/Refcount.hpp>
+#endif
+
+#ifndef _h_ngs_itf_read_collectionitf_
+#include <ngs/itf/ReadCollectionItf.h>
+#endif
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class ReadItf;
+    class StringItf;
+    class ReadGroupItf;
+    class ReferenceItf;
+    class AlignmentItf;
+
+    /*----------------------------------------------------------------------
+     * ReadCollectionItf
+     */
+    class ReadCollectionItf : public Refcount < ReadCollectionItf, NGS_ReadCollection_v1 >
+    {
+    public:
+        
+        virtual StringItf * getName () const = 0;
+        virtual ReadGroupItf * getReadGroups () const = 0;
+        virtual ReadGroupItf * getReadGroup ( const char * spec ) const = 0;
+        virtual ReferenceItf * getReferences () const = 0;
+        virtual ReferenceItf * getReference ( const char * spec ) const = 0;
+        virtual AlignmentItf * getAlignment ( const char * alignmentId ) const = 0;
+        virtual AlignmentItf * getAlignments ( bool wants_primary, bool wants_secondary ) const = 0;
+        virtual uint64_t getAlignmentCount ( bool wants_primary, bool wants_secondary ) const = 0;
+        virtual AlignmentItf * getAlignmentRange ( uint64_t first, uint64_t count, bool wants_primary, bool wants_secondary ) const = 0;
+        virtual ReadItf * getRead ( const char * readId ) const = 0;
+        virtual ReadItf * getReads ( bool wants_full, bool wants_partial, bool wants_unaligned ) const = 0;
+        virtual uint64_t getReadCount ( bool wants_full, bool wants_partial, bool wants_unaligned ) const = 0;
+        virtual ReadItf * getReadRange ( uint64_t first, uint64_t count, bool wants_full, bool wants_partial, bool wants_unaligned ) const = 0;
+
+    protected:
+
+        ReadCollectionItf ();
+        static NGS_ReadCollection_v1_vt ivt;
+
+    private:
+
+        static NGS_String_v1 * CC get_name ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_ReadGroup_v1 * CC get_read_groups ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_ReadGroup_v1 * CC get_read_group ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+            const char * spec );
+        static NGS_Reference_v1 * CC get_references ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_Reference_v1 * CC get_reference ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+            const char * spec );
+        static NGS_Alignment_v1 * CC get_alignment ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+            const char * alignmentId );
+        static NGS_Alignment_v1 * CC get_alignments ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+            bool wants_primary, bool wants_secondary );
+        static uint64_t CC get_align_count ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+            bool wants_primary, bool wants_secondary );
+        static NGS_Alignment_v1 * CC get_align_range ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+            uint64_t first, uint64_t count, bool wants_primary, bool wants_secondary );
+        static NGS_Read_v1 * CC get_read ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+            const char * readId );
+        static NGS_Read_v1 * CC get_reads ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+            bool wants_full, bool wants_partial, bool wants_unaligned );
+        static uint64_t CC get_read_count ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+            bool wants_full, bool wants_partial, bool wants_unaligned );
+        static NGS_Read_v1 * CC get_read_range ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+            uint64_t first, uint64_t count, bool wants_full, bool wants_partial, bool wants_unaligned );
+
+    };
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_read_collectionitf_
diff --git a/ngs-sdk/ngs/adapter/ReadGroupItf.hpp b/ngs-sdk/ngs/adapter/ReadGroupItf.hpp
new file mode 100644
index 0000000..36ffb64
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/ReadGroupItf.hpp
@@ -0,0 +1,73 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_read_groupitf_
+#define _hpp_ngs_adapt_read_groupitf_
+
+#ifndef _hpp_ngs_adapt_refcount_
+#include <ngs/adapter/Refcount.hpp>
+#endif
+
+#ifndef _h_ngs_itf_read_groupitf_
+#include <ngs/itf/ReadGroupItf.h>
+#endif
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+    class StatisticsItf;
+
+    /*----------------------------------------------------------------------
+     * ReadGroupItf
+     */
+    class ReadGroupItf : public Refcount < ReadGroupItf, NGS_ReadGroup_v1 >
+    {
+    public:
+
+        virtual StringItf * getName () const = 0;
+        virtual StatisticsItf * getStatistics () const = 0;
+        virtual bool nextReadGroup () = 0;
+
+    protected:
+
+        ReadGroupItf ();
+        static NGS_ReadGroup_v1_vt ivt;
+
+    private:
+
+        static NGS_String_v1 * CC get_name ( const NGS_ReadGroup_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_Statistics_v1 * CC get_stats ( const NGS_ReadGroup_v1 * self, NGS_ErrBlock_v1 * err );
+        static bool CC next ( NGS_ReadGroup_v1 * self, NGS_ErrBlock_v1 * err );
+
+    };
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_read_groupitf_
diff --git a/ngs-sdk/ngs/adapter/ReadItf.hpp b/ngs-sdk/ngs/adapter/ReadItf.hpp
new file mode 100644
index 0000000..cad06f9
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/ReadItf.hpp
@@ -0,0 +1,95 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_readitf_
+#define _hpp_ngs_adapt_readitf_
+
+#ifndef _hpp_ngs_adapt_fragmentitf_
+#include <ngs/adapter/FragmentItf.hpp>
+#endif
+
+#ifndef _h_ngs_itf_readitf_
+#include <ngs/itf/ReadItf.h>
+#endif
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+
+    /*----------------------------------------------------------------------
+     * ReadItf
+     */
+    class ReadItf : public FragmentItf
+    {
+    public:
+
+        virtual StringItf * getReadId () const = 0;
+        virtual uint32_t getNumFragments () const = 0;
+        virtual uint32_t getReadCategory () const = 0;
+        virtual StringItf * getReadGroup () const = 0;
+        virtual StringItf * getReadName () const = 0;
+        virtual StringItf * getReadBases ( uint64_t offset, uint64_t length ) const = 0;
+        virtual StringItf * getReadQualities ( uint64_t offset, uint64_t length ) const = 0;
+        virtual bool nextRead () = 0;
+
+        inline NGS_Read_v1 * Cast ()
+        { return static_cast < NGS_Read_v1* > ( OpaqueRefcount :: offset_this () ); }
+
+        inline const NGS_Read_v1 * Cast () const
+        { return static_cast < const NGS_Read_v1* > ( OpaqueRefcount :: offset_this () ); }
+
+        // assistance for C objects
+        static inline ReadItf * Self ( NGS_Read_v1 * obj )
+        { return static_cast < ReadItf* > ( OpaqueRefcount :: offset_cobj ( obj ) ); }
+
+        static inline const ReadItf * Self ( const NGS_Read_v1 * obj )
+        { return static_cast < const ReadItf* > ( OpaqueRefcount :: offset_cobj ( obj ) ); }
+
+    protected:
+
+        ReadItf ();
+        static NGS_Read_v1_vt ivt;
+
+    private:
+
+        static NGS_String_v1 * CC get_id ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+        static uint32_t CC get_num_frags ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+        static uint32_t CC get_category ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_read_group ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_name ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_bases ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length );
+        static NGS_String_v1 * CC get_quals ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length );
+        static bool CC next ( NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+
+    };
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_readitf_
diff --git a/ngs-sdk/ngs/adapter/Refcount.hpp b/ngs-sdk/ngs/adapter/Refcount.hpp
new file mode 100644
index 0000000..fbfeb5f
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/Refcount.hpp
@@ -0,0 +1,131 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_refcount_
+#define _hpp_ngs_adapt_refcount_
+
+#ifndef _h_ngs_itf_refcount_
+#include <ngs/itf/Refcount.h>
+#endif
+
+#ifndef _h_ngs_adapt_defs_
+#include <ngs/adapter/defs.h>
+#endif
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * OpaqueRefcount
+     */
+    class OpaqueRefcount
+    {
+    public:
+
+        // interface
+        virtual void Release ();
+        virtual void * Duplicate () const;
+
+    public:
+
+        // C++ support
+        virtual ~ OpaqueRefcount ();
+
+    protected:
+
+        // not directly instantiable
+        OpaqueRefcount ( const OpaqueRefcount & obj );
+
+    protected:
+
+        // support for C vtable
+        OpaqueRefcount ( const NGS_VTable * vt );
+        static NGS_Refcount_v1_vt ivt;
+
+        inline void * offset_this ()
+        { return ( void* ) & cobj; }
+
+        inline const void * offset_this () const
+        { return ( const void* ) & cobj; }
+
+        static inline void * offset_cobj ( void * obj )
+        {
+            char * cobj = ( char* ) obj;
+            size_t offset = ( size_t ) & ( ( OpaqueRefcount* ) 8 ) -> cobj - 8;
+            return ( void * ) ( cobj - offset );
+        }
+        static inline const void * offset_cobj ( const void * obj )
+        {
+            const char * cobj = ( const char* ) obj;
+            size_t offset = ( size_t ) & ( ( OpaqueRefcount* ) 8 ) -> cobj - 8;
+            return ( const void * ) ( cobj - offset );
+        }
+
+    private:
+
+        static void CC release ( NGS_Refcount_v1 * self, NGS_ErrBlock_v1 * err );
+        static void * CC duplicate ( const NGS_Refcount_v1 * self, NGS_ErrBlock_v1 * err );
+        NGS_Refcount_v1 cobj;
+
+
+    private:
+
+        // member variables
+        mutable atomic32_t refcount;
+    };
+
+    /*----------------------------------------------------------------------
+     * Refcount
+     */
+    template < class T, class C >
+    class Refcount : protected OpaqueRefcount
+    {
+    protected:
+
+        Refcount ( const NGS_VTable * vt )
+            : OpaqueRefcount ( vt )
+        {
+        }
+
+    public:
+
+        inline C * Cast ()
+        { return static_cast < C* > ( OpaqueRefcount :: offset_this () ); }
+
+        inline const C * Cast () const
+        { return static_cast < const C* > ( OpaqueRefcount :: offset_this () ); }
+
+        // assistance for C objects
+        static inline T * Self ( C * obj )
+        { return static_cast < T* > ( OpaqueRefcount :: offset_cobj ( obj ) ); }
+
+        static inline const T * Self ( const C * obj )
+        { return static_cast < const T* > ( OpaqueRefcount :: offset_cobj ( obj ) ); }
+    };
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_refcount_
diff --git a/ngs-sdk/ngs/adapter/ReferenceItf.hpp b/ngs-sdk/ngs/adapter/ReferenceItf.hpp
new file mode 100644
index 0000000..4284abb
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/ReferenceItf.hpp
@@ -0,0 +1,99 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_referenceitf_
+#define _hpp_ngs_adapt_referenceitf_
+
+#ifndef _hpp_ngs_adapt_refcount_
+#include <ngs/adapter/Refcount.hpp>
+#endif
+
+#ifndef _h_ngs_itf_referenceitf_
+#include <ngs/itf/ReferenceItf.h>
+#endif
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+    class PileupItf;
+    class AlignmentItf;
+
+    /*----------------------------------------------------------------------
+     * Reference
+     */
+    class ReferenceItf : public Refcount < ReferenceItf, NGS_Reference_v1 >
+    {
+    public:
+
+        virtual StringItf * getCommonName () const = 0;
+        virtual StringItf * getCanonicalName () const = 0;
+        virtual bool getIsCircular () const = 0;
+        virtual uint64_t getLength () const = 0;
+        virtual StringItf * getReferenceBases ( uint64_t offset, uint64_t length ) const = 0;
+        virtual StringItf * getReferenceChunk ( uint64_t offset, uint64_t length ) const = 0;
+        virtual AlignmentItf * getAlignment ( const char * alignmentId ) const = 0;
+        virtual AlignmentItf * getAlignments ( bool wants_primary, bool wants_secondary ) const = 0;
+        virtual AlignmentItf * getAlignmentSlice ( int64_t start, uint64_t length, bool wants_primary, bool wants_secondary ) const = 0;
+        virtual PileupItf * getPileups ( bool wants_primary, bool wants_secondary ) const = 0;
+        virtual PileupItf * getPileupSlice ( int64_t start, uint64_t length, bool wants_primary, bool wants_secondary ) const = 0;
+        virtual bool nextReference () = 0;
+
+    protected:
+
+        ReferenceItf ();
+        static NGS_Reference_v1_vt ivt;
+
+    private:
+
+        static NGS_String_v1 * CC get_cmn_name ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_canon_name ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err );
+        static bool CC is_circular ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err );
+        static uint64_t CC get_length ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC get_ref_bases ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err,
+            uint64_t offset, uint64_t length );
+        static NGS_String_v1 * CC get_ref_chunk ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err,
+            uint64_t offset, uint64_t length );
+        static NGS_Alignment_v1 * CC get_alignment ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err,
+            const char * alignmentId );
+        static NGS_Alignment_v1 * CC get_alignments ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err,
+            bool wants_primary, bool wants_secondary );
+        static NGS_Alignment_v1 * CC get_align_slice ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err,
+            int64_t start, uint64_t length, bool wants_primary, bool wants_secondary );
+        static NGS_Pileup_v1 * CC get_pileups ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err,
+            bool wants_primary, bool wants_secondary );
+        static NGS_Pileup_v1 * CC get_pileup_slice ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err,
+            int64_t start, uint64_t length, bool wants_primary, bool wants_secondary );
+        static bool CC next ( NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err );
+
+    };
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_referenceitf_
diff --git a/ngs-sdk/ngs/adapter/StatisticsItf.hpp b/ngs-sdk/ngs/adapter/StatisticsItf.hpp
new file mode 100644
index 0000000..1678f7d
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/StatisticsItf.hpp
@@ -0,0 +1,78 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_statisticsitf_
+#define _hpp_ngs_adapt_statisticsitf_
+
+#ifndef _hpp_ngs_adapt_refcount_
+#include <ngs/adapter/Refcount.hpp>
+#endif
+
+#ifndef _h_ngs_itf_statisticsitf_
+#include <ngs/itf/StatisticsItf.h>
+#endif
+
+namespace ngs_adapt
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+
+    /*----------------------------------------------------------------------
+     * StatisticsItf
+     */
+    class StatisticsItf : public Refcount < StatisticsItf, NGS_Statistics_v1 >
+    {
+    public:
+
+        virtual uint32_t getValueType ( const char * path ) const = 0;
+        virtual StringItf * getAsString ( const char * path ) const = 0;
+        virtual int64_t getAsI64 ( const char * path ) const = 0;
+        virtual uint64_t getAsU64 ( const char * path ) const = 0;
+        virtual double getAsDouble ( const char * path ) const = 0;
+        virtual StringItf * nextPath ( const char * path ) const = 0;
+
+    protected:
+
+        StatisticsItf ();
+        static NGS_Statistics_v1_vt ivt;
+
+    private:
+
+        static uint32_t CC get_type ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+        static NGS_String_v1 * CC as_string ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+        static int64_t CC as_I64 ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+        static uint64_t CC as_U64 ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+        static double CC as_F64 ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+        static NGS_String_v1 * CC next_path ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+
+    };
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_statisticsitf_
diff --git a/ngs-sdk/ngs/adapter/StringItf.hpp b/ngs-sdk/ngs/adapter/StringItf.hpp
new file mode 100644
index 0000000..c7d1049
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/StringItf.hpp
@@ -0,0 +1,88 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_adapt_stringitf_
+#define _hpp_ngs_adapt_stringitf_
+
+#ifndef _hpp_ngs_adapt_refcount_
+#include <ngs/adapter/Refcount.hpp>
+#endif
+
+#ifndef _h_ngs_itf_stringitf_
+#include <ngs/itf/StringItf.h>
+#endif
+
+#include <string>
+
+namespace ngs_adapt
+{
+    /*----------------------------------------------------------------------
+     * StringItf
+     */
+    class StringItf : public Refcount < StringItf, NGS_String_v1 >
+    {
+    public:
+
+        // interface
+        virtual const char * data () const;
+        virtual size_t size () const;
+        virtual StringItf * substr ( size_t offset, size_t size ) const;
+
+    public:
+
+        // C++ support
+        StringItf ( const char * data, size_t size );
+        virtual ~ StringItf ();
+
+    private:
+
+        // ?? should these be left public ??
+        StringItf ( const StringItf & obj );
+        StringItf & operator = ( const StringItf & obj );
+
+    protected:
+
+        // support for C vtable
+        static NGS_String_v1_vt ivt;
+
+    private:
+
+        // dispatch handlers
+        static const char * CC data_dispatch ( const NGS_String_v1 * self, NGS_ErrBlock_v1 * err );
+        static size_t CC size_dispatch ( const NGS_String_v1 * self, NGS_ErrBlock_v1 * err );
+        static NGS_String_v1 * CC substr_dispatch ( const NGS_String_v1 * self, NGS_ErrBlock_v1 * err,
+                                                    size_t offset, size_t size );
+
+    protected:
+
+        // member variables
+        const char * str;
+        size_t sz;
+    };
+
+} // namespace ngs_adapt
+
+#endif // _hpp_ngs_adapt_stringitf_
diff --git a/ngs-sdk/ngs/adapter/defs.h b/ngs-sdk/ngs/adapter/defs.h
new file mode 100644
index 0000000..199532d
--- /dev/null
+++ b/ngs-sdk/ngs/adapter/defs.h
@@ -0,0 +1,64 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_adapt_defs_
+#define _h_ngs_adapt_defs_
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <assert.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * NGS_ErrBlock
+ *  see "ErrBlock.h"
+ */
+typedef struct NGS_ErrBlock_v1 NGS_ErrBlock_v1;
+
+/*--------------------------------------------------------------------------
+ * NGS_String
+ *  see "StringItf.h"
+ */
+typedef struct NGS_String_v1 NGS_String_v1;
+
+/*--------------------------------------------------------------------------
+ * atomic32_t
+ */
+typedef struct atomic32_t atomic32_t;
+struct atomic32_t
+{
+    volatile int counter;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_adapt_defs_ */
diff --git a/ngs-sdk/ngs/defs.h b/ngs-sdk/ngs/defs.h
new file mode 100644
index 0000000..5661ede
--- /dev/null
+++ b/ngs-sdk/ngs/defs.h
@@ -0,0 +1,43 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_defs_
+#define _h_ngs_defs_
+
+/*--------------------------------------------------------------------------
+ * DLL interface
+ */
+#if defined _MSC_VER
+ #if defined _LIBRARY
+  #define NGS_EXTERN   __declspec( dllexport ) 
+ #else
+  #define NGS_EXTERN   __declspec( dllimport ) 
+ #endif
+#else
+ #define NGS_EXTERN   
+#endif
+
+#endif /* _h_ngs_defs_ */
diff --git a/ngs-sdk/ngs/inl/Alignment.hpp b/ngs-sdk/ngs/inl/Alignment.hpp
new file mode 100644
index 0000000..24f7038
--- /dev/null
+++ b/ngs-sdk/ngs/inl/Alignment.hpp
@@ -0,0 +1,164 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_alignment_
+#define _inl_ngs_alignment_
+
+#ifndef _hpp_ngs_alignment_
+#include <ngs/c++/Alignment.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_alignmentitf_
+#include <ngs/itf/AlignmentItf.hpp>
+#endif
+
+namespace ngs
+{
+
+    // the "self" member is typed as FragmentRef
+    // but is used here as an AlignmentRef
+#define self reinterpret_cast < const AlignmentItf * > ( self )
+
+    /*----------------------------------------------------------------------
+     * Alignment
+     *  inline dispatch
+     */
+
+    inline
+    StringRef Alignment :: getAlignmentId () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getAlignmentId () ); }
+
+    inline
+    String Alignment :: getReferenceSpec () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReferenceSpec () ) . toString (); }
+
+    inline
+    int Alignment :: getMappingQuality () const
+        throw ( ErrorMsg )
+    { return self -> getMappingQuality (); }
+
+    inline
+    StringRef Alignment :: getReferenceBases () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReferenceBases () ); }
+
+    inline
+    String Alignment :: getReadGroup () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReadGroup () ) . toString (); }
+
+    inline
+    StringRef Alignment :: getReadId () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReadId () ); }
+
+    inline
+    StringRef Alignment :: getClippedFragmentBases () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getClippedFragmentBases () ); }
+
+    inline
+    StringRef Alignment :: getClippedFragmentQualities () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getClippedFragmentQualities () ); }
+
+    inline
+    StringRef Alignment :: getAlignedFragmentBases () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getAlignedFragmentBases () ); }
+
+    inline
+    Alignment :: AlignmentCategory Alignment :: getAlignmentCategory () const
+        throw ( ErrorMsg )
+    { return ( Alignment :: AlignmentCategory ) self -> getAlignmentCategory (); }
+
+    inline
+    int64_t Alignment :: getAlignmentPosition () const
+        throw ( ErrorMsg )
+    { return self -> getAlignmentPosition (); }
+
+    inline
+    uint64_t Alignment :: getAlignmentLength () const
+        throw ( ErrorMsg )
+    { return self -> getAlignmentLength (); }
+
+    inline
+    bool Alignment :: getIsReversedOrientation () const
+        throw ( ErrorMsg )
+    { return self -> getIsReversedOrientation (); }
+
+    inline
+    int Alignment :: getSoftClip ( ClipEdge edge ) const
+        throw ( ErrorMsg )
+    { return self -> getSoftClip ( edge ); }
+
+    inline
+    uint64_t Alignment :: getTemplateLength () const
+        throw ( ErrorMsg )
+    { return self -> getTemplateLength (); }
+
+    inline
+    StringRef Alignment :: getShortCigar ( bool clipped ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getShortCigar ( clipped ) ); }
+
+    inline
+    StringRef Alignment :: getLongCigar ( bool clipped ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getLongCigar ( clipped ) ); }
+
+    inline
+    bool Alignment :: hasMate () const
+        throw ()
+    { return self -> hasMate (); }
+
+    inline
+    StringRef Alignment :: getMateAlignmentId () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getMateAlignmentId () ); }
+
+    inline
+    Alignment Alignment :: getMateAlignment () const
+        throw ( ErrorMsg )
+    { return Alignment ( ( AlignmentRef ) self -> getMateAlignment () ); }
+
+    inline
+    String Alignment :: getMateReferenceSpec () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getMateReferenceSpec () ) . toString (); }
+
+    inline
+    bool Alignment :: getMateIsReversedOrientation () const
+        throw ( ErrorMsg )
+    { return self -> getMateIsReversedOrientation (); }
+
+#undef self
+
+} // namespace ngs
+
+#endif // _inl_ngs_alignment_
diff --git a/ngs-sdk/ngs/inl/AlignmentIterator.hpp b/ngs-sdk/ngs/inl/AlignmentIterator.hpp
new file mode 100644
index 0000000..9b4c5ea
--- /dev/null
+++ b/ngs-sdk/ngs/inl/AlignmentIterator.hpp
@@ -0,0 +1,59 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_alignment_iterator_
+#define _inl_ngs_alignment_iterator_
+
+#ifndef _inl_ngs_alignment_
+#include <ngs/c++/AlignmentIterator.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_alignmentitf_
+#include <ngs/itf/AlignmentItf.hpp>
+#endif
+
+namespace ngs
+{
+    // the "self" member is typed as FragmentRef
+    // but is used here as an AlignmentRef
+#define self reinterpret_cast < AlignmentItf * > ( self )
+
+
+    /*----------------------------------------------------------------------
+     * AlignmentIterator
+     *  iterates across a list of Alignments
+     */
+
+    inline
+    bool AlignmentIterator :: nextAlignment ()
+        throw ( ErrorMsg )
+    { return self -> nextAlignment (); }
+
+#undef self
+
+}
+
+#endif // _inl_ngs_alignment_iterator_
diff --git a/ngs-sdk/ngs/inl/Fragment.hpp b/ngs-sdk/ngs/inl/Fragment.hpp
new file mode 100644
index 0000000..58069ff
--- /dev/null
+++ b/ngs-sdk/ngs/inl/Fragment.hpp
@@ -0,0 +1,84 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_fragment_
+#define _inl_ngs_fragment_
+
+#ifndef _hpp_ngs_fragment_
+#include <ngs/c++/Fragment.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_fragmentitf_
+#include <ngs/itf/FragmentItf.hpp>
+#endif
+
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * Fragment
+     */
+
+    inline
+    StringRef Fragment :: getFragmentId () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getFragmentId () ); }
+
+    inline
+    StringRef Fragment :: getFragmentBases () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getFragmentBases () ); }
+
+    inline
+    StringRef Fragment :: getFragmentBases ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getFragmentBases ( offset ) ); }
+
+    inline
+    StringRef Fragment :: getFragmentBases ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getFragmentBases ( offset, length ) ); }
+
+    inline
+    StringRef Fragment :: getFragmentQualities () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getFragmentQualities () ); }
+
+    inline
+    StringRef Fragment :: getFragmentQualities ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getFragmentQualities ( offset ) ); }
+
+    inline
+    StringRef Fragment :: getFragmentQualities ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getFragmentQualities ( offset, length ) ); }
+
+
+} // namespace ngs
+
+#endif // _inl_ngs_fragment_
diff --git a/ngs-sdk/ngs/inl/FragmentIterator.hpp b/ngs-sdk/ngs/inl/FragmentIterator.hpp
new file mode 100644
index 0000000..7e1e9b2
--- /dev/null
+++ b/ngs-sdk/ngs/inl/FragmentIterator.hpp
@@ -0,0 +1,54 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_fragment_iterator_
+#define _inl_ngs_fragment_iterator_
+
+#ifndef _hpp_ngs_fragment_iterator_
+#include <ngs/c++/FragmentIterator.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_fragmentitf_
+#include <ngs/itf/FragmentItf.hpp>
+#endif
+
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * FragmentIterator
+     */
+
+    inline
+    bool FragmentIterator :: nextFragment ()
+        throw ( ErrorMsg )
+    { return self -> nextFragment (); }
+
+
+} // namespace ngs
+
+#endif // _inl_ngs_fragment_iterator_
diff --git a/ngs-sdk/ngs/inl/Pileup.hpp b/ngs-sdk/ngs/inl/Pileup.hpp
new file mode 100644
index 0000000..f9ffb71
--- /dev/null
+++ b/ngs-sdk/ngs/inl/Pileup.hpp
@@ -0,0 +1,68 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_pileup_
+#define _inl_ngs_pileup_
+
+#ifndef _hpp_ngs_pileup_
+#include <ngs/Pileup.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_pileupitf_
+#include <ngs/itf/PileupItf.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * Pileup
+     */
+
+    inline
+    String Pileup :: getReferenceSpec () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReferenceSpec () ) . toString (); }
+
+    inline
+    int64_t Pileup :: getReferencePosition () const
+        throw ( ErrorMsg )
+    { return self -> getReferencePosition (); }
+
+    inline
+    PileupEventIterator Pileup :: getPileupEvents () const
+        throw ( ErrorMsg )
+    { return PileupEventIterator ( self -> getPileupEvents () ); }
+
+    inline
+    uint32_t Pileup :: getPileupDepth () const
+        throw ( ErrorMsg )
+    { return self -> getPileupDepth (); }
+
+
+} // namespace ngs
+
+#endif // _inl_ngs_pileup_
diff --git a/ngs-sdk/ngs/inl/PileupEvent.hpp b/ngs-sdk/ngs/inl/PileupEvent.hpp
new file mode 100644
index 0000000..8fcc04f
--- /dev/null
+++ b/ngs-sdk/ngs/inl/PileupEvent.hpp
@@ -0,0 +1,118 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_pileup_event_
+#define _inl_ngs_pileup_event_
+
+#ifndef _hpp_ngs_pileup_event_
+#include <ngs/c++/PileupEvent.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_pileup_eventitf_
+#include <ngs/itf/PileupEventItf.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * PileupEvent
+     */
+
+    inline
+    String PileupEvent :: getReferenceSpec () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReferenceSpec () ) . toString (); }
+
+    inline
+    int64_t PileupEvent :: getReferencePosition () const
+        throw ( ErrorMsg )
+    { return self -> getReferencePosition (); }
+
+    inline
+    int PileupEvent :: getMappingQuality () const
+        throw ( ErrorMsg )
+    { return self -> getMappingQuality (); }
+
+    inline
+    StringRef PileupEvent :: getAlignmentId () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getAlignmentId () ); }
+
+    inline
+    Alignment PileupEvent :: getAlignment () const
+        throw ( ErrorMsg )
+    { return Alignment ( ( AlignmentRef ) self -> getAlignment () ); }
+
+    inline
+    int64_t PileupEvent :: getAlignmentPosition () const
+        throw ( ErrorMsg )
+    { return self -> getAlignmentPosition (); }
+
+    inline
+    int64_t PileupEvent :: getFirstAlignmentPosition () const
+        throw ( ErrorMsg )
+    { return self -> getFirstAlignmentPosition (); }
+
+    inline
+    int64_t PileupEvent :: getLastAlignmentPosition () const
+        throw ( ErrorMsg )
+    { return self -> getLastAlignmentPosition (); }
+
+    inline
+    PileupEvent :: PileupEventType PileupEvent :: getEventType () const
+        throw ( ErrorMsg )
+    { return ( PileupEvent :: PileupEventType ) self -> getEventType (); }
+
+    inline
+    char PileupEvent :: getAlignmentBase () const
+        throw ( ErrorMsg )
+    { return self -> getAlignmentBase (); }
+
+    inline
+    char PileupEvent :: getAlignmentQuality () const
+        throw ( ErrorMsg )
+    { return self -> getAlignmentQuality (); }
+
+    inline
+    StringRef PileupEvent :: getInsertionBases () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getInsertionBases () ); }
+
+    inline
+    StringRef PileupEvent :: getInsertionQualities () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getInsertionQualities () ); }
+
+    inline
+    uint32_t PileupEvent :: getDeletionCount () const
+        throw ( ErrorMsg )
+    { return self -> getDeletionCount (); }
+
+
+} // namespace ngs
+
+#endif // _inl_ngs_pileup_event_
diff --git a/ngs-sdk/ngs/inl/PileupEventIterator.hpp b/ngs-sdk/ngs/inl/PileupEventIterator.hpp
new file mode 100644
index 0000000..9a7b5a1
--- /dev/null
+++ b/ngs-sdk/ngs/inl/PileupEventIterator.hpp
@@ -0,0 +1,52 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_pileup_event_iterator_
+#define _inl_ngs_pileup_event_iterator_
+
+#ifndef _hpp_ngs_pileup_event_iterator_
+#include <ngs/c++/PileupEventIterator.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_pileup_eventitf_
+#include <ngs/itf/PileupEventItf.hpp>
+#endif
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * PileupEventIterator
+     */
+
+    inline
+    bool PileupEventIterator :: nextPileupEvent ()
+        throw ( ErrorMsg )
+    { return self -> nextPileupEvent (); }
+
+
+} // namespace ngs
+
+#endif // _inl_ngs_pileup_event_iterator_
diff --git a/ngs-sdk/ngs/inl/PileupIterator.hpp b/ngs-sdk/ngs/inl/PileupIterator.hpp
new file mode 100644
index 0000000..3258e10
--- /dev/null
+++ b/ngs-sdk/ngs/inl/PileupIterator.hpp
@@ -0,0 +1,52 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_pileup_iterator_
+#define _inl_ngs_pileup_iterator_
+
+#ifndef _hpp_ngs_pileup_iterator_
+#include <ngs/c++/PileupIterator.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_pileupitf_
+#include <ngs/itf/PileupItf.hpp>
+#endif
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * PileupIterator
+     */
+
+    inline
+    bool PileupIterator :: nextPileup ()
+        throw ( ErrorMsg )
+    { return self -> nextPileup (); }
+
+
+} // namespace ngs
+
+#endif // _inl_ngs_pileup_iterator_
diff --git a/ngs-sdk/ngs/inl/Read.hpp b/ngs-sdk/ngs/inl/Read.hpp
new file mode 100644
index 0000000..86c1d2f
--- /dev/null
+++ b/ngs-sdk/ngs/inl/Read.hpp
@@ -0,0 +1,108 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_read_
+#define _inl_ngs_read_
+
+#ifndef _hpp_ngs_read_
+#include <ngs/Read.hpp>
+#endif
+
+#include <ngs/itf/ReadItf.hpp>
+
+namespace ngs
+{
+
+    // the "self" member is typed as FragmentRef
+    // but is used here as an ReadRef
+#define self reinterpret_cast < const ReadItf * > ( self )
+
+    /*----------------------------------------------------------------------
+     * Read
+     *  represents an NGS machine read
+     *  having some number of biological Fragments
+     */
+
+    inline
+    StringRef Read :: getReadId () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReadId () ); }
+
+    inline
+    uint32_t Read :: getNumFragments () const
+        throw ( ErrorMsg )
+    { return self -> getNumFragments (); }
+
+    inline
+    Read :: ReadCategory Read :: getReadCategory () const
+        throw ( ErrorMsg )
+    { return ( Read :: ReadCategory ) self -> getReadCategory (); }
+
+    inline
+    String Read :: getReadGroup () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReadGroup () ) . toString (); }
+
+    inline
+    StringRef Read :: getReadName () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReadName () ); }
+
+    inline
+    StringRef Read :: getReadBases () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReadBases () ); }
+
+    inline
+    StringRef Read :: getReadBases ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReadBases ( offset ) ); }
+
+    inline
+    StringRef Read :: getReadBases ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReadBases ( offset, length ) ); }
+
+    inline
+    StringRef Read :: getReadQualities () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReadQualities () ); }
+
+    inline
+    StringRef Read :: getReadQualities ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReadQualities ( offset ) ); }
+
+    inline
+    StringRef Read :: getReadQualities ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReadQualities ( offset, length ) ); }
+
+#undef self
+
+} // namespace ngs
+
+#endif // _inl_ngs_read_
diff --git a/ngs-sdk/ngs/inl/ReadCollection.hpp b/ngs-sdk/ngs/inl/ReadCollection.hpp
new file mode 100644
index 0000000..9b583a8
--- /dev/null
+++ b/ngs-sdk/ngs/inl/ReadCollection.hpp
@@ -0,0 +1,132 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_collection_
+#define _hpp_ngs_itf_collection_
+
+#ifndef _hpp_ngs_itf_collection_
+#include <ngs/ReadCollection.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_read_collectionitf_
+#include <ngs/itf/ReadCollectionItf.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * ReadCollection
+     */
+
+	inline
+    String ReadCollection :: getName () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getName () ) . toString (); }
+
+	inline
+    ReadGroupIterator ReadCollection :: getReadGroups () const
+        throw ( ErrorMsg )
+    { return ReadGroupIterator ( self -> getReadGroups () ); }
+
+	inline
+    ReadGroup ReadCollection :: getReadGroup ( const String & spec ) const
+        throw ( ErrorMsg )
+    { return ReadGroup ( self -> getReadGroup ( spec . c_str () ) ); }
+
+	inline
+    ReferenceIterator ReadCollection :: getReferences () const
+        throw ( ErrorMsg )
+    { return ReferenceIterator ( self -> getReferences () ); }
+
+	inline
+    Reference ReadCollection :: getReference ( const String & spec ) const
+        throw ( ErrorMsg )
+    { return Reference ( self -> getReference ( spec . c_str () ) ); }
+
+	inline
+    Alignment ReadCollection :: getAlignment ( const String & alignmentId ) const
+        throw ( ErrorMsg )
+    { return Alignment ( ( AlignmentRef ) self -> getAlignment ( alignmentId . c_str () ) ); }
+
+	inline
+    AlignmentIterator ReadCollection :: getAlignments ( Alignment :: AlignmentCategory categories ) const
+        throw ( ErrorMsg )
+    { return AlignmentIterator ( ( AlignmentRef ) self -> getAlignments ( ( uint32_t ) categories ) ); }
+
+	inline
+    uint64_t ReadCollection :: getAlignmentCount () const
+        throw ( ErrorMsg )
+    { return self -> getAlignmentCount ( ( uint32_t ) Alignment :: all ); }
+
+	inline
+    uint64_t ReadCollection :: getAlignmentCount ( Alignment :: AlignmentCategory categories ) const
+        throw ( ErrorMsg )
+    { return self -> getAlignmentCount ( ( uint32_t ) categories ); }
+
+	inline
+    AlignmentIterator ReadCollection :: getAlignmentRange ( uint64_t first, uint64_t count ) const
+        throw ( ErrorMsg )
+    { return AlignmentIterator ( ( AlignmentRef ) self -> getAlignmentRange ( first, count, ( uint32_t ) Alignment :: all ) ); }
+
+	inline
+    AlignmentIterator ReadCollection :: getAlignmentRange ( uint64_t first, uint64_t count, Alignment :: AlignmentCategory categories ) const
+        throw ( ErrorMsg )
+    { return AlignmentIterator ( ( AlignmentRef ) self -> getAlignmentRange ( first, count, ( uint32_t ) categories ) ); }
+
+	inline
+    Read ReadCollection :: getRead ( const String & readId ) const
+        throw ( ErrorMsg )
+    { return Read ( ( ReadRef ) self -> getRead ( readId . c_str () ) ); }
+
+	inline
+    ReadIterator ReadCollection :: getReads ( Read :: ReadCategory categories ) const
+        throw ( ErrorMsg )
+    { return ReadIterator ( ( ReadRef ) self -> getReads ( ( uint32_t ) categories ) ); }
+
+	inline
+    uint64_t ReadCollection :: getReadCount () const
+        throw ( ErrorMsg )
+    { return self -> getReadCount ( ( uint32_t ) Read :: all ); }
+
+	inline
+    uint64_t ReadCollection :: getReadCount ( Read :: ReadCategory categories ) const
+        throw ( ErrorMsg )
+    { return self -> getReadCount ( ( uint32_t ) categories ); }
+
+	inline
+    ReadIterator ReadCollection :: getReadRange ( uint64_t first, uint64_t count ) const
+        throw ( ErrorMsg )
+    { return ReadIterator ( ( ReadRef ) self -> getReadRange ( first, count ) ); }
+
+	inline
+    ReadIterator ReadCollection :: getReadRange ( uint64_t first, uint64_t count, Read :: ReadCategory categories ) const
+        throw ( ErrorMsg )
+    { return ReadIterator ( ( ReadRef ) self -> getReadRange ( first, count, ( uint32_t ) categories ) ); }
+    
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_collection_
diff --git a/ngs-sdk/ngs/inl/ReadGroup.hpp b/ngs-sdk/ngs/inl/ReadGroup.hpp
new file mode 100644
index 0000000..eabb86c
--- /dev/null
+++ b/ngs-sdk/ngs/inl/ReadGroup.hpp
@@ -0,0 +1,57 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_itf_group_
+#define _inl_ngs_itf_group_
+
+#ifndef _hpp_ngs_itf_group_
+#include <ngs/ReadGroup.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_read_groupitf_
+#include <ngs/itf/ReadGroupItf.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * ReadGroup
+     */
+
+    inline
+    String ReadGroup :: getName () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getName () ) . toString (); }
+
+    inline
+    Statistics ReadGroup :: getStatistics () const 
+        throw ( ErrorMsg )
+    { return Statistics ( self -> getStatistics () ); }
+
+} // namespace ngs
+
+#endif // _inl_ngs_itf_group_
diff --git a/ngs-sdk/ngs/inl/ReadGroupIterator.hpp b/ngs-sdk/ngs/inl/ReadGroupIterator.hpp
new file mode 100644
index 0000000..4a7a9b4
--- /dev/null
+++ b/ngs-sdk/ngs/inl/ReadGroupIterator.hpp
@@ -0,0 +1,52 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_itf_group_iterator_
+#define _inl_ngs_itf_group_iterator_
+
+#ifndef _hpp_ngs_itf_group_iterator_
+#include <ngs/ReadGroupIterator.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_read_groupitf_
+#include <ngs/itf/ReadGroupItf.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * ReadGroup
+     */
+
+    inline
+    bool ReadGroupIterator :: nextReadGroup ()
+        throw ( ErrorMsg )
+    { return self -> nextReadGroup (); }
+
+} // namespace ngs
+
+#endif // _inl_ngs_itf_group_iterator_
diff --git a/ngs-sdk/ngs/inl/ReadIterator.hpp b/ngs-sdk/ngs/inl/ReadIterator.hpp
new file mode 100644
index 0000000..e980d3a
--- /dev/null
+++ b/ngs-sdk/ngs/inl/ReadIterator.hpp
@@ -0,0 +1,55 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_read_iterator_
+#define _inl_ngs_read_iterator_
+
+#ifndef _hpp_ngs_read_iterator_
+#include <ngs/c++/ReadIterator.hpp>
+#endif
+
+namespace ngs
+{
+
+    // the "self" member is typed as FragmentRef
+    // but is used here as an ReadRef
+#define self reinterpret_cast < ReadItf * > ( self )
+
+    /*----------------------------------------------------------------------
+     * ReadIterator
+     */
+
+    inline
+    bool ReadIterator :: nextRead ()
+        throw ( ErrorMsg )
+    { return self -> nextRead (); }
+
+
+#undef self
+
+} // namespace ngs
+
+#endif // _inl_ngs_read_iterator_
diff --git a/ngs-sdk/ngs/inl/Reference.hpp b/ngs-sdk/ngs/inl/Reference.hpp
new file mode 100644
index 0000000..05228c7
--- /dev/null
+++ b/ngs-sdk/ngs/inl/Reference.hpp
@@ -0,0 +1,122 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_reference_
+#define _inl_ngs_reference_
+
+#ifndef _hpp_ngs_reference_
+#include <ngs/Reference.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_referenceitf_
+#include <ngs/itf/ReferenceItf.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * Reference
+     */
+
+    inline
+    String Reference :: getCommonName () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getCommonName () ) . toString (); }
+
+    inline
+    String Reference :: getCanonicalName () const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getCanonicalName () ) . toString (); }
+
+    inline
+    bool Reference :: getIsCircular () const
+        throw ( ErrorMsg )
+    { return self -> getIsCircular (); }
+
+    inline
+    uint64_t Reference :: getLength () const
+        throw ( ErrorMsg )
+    { return self -> getLength (); }
+
+    inline
+    String Reference :: getReferenceBases ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReferenceBases ( offset ) ) . toString (); }
+
+    inline
+    String Reference :: getReferenceBases ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReferenceBases ( offset, length ) ) . toString (); }
+
+    inline
+    StringRef Reference :: getReferenceChunk ( uint64_t offset ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReferenceChunk ( offset ) ); }
+
+    inline
+    StringRef Reference :: getReferenceChunk ( uint64_t offset, uint64_t length ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getReferenceChunk ( offset, length ) ); }
+
+    inline
+    Alignment Reference :: getAlignment ( const String & alignmentId ) const
+        throw ( ErrorMsg )
+    { return Alignment ( ( AlignmentRef ) self -> getAlignment ( alignmentId . c_str () ) ); }
+
+    inline
+    AlignmentIterator Reference :: getAlignments ( Alignment :: AlignmentCategory categories ) const
+        throw ( ErrorMsg )
+    { return AlignmentIterator ( ( AlignmentRef ) self -> getAlignments ( ( uint32_t ) categories ) ); }
+
+    inline
+    AlignmentIterator Reference :: getAlignmentSlice ( int64_t start, uint64_t length ) const
+        throw ( ErrorMsg )
+    { return AlignmentIterator ( ( AlignmentRef ) self -> getAlignmentSlice ( start, length ) ); }
+
+    inline
+    AlignmentIterator Reference :: getAlignmentSlice ( int64_t start, uint64_t length, Alignment :: AlignmentCategory categories ) const
+        throw ( ErrorMsg )
+    { return AlignmentIterator ( ( AlignmentRef ) self -> getAlignmentSlice ( start, length, ( uint32_t ) categories ) ); }
+
+    inline
+    PileupIterator Reference :: getPileups ( Alignment :: AlignmentCategory categories ) const
+        throw ( ErrorMsg )
+    { return PileupIterator ( self -> getPileups ( ( uint32_t ) categories ) ); }
+    
+    inline
+    PileupIterator Reference :: getPileupSlice ( int64_t start, uint64_t length ) const
+        throw ( ErrorMsg )
+    { return PileupIterator ( self -> getPileupSlice ( start, length ) ); }
+
+    inline
+    PileupIterator Reference :: getPileupSlice ( int64_t start, uint64_t length, Alignment :: AlignmentCategory categories ) const
+        throw ( ErrorMsg )
+    { return PileupIterator ( self -> getPileupSlice ( start, length, ( uint32_t ) categories ) ); }
+
+} // namespace ngs
+
+#endif // _inl_ngs_reference_
diff --git a/ngs-sdk/ngs/inl/ReferenceIterator.hpp b/ngs-sdk/ngs/inl/ReferenceIterator.hpp
new file mode 100644
index 0000000..af4db16
--- /dev/null
+++ b/ngs-sdk/ngs/inl/ReferenceIterator.hpp
@@ -0,0 +1,53 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_reference_iterator_
+#define _inl_ngs_reference_iterator_
+
+#ifndef _hpp_ngs_reference_iterator_
+#include <ngs/c++/ReferenceIterator.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_referenceitf_
+#include <ngs/itf/ReferenceItf.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * ReferenceIterator
+     */
+
+    inline
+    bool ReferenceIterator :: nextReference ()
+        throw ( ErrorMsg )
+    { return self -> nextReference (); }
+
+
+} // namespace ngs
+
+#endif // _inl_ngs_reference_iterator_
diff --git a/ngs-sdk/ngs/inl/Statistics.hpp b/ngs-sdk/ngs/inl/Statistics.hpp
new file mode 100644
index 0000000..c34a416
--- /dev/null
+++ b/ngs-sdk/ngs/inl/Statistics.hpp
@@ -0,0 +1,77 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_statistics_
+#define _inl_ngs_statistics_
+
+#ifndef _hpp_ngs_statistics_
+#include <ngs/Statistics.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_statisticsitf_
+#include <ngs/itf/StatisticsItf.hpp>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * Statistics
+     */
+
+    inline
+    Statistics :: ValueType Statistics :: getValueType ( const String & path ) const
+        throw ()
+    { return ( Statistics :: ValueType ) self -> getValueType ( path . c_str () ); }
+
+    inline
+    String Statistics :: getAsString ( const String & path ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> getAsString ( path . c_str () ) ) . toString (); }
+
+    inline
+    int64_t Statistics :: getAsI64 ( const String & path ) const
+        throw ( ErrorMsg )
+    { return self -> getAsI64 ( path . c_str () ); }
+
+    inline
+    uint64_t Statistics :: getAsU64 ( const String & path ) const
+        throw ( ErrorMsg )
+    { return self -> getAsU64 ( path . c_str () ); }
+
+    inline
+    double Statistics :: getAsDouble ( const String & path ) const
+        throw ( ErrorMsg )
+    { return self -> getAsDouble ( path . c_str () ); }
+
+    inline
+    String Statistics :: nextPath ( const String & path ) const
+        throw ()
+    { return StringRef ( self -> nextPath ( path . c_str () ) ) . toString (); }
+
+} // namespace ngs
+
+#endif // _inl_ngs_statistics_
diff --git a/ngs-sdk/ngs/inl/StringRef.hpp b/ngs-sdk/ngs/inl/StringRef.hpp
new file mode 100644
index 0000000..97927a6
--- /dev/null
+++ b/ngs-sdk/ngs/inl/StringRef.hpp
@@ -0,0 +1,68 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _inl_ngs_stringref_
+#define _inl_ngs_stringref_
+
+#ifndef _hpp_ngs_stringref_
+#include <ngs/c++/StringRef.hpp>
+#endif
+
+#ifndef _hpp_ngs_itf_stringitf_
+#include <ngs/itf/StringItf.hpp>
+#endif
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * StringRef
+     *  inline dispatch
+     */
+
+    inline
+    const char * StringRef :: data () const
+        throw ()
+    { return self -> data (); }
+
+    inline
+    size_t StringRef :: size () const
+        throw ()
+    { return self -> size (); }
+
+    inline
+    StringRef StringRef :: substr ( size_t offset ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> substr ( offset ) ); }
+
+    inline
+    StringRef StringRef :: substr ( size_t offset, size_t size ) const
+        throw ( ErrorMsg )
+    { return StringRef ( self -> substr ( offset, size ) ); }
+
+
+} // namespace ngs
+
+#endif // _inl_ngs_stringref_
diff --git a/ngs-sdk/ngs/itf/AlignmentItf.h b/ngs-sdk/ngs/itf/AlignmentItf.h
new file mode 100644
index 0000000..6697452
--- /dev/null
+++ b/ngs-sdk/ngs/itf/AlignmentItf.h
@@ -0,0 +1,82 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_alignmentitf_
+#define _h_ngs_itf_alignmentitf_
+
+#ifndef _h_ngs_itf_vtable_
+#include <ngs/itf/VTable.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * NGS_Alignment_v1
+ */
+typedef struct NGS_Alignment_v1 NGS_Alignment_v1;
+struct NGS_Alignment_v1
+{
+    const NGS_VTable * vt;
+};
+
+typedef struct NGS_Alignment_v1_vt NGS_Alignment_v1_vt;
+struct NGS_Alignment_v1_vt
+{
+    NGS_VTable dad;
+
+    NGS_String_v1 * ( CC * get_id ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_ref_spec ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    int32_t ( CC * get_map_qual ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_ref_bases ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_read_group ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_read_id ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_clipped_frag_bases ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_clipped_frag_quals ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_aligned_frag_bases ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    bool ( CC * is_primary ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    int64_t ( CC * get_align_pos ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    uint64_t ( CC * get_align_length ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    bool ( CC * get_is_reversed ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    int32_t ( CC * get_soft_clip ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err, uint32_t edge );
+    uint64_t ( CC * get_template_len ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_short_cigar ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err, bool clipped );
+    NGS_String_v1 * ( CC * get_long_cigar ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err, bool clipped );
+    bool ( CC * has_mate ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_mate_id ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_Alignment_v1 * ( CC * get_mate_alignment ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_mate_ref_spec ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    bool ( CC * get_mate_is_reversed ) ( const NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+    bool ( CC * next ) ( NGS_Alignment_v1 * self, NGS_ErrBlock_v1 * err );
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_alignmentitf_ */
diff --git a/ngs-sdk/ngs/itf/AlignmentItf.hpp b/ngs-sdk/ngs/itf/AlignmentItf.hpp
new file mode 100644
index 0000000..688cabe
--- /dev/null
+++ b/ngs-sdk/ngs/itf/AlignmentItf.hpp
@@ -0,0 +1,101 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_alignment_
+#define _hpp_ngs_itf_alignment_
+
+#ifndef _hpp_ngs_itf_refcount
+#include <ngs/itf/Refcount.hpp>
+#endif
+
+struct NGS_Alignment_v1;
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+
+    /*----------------------------------------------------------------------
+     * AlignmentItf
+     */
+    class NGS_ITF_EXTERN  AlignmentItf : public Refcount < AlignmentItf, NGS_Alignment_v1 >
+    {
+    public:
+
+        StringItf * getAlignmentId () const
+            throw ( ErrorMsg );
+        StringItf * getReferenceSpec () const
+            throw ( ErrorMsg );
+        int32_t getMappingQuality () const
+            throw ( ErrorMsg );
+        StringItf * getReferenceBases () const
+            throw ( ErrorMsg );
+        StringItf * getReadGroup () const
+            throw ( ErrorMsg );
+        StringItf * getReadId () const
+            throw ( ErrorMsg );
+        StringItf * getClippedFragmentBases () const
+            throw ( ErrorMsg );
+        StringItf * getClippedFragmentQualities () const
+            throw ( ErrorMsg );
+        StringItf * getAlignedFragmentBases () const
+            throw ( ErrorMsg );
+        uint32_t getAlignmentCategory () const
+            throw ( ErrorMsg );
+        int64_t getAlignmentPosition () const
+            throw ( ErrorMsg );
+        uint64_t getAlignmentLength () const
+            throw ( ErrorMsg );
+        bool getIsReversedOrientation () const
+            throw ( ErrorMsg );
+        int32_t getSoftClip ( uint32_t edge ) const
+            throw ( ErrorMsg );
+        uint64_t getTemplateLength () const
+            throw ( ErrorMsg );
+        StringItf * getShortCigar ( bool clipped ) const
+            throw ( ErrorMsg );
+        StringItf * getLongCigar ( bool clipped ) const
+            throw ( ErrorMsg );
+        bool hasMate () const
+            throw ();
+        StringItf * getMateAlignmentId () const
+            throw ( ErrorMsg );
+        AlignmentItf * getMateAlignment () const
+            throw ( ErrorMsg );
+        StringItf * getMateReferenceSpec () const
+            throw ( ErrorMsg );
+        bool getMateIsReversedOrientation () const
+            throw ( ErrorMsg );
+        bool nextAlignment ()
+            throw ( ErrorMsg );
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_alignment_
diff --git a/ngs-sdk/ngs/itf/ErrBlock.h b/ngs-sdk/ngs/itf/ErrBlock.h
new file mode 100644
index 0000000..d4c34c5
--- /dev/null
+++ b/ngs-sdk/ngs/itf/ErrBlock.h
@@ -0,0 +1,60 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_err_block_
+#define _h_ngs_itf_err_block_
+
+#ifndef _h_ngs_itf_defs_
+#include <ngs/itf/defs.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * NGS_ErrBlock
+ *  holds a message describing what happened
+ */
+struct NGS_ErrBlock_v1
+{
+    uint32_t xtype;
+    char msg [ 4096 ];
+};
+
+enum
+{
+    xt_okay,
+    xt_error_msg,
+    xt_runtime
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_err_block_ */
diff --git a/ngs-sdk/ngs/itf/ErrBlock.hpp b/ngs-sdk/ngs/itf/ErrBlock.hpp
new file mode 100644
index 0000000..ac887c9
--- /dev/null
+++ b/ngs-sdk/ngs/itf/ErrBlock.hpp
@@ -0,0 +1,67 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_err_block_
+#define _hpp_ngs_itf_err_block_
+
+#ifndef _hp_ngs_itf_error_msg_
+#include <ngs/itf/ErrorMsg.hpp>
+#endif
+
+#ifndef _h_ngs_itf_err_block_
+#include <ngs/itf/ErrBlock.h>
+#endif
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * ErrBlock
+     *  holds a message describing what happened
+     */
+    struct NGS_ITF_EXTERN  ErrBlock : public :: NGS_ErrBlock_v1
+    {
+        void Throw () const
+            throw ( ErrorMsg );
+
+        inline
+        void Check () const
+            throw ( ErrorMsg )
+        {
+            if ( xtype != xt_okay )
+                Throw ();
+        }
+
+        ErrBlock ()
+        {
+            xtype = xt_okay;
+            msg [ 0 ] = 0;
+        }
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_err_block_
diff --git a/ngs-sdk/ngs/itf/ErrorMsg.hpp b/ngs-sdk/ngs/itf/ErrorMsg.hpp
new file mode 100644
index 0000000..43aeea6
--- /dev/null
+++ b/ngs-sdk/ngs/itf/ErrorMsg.hpp
@@ -0,0 +1,94 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_error_msg_
+#define _hpp_ngs_itf_error_msg_
+
+#ifndef _h_ngs_itf_defs_
+#include <ngs/itf/defs.h>
+#endif
+
+#include <exception>
+#include <string>
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * ErrorMsg
+     *  a generic NGS error class
+     *  holds a message describing what happened
+     */
+    class NGS_ITF_EXTERN  ErrorMsg : public :: std :: exception
+    {
+    public:
+
+        /* what ( for C++ )
+         *  what went wrong
+         */
+        const char * what () const
+            throw ();
+
+        /* toMessage ( for Java )
+         *  returns the detailed message
+         */
+        const :: std :: string & toMessage () const
+            throw ();
+
+        /* toString ( for Java )
+         *  returns a short description
+         */
+        const :: std :: string & toString () const
+            throw ();
+
+        /* constructors
+         *  various means of constructing
+         */        
+        ErrorMsg ()
+            throw ();
+        ErrorMsg ( const :: std :: string & message )
+            throw ();
+
+    public:
+
+        // C++ support
+
+        ErrorMsg ( const ErrorMsg & obj )
+            throw ();
+        ErrorMsg & operator = ( const ErrorMsg & obj )
+            throw ();
+
+        virtual ~ ErrorMsg ()
+            throw ();
+
+    private:
+
+        :: std :: string msg;
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_error_msg_
diff --git a/ngs-sdk/ngs/itf/FragmentItf.h b/ngs-sdk/ngs/itf/FragmentItf.h
new file mode 100644
index 0000000..eab6bd3
--- /dev/null
+++ b/ngs-sdk/ngs/itf/FragmentItf.h
@@ -0,0 +1,63 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_fragmentitf_
+#define _h_ngs_itf_fragmentitf_
+
+#ifndef _h_ngs_itf_vtable_
+#include "VTable.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * NGS_Fragment_v1
+ */
+typedef struct NGS_Fragment_v1 NGS_Fragment_v1;
+struct NGS_Fragment_v1
+{
+    const NGS_VTable * vt;
+};
+
+typedef struct NGS_Fragment_v1_vt NGS_Fragment_v1_vt;
+struct NGS_Fragment_v1_vt
+{
+    NGS_VTable dad;
+
+    NGS_String_v1 * ( CC * get_id ) ( const NGS_Fragment_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_bases ) ( const NGS_Fragment_v1 * self, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length );
+    NGS_String_v1 * ( CC * get_quals ) ( const NGS_Fragment_v1 * self, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length );
+    bool ( CC * next ) ( NGS_Fragment_v1 * self, NGS_ErrBlock_v1 * err );
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_fragmentitf_ */
diff --git a/ngs-sdk/ngs/itf/FragmentItf.hpp b/ngs-sdk/ngs/itf/FragmentItf.hpp
new file mode 100644
index 0000000..be15fd3
--- /dev/null
+++ b/ngs-sdk/ngs/itf/FragmentItf.hpp
@@ -0,0 +1,72 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_fragmentitf_
+#define _hpp_ngs_itf_fragmentitf_
+
+#ifndef _hpp_ngs_itf_refcount_
+#include <ngs/itf/Refcount.hpp>
+#endif
+
+struct NGS_Fragment_v1;
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+
+    /*----------------------------------------------------------------------
+     * FragmentItf
+     */
+    class NGS_ITF_EXTERN  FragmentItf : public Refcount < FragmentItf, NGS_Fragment_v1 >
+    {
+    public:
+
+        StringItf * getFragmentId () const
+            throw ( ErrorMsg );
+        StringItf * getFragmentBases () const
+            throw ( ErrorMsg );
+        StringItf * getFragmentBases ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        StringItf * getFragmentBases ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+        StringItf * getFragmentQualities () const
+            throw ( ErrorMsg );
+        StringItf * getFragmentQualities ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        StringItf * getFragmentQualities ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+        bool nextFragment ()
+            throw ( ErrorMsg );
+    };
+
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_fragmentitf_
diff --git a/ngs-sdk/ngs/itf/PileupEventItf.h b/ngs-sdk/ngs/itf/PileupEventItf.h
new file mode 100644
index 0000000..8d5ab2e
--- /dev/null
+++ b/ngs-sdk/ngs/itf/PileupEventItf.h
@@ -0,0 +1,80 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_pileup_eventitf_
+#define _h_ngs_itf_pileup_eventitf_
+
+#ifndef _h_ngs_itf_vtable_
+#include "VTable.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+struct NGS_Alignment_v1;
+
+
+/*--------------------------------------------------------------------------
+ * NGS_PileupEvent_v1
+ */
+typedef struct NGS_PileupEvent_v1 NGS_PileupEvent_v1;
+struct NGS_PileupEvent_v1
+{
+    const NGS_VTable * vt;
+};
+
+typedef struct NGS_PileupEvent_v1_vt NGS_PileupEvent_v1_vt;
+struct NGS_PileupEvent_v1_vt
+{
+    NGS_VTable dad;
+
+    NGS_String_v1 * ( CC * get_ref_spec ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    int64_t ( CC * get_ref_pos ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    int32_t ( CC * get_map_qual ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_align_id ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    struct NGS_Alignment_v1 * ( CC * get_alignment ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    int64_t ( CC * get_align_pos ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    int64_t ( CC * get_first_align_pos ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    int64_t ( CC * get_last_align_pos ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    uint32_t ( CC * get_event_type ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    char ( CC * get_align_base ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    char ( CC * get_align_qual ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_ins_bases ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_ins_quals ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    uint32_t ( CC * get_del_count ) ( const NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+    bool ( CC * next ) ( NGS_PileupEvent_v1 * self, NGS_ErrBlock_v1 * err );
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_pileup_eventitf_ */
diff --git a/ngs-sdk/ngs/itf/PileupEventItf.hpp b/ngs-sdk/ngs/itf/PileupEventItf.hpp
new file mode 100644
index 0000000..77bad5a
--- /dev/null
+++ b/ngs-sdk/ngs/itf/PileupEventItf.hpp
@@ -0,0 +1,87 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_pileup_eventitf_
+#define _hpp_ngs_itf_pileup_eventitf_
+
+#ifndef _hpp_ngs_itf_refcount_
+#include <ngs/itf/Refcount.hpp>
+#endif
+
+struct NGS_PileupEvent_v1;
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+    class AlignmentItf;
+
+    /*----------------------------------------------------------------------
+     * PileupEventItf
+     */
+    class NGS_ITF_EXTERN  PileupEventItf : public Refcount < PileupEventItf, NGS_PileupEvent_v1 >
+    {
+    public:
+
+        StringItf * getReferenceSpec () const
+            throw ( ErrorMsg );
+        int64_t getReferencePosition () const
+            throw ( ErrorMsg );
+        int32_t getMappingQuality () const
+            throw ( ErrorMsg );
+        StringItf * getAlignmentId () const
+            throw ( ErrorMsg );
+        AlignmentItf * getAlignment () const
+            throw ( ErrorMsg );
+        int64_t getAlignmentPosition () const
+            throw ( ErrorMsg );
+        int64_t getFirstAlignmentPosition () const
+            throw ( ErrorMsg );
+        int64_t getLastAlignmentPosition () const
+            throw ( ErrorMsg );
+        uint32_t getEventType () const
+            throw ( ErrorMsg );
+        char getAlignmentBase () const
+            throw ( ErrorMsg );
+        char getAlignmentQuality () const
+            throw ( ErrorMsg );
+        StringItf * getInsertionBases () const
+            throw ( ErrorMsg );
+        StringItf * getInsertionQualities () const
+            throw ( ErrorMsg );
+        uint32_t getDeletionCount () const
+            throw ( ErrorMsg );
+        bool nextPileupEvent ()
+            throw ( ErrorMsg );
+
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_pileup_eventitf_
diff --git a/ngs-sdk/ngs/itf/PileupItf.h b/ngs-sdk/ngs/itf/PileupItf.h
new file mode 100644
index 0000000..f0b10d1
--- /dev/null
+++ b/ngs-sdk/ngs/itf/PileupItf.h
@@ -0,0 +1,72 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_pileupitf_
+#define _h_ngs_itf_pileupitf_
+
+#ifndef _h_ngs_itf_vtable_
+#include "VTable.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+struct NGS_PileupEvent_v1;
+struct NGS_Pileup_v1_vt;
+extern struct NGS_Pileup_v1_vt ITF_Pileup_vt;
+
+/*--------------------------------------------------------------------------
+ * NGS_Pileup_v1
+ */
+typedef struct NGS_Pileup_v1 NGS_Pileup_v1;
+struct NGS_Pileup_v1
+{
+    const NGS_VTable * vt;
+};
+
+typedef struct NGS_Pileup_v1_vt NGS_Pileup_v1_vt;
+struct NGS_Pileup_v1_vt
+{
+    NGS_VTable dad;
+
+    NGS_String_v1 * ( CC * get_ref_spec ) ( const NGS_Pileup_v1 * self, NGS_ErrBlock_v1 * err );
+    int64_t ( CC * get_ref_pos ) ( const NGS_Pileup_v1 * self, NGS_ErrBlock_v1 * err );
+    struct NGS_PileupEvent_v1 * ( CC * get_pileup_events ) ( const NGS_Pileup_v1 * self, NGS_ErrBlock_v1 * err );
+    uint32_t ( CC * get_pileup_depth ) ( const NGS_Pileup_v1 * self, NGS_ErrBlock_v1 * err );
+    bool ( CC * next ) ( NGS_Pileup_v1 * self, NGS_ErrBlock_v1 * err );
+
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_pileupitf_ */
diff --git a/ngs-sdk/ngs/itf/PileupItf.hpp b/ngs-sdk/ngs/itf/PileupItf.hpp
new file mode 100644
index 0000000..5f5db08
--- /dev/null
+++ b/ngs-sdk/ngs/itf/PileupItf.hpp
@@ -0,0 +1,67 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_pileupitf_
+#define _hpp_ngs_itf_pileupitf_
+
+#ifndef _hpp_ngs_itf_refcount_
+#include <ngs/itf/Refcount.hpp>
+#endif
+
+struct NGS_Pileup_v1;
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+    class PileupEventItf;
+
+    /*----------------------------------------------------------------------
+     * PileupItf
+     */
+    class NGS_ITF_EXTERN  PileupItf : public Refcount < PileupItf, NGS_Pileup_v1 >
+    {
+    public:
+
+        StringItf * getReferenceSpec () const
+            throw ( ErrorMsg );
+        int64_t getReferencePosition () const
+            throw ( ErrorMsg );
+        PileupEventItf * getPileupEvents () const
+            throw ( ErrorMsg );
+        uint32_t getPileupDepth () const
+            throw ( ErrorMsg );
+        bool nextPileup ()
+            throw ( ErrorMsg );
+
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_pileupitf_
diff --git a/ngs-sdk/ngs/itf/ReadCollectionItf.h b/ngs-sdk/ngs/itf/ReadCollectionItf.h
new file mode 100644
index 0000000..a5404bf
--- /dev/null
+++ b/ngs-sdk/ngs/itf/ReadCollectionItf.h
@@ -0,0 +1,84 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_read_collectionitf_
+#define _h_ngs_itf_read_collectionitf_
+
+#ifndef _h_ngs_itf_vtable_
+#include "VTable.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+struct NGS_Read_v1;
+struct NGS_ReadGroup_v1;
+struct NGS_Reference_v1;
+struct NGS_Alignment_v1;
+
+
+/*--------------------------------------------------------------------------
+ * NGS_ReadCollection_v1
+ */
+typedef struct NGS_ReadCollection_v1 NGS_ReadCollection_v1;
+struct NGS_ReadCollection_v1
+{
+    const NGS_VTable * vt;
+};
+
+typedef struct NGS_ReadCollection_v1_vt NGS_ReadCollection_v1_vt;
+struct NGS_ReadCollection_v1_vt
+{
+    NGS_VTable dad;
+
+    NGS_String_v1 * ( CC * get_name ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err );
+    struct NGS_ReadGroup_v1 * ( CC * get_read_groups ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err );
+    struct NGS_ReadGroup_v1 * ( CC * get_read_group ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err, const char * spec );
+    struct NGS_Reference_v1 * ( CC * get_references ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err );
+    struct NGS_Reference_v1 * ( CC * get_reference ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err, const char * spec );
+    struct NGS_Alignment_v1 * ( CC * get_alignment ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+        const char * alignmentId );
+    struct NGS_Alignment_v1 * ( CC * get_alignments ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err, bool wants_primary, bool wants_secondary );
+    uint64_t ( CC * get_align_count ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err, bool wants_primary, bool wants_secondary );
+    struct NGS_Alignment_v1 * ( CC * get_align_range ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err,
+        uint64_t first, uint64_t count, bool wants_primary, bool wants_secondary );
+    struct NGS_Read_v1 * ( CC * get_read ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err, const char * readId );
+    struct NGS_Read_v1 * ( CC * get_reads ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err, bool wants_full, bool wants_partial, bool wants_unaligned );
+    uint64_t ( CC * get_read_count ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err, bool wants_full, bool wants_partial, bool wants_unaligned );
+    struct NGS_Read_v1 * ( CC * get_read_range ) ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err, 
+        uint64_t first, uint64_t count, bool wants_full, bool wants_partial, bool wants_unaligned );
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_read_collectionitf_ */
diff --git a/ngs-sdk/ngs/itf/ReadCollectionItf.hpp b/ngs-sdk/ngs/itf/ReadCollectionItf.hpp
new file mode 100644
index 0000000..b1672f4
--- /dev/null
+++ b/ngs-sdk/ngs/itf/ReadCollectionItf.hpp
@@ -0,0 +1,87 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_read_collectionitf_
+#define _hpp_ngs_itf_read_collectionitf_
+
+#ifndef _hpp_ngs_itf_refcount_
+#include <ngs/itf/Refcount.hpp>
+#endif
+
+struct NGS_ReadCollection_v1;
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class ReadItf;
+    class StringItf;
+    class ReadGroupItf;
+    class ReferenceItf;
+    class AlignmentItf;
+
+    /*----------------------------------------------------------------------
+     * ReadCollectionItf
+     */
+    class NGS_ITF_EXTERN  ReadCollectionItf : public Refcount < ReadCollectionItf, NGS_ReadCollection_v1 >
+    {
+    public:
+        
+        StringItf * getName () const
+            throw ( ErrorMsg );
+        ReadGroupItf * getReadGroups () const
+            throw ( ErrorMsg );
+        ReadGroupItf * getReadGroup ( const char * spec ) const
+            throw ( ErrorMsg );
+        ReferenceItf * getReferences () const
+            throw ( ErrorMsg );
+        ReferenceItf * getReference ( const char * spec ) const
+            throw ( ErrorMsg );
+        AlignmentItf * getAlignment ( const char * alignmentId ) const
+            throw ( ErrorMsg );
+        AlignmentItf * getAlignments ( uint32_t categories ) const
+            throw ( ErrorMsg );
+        uint64_t getAlignmentCount ( uint32_t categories ) const
+            throw ( ErrorMsg );
+        AlignmentItf * getAlignmentRange ( uint64_t first, uint64_t count, uint32_t categories ) const
+            throw ( ErrorMsg );
+        ReadItf * getRead ( const char * readId ) const
+            throw ( ErrorMsg );
+        ReadItf * getReads ( uint32_t categories ) const
+            throw ( ErrorMsg );
+        uint64_t getReadCount ( uint32_t categories ) const
+            throw ( ErrorMsg );
+        ReadItf * getReadRange ( uint64_t first, uint64_t count ) const
+            throw ( ErrorMsg );
+        ReadItf * getReadRange ( uint64_t first, uint64_t count, uint32_t categories ) const
+            throw ( ErrorMsg );
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_read_collectionitf_
diff --git a/ngs-sdk/ngs/itf/ReadGroupItf.h b/ngs-sdk/ngs/itf/ReadGroupItf.h
new file mode 100644
index 0000000..71ae6fc
--- /dev/null
+++ b/ngs-sdk/ngs/itf/ReadGroupItf.h
@@ -0,0 +1,68 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_read_groupitf_
+#define _h_ngs_itf_read_groupitf_
+
+#ifndef _h_ngs_itf_vtable_
+#include "VTable.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+struct NGS_Statistics_v1;
+
+
+/*--------------------------------------------------------------------------
+ * NGS_ReadGroup_v1
+ */
+typedef struct NGS_ReadGroup_v1 NGS_ReadGroup_v1;
+struct NGS_ReadGroup_v1
+{
+    const NGS_VTable * vt;
+};
+
+typedef struct NGS_ReadGroup_v1_vt NGS_ReadGroup_v1_vt;
+struct NGS_ReadGroup_v1_vt
+{
+    NGS_VTable dad;
+
+    NGS_String_v1 * ( CC * get_name ) ( const NGS_ReadGroup_v1 * self, NGS_ErrBlock_v1 * err );
+    struct NGS_Statistics_v1 * ( CC * get_stats ) ( const NGS_ReadGroup_v1 * self, NGS_ErrBlock_v1 * err );
+    bool ( CC * next ) ( NGS_ReadGroup_v1 * self, NGS_ErrBlock_v1 * err );
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_read_groupitf_ */
diff --git a/ngs-sdk/ngs/itf/ReadGroupItf.hpp b/ngs-sdk/ngs/itf/ReadGroupItf.hpp
new file mode 100644
index 0000000..6e71a41
--- /dev/null
+++ b/ngs-sdk/ngs/itf/ReadGroupItf.hpp
@@ -0,0 +1,69 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_read_groupitf_
+#define _hpp_ngs_itf_read_groupitf_
+
+#ifndef _hpp_ngs_itf_refcount_
+#include <ngs/itf/Refcount.hpp>
+#endif
+
+struct NGS_ReadGroup_v1;
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class ReadItf;
+    class StringItf;
+    class StatisticsItf;
+
+    /*----------------------------------------------------------------------
+     * ReadGroupItf
+     */
+    class NGS_ITF_EXTERN  ReadGroupItf : public Refcount < ReadGroupItf, NGS_ReadGroup_v1 >
+    {
+    public:
+
+        StringItf * getName () const
+            throw ( ErrorMsg );
+#if READ_GROUP_SUPPORTS_READS
+        ReadItf * getRead ( const char * readId )
+            throw ( ErrorMsg );
+        ReadItf * getReads ( uint32_t categories )
+            throw ( ErrorMsg );
+#endif
+		StatisticsItf * getStatistics () const 
+            throw ( ErrorMsg );
+        bool nextReadGroup ()
+            throw ( ErrorMsg );
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_read_groupitf_
diff --git a/ngs-sdk/ngs/itf/ReadItf.h b/ngs-sdk/ngs/itf/ReadItf.h
new file mode 100644
index 0000000..ad8aa29
--- /dev/null
+++ b/ngs-sdk/ngs/itf/ReadItf.h
@@ -0,0 +1,68 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_readitf_
+#define _h_ngs_itf_readitf_
+
+#ifndef _h_ngs_itf_vtable_
+#include "VTable.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * NGS_Read_v1
+ */
+typedef struct NGS_Read_v1 NGS_Read_v1;
+struct NGS_Read_v1
+{
+    const NGS_VTable * vt;
+};
+
+typedef struct NGS_Read_v1_vt NGS_Read_v1_vt;
+struct NGS_Read_v1_vt
+{
+    NGS_VTable dad;
+
+    NGS_String_v1 * ( CC * get_id ) ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+    uint32_t ( CC * get_num_frags ) ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+    uint32_t ( CC * get_category ) ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_read_group ) ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_name ) ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_bases ) ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length );
+    NGS_String_v1 * ( CC * get_quals ) ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length );
+    bool ( CC * next ) ( NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
+
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_readitf_ */
diff --git a/ngs-sdk/ngs/itf/ReadItf.hpp b/ngs-sdk/ngs/itf/ReadItf.hpp
new file mode 100644
index 0000000..5582a20
--- /dev/null
+++ b/ngs-sdk/ngs/itf/ReadItf.hpp
@@ -0,0 +1,79 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_readitf_
+#define _hpp_ngs_itf_readitf_
+
+#ifndef _hpp_ngs_itf_refcount_
+#include <ngs/itf/Refcount.hpp>
+#endif
+
+struct NGS_Read_v1;
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+
+    /*----------------------------------------------------------------------
+     * ReadItf
+     */
+    class NGS_ITF_EXTERN  ReadItf : public Refcount < ReadItf, NGS_Read_v1 >
+    {
+    public:
+
+        StringItf * getReadId () const
+            throw ( ErrorMsg );
+        uint32_t getNumFragments () const
+            throw ( ErrorMsg );
+        uint32_t getReadCategory () const
+            throw ( ErrorMsg );
+        StringItf * getReadGroup () const
+            throw ( ErrorMsg );
+        StringItf * getReadName () const
+            throw ( ErrorMsg );
+        StringItf * getReadBases () const
+            throw ( ErrorMsg );
+        StringItf * getReadBases ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        StringItf * getReadBases ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+        StringItf * getReadQualities () const
+            throw ( ErrorMsg );
+        StringItf * getReadQualities ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        StringItf * getReadQualities ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+        bool nextRead ()
+            throw ( ErrorMsg );
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_readitf_
diff --git a/ngs-sdk/ngs/itf/Refcount.h b/ngs-sdk/ngs/itf/Refcount.h
new file mode 100644
index 0000000..f9ffdc2
--- /dev/null
+++ b/ngs-sdk/ngs/itf/Refcount.h
@@ -0,0 +1,60 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_refcount_
+#define _h_ngs_itf_refcount_
+
+#ifndef _h_ngs_itf_vtable_
+#include "VTable.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * NGS_Refcount_v1
+ */
+typedef struct NGS_Refcount_v1 NGS_Refcount_v1;
+struct NGS_Refcount_v1
+{
+    const NGS_VTable * vt;
+};
+
+typedef struct NGS_Refcount_v1_vt NGS_Refcount_v1_vt;
+struct NGS_Refcount_v1_vt
+{
+    NGS_VTable dad;
+
+    void ( CC * release ) ( NGS_Refcount_v1 * self, NGS_ErrBlock_v1 * err );
+    void* ( CC * duplicate ) ( const NGS_Refcount_v1 * self, NGS_ErrBlock_v1 * err );
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_refcount_ */
diff --git a/ngs-sdk/ngs/itf/Refcount.hpp b/ngs-sdk/ngs/itf/Refcount.hpp
new file mode 100644
index 0000000..99552c3
--- /dev/null
+++ b/ngs-sdk/ngs/itf/Refcount.hpp
@@ -0,0 +1,122 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_refcount_
+#define _hpp_ngs_itf_refcount_
+
+#ifndef _hpp_ngs_itf_error_msg_
+#include <ngs/itf/ErrorMsg.hpp>
+#endif
+
+#ifndef _h_ngs_itf_defs_
+#include <ngs/itf/defs.h>
+#endif
+
+struct NGS_Refcount_v1;
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * OpaqueRefcount
+     */
+    class NGS_ITF_EXTERN  OpaqueRefcount
+    {
+    public:
+
+        void Release ()
+            throw ();
+
+        void * Duplicate () const
+            throw ( ErrorMsg );
+
+    private:
+        OpaqueRefcount ();
+
+        NGS_Refcount_v1 * Self ();
+        const NGS_Refcount_v1 * Self () const;
+    };
+
+
+    /*----------------------------------------------------------------------
+     * Refcount
+     */
+    template < class T, class C >
+    class NGS_ITF_EXTERN  Refcount : protected OpaqueRefcount
+    {
+    public:
+
+        inline
+        void Release ()
+            throw ()
+        {
+            OpaqueRefcount :: Release ();
+        }
+
+        inline
+        T * Duplicate () const
+            throw ( ErrorMsg )
+        {
+            return static_cast < T* > ( OpaqueRefcount :: Duplicate () );
+        }
+
+    protected:
+
+        // type-punning casts from C++ to C object
+        inline C * Self ()
+        { return reinterpret_cast < C* > ( this ); }
+
+        inline const C * Self () const
+        { return reinterpret_cast < const C* > ( this ); }
+
+        // test "this" pointer for NULL
+        inline C * Test ()
+        {
+            if ( this == 0 )
+                throw ErrorMsg ( "message sent to NULL object" );
+            return Self ();
+        }
+        inline const C * Test () const
+        {
+            if ( this == 0 )
+                throw ErrorMsg ( "message sent to NULL object" );
+            return Self ();
+        }
+
+    public:
+
+        // type-punning cast from C object to C++
+        static inline T * Cast ( C * cobj )
+        { return reinterpret_cast < T* > ( cobj ); }
+
+        static inline const T * Cast ( const C * cobj )
+        { return reinterpret_cast < const T* > ( cobj ); }
+
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_refcount_
diff --git a/ngs-sdk/ngs/itf/ReferenceItf.h b/ngs-sdk/ngs/itf/ReferenceItf.h
new file mode 100644
index 0000000..cc2fd90
--- /dev/null
+++ b/ngs-sdk/ngs/itf/ReferenceItf.h
@@ -0,0 +1,80 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_referenceitf_
+#define _h_ngs_itf_referenceitf_
+
+#ifndef _h_ngs_itf_vtable_
+#include "VTable.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+struct NGS_Pileup_v1;
+struct NGS_Alignment_v1;
+
+
+/*--------------------------------------------------------------------------
+ * NGS_Reference_v1
+ */
+typedef struct NGS_Reference_v1 NGS_Reference_v1;
+struct NGS_Reference_v1
+{
+    const NGS_VTable * vt;
+};
+
+typedef struct NGS_Reference_v1_vt NGS_Reference_v1_vt;
+struct NGS_Reference_v1_vt
+{
+    NGS_VTable dad;
+
+    NGS_String_v1 * ( CC * get_cmn_name ) ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_canon_name ) ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err );
+    bool ( CC * is_circular ) ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err );
+    uint64_t ( CC * get_length ) ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1 * ( CC * get_ref_bases ) ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length );
+    NGS_String_v1 * ( CC * get_ref_chunk ) ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length );
+    struct NGS_Alignment_v1 * ( CC * get_alignment ) ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err, const char * alignmentId );
+    struct NGS_Alignment_v1 * ( CC * get_alignments ) ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err, bool wants_primary, bool wants_secondary );
+    struct NGS_Alignment_v1 * ( CC * get_align_slice ) ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err,
+        int64_t start, uint64_t length, bool wants_primary, bool wants_secondary );
+    struct NGS_Pileup_v1 * ( CC * get_pileups ) ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err, bool wants_primary, bool wants_secondary );
+    struct NGS_Pileup_v1 * ( CC * get_pileup_slice ) ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err,
+        int64_t start, uint64_t length, bool wants_primary, bool wants_secondary );
+    bool ( CC * next ) ( NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err );
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_referenceitf_ */
diff --git a/ngs-sdk/ngs/itf/ReferenceItf.hpp b/ngs-sdk/ngs/itf/ReferenceItf.hpp
new file mode 100644
index 0000000..d5f855c
--- /dev/null
+++ b/ngs-sdk/ngs/itf/ReferenceItf.hpp
@@ -0,0 +1,89 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_referenceitf_
+#define _hpp_ngs_itf_referenceitf_
+
+#ifndef _hpp_ngs_itf_refcount_
+#include <ngs/itf/Refcount.hpp>
+#endif
+
+struct NGS_Reference_v1;
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+    class PileupItf;
+    class AlignmentItf;
+
+    /*----------------------------------------------------------------------
+     * Reference
+     */
+    class NGS_ITF_EXTERN   ReferenceItf : public Refcount < ReferenceItf, NGS_Reference_v1 >
+    {
+    public:
+
+        StringItf * getCommonName () const
+            throw ( ErrorMsg );
+        StringItf * getCanonicalName () const
+            throw ( ErrorMsg );
+        bool getIsCircular () const
+            throw ( ErrorMsg );
+        uint64_t getLength () const
+            throw ( ErrorMsg );
+        StringItf * getReferenceBases ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        StringItf * getReferenceBases ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+        StringItf * getReferenceChunk ( uint64_t offset ) const
+            throw ( ErrorMsg );
+        StringItf * getReferenceChunk ( uint64_t offset, uint64_t length ) const
+            throw ( ErrorMsg );
+        AlignmentItf * getAlignment ( const char * alignmentId ) const
+            throw ( ErrorMsg );
+        AlignmentItf * getAlignments ( uint32_t categories ) const
+            throw ( ErrorMsg );
+        AlignmentItf * getAlignmentSlice ( int64_t start, uint64_t length ) const
+            throw ( ErrorMsg );
+        AlignmentItf * getAlignmentSlice ( int64_t start, uint64_t length, uint32_t categories ) const
+            throw ( ErrorMsg );
+        PileupItf * getPileups ( uint32_t categories ) const
+            throw ( ErrorMsg );
+        PileupItf * getPileupSlice ( int64_t start, uint64_t length ) const
+            throw ( ErrorMsg );
+        PileupItf * getPileupSlice ( int64_t start, uint64_t length, uint32_t categories ) const
+            throw ( ErrorMsg );
+        bool nextReference ()
+            throw ( ErrorMsg );
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_referenceitf_
diff --git a/ngs-sdk/ngs/itf/StatisticsItf.h b/ngs-sdk/ngs/itf/StatisticsItf.h
new file mode 100644
index 0000000..9ca53d3
--- /dev/null
+++ b/ngs-sdk/ngs/itf/StatisticsItf.h
@@ -0,0 +1,65 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_statisticsitf_
+#define _h_ngs_itf_statisticsitf_
+
+#ifndef _h_ngs_itf_vtable_
+#include "VTable.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * NGS_Statistics_v1
+ */
+typedef struct NGS_Statistics_v1 NGS_Statistics_v1;
+struct NGS_Statistics_v1
+{
+    const NGS_VTable * vt;
+};
+
+typedef struct NGS_Statistics_v1_vt NGS_Statistics_v1_vt;
+struct NGS_Statistics_v1_vt
+{
+    NGS_VTable dad;
+
+    uint32_t ( CC * get_type ) ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+    NGS_String_v1 * ( CC * as_string ) ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+    int64_t ( CC * as_I64 ) ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+    uint64_t ( CC * as_U64 ) ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+    double ( CC * as_F64 ) ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+    NGS_String_v1 * ( CC * next_path ) ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path );
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_statisticsitf_ */
diff --git a/ngs-sdk/ngs/itf/StatisticsItf.hpp b/ngs-sdk/ngs/itf/StatisticsItf.hpp
new file mode 100644
index 0000000..8733475
--- /dev/null
+++ b/ngs-sdk/ngs/itf/StatisticsItf.hpp
@@ -0,0 +1,67 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_statisticsitf_
+#define _hpp_ngs_itf_statisticsitf_
+
+#ifndef _hpp_ngs_itf_refcount_
+#include <ngs/itf/Refcount.hpp>
+#endif
+
+struct NGS_Statistics_v1;
+
+namespace ngs
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+    class StringItf;
+
+    /*----------------------------------------------------------------------
+     * StatisticsItf
+     */
+    class NGS_ITF_EXTERN  StatisticsItf : public Refcount < StatisticsItf, NGS_Statistics_v1 >
+    {
+    public:
+
+        uint32_t getValueType ( const char * path ) const
+            throw ( ErrorMsg );
+        StringItf * getAsString ( const char * path ) const
+            throw ( ErrorMsg );
+        int64_t getAsI64 ( const char * path ) const
+            throw ( ErrorMsg );
+        uint64_t getAsU64 ( const char * path ) const
+            throw ( ErrorMsg );
+        double getAsDouble ( const char * path ) const
+            throw ( ErrorMsg );
+        StringItf * nextPath ( const char * path ) const
+            throw ();
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_statisticsitf_
diff --git a/ngs-sdk/ngs/itf/StringItf.h b/ngs-sdk/ngs/itf/StringItf.h
new file mode 100644
index 0000000..211c87b
--- /dev/null
+++ b/ngs-sdk/ngs/itf/StringItf.h
@@ -0,0 +1,62 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_stringitf_
+#define _h_ngs_itf_stringitf_
+
+#ifndef _h_ngs_itf_vtable_
+#include <ngs/itf/VTable.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * NGS_String_v1
+ */
+struct NGS_String_v1
+{
+    const NGS_VTable * vt;
+};
+
+typedef struct NGS_String_v1_vt NGS_String_v1_vt;
+struct NGS_String_v1_vt
+{
+    NGS_VTable dad;
+
+    const char* ( CC * data ) ( const NGS_String_v1 * self, NGS_ErrBlock_v1 * err );
+    size_t ( CC * size ) ( const NGS_String_v1 * self, NGS_ErrBlock_v1 * err );
+    NGS_String_v1* ( CC * substr ) ( const NGS_String_v1 * self, NGS_ErrBlock_v1 * err,
+        size_t offset, size_t size );
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_stringitf_ */
diff --git a/ngs-sdk/ngs/itf/StringItf.hpp b/ngs-sdk/ngs/itf/StringItf.hpp
new file mode 100644
index 0000000..f7de0db
--- /dev/null
+++ b/ngs-sdk/ngs/itf/StringItf.hpp
@@ -0,0 +1,59 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_stringitf_
+#define _hpp_ngs_itf_stringitf_
+
+#ifndef _hpp_ngs_itf_refcount_
+#include <ngs/itf/Refcount.hpp>
+#endif
+
+struct NGS_String_v1;
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * StringItf
+     *  a dynamically allocated object representing a string reference
+     */
+    class NGS_ITF_EXTERN  StringItf : public Refcount < StringItf, NGS_String_v1 >
+    {
+    public:
+
+        const char * data () const
+            throw ();
+        size_t size () const
+            throw ();
+        StringItf * substr ( size_t offset ) const
+            throw ( ErrorMsg );
+        StringItf * substr ( size_t offset, size_t size ) const
+            throw ( ErrorMsg );
+    };
+
+
+} // namespace ngs
+
+#endif // _hpp_ngs_itf_stringitf_
diff --git a/ngs-sdk/ngs/itf/VTable.h b/ngs-sdk/ngs/itf/VTable.h
new file mode 100644
index 0000000..33169f9
--- /dev/null
+++ b/ngs-sdk/ngs/itf/VTable.h
@@ -0,0 +1,98 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_vtable_
+#define _h_ngs_itf_vtable_
+
+#ifndef _h_ngs_itf_defs_
+#include <ngs/itf/defs.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+typedef struct NGS_VTable NGS_VTable;
+
+
+/*--------------------------------------------------------------------------
+ * NGS_HierCache
+ */
+typedef struct NGS_HierCache NGS_HierCache;
+struct NGS_HierCache
+{
+    const NGS_HierCache * volatile next;
+
+    size_t length;
+    struct
+    {
+        const NGS_VTable * parent;
+        const void * itf_tok;
+    } hier [ 1 ];
+};
+
+
+/*--------------------------------------------------------------------------
+ * NGS_VTable
+ */
+
+/* some members are mutable */
+#ifdef __cplusplus
+#define NGS_MUTABLE mutable
+#else
+#define NGS_MUTABLE
+#endif
+
+struct NGS_VTable
+{
+    /* name of the implementation class */
+    const char * class_name;
+
+    /* name of the interface */
+    const char * itf_name;
+
+    /* interface minor version number */
+    size_t minor_version;
+
+    /* allow for single-inheritance
+       interface hierarchy */
+    const NGS_VTable * parent;
+
+    /* cached linear inheritance array
+       the implementation must set this to NULL */
+    NGS_MUTABLE const NGS_HierCache *  volatile cache;
+};
+
+#undef NGS_MUTABLE
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_vtable_ */
diff --git a/ngs-sdk/ngs/itf/VTable.hpp b/ngs-sdk/ngs/itf/VTable.hpp
new file mode 100644
index 0000000..9fae60a
--- /dev/null
+++ b/ngs-sdk/ngs/itf/VTable.hpp
@@ -0,0 +1,110 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_itf_vtable_
+#define _hpp_ngs_itf_vtable_
+
+#ifndef _hpp_ngs_itf_error_msg_
+#include <ngs/itf/ErrorMsg.hpp>
+#endif
+
+#ifndef _h_ngs_itf_vtable_
+#include <ngs/itf/VTable.h>
+#endif
+
+namespace ngs
+{
+    /*----------------------------------------------------------------------
+     * ItfTok
+     */
+    struct ItfTok
+    {
+        ItfTok ( const char * name )
+            : itf_name ( name )
+        {
+            assert ( parent == 0 );
+            assert ( idx == 0 );
+        }
+
+        ItfTok ( const char * name, const ItfTok & dad )
+            : itf_name ( name )
+            , parent ( & dad )
+        {
+            assert ( idx == 0 );
+        }
+
+        /* name of the interface */
+        const char * itf_name;
+
+        // single-inheritance - interface hierarchy
+        const ItfTok * parent;
+
+        // index into linear inheritance array
+        uint32_t mutable volatile idx;
+    };
+
+    /*----------------------------------------------------------------------
+     * Resolve
+     *  creates a cache of interface hierarchy
+     *  resolves array indices of itf tokens
+     */
+    void Resolve ( const ItfTok & itf )
+        throw ();
+    void Resolve ( const NGS_VTable * vt, const ItfTok & itf )
+        throw ( ErrorMsg );
+
+    /*----------------------------------------------------------------------
+     * Cast
+     *  cast an NGS_VTable to the desired level
+     */
+    inline
+    const void * Cast ( const NGS_VTable * vt, const ItfTok & itf )
+        throw ( ErrorMsg )
+    {
+        if ( vt != 0 )
+        {
+            if ( itf . idx == 0 )
+                Resolve ( itf );
+            if ( vt -> cache == 0 )
+                Resolve ( vt, itf );
+
+            assert ( itf . idx != 0 );
+            assert ( itf . idx <= ( unsigned int ) vt -> cache -> length );
+            if ( vt -> cache -> hier [ itf . idx - 1 ] . itf_tok == ( const void* ) & itf )
+                return vt -> cache -> hier [ itf . idx - 1 ] . parent;
+            if ( vt -> cache -> hier [ itf . idx - 1 ] . itf_tok == 0 )
+            {
+                Resolve ( vt, itf );
+                if ( vt -> cache -> hier [ itf . idx - 1 ] . itf_tok == ( const void* ) & itf )
+                    return vt -> cache -> hier [ itf . idx - 1 ] . parent;
+            }
+        }
+
+        return 0;
+    }
+}
+
+#endif // _hpp_ngs_itf_vtable_
diff --git a/ngs-sdk/ngs/itf/defs.h b/ngs-sdk/ngs/itf/defs.h
new file mode 100644
index 0000000..759bfee
--- /dev/null
+++ b/ngs-sdk/ngs/itf/defs.h
@@ -0,0 +1,80 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_itf_defs_
+#define _h_ngs_itf_defs_
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <assert.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * calling convention
+ */
+#ifndef CC
+ #if defined _MSC_VER
+  #define CC __cdecl
+ #else
+  #define CC
+ #endif
+#endif
+
+/*--------------------------------------------------------------------------
+ * DLL interface
+ */
+#if defined _MSC_VER
+ #if defined _LIBRARY
+  #define NGS_ITF_EXTERN   __declspec( dllexport ) 
+ #else
+  #define NGS_ITF_EXTERN   __declspec( dllimport ) 
+ #endif
+#else
+ #define NGS_ITF_EXTERN   
+#endif
+
+/*--------------------------------------------------------------------------
+ * NGS_ErrBlock
+ *  see "ErrBlock.h"
+ */
+typedef struct NGS_ErrBlock_v1 NGS_ErrBlock_v1;
+
+/*--------------------------------------------------------------------------
+ * NGS_String
+ *  see "StringItf.h"
+ */
+typedef struct NGS_String_v1 NGS_String_v1;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_itf_defs_ */
diff --git a/ngs-sdk/os-arch.perl b/ngs-sdk/os-arch.perl
new file mode 100644
index 0000000..a7b4990
--- /dev/null
+++ b/ngs-sdk/os-arch.perl
@@ -0,0 +1,22 @@
+use strict;
+
+use FindBin qw($Bin);
+require "$Bin/os-arch.pm";
+
+my ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+
+my $res = "$OS.$ARCH";
+
+if (@ARCHITECTURES) {
+    my $name = "$Bin/Makefile.config.$OS.arch";
+    if (-e $name) {
+        while (1) {
+            open F, $name or last;
+            $res = "$OS." . <F>;
+            chomp $res;
+            last;
+        }
+    }
+}
+
+print "$res\n";
diff --git a/ngs-sdk/os-arch.pm b/ngs-sdk/os-arch.pm
new file mode 100644
index 0000000..6fbd606
--- /dev/null
+++ b/ngs-sdk/os-arch.pm
@@ -0,0 +1,100 @@
+sub OsArch {
+    my ($UNAME, $HOST_OS, $HOST_ARCH, $MARCH, @ARCHITECTURES);
+    if ($^O eq 'MSWin32') {
+        $UNAME = $HOST_OS = 'win';
+        $HOST_ARCH = $MARCH = 'x86_64';
+        @ARCHITECTURES = qw(x86_64 i386);
+    } else {
+        $UNAME = `uname -s`;
+        chomp $UNAME;
+        if ($UNAME =~ /Darwin/) {
+            $HOST_OS = 'mac';
+        } elsif ($UNAME =~ /Linux/) {
+            $HOST_OS = 'linux';
+        } elsif ($UNAME =~ /SunOS/) {
+            $HOST_OS = 'sun';
+            @ARCHITECTURES = qw(x86_64 i386);
+        } elsif ($UNAME =~ /xCYGWIN/) {
+            $HOST_OS = 'win';
+        } elsif ($UNAME =~ /xMINGW/) {
+            $HOST_OS = 'win';
+        }
+        if ($HOST_OS eq 'mac') {
+            $MARCH = $HOST_ARCH = MacArch();
+            @ARCHITECTURES = qw(x86_64 i386) if ($MARCH eq 'x86_64');
+        } else {
+            $MARCH = `uname -m`;
+            chomp $MARCH;
+            if ($MARCH =~ /i386/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i486/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i586/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i686/) {
+                if ($UNAME =~ /WOW64/) { # 64-bit capable Cygwin.
+                     # Analyze the version of cl to set the correct architecture
+                    my $CL = `cl.exe 2>&1 > /dev/null`;
+                    if ($CL =~ /for x64/) {
+                        $HOST_ARCH = 'x86_64';
+                    } else {
+                        $HOST_ARCH = 'i386';
+                    }
+                } else {
+                    $HOST_ARCH = 'i386';
+                }
+            } elsif ($MARCH =~ /x86_64/) {
+                $HOST_ARCH = 'x86_64';
+            } elsif ($MARCH =~ /i86pc/) {
+                $HOST_ARCH = 'x86_64';
+                @ARCHITECTURES = qw(x86_64 i386);
+            } elsif ($MARCH =~ /sun4v/) {
+                $HOST_ARCH = 'sparc64';
+		        @ARCHITECTURES = qw(sparc64 sparc32);
+            }
+        }
+    }
+    ($HOST_OS, $HOST_ARCH, $UNAME, $MARCH, @ARCHITECTURES);
+}
+
+sub MacArch {
+    my $ARCH = `uname -m`;
+    chomp $ARCH;
+    if ($ARCH eq 'x86_64') {
+        return $ARCH;
+    } else {
+        my $SYSCTL = '/usr/sbin/sysctl';
+        $SYSCTL = '/sbin/sysctl' if (-x '/sbin/sysctl');
+
+        my $CAP64 = `$SYSCTL -n hw.cpu64bit_capable`;
+        chomp $CAP64;
+
+        my $PADDR_BITS = `$SYSCTL -n machdep.cpu.address_bits.physical`;
+        chomp $PADDR_BITS;
+
+        my $VADDR_BITS = `$SYSCTL -n machdep.cpu.address_bits.virtual`;
+        chomp $VADDR_BITS;
+        
+        if ($CAP64 != 0) {
+            if ($PADDR_BITS > 32 && $VADDR_BITS > 32) {
+                if ($ARCH eq 'i386' || $ARCH eq 'x86_64') {
+                    return 'x86_64';
+                } elsif ($ARCH eq 'Power Macintosh') {
+                    return 'ppc64';
+                } else {
+                    return 'unrecognized';
+                }
+            }
+        }
+
+        if ($ARCH eq 'i386') {
+            return 'i386';
+        } elsif ($ARCH eq 'Power Macintosh') {
+            return 'ppc32';
+        } else {
+            return 'unrecognized';
+        }
+    }
+}
+
+1
diff --git a/ngs-sdk/package.pm b/ngs-sdk/package.pm
new file mode 100644
index 0000000..025a876
--- /dev/null
+++ b/ngs-sdk/package.pm
@@ -0,0 +1,15 @@
+################################################################################
+sub PACKAGE      { 'ngs-sdk' }
+sub VERSION      { '1.0.0' }
+sub PACKAGE_TYPE { 'L' }
+sub PACKAGE_NAME { 'NGS-SDK' }
+sub PACKAGE_NAMW { 'NGS' }
+sub DEPENDS      {}
+sub CONFIG_OUT   { '.' }
+sub PKG { ( LNG   => 'C',
+            OUT   => 'ncbi-outdir',
+            PATH  => '/usr/local/ngs/ngs-sdk',
+            UPATH =>      '$HOME/ngs/ngs-sdk',
+            EXAMP => '1' ) }
+sub REQ {}
+1
diff --git a/ngs-sdk/test/Makefile b/ngs-sdk/test/Makefile
new file mode 100644
index 0000000..145de06
--- /dev/null
+++ b/ngs-sdk/test/Makefile
@@ -0,0 +1,57 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: subdirs
+
+TOP ?= $(abspath ..)
+export TOP
+
+SUBDIRS =  \
+	test_engine    \
+	ngs-test
+
+SUBDIRS_CLN = \
+	$(addsuffix _cln,$(SUBDIRS))
+
+SUBDIRS_TST = \
+	$(addsuffix _tst,$(SUBDIRS))
+
+subdirs: $(SUBDIRS)
+
+clean: $(SUBDIRS_CLN)
+
+test runtests: $(SUBDIRS_TST)
+
+$(SUBDIRS):
+	@ $(MAKE) -C $@
+
+$(SUBDIRS_CLN):
+	@ $(MAKE) -s -C $(subst _cln,,$@) clean
+
+$(SUBDIRS_TST):
+	@ $(MAKE) -C $(subst _tst,,$@) runtests
+
+.PHONY: default subdirs $(SUBDIRS) $(SUBDIRS_CLN) $(SUBDIRS_TST)
+
diff --git a/ngs-sdk/test/ngs-test/Makefile b/ngs-sdk/test/ngs-test/Makefile
new file mode 100644
index 0000000..40c918b
--- /dev/null
+++ b/ngs-sdk/test/ngs-test/Makefile
@@ -0,0 +1,61 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+include $(TOP)/Makefile.config
+
+TARGETS =      \
+    test-ngs
+
+all std: $(TARGETS)
+
+clean:
+	rm -rf $(OBJDIR) $(BINDIR)/test-ngs*
+
+.PHONY: default all std $(TARGETS)
+
+test-ngs: $(BINDIR) $(OBJDIR) $(BINDIR)/test-ngs$(EXEX)
+
+#-------------------------------------------------------------------------------
+# test-ngs
+#
+TEST_NGS_SRC = \
+    main
+
+TEST_NGS_OBJ = \
+	$(addprefix $(OBJDIR)/,$(addsuffix .$(OBJX),$(TEST_NGS_SRC)))
+
+TEST_NGS_LIB = \
+    -ltest_engine \
+    -lngs-bind-c++ \
+    -lngs-disp \
+
+$(BINDIR)/test-ngs$(EXEX): $(TEST_NGS_OBJ) 
+	$(LP) $(DBG) $(OPT) -o $@ $^ -L$(LIBDIR) -L$(ILIBDIR) $(TEST_NGS_LIB) 
+
+runtests: std $(BINDIR)/test-ngs$(EXEX)
+	@ export LD_LIBRARY_PATH=$(LIBDIR):$(LD_LIBRARY_PATH); echo "Running $^ ..."; $(BINDIR)/test-ngs$(EXEX)
diff --git a/ngs-sdk/test/ngs-test/main.cpp b/ngs-sdk/test/ngs-test/main.cpp
new file mode 100644
index 0000000..7b11bb9
--- /dev/null
+++ b/ngs-sdk/test/ngs-test/main.cpp
@@ -0,0 +1,794 @@
+#include <stdexcept>
+
+#include <test/test_engine/test_engine.hpp>
+#include <test/test_engine/ReadCollectionItf.hpp>
+
+//////////////////////////////////// 
+
+// our little unit testing framework
+
+static unsigned int tests_run = 0;
+static unsigned int tests_failed = 0;
+static unsigned int tests_passed = 0;
+
+#define TEST_BEGIN(f) void f() { try { ++tests_run;
+
+#define TEST_END ++tests_passed; } \
+    catch (std::exception& x)   { std::cout << "exception in " << __FILE__ << ":" << __LINE__ << ": " << x.what()   << std::endl; ++tests_failed; } \
+    catch (...)                 { std::cout << "exception in " << __FILE__ << ":" << __LINE__ << ": unknown"        << std::endl; ++tests_failed; } }
+
+#define Assert(v) \
+    { if ( ! ( v ) ) throw std::logic_error ( "Assertion failed: " #v ); }
+
+//////////////////////////////////// 
+#define TEST_BEGIN_READCOLLECTION( v ) \
+    TEST_BEGIN ( v ) \
+    ngs::ReadCollection rc = ngs_test_engine::NGS::openReadCollection ( "test" );	
+
+/////////// ReadCollection
+TEST_BEGIN ( ReadCollection_CreateDestroy )
+    {
+        ngs::ReadCollection rc = ngs_test_engine::NGS::openReadCollection ( "test" );	
+        Assert ( ngs_test_engine::ReadCollectionItf::instanceCount == 1 );
+    }
+    Assert ( ngs_test_engine::ReadCollectionItf::instanceCount == 0 );
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getName )
+    ngs::String name = rc.getName ();
+    Assert ( "test" == name );
+TEST_END
+
+TEST_BEGIN ( ReadCollection_Duplicate )
+    {
+        ngs::ReadCollection rc1 = ngs_test_engine::NGS::openReadCollection ( "test" );	
+        Assert ( ngs_test_engine::ReadCollectionItf::instanceCount == 1 );
+
+        ngs::ReadCollection rc2 = rc1;
+        Assert ( ngs_test_engine::ReadCollectionItf::instanceCount == 1 );
+
+        ngs::String name = rc2.getName ();
+        Assert ( "test" == name );
+    }
+    Assert ( ngs_test_engine::ReadCollectionItf::instanceCount == 0 );
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getReadGroups )
+    ngs::ReadGroupIterator rgs = rc.getReadGroups ();
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getReadGroup )
+    ngs::ReadGroup rgs = rc.getReadGroup ( "readgroup" );
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getReferences )
+    ngs::ReferenceIterator refs = rc.getReferences ();
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getReference )
+    ngs::Reference ref = rc.getReference ( "reference" );
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getAlignment )
+    ngs::Alignment al = rc.getAlignment ("alignment" );
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getAlignments )
+    ngs::AlignmentIterator als = rc.getAlignments ( ngs::Alignment::all );
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getAlignmentCount )
+    uint64_t count = rc.getAlignmentCount ( ngs::Alignment::all );
+    Assert ( 13 == count );
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getAlignmentRange )
+    ngs::AlignmentIterator als = rc.getAlignmentRange ( 1, 20, ngs::Alignment::all );
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getRead )
+    ngs::Read read = rc.getRead ( "read" );
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getReads )
+    ngs::ReadIterator read = rc.getReads ( ngs::Read::all );
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getReadCount )
+    uint64_t count = rc.getReadCount ( ngs::Read::all );
+    Assert ( 26 == count );
+TEST_END
+
+TEST_BEGIN_READCOLLECTION ( ReadCollection_getReadRange )
+    ngs::ReadIterator read = rc.getReadRange ( 1, 25, ngs::Read::all );
+TEST_END
+
+void TestReadCollection()
+{
+    ReadCollection_CreateDestroy ();
+    ReadCollection_getName ();
+    ReadCollection_getReadGroups ();
+    ReadCollection_getReadGroup ();
+    ReadCollection_getReferences ();
+    ReadCollection_getReference ();
+    ReadCollection_getAlignment ();
+    ReadCollection_getAlignments ();
+    ReadCollection_getAlignmentCount ();
+    ReadCollection_getAlignmentRange ();
+    ReadCollection_getRead ();
+    ReadCollection_getReads ();
+    ReadCollection_getReadCount();
+    ReadCollection_getReadRange();
+}
+
+/////////// ReadGroup
+TEST_BEGIN_READCOLLECTION ( ReadGroup_Iteration )
+    ngs::ReadGroupIterator readGroupIt = rc.getReadGroups ();
+    // 2 read groups
+    Assert ( readGroupIt.nextReadGroup() );
+    Assert ( readGroupIt.nextReadGroup() );
+    Assert ( ! readGroupIt.nextReadGroup() );
+TEST_END
+
+#define TEST_BEGIN_READGROUP( v ) \
+    TEST_BEGIN_READCOLLECTION ( v ) \
+        ngs::ReadGroupIterator readGroupIt = rc.getReadGroups (); \
+        Assert ( readGroupIt.nextReadGroup() ); \
+        ngs::ReadGroup readGroup = readGroupIt;
+        
+TEST_BEGIN_READGROUP ( ReadGroup_getName )
+    ngs::String name = readGroup.getName();
+    Assert ( "readgroup" == name );
+TEST_END
+
+TEST_BEGIN_READGROUP ( ReadGroup_getStatistics )
+    ngs::Statistics stat = readGroup.getStatistics();
+TEST_END
+
+void TestReadGroup()
+{
+    ReadGroup_Iteration ();
+    ReadGroup_getName ();
+    ReadGroup_getStatistics();
+}
+
+/////////// Reference
+TEST_BEGIN_READCOLLECTION ( Reference_Iteration )
+    ngs::ReferenceIterator refs = rc.getReferences();
+    // 3 references
+    Assert ( refs.nextReference() );
+    Assert ( refs.nextReference() );
+    Assert ( refs.nextReference() );
+    Assert ( ! refs.nextReference() );
+TEST_END
+
+#define TEST_BEGIN_REFERENCE( v ) \
+    TEST_BEGIN_READCOLLECTION ( v ) \
+        ngs::ReferenceIterator refs = rc.getReferences(); \
+        Assert ( refs.nextReference() );
+
+TEST_BEGIN_REFERENCE ( Reference_getCommonName )
+    ngs::String name = refs.getCommonName();
+    Assert ( "common name" == name );
+TEST_END
+
+TEST_BEGIN_REFERENCE ( Reference_getCanonicalName )
+    ngs::String name = refs.getCanonicalName();
+    Assert ( "canonical name" == name );
+TEST_END
+
+TEST_BEGIN_REFERENCE ( Reference_getIsCircular )
+    Assert ( ! refs.getIsCircular() );
+TEST_END
+
+TEST_BEGIN_REFERENCE ( Reference_getLength )
+    uint64_t length = refs.getLength ();
+    Assert ( 101 == length );
+TEST_END
+
+TEST_BEGIN_REFERENCE ( Reference_getReferenceBases )
+    ngs::String bases = refs.getReferenceBases ( 1, 100 );
+    Assert ( "CAGT" == bases );
+TEST_END
+
+TEST_BEGIN_REFERENCE ( Reference_getReferenceChunk )
+    ngs::String chunk = refs.getReferenceChunk ( 2, 20 ).toString ();
+    Assert ( "AG" == chunk );
+TEST_END
+
+TEST_BEGIN_REFERENCE( Reference_getAlignment )
+    ngs::Alignment al = refs.getAlignment ("alignment" );
+TEST_END
+
+TEST_BEGIN_REFERENCE( Reference_getAlignments )
+    ngs::AlignmentIterator als = refs.getAlignments ( ngs::Alignment::all );
+TEST_END
+
+TEST_BEGIN_REFERENCE( Reference_getAlignmentSlice )
+    ngs::AlignmentIterator als = refs.getAlignmentSlice ( 3, 2, ngs::Alignment::all );
+TEST_END
+
+TEST_BEGIN_REFERENCE( Reference_getPileups )
+    ngs::PileupIterator pups = refs.getPileups ( ngs::Alignment::all );
+TEST_END
+
+TEST_BEGIN_REFERENCE( Reference_getPileupSlice )
+    ngs::PileupIterator pups = refs.getPileupSlice ( 2, 5, ngs::Alignment::all );
+TEST_END
+
+void TestReference()
+{
+    Reference_Iteration ();
+
+    Reference_getCommonName ();
+    Reference_getCanonicalName ();
+    Reference_getIsCircular ();
+    Reference_getLength ();
+    Reference_getReferenceBases ();
+    Reference_getReferenceChunk ();
+    Reference_getAlignment ();
+    Reference_getAlignments ();
+    Reference_getAlignmentSlice ();
+    Reference_getPileups();
+    Reference_getPileupSlice();
+}
+
+/////////// Read
+
+TEST_BEGIN_READCOLLECTION ( Read_Iteration)
+    ngs::ReadIterator it = rc.getReads( ngs::Read::all );
+    // 6 reads
+    Assert ( it.nextRead() );
+    Assert ( it.nextRead() );
+    Assert ( it.nextRead() );
+    Assert ( it.nextRead() );
+    Assert ( it.nextRead() );
+    Assert ( it.nextRead() );
+    Assert ( ! it.nextRead() );
+TEST_END
+
+#define TEST_BEGIN_READ( v ) \
+    TEST_BEGIN_READCOLLECTION ( v ) \
+        ngs::Read read = rc.getRead("read");
+
+TEST_BEGIN_READ ( Read_getFragmentId )
+    ngs::String id = read.getFragmentId().toString();
+    Assert ( "readFragId" == id );
+TEST_END
+
+TEST_BEGIN_READ( Read_getFragmentBases )
+    ngs::String bases = read.getFragmentBases().toString();
+    Assert ( "AGCT" == bases );
+TEST_END
+
+TEST_BEGIN_READ( Read_getFragmentBasesOffset )
+    ngs::String bases = read.getFragmentBases( 1 ).toString();
+    Assert ( "GCT" == bases );
+TEST_END
+
+TEST_BEGIN_READ( Read_getFragmentBasesOffsetLength )
+    ngs::String bases = read.getFragmentBases( 1, 2 ).toString();
+    Assert ( "GC" == bases );
+TEST_END
+
+TEST_BEGIN_READ( Read_getFragmentQualities )
+    ngs::String quals = read.getFragmentQualities().toString();
+    Assert ( "bbd^" == quals );
+TEST_END
+
+TEST_BEGIN_READ( Read_getFragmentQualitiesOffset )
+    ngs::String quals = read.getFragmentQualities( 1 ).toString();
+    Assert ( "bd^" == quals );
+TEST_END
+
+TEST_BEGIN_READ( Read_getFragmentQualitiesOffsetLength )
+    ngs::String quals = read.getFragmentQualities( 1, 2 ).toString();
+    Assert ( "bd" == quals );
+TEST_END
+
+TEST_BEGIN_READ( Read_IterationFragments )
+    // 2 fragments
+    Assert ( read.nextFragment() );
+    Assert ( read.nextFragment() );
+    Assert ( ! read.nextFragment() );
+TEST_END
+
+TEST_BEGIN_READ( Read_getReadId )
+    ngs::String id = read.getReadId().toString();
+    Assert ( "readId" == id );
+TEST_END
+
+TEST_BEGIN_READ( Read_getNumFragments )
+    uint32_t count = read.getNumFragments();
+    Assert ( 2 == count );
+TEST_END
+
+TEST_BEGIN_READ( Read_getReadCategory )
+    ngs::Read::ReadCategory cat = read.getReadCategory();
+    Assert ( ngs::Read::partiallyAligned == cat );
+TEST_END
+
+TEST_BEGIN_READ( Read_getReadGroup )
+    ngs::String name = read.getReadGroup();
+    Assert ( "readGroup" == name );
+TEST_END
+
+TEST_BEGIN_READ( Read_getReadName )
+    ngs::String name = read.getReadName().toString();
+    Assert ( "readName" == name );
+TEST_END
+
+TEST_BEGIN_READ( Read_getReadBases )
+    ngs::String bases = read.getReadBases().toString();
+    Assert ( "TGCA" == bases );
+TEST_END
+
+TEST_BEGIN_READ( Read_getReadBasesOffset )
+    ngs::String bases = read.getReadBases( 1 ).toString();
+    Assert ( "GCA" == bases );
+TEST_END
+
+TEST_BEGIN_READ( Read_getReadBasesOffsetLength )
+    ngs::String bases = read.getReadBases( 1, 2 ).toString();
+    Assert ( "GC" == bases );
+TEST_END
+
+TEST_BEGIN_READ( Read_getReadQualities )
+    ngs::String quals = read.getReadQualities().toString();
+    Assert ( "qrst" == quals );
+TEST_END
+
+TEST_BEGIN_READ( Read_getReadQualitiesOffset )
+    ngs::String quals = read.getReadQualities( 1 ).toString();
+    Assert ( "rst" == quals );
+TEST_END
+
+TEST_BEGIN_READ( Read_getReadQualitiesOffsetLength )
+    ngs::String quals = read.getReadQualities( 1, 2 ).toString();
+    Assert ( "rs" == quals );
+TEST_END
+
+void TestRead ()
+{
+    Read_Iteration ();
+
+    Read_getFragmentId ();
+    Read_getFragmentBases ();
+    Read_getFragmentBasesOffset ();
+    Read_getFragmentBasesOffsetLength ();
+    Read_getFragmentQualities();
+    Read_getFragmentQualitiesOffset ();
+    Read_getFragmentQualitiesOffsetLength ();
+    
+    Read_IterationFragments ();
+    
+    Read_getReadId ();
+    Read_getNumFragments ();
+    Read_getReadCategory ();
+    Read_getReadGroup ();
+    Read_getReadName ();
+    Read_getReadBases ();
+    Read_getReadBasesOffset ();
+    Read_getReadBasesOffsetLength ();
+    Read_getReadQualities();
+    Read_getReadQualitiesOffset ();
+    Read_getReadQualitiesOffsetLength ();
+}
+
+/////////// Alignment
+
+TEST_BEGIN_READCOLLECTION ( Alignment_Iteration )
+    ngs::AlignmentIterator it = rc.getAlignments ( ngs::Alignment::all );
+    // 4 alignments
+    Assert ( it.nextAlignment() );
+    Assert ( it.nextAlignment() );
+    Assert ( it.nextAlignment() );
+    Assert ( it.nextAlignment() );
+    Assert ( ! it.nextAlignment() );
+TEST_END
+
+
+#define TEST_BEGIN_ALIGNMENT( v ) \
+    TEST_BEGIN_READCOLLECTION ( v ) \
+        ngs::Alignment align = rc.getAlignment("align");
+
+TEST_BEGIN_ALIGNMENT( Alignment_getFragmentId )
+    ngs::String id = align.getFragmentId().toString();
+    Assert ( "alignFragId" == id );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getFragmentBases )
+    ngs::String bases = align.getFragmentBases().toString();
+    Assert ( "AGCT" == bases );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getFragmentBasesOffset )
+    ngs::String bases = align.getFragmentBases( 1 ).toString();
+    Assert ( "GCT" == bases );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getFragmentBasesOffsetLength )
+    ngs::String bases = align.getFragmentBases( 1, 2 ).toString();
+    Assert ( "GC" == bases );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getFragmentQualities )
+    ngs::String quals = align.getFragmentQualities().toString();
+    Assert ( "bbd^" == quals );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getFragmentQualitiesOffset )
+    ngs::String quals = align.getFragmentQualities( 1 ).toString();
+    Assert ( "bd^" == quals );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getFragmentQualitiesOffsetLength )
+    ngs::String quals = align.getFragmentQualities( 1, 2 ).toString();
+    Assert ( "bd" == quals );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getAlignmentId )
+    ngs::String id = align.getAlignmentId().toString();
+    Assert ( "align" == id );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getReferenceSpec )
+    ngs::String spec = align.getReferenceSpec();
+    Assert ( "referenceSpec" == spec );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getMappingQuality )
+    int qual = align.getMappingQuality();
+    Assert ( 90 == qual );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getReferenceBases )
+    ngs::String bases = align.getReferenceBases().toString();
+    Assert ( "CTAG" == bases );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getReadGroup )
+    ngs::String name = align.getReadGroup();
+    Assert ( "alignReadGroup" == name );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getReadId )
+    ngs::String id = align.getReadId().toString();
+    Assert ( "alignReadId" == id );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getClippedFragmentBases )
+    ngs::String bases = align.getClippedFragmentBases().toString();
+    Assert ( "TA" == bases );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getClippedFragmentQualities )
+    ngs::String quals = align.getClippedFragmentQualities().toString();
+    Assert ( "bd" == quals );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getAlignedFragmentBases )
+    ngs::String bases = align.getAlignedFragmentBases().toString();
+    Assert ( "AC" == bases );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getAlignmentCategory )
+    ngs::Alignment::AlignmentCategory cat = align.getAlignmentCategory();
+    Assert ( ngs::Alignment::secondaryAlignment == cat );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getAlignmentPosition )
+    int64_t pos = align.getAlignmentPosition();
+    Assert ( 123 == pos );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getAlignmentLength )
+    uint64_t len = align.getAlignmentLength();
+    Assert ( 321 == len );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getIsReversedOrientation )
+    Assert ( align.getIsReversedOrientation() );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getSoftClip )
+    int clip = align.getSoftClip( ngs::Alignment::clipRight );
+    Assert ( 2 == clip );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getTemplateLength )
+    uint64_t len = align.getTemplateLength();
+    Assert ( 17 == len );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getShortCigar )
+    ngs::String cigar = align.getShortCigar( true ).toString();
+    Assert ( "MD" == cigar );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getLongCigar )
+    ngs::String cigar = align.getLongCigar( false ).toString();
+    Assert ( "MDNA" == cigar );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_hasMate )
+    Assert ( align.hasMate() );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getMateAlignmentId )
+    ngs::String id = align.getMateAlignmentId().toString();
+    Assert ( "mateId" == id );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getMateAlignment )
+    ngs::Alignment mate = align.getMateAlignment();
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getMateReferenceSpec )
+    ngs::String spec = align.getMateReferenceSpec();
+    Assert ( "mateReferenceSpec" == spec );
+TEST_END
+
+TEST_BEGIN_ALIGNMENT( Alignment_getMateIsReversedOrientation )
+    Assert ( align.getMateIsReversedOrientation() );
+TEST_END
+
+
+void TestAlignment ()
+{
+    Alignment_Iteration ();
+
+    Alignment_getFragmentId ();
+    Alignment_getFragmentBases ();
+    Alignment_getFragmentBasesOffset ();
+    Alignment_getFragmentBasesOffsetLength ();
+    Alignment_getFragmentQualities();
+    Alignment_getFragmentQualitiesOffset ();
+    Alignment_getFragmentQualitiesOffsetLength ();
+
+    Alignment_getAlignmentId ();
+    Alignment_getReferenceSpec ();
+    Alignment_getMappingQuality ();
+    Alignment_getReferenceBases ();
+    Alignment_getReadGroup ();
+    Alignment_getReadId ();
+    Alignment_getClippedFragmentBases ();
+    Alignment_getClippedFragmentQualities ();
+    Alignment_getAlignedFragmentBases ();
+    Alignment_getAlignmentCategory ();
+    Alignment_getAlignmentPosition ();
+    Alignment_getAlignmentLength ();
+    Alignment_getIsReversedOrientation ();
+    Alignment_getSoftClip ();
+    Alignment_getTemplateLength ();
+    Alignment_getShortCigar ();
+    Alignment_getLongCigar ();
+    Alignment_hasMate ();
+    Alignment_getMateAlignmentId ();
+    Alignment_getMateAlignment ();
+    Alignment_getMateReferenceSpec ();
+    Alignment_getMateIsReversedOrientation ();
+}
+
+/////////// Pileup
+
+TEST_BEGIN_READCOLLECTION ( Pileup_Iteration )
+    ngs::PileupIterator it = rc.getReference ( "refspec" ) .getPileups ( ngs::Alignment::all );
+    // 3 pileups
+    Assert ( it.nextPileup () );
+    Assert ( it.nextPileup () );
+    Assert ( it.nextPileup () );
+    Assert ( ! it.nextPileup () );
+TEST_END
+
+#define TEST_BEGIN_PILEUP( v ) \
+    TEST_BEGIN_READCOLLECTION ( v ) \
+        ngs::PileupIterator it = rc.getReference ( "refspec" ) .getPileups ( ngs::Alignment::all ); \
+        Assert ( it.nextPileup () ); \
+        ngs::Pileup pileup = it;
+
+TEST_BEGIN_PILEUP ( Pileup_getReferenceSpec )
+    Assert ( "pileupRefSpec" == pileup.getReferenceSpec() );
+TEST_END
+
+TEST_BEGIN_PILEUP ( Pileup_getReferencePosition )
+    Assert ( 12345 == pileup.getReferencePosition() );
+TEST_END
+
+TEST_BEGIN_PILEUP ( Pileup_getPileupEvents )
+    ngs::PileupEventIterator events = pileup.getPileupEvents ();
+TEST_END
+
+TEST_BEGIN_PILEUP ( Pileup_getPileupDepth )
+    Assert ( 21 == pileup.getPileupDepth() );
+TEST_END
+
+void TestPileup ()
+{
+    Pileup_Iteration ();
+
+    Pileup_getReferenceSpec ();
+    Pileup_getReferencePosition ();
+    Pileup_getPileupEvents ();
+    Pileup_getPileupDepth ();
+}
+
+/////////// PileupEvent
+
+TEST_BEGIN_READCOLLECTION ( PileupEvent_Iteration )
+    ngs::PileupIterator pileupIt = rc.getReference ( "refspec" ) .getPileups ( ngs::Alignment::all );
+    Assert ( pileupIt.nextPileup () );
+    ngs::PileupEventIterator eventIt = pileupIt.getPileupEvents();
+    // 7 events
+    Assert ( eventIt.nextPileupEvent () );
+    Assert ( eventIt.nextPileupEvent () );
+    Assert ( eventIt.nextPileupEvent () );
+    Assert ( eventIt.nextPileupEvent () );
+    Assert ( eventIt.nextPileupEvent () );
+    Assert ( eventIt.nextPileupEvent () );
+    Assert ( eventIt.nextPileupEvent () );
+    Assert ( ! eventIt.nextPileupEvent () );
+TEST_END
+
+#define TEST_BEGIN_PILEUPEVENT( v ) \
+    TEST_BEGIN_READCOLLECTION ( v ) \
+        ngs::PileupIterator pileupIt = rc.getReference ( "refspec" ) .getPileups ( ngs::Alignment::all ); \
+        Assert ( pileupIt.nextPileup () ); \
+        ngs::PileupEventIterator eventIt = pileupIt.getPileupEvents(); \
+        Assert ( eventIt.nextPileupEvent () ); \
+        ngs::PileupEvent evt = eventIt;
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getReferenceSpec )
+    Assert ( "pileupEventRefSpec" == evt.getReferenceSpec() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getReferencePosition )
+    Assert ( 1234 == evt.getReferencePosition() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getMappingQuality )
+    Assert ( 98 == evt.getMappingQuality() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getAlignmentId )
+    Assert ( "pileupEventAlignId" == evt.getAlignmentId().toString() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getAlignment )
+    ngs::Alignment al = evt.getAlignment();
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getAlignmentPosition )
+    Assert ( 5678 == evt.getAlignmentPosition() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getFirstAlignmentPosition )
+    Assert ( 90123 == evt.getFirstAlignmentPosition() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getLastAlignmentPosition )
+    Assert ( 45678 == evt.getLastAlignmentPosition() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getEventType )
+    Assert ( ngs::PileupEvent::mismatch == evt.getEventType() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getAlignmentBase )
+    Assert ( 'A' == evt.getAlignmentBase() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getAlignmentQuality)
+    Assert ( 'q' == evt.getAlignmentQuality() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getInsertionBases)
+    Assert ( "AC" == evt.getInsertionBases().toString() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getInsertionQualities)
+    Assert ( "#$" == evt.getInsertionQualities().toString() );
+TEST_END
+
+TEST_BEGIN_PILEUPEVENT ( PileupEvent_getDeletionCount)
+    Assert ( 23 == evt.getDeletionCount() );
+TEST_END
+
+void TestPileupEvent ()
+{
+    PileupEvent_Iteration();
+
+    PileupEvent_getReferenceSpec ();
+    PileupEvent_getReferencePosition ();
+    PileupEvent_getMappingQuality ();
+    PileupEvent_getAlignmentId ();
+    PileupEvent_getAlignment ();
+    PileupEvent_getAlignmentPosition ();
+    PileupEvent_getFirstAlignmentPosition ();
+    PileupEvent_getLastAlignmentPosition ();
+    PileupEvent_getEventType ();
+    PileupEvent_getAlignmentBase ();
+    PileupEvent_getAlignmentQuality ();
+    PileupEvent_getInsertionBases ();
+    PileupEvent_getInsertionQualities ();
+    PileupEvent_getDeletionCount ();
+
+}
+
+/////////// Statistics
+#define TEST_BEGIN_STATISTICS( v ) \
+    TEST_BEGIN_READCOLLECTION ( v ) \
+        ngs::ReadGroupIterator readGroupIt = rc.getReadGroups (); \
+        Assert ( readGroupIt.nextReadGroup() ); \
+        ngs::ReadGroup readGroup = readGroupIt; \
+        ngs::Statistics stat = readGroup.getStatistics();
+
+TEST_BEGIN_STATISTICS ( Statistics_getValueType)
+    Assert ( ngs::Statistics::uint64 == stat.getValueType("path") );
+TEST_END
+
+TEST_BEGIN_STATISTICS ( Statistics_getAsString)
+    Assert ( "string" == stat.getAsString("path") );
+TEST_END
+
+TEST_BEGIN_STATISTICS ( Statistics_getAsI64)
+    Assert ( -14 == stat.getAsI64("path") );
+TEST_END
+
+TEST_BEGIN_STATISTICS ( Statistics_getAsU64)
+    Assert ( 144 == stat.getAsU64("path") );
+TEST_END
+
+TEST_BEGIN_STATISTICS ( Statistics_getAsDouble)
+    Assert ( 3.14 == stat.getAsDouble("path") );
+TEST_END
+
+TEST_BEGIN_STATISTICS ( Statistics_nextPath)
+    Assert ( "nextpath" == stat.nextPath("path") );
+TEST_END
+
+void TestStatistics ()
+{
+    Statistics_getValueType ();
+    Statistics_getAsString ();
+    Statistics_getAsI64 ();
+    Statistics_getAsU64 ();
+    Statistics_getAsDouble ();
+    Statistics_nextPath ();
+}
+
+/////////// main
+
+int main ()
+{
+    ReadCollection_Duplicate(); // call this one first to test correct population of static vtables!
+
+    TestReadCollection ();
+    TestReadGroup ();
+    TestReference ();
+    TestRead ();
+    TestAlignment ();
+    TestPileup ();
+    TestPileupEvent ();
+    TestStatistics ();
+
+
+    // check for object leaks
+    Assert ( ngs_test_engine::ReadCollectionItf::instanceCount == 0 );
+    Assert ( ngs_test_engine::ReadGroupItf::instanceCount == 0 );
+    Assert ( ngs_test_engine::ReferenceItf::instanceCount == 0 );
+    Assert ( ngs_test_engine::ReadItf::instanceCount == 0 );
+    Assert ( ngs_test_engine::AlignmentItf::instanceCount == 0 );
+    Assert ( ngs_test_engine::PileupItf::instanceCount == 0 );
+    Assert ( ngs_test_engine::PileupEventItf::instanceCount == 0 );
+
+    // report results
+    std :: cout << "Test cases run: " << tests_run << std::endl;
+    std :: cout << "Test cases passed: " << tests_passed << std::endl;
+    if ( tests_failed > 0 )
+    {
+        std :: cout << "Test cases failed: " << tests_failed << std::endl;
+        return -1;
+    }
+    return 0;
+}
\ No newline at end of file
diff --git a/ngs-sdk/test/test_engine/AlignmentItf.hpp b/ngs-sdk/test/test_engine/AlignmentItf.hpp
new file mode 100644
index 0000000..9612843
--- /dev/null
+++ b/ngs-sdk/test/test_engine/AlignmentItf.hpp
@@ -0,0 +1,232 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_test_engine_alignmentitf_
+#define _hpp_ngs_test_engine_alignmentitf_
+
+#include <ngs/adapter/ErrorMsg.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/AlignmentItf.hpp>
+
+namespace ngs_test_engine
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+
+    /*----------------------------------------------------------------------
+     * AlignmentItf
+     */
+    class AlignmentItf : public ngs_adapt :: AlignmentItf
+    {
+    public:
+
+        virtual ngs_adapt::StringItf * getFragmentId () const 
+        {
+            static std::string id = "alignFragId";
+            return new ngs_adapt::StringItf( id.c_str(), id.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getFragmentBases ( uint64_t offset, uint64_t length ) const 
+        {
+            static std::string bases = "AGCT";
+            static std::string substr;
+            substr = bases.substr( ( size_t ) offset, length == (uint64_t)-1 ? std::string::npos : ( size_t ) length );
+            return new ngs_adapt::StringItf( substr.c_str(), substr.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getFragmentQualities ( uint64_t offset, uint64_t length ) const 
+        {
+            static std::string quals = "bbd^";
+            static std::string substr;
+            substr = quals.substr( ( size_t ) offset, length == (uint64_t)-1 ? std::string::npos : ( size_t ) length );
+            return new ngs_adapt::StringItf( substr.c_str(), substr.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getAlignmentId () const 
+        {
+            return new ngs_adapt::StringItf( id.c_str(), id.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getReferenceSpec () const
+        {
+            static std::string spec = "referenceSpec";
+            return new ngs_adapt::StringItf( spec.c_str(), spec.size() ); 
+        }
+
+        virtual int32_t getMappingQuality () const 
+        { 
+            return 90; 
+        }
+
+        virtual ngs_adapt::StringItf * getReferenceBases () const 
+        {
+            static std::string bases = "CTAG";
+            return new ngs_adapt::StringItf( bases.c_str(), bases.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getReadGroup () const
+        {
+            static std::string rg = "alignReadGroup";
+            return new ngs_adapt::StringItf( rg.c_str(), rg.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getReadId () const
+        {
+            static std::string id = "alignReadId";
+            return new ngs_adapt::StringItf( id.c_str(), id.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getClippedFragmentBases () const
+        {
+            static std::string bases = "TA";
+            return new ngs_adapt::StringItf( bases.c_str(), bases.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getClippedFragmentQualities () const
+        {
+            static std::string quals = "bd";
+            return new ngs_adapt::StringItf( quals.c_str(), quals.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getAlignedFragmentBases () const
+        {
+            static std::string bases = "AC";
+            return new ngs_adapt::StringItf( bases.c_str(), bases.size() ); 
+        }
+
+        virtual bool isPrimary () const 
+        { 
+            return false; 
+        }
+
+        virtual int64_t getAlignmentPosition () const 
+        { 
+            return 123; 
+        }
+
+        virtual uint64_t getAlignmentLength () const 
+        { 
+            return 321; 
+        }
+
+        virtual bool getIsReversedOrientation () const 
+        { 
+            return true; 
+        }
+
+        virtual int32_t getSoftClip ( uint32_t edge ) const 
+        { 
+            return edge + 1; 
+        }
+
+        virtual uint64_t getTemplateLength () const 
+        { 
+            return 17; 
+        }
+
+        virtual ngs_adapt::StringItf * getShortCigar ( bool clipped ) const 
+        { 
+            static std::string cigar = "MD";
+            return new ngs_adapt::StringItf( cigar.c_str(), cigar.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getLongCigar ( bool clipped ) const 
+        { 
+            static std::string cigar = "MDNA";
+            return new ngs_adapt::StringItf( cigar.c_str(), cigar.size() ); 
+        }
+
+        virtual bool hasMate () const 
+        { 
+            return true; 
+        }
+
+        virtual ngs_adapt::StringItf * getMateAlignmentId () const 
+        { 
+            static std::string id = "mateId";
+            return new ngs_adapt::StringItf( id.c_str(), id.size() ); 
+        }
+
+        virtual ngs_adapt::AlignmentItf * getMateAlignment () const 
+        { 
+            return new ngs_test_engine::AlignmentItf(); 
+        }
+
+        virtual ngs_adapt::StringItf * getMateReferenceSpec () const 
+        {
+            static std::string spec = "mateReferenceSpec";
+            return new ngs_adapt::StringItf( spec.c_str(), spec.size() ); 
+        }
+
+        virtual bool getMateIsReversedOrientation () const 
+        { 
+            return true; 
+        }
+
+        virtual bool nextAlignment () 
+        { 
+            switch ( iterateFor )
+            {
+            case -1:    throw ngs_adapt::ErrorMsg ( "invalid iterator access" );
+            case 0:     return false;
+            default:    --iterateFor; return true;
+            }
+        }
+
+	public:
+		AlignmentItf () 
+        :   iterateFor(-1)
+        { 
+            ++instanceCount;
+        }
+		AlignmentItf ( const char* p_id ) 
+        :   id(p_id), 
+            iterateFor(-1)
+        { 
+            ++instanceCount;
+        }
+		AlignmentItf ( unsigned int p_iterateFor ) 
+        :   iterateFor( ( int ) p_iterateFor )
+        { 
+            ++instanceCount;
+        }
+		
+        ~AlignmentItf () 
+        { 
+            --instanceCount;
+        }
+
+        static NGS_EXTERN  unsigned int instanceCount;
+
+        std::string id;
+        int iterateFor;
+    };
+
+} // namespace ngs_test_engine
+
+#endif // _hpp_ngs_test_engine_alignmentitf_
diff --git a/ngs-sdk/test/test_engine/Makefile b/ngs-sdk/test/test_engine/Makefile
new file mode 100644
index 0000000..db82a35
--- /dev/null
+++ b/ngs-sdk/test/test_engine/Makefile
@@ -0,0 +1,64 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+include $(TOP)/Makefile.config
+
+TARGETS =      \
+    test_engine
+
+all std: $(TARGETS)
+
+clean:
+	rm -rf $(LIBDIR)/$(LPFX)test_engine* $(OBJDIR)
+
+.PHONY: default all std $(TARGETS)
+
+test_engine: $(LIBDIR) $(OBJDIR) $(LIBDIR)/$(LPFX)test_engine.$(SHLX)
+
+runtests: test_engine
+
+#-------------------------------------------------------------------------------
+# test-ngs
+#
+TEST_ENGINE_SRC = \
+    test_engine
+
+TEST_ENGINE_OBJ = \
+	$(addprefix $(OBJDIR)/,$(addsuffix .$(LOBX),$(TEST_ENGINE_SRC)))
+
+TEST_ENGINE_LIB = \
+    -lngs-adapt-c++ \
+	-lngs-bind-c++ \
+	-lngs-disp
+
+$(LIBDIR)/$(LPFX)test_engine.$(SHLX): $(LIBDIR)/$(LPFX)ngs-adapt-c++.$(LIBX) $(TEST_ENGINE_OBJ) 
+	$(LP) --shared -o $@ $(TEST_ENGINE_OBJ) -L$(LIBDIR) -L$(ILIBDIR) $(TEST_ENGINE_LIB)
+
+$(LIBDIR)/$(LPFX)ngs-adapt-c++.$(LIBX):
+	@ echo missing $@
+	@ false
diff --git a/ngs-sdk/test/test_engine/PileupEventItf.hpp b/ngs-sdk/test/test_engine/PileupEventItf.hpp
new file mode 100644
index 0000000..06411a1
--- /dev/null
+++ b/ngs-sdk/test/test_engine/PileupEventItf.hpp
@@ -0,0 +1,149 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_test_engine_pileupeventitf_
+#define _hpp_ngs_test_engine_pileupeventitf_
+
+#include <ngs/adapter/ErrorMsg.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/PileupEventItf.hpp>
+
+namespace ngs_test_engine
+{
+    /*======================================================================
+     * PileupEventItf
+     *  represents a single cell of a sparse 2D matrix
+     *  with Reference coordinates on one axis
+     *  and stacked Alignments on the other axis
+     */
+    class PileupEventItf : public ngs_adapt::PileupEventItf
+    {
+    public:
+    
+        virtual ngs_adapt::StringItf * getReferenceSpec () const 
+        {
+            static std::string refspec = "pileupEventRefSpec";
+            return new ngs_adapt::StringItf ( refspec.c_str(), refspec.size() );
+        }
+
+        virtual int64_t getReferencePosition () const 
+        {
+            return 1234;
+        }
+
+        virtual int32_t getMappingQuality () const 
+        {
+            return 98;
+        }
+
+        virtual ngs_adapt::StringItf * getAlignmentId () const
+        {
+            static std::string alId = "pileupEventAlignId";
+            return new ngs_adapt::StringItf ( alId.c_str(), alId.size() );
+        }
+
+        virtual ngs_adapt::AlignmentItf * getAlignment () const
+        {
+            return new ngs_test_engine::AlignmentItf();
+        }
+
+        virtual int64_t getAlignmentPosition () const
+        {
+            return 5678;
+        }
+
+        virtual int64_t getFirstAlignmentPosition () const
+        {
+            return 90123;
+        }
+
+        virtual int64_t getLastAlignmentPosition () const
+        {
+            return 45678;
+        }
+
+        virtual uint32_t getEventType () const
+        {
+            return 1;
+        }
+
+        virtual char getAlignmentBase () const
+        {
+            return 'A';
+        }
+
+        virtual char getAlignmentQuality () const
+        {
+            return 'q';
+        }
+
+        virtual ngs_adapt::StringItf * getInsertionBases () const
+        {
+            static std::string bases = "AC";
+            return new ngs_adapt::StringItf ( bases.c_str(), bases.size() );
+        }
+
+        virtual ngs_adapt::StringItf * getInsertionQualities () const
+        {
+            static std::string quals = "#$";
+            return new ngs_adapt::StringItf ( quals.c_str(), quals.size() );
+        }
+
+        virtual uint32_t getDeletionCount () const
+        {
+            return 23;
+        }
+
+        virtual bool nextPileupEvent ()
+        {
+            switch ( iterateFor )
+            {
+            case -1:    throw ngs_adapt::ErrorMsg ( "invalid iterator access" );
+            case 0:     return false;
+            default:    --iterateFor; return true;
+            }
+        }
+
+	public:
+		PileupEventItf ( unsigned int p_iterateFor ) 
+        : iterateFor( p_iterateFor )
+        { 
+            ++instanceCount;
+        }
+		
+        ~PileupEventItf () 
+        { 
+            --instanceCount;
+        }
+
+        static NGS_EXTERN  unsigned int instanceCount;
+
+        unsigned int iterateFor;
+    };
+
+} // namespace ngs
+
+#endif // _hpp_ngs_test_engine_pileupeventitf_
diff --git a/ngs-sdk/test/test_engine/PileupItf.hpp b/ngs-sdk/test/test_engine/PileupItf.hpp
new file mode 100644
index 0000000..e69891a
--- /dev/null
+++ b/ngs-sdk/test/test_engine/PileupItf.hpp
@@ -0,0 +1,100 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_test_engine_pileupitf_
+#define _hpp_ngs_test_engine_pileupitf_
+
+#include <ngs/adapter/ErrorMsg.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/PileupItf.hpp>
+
+#include "PileupEventItf.hpp"
+
+namespace ngs_test_engine
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+
+    /*----------------------------------------------------------------------
+     * PileupItf
+     */
+    class PileupItf : public ngs_adapt::PileupItf
+    {
+    public:
+
+        virtual ngs_adapt::StringItf * getReferenceSpec () const
+        {
+            static std::string spec = "pileupRefSpec";
+            return new ngs_adapt::StringItf( spec.c_str(), spec.size() ); 
+        }
+
+        virtual int64_t getReferencePosition () const
+        {
+            return 12345;
+        }
+
+        virtual ngs_adapt::PileupEventItf * getPileupEvents () const 
+        { 
+            return new ngs_test_engine::PileupEventItf(7);
+        }
+
+        virtual uint32_t getPileupDepth () const 
+        { 
+            return 21; 
+        }
+
+        virtual bool nextPileup ()  
+        {
+            switch ( iterateFor )
+            {
+            case -1:    throw ngs_adapt::ErrorMsg ( "invalid iterator access" );
+            case 0:     return false;
+            default:    --iterateFor; return true;
+            }
+        }
+
+	public:
+		PileupItf ( unsigned int p_iterateFor ) 
+        : iterateFor( p_iterateFor )
+        { 
+            ++instanceCount;
+        }
+		
+        ~PileupItf () 
+        { 
+            --instanceCount;
+        }
+
+        static NGS_EXTERN  unsigned int instanceCount;
+
+        unsigned int iterateFor;
+    };
+
+} // namespace ngs_test_engine
+
+#endif // _hpp_ngs_test_engine_pileupitf_
diff --git a/ngs-sdk/test/test_engine/ReadCollectionItf.hpp b/ngs-sdk/test/test_engine/ReadCollectionItf.hpp
new file mode 100644
index 0000000..59020b6
--- /dev/null
+++ b/ngs-sdk/test/test_engine/ReadCollectionItf.hpp
@@ -0,0 +1,137 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_test_engine_read_collectionitf_
+#define _hpp_ngs_test_engine_read_collectionitf_
+
+#include <ngs/adapter/ReadCollectionItf.hpp>
+#include <ngs/adapter/StringItf.hpp>
+
+#include "ReadGroupItf.hpp"
+#include "ReferenceItf.hpp"
+#include "AlignmentItf.hpp"
+#include "ReadItf.hpp"
+
+namespace ngs_test_engine
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+
+    /*----------------------------------------------------------------------
+     * ReadCollectionItf
+     */
+    class ReadCollectionItf : public ngs_adapt::ReadCollectionItf
+    {
+    public:
+
+		virtual ngs_adapt::StringItf * getName () const 
+        { 
+            return new ngs_adapt::StringItf ( name.c_str(), name.size() ); 
+        }
+
+        virtual ngs_adapt::ReadGroupItf *	getReadGroups () const 
+        { 
+            return new ngs_test_engine::ReadGroupItf ( 2 );
+        }
+
+        virtual ngs_adapt::ReadGroupItf *	getReadGroup ( const char * spec ) const 
+        { 
+            return new ngs_test_engine::ReadGroupItf (); 
+        }
+
+        virtual ngs_adapt::ReferenceItf *	getReferences () const 
+        { 
+            return new ngs_test_engine::ReferenceItf ( 3 ); 
+        }
+
+        virtual ngs_adapt::ReferenceItf *	getReference ( const char * spec ) const 
+        { 
+            return new ngs_test_engine::ReferenceItf (); 
+        }
+
+        virtual ngs_adapt::AlignmentItf *	getAlignment ( const char * alignmentId ) const 
+        { 
+            return new ngs_test_engine::AlignmentItf ( alignmentId ); 
+        }
+
+        virtual ngs_adapt::AlignmentItf *	getAlignments ( bool wants_primary, bool wants_secondary ) const 
+        { 
+            return new ngs_test_engine::AlignmentItf ( 4 ); 
+        }
+
+        virtual uint64_t getAlignmentCount ( bool wants_primary, bool wants_secondary ) const 
+        { 
+            return 13; 
+        }
+
+        virtual ngs_adapt::AlignmentItf * getAlignmentRange ( uint64_t first, uint64_t count, bool wants_primary, bool wants_secondary ) const 
+        {
+            return new ngs_test_engine::AlignmentItf ( 2 ); 
+        }
+
+        virtual ngs_adapt::ReadItf * getRead ( const char * readId ) const 
+        {
+            return new ngs_test_engine::ReadItf ( readId ); 
+        }
+
+        virtual ngs_adapt::ReadItf * getReads ( bool wants_full, bool wants_partial, bool wants_unaligned ) const 
+        {
+            return new ngs_test_engine::ReadItf ( 6 ); 
+        }
+
+        virtual uint64_t getReadCount ( bool wants_full, bool wants_partial, bool wants_unaligned ) const 
+        { 
+            return 26; 
+        }
+
+        virtual ngs_adapt::ReadItf * getReadRange ( uint64_t first, uint64_t count, bool wants_full, bool wants_partial, bool wants_unaligned ) const 
+        {
+            return new ngs_test_engine::ReadItf ( ( unsigned int ) count ); 
+        }
+
+	public:
+		ReadCollectionItf ( const char* accession ) 
+            : name ( accession )
+        { 
+            ++instanceCount;
+        }
+		
+        ~ReadCollectionItf () 
+        { 
+            --instanceCount;
+        }
+
+        static NGS_EXTERN  unsigned int instanceCount;
+
+    private:
+        std::string name;
+    };
+
+} // namespace ngs_test_engine
+
+#endif // _hpp_ngs_test_engine_read_collectionitf_
diff --git a/ngs-sdk/test/test_engine/ReadGroupItf.hpp b/ngs-sdk/test/test_engine/ReadGroupItf.hpp
new file mode 100644
index 0000000..5a3a479
--- /dev/null
+++ b/ngs-sdk/test/test_engine/ReadGroupItf.hpp
@@ -0,0 +1,95 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_test_engine_read_groupitf_
+#define _hpp_ngs_test_engine_read_groupitf_
+
+#include <ngs/adapter/ErrorMsg.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/ReadGroupItf.hpp>
+
+#include "StatisticsItf.hpp"
+
+namespace ngs_test_engine
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+
+    /*----------------------------------------------------------------------
+     * ReadGroupItf
+     */
+    class ReadGroupItf : public ngs_adapt::ReadGroupItf
+    {
+    public:
+
+		virtual ngs_adapt::StringItf * getName () const 
+        { 
+            static std::string name = "readgroup";
+            return new ngs_adapt::StringItf ( name.c_str(), name.size() ); 
+        }
+
+        virtual ngs_adapt::StatisticsItf * getStatistics () const
+        {
+            return new ngs_test_engine::StatisticsItf();
+        }
+
+        virtual bool nextReadGroup () 
+        {
+            switch ( iterateFor )
+            {
+            case -1:    throw ngs_adapt::ErrorMsg ( "invalid iterator access" );
+            case 0:     return false;
+            default:    --iterateFor; return true;
+            }
+        }
+
+	public:
+		ReadGroupItf () 
+        : iterateFor(-1)
+        { 
+            ++instanceCount;
+        }
+		ReadGroupItf ( unsigned int p_iterateFor ) 
+        : iterateFor( ( int ) p_iterateFor )
+        { 
+            ++instanceCount;
+        }
+		
+        ~ReadGroupItf () 
+        { 
+            --instanceCount;
+        }
+
+        static NGS_EXTERN  unsigned int instanceCount;
+
+        int iterateFor;
+    };
+
+} // namespace ngs_test_engine
+
+#endif // _hpp_ngs_test_engine_read_groupitf_
diff --git a/ngs-sdk/test/test_engine/ReadItf.hpp b/ngs-sdk/test/test_engine/ReadItf.hpp
new file mode 100644
index 0000000..fe04c2d
--- /dev/null
+++ b/ngs-sdk/test/test_engine/ReadItf.hpp
@@ -0,0 +1,169 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_test_engine_readitf_
+#define _hpp_ngs_test_engine_readitf_
+
+#include <ngs/adapter/ErrorMsg.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/ReadItf.hpp>
+
+namespace ngs_test_engine
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+
+    /*----------------------------------------------------------------------
+     * ReadItf
+     */
+    class ReadItf : public ngs_adapt::ReadItf
+    {
+    public:
+
+        virtual ngs_adapt::StringItf * getFragmentId () const 
+        {
+            static std::string fragId = "readFragId";
+            return new ngs_adapt::StringItf( fragId.c_str(), fragId.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getFragmentBases ( uint64_t offset, uint64_t length ) const 
+        {
+            static std::string fragBases = "AGCT";
+            static std::string substr;
+            substr = fragBases.substr( ( size_t ) offset, length == (uint64_t)-1 ? std::string::npos : ( size_t ) length );
+            return new ngs_adapt::StringItf( substr.c_str(), substr.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getFragmentQualities ( uint64_t offset, uint64_t length ) const 
+        {
+            static std::string fragQuals = "bbd^";
+            static std::string substr;
+            substr = fragQuals.substr( ( size_t ) offset, length == (uint64_t)-1 ? std::string::npos : ( size_t ) length );
+            return new ngs_adapt::StringItf( substr.c_str(), substr.size() ); 
+        }
+
+        virtual bool nextFragment () 
+        {
+            switch ( fragmentsIterateFor )
+            {
+            case -1:    throw ngs_adapt::ErrorMsg ( "invalid iterator access" );
+            case 0:     return false;
+            default:    --fragmentsIterateFor; return true;
+            }
+        }
+
+        virtual ngs_adapt::StringItf * getReadId () const 
+        {
+            static std::string readId = "readId";
+            return new ngs_adapt::StringItf( readId.c_str(), readId.size() ); 
+        }
+
+        virtual uint32_t getNumFragments () const 
+        { 
+            return 2; 
+        }
+
+        virtual uint32_t getReadCategory () const 
+        { 
+            return ngs::Read::partiallyAligned; 
+        }
+
+        virtual ngs_adapt::StringItf * getReadGroup () const 
+        {
+            static std::string rg = "readGroup";
+            return new ngs_adapt::StringItf( rg.c_str(), rg.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getReadName () const
+        {
+            static std::string name = "readName";
+            return new ngs_adapt::StringItf( name.c_str(), name.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getReadBases ( uint64_t offset, uint64_t length ) const
+        {
+            static std::string readBases = "TGCA";
+            static std::string substr;
+            substr = readBases.substr( ( size_t ) offset, length == (uint64_t)-1 ? std::string::npos : ( size_t ) length );
+            return new ngs_adapt::StringItf( substr.c_str(), substr.size() ); 
+        }
+
+        virtual ngs_adapt::StringItf * getReadQualities ( uint64_t offset, uint64_t length ) const
+        {
+            static std::string readQuals = "qrst";
+            static std::string substr;
+            substr = readQuals.substr( ( size_t ) offset, length == (uint64_t)-1 ? std::string::npos : ( size_t ) length );
+            return new ngs_adapt::StringItf( substr.c_str(), substr.size() ); 
+        }
+
+        virtual bool nextRead () 
+        {
+            switch ( iterateFor )
+            {
+            case -1:    throw ngs_adapt::ErrorMsg ( "invalid iterator access" );
+            case 0:     return false;
+            default:    --iterateFor; return true;
+            }
+        }
+
+	public:
+		ReadItf () 
+        :   iterateFor(-1),
+            fragmentsIterateFor(2)
+        { 
+            ++instanceCount;
+        }
+		ReadItf ( const char* p_id ) 
+        :   id(p_id), 
+            iterateFor(-1),
+            fragmentsIterateFor(2)
+        { 
+            ++instanceCount;
+        }
+		ReadItf ( unsigned int p_iterateFor ) 
+        :   iterateFor( ( int ) p_iterateFor ),
+            fragmentsIterateFor(2)
+        { 
+            ++instanceCount;
+        }
+		
+        ~ReadItf () 
+        { 
+            --instanceCount;
+        }
+
+        static NGS_EXTERN  unsigned int instanceCount;
+
+        std::string id;
+        int iterateFor;
+        int fragmentsIterateFor;
+    };
+
+} // namespace ngs_test_engine
+
+#endif // _hpp_ngs_test_engine_alignmentitf_
diff --git a/ngs-sdk/test/test_engine/ReferenceItf.hpp b/ngs-sdk/test/test_engine/ReferenceItf.hpp
new file mode 100644
index 0000000..a2a1afe
--- /dev/null
+++ b/ngs-sdk/test/test_engine/ReferenceItf.hpp
@@ -0,0 +1,144 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_test_engine_referenceitf_
+#define _hpp_ngs_test_engine_referenceitf_
+
+#include <ngs/adapter/ErrorMsg.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/ReferenceItf.hpp>
+
+#include "AlignmentItf.hpp"
+#include "PileupItf.hpp"
+
+namespace ngs_test_engine
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+
+    /*----------------------------------------------------------------------
+     * ReferenceItf
+     */
+    class ReferenceItf : public ngs_adapt :: ReferenceItf
+    {
+    public:
+
+		virtual ngs_adapt :: StringItf * getCommonName () const 
+        { 
+            static std::string name = "common name";
+            return new ngs_adapt :: StringItf ( name.c_str(), name.size() ); 
+        }
+
+		virtual ngs_adapt :: StringItf * getCanonicalName () const 
+        { 
+            static std::string name = "canonical name";
+            return new ngs_adapt :: StringItf ( name.c_str(), name.size() ); 
+        }
+
+        virtual bool getIsCircular () const
+        {   
+            return false;
+        }
+
+        virtual uint64_t getLength () const
+        {
+            return 101;
+        }
+
+        virtual ngs_adapt :: StringItf * getReferenceBases ( uint64_t offset, uint64_t length ) const
+        {
+            static std::string bases= "CAGT";
+            return new ngs_adapt :: StringItf ( bases.c_str(), bases.size() ); 
+        }
+
+        virtual ngs_adapt :: StringItf * getReferenceChunk ( uint64_t offset, uint64_t length ) const
+        {
+            static std::string bases= "AG";
+            return new ngs_adapt :: StringItf ( bases.c_str(), bases.size() ); 
+        }
+
+        virtual ngs_adapt :: AlignmentItf * getAlignment ( const char * alignmentId ) const
+        {
+            return new ngs_test_engine::AlignmentItf ( alignmentId ); 
+        }
+
+        virtual ngs_adapt :: AlignmentItf * getAlignments ( bool wants_primary, bool wants_secondary ) const
+        {
+            return new ngs_test_engine::AlignmentItf ( 5 ); 
+        }
+
+        virtual ngs_adapt :: AlignmentItf * getAlignmentSlice ( int64_t start, uint64_t length, bool wants_primary, bool wants_secondary ) const
+        {
+            return new ngs_test_engine::AlignmentItf ( ( unsigned int ) length ); 
+        }
+
+        virtual ngs_adapt :: PileupItf * getPileups ( bool wants_primary, bool wants_secondary ) const
+        {
+            return new ngs_test_engine::PileupItf ( 3 ); 
+        }
+
+        virtual ngs_adapt :: PileupItf * getPileupSlice ( int64_t start, uint64_t length, bool wants_primary, bool wants_secondary ) const
+        {
+            return new ngs_test_engine::PileupItf ( ( unsigned int ) length ); 
+        }
+
+        virtual bool nextReference () 
+        {
+            switch ( iterateFor )
+            {
+            case -1:    throw ngs_adapt::ErrorMsg ( "invalid iterator access" );
+            case 0:     return false;
+            default:    --iterateFor; return true;
+            }
+        }
+
+	public:
+		ReferenceItf () 
+        : iterateFor(-1)
+        { 
+            ++instanceCount;
+        }
+		ReferenceItf ( unsigned int p_iterateFor ) 
+        : iterateFor( ( int ) p_iterateFor )
+        { 
+            ++instanceCount;
+        }
+		
+        ~ReferenceItf () 
+        { 
+            --instanceCount;
+        }
+
+        static NGS_EXTERN  unsigned int instanceCount;
+
+        int iterateFor;
+    };
+
+} // namespace ngs_test_engine
+
+#endif // _hpp_ngs_test_engine_referenceitf_
diff --git a/ngs-sdk/test/test_engine/StatisticsItf.hpp b/ngs-sdk/test/test_engine/StatisticsItf.hpp
new file mode 100644
index 0000000..d925a00
--- /dev/null
+++ b/ngs-sdk/test/test_engine/StatisticsItf.hpp
@@ -0,0 +1,92 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_test_engine_statisticsitf_
+#define _hpp_ngs_test_engine_statisticsitf_
+
+#include <ngs/adapter/ErrorMsg.hpp>
+#include <ngs/adapter/StringItf.hpp>
+#include <ngs/adapter/StatisticsItf.hpp>
+
+namespace ngs_test_engine
+{
+
+    /*----------------------------------------------------------------------
+     * forwards
+     */
+
+    /*----------------------------------------------------------------------
+     * StatisticsItf
+     */
+    class StatisticsItf : public ngs_adapt::StatisticsItf
+    {
+    public:
+
+        virtual uint32_t getValueType ( const char * path ) const 
+        { 
+            return 3; 
+        }
+
+        virtual ngs_adapt::StringItf * getAsString ( const char * path ) const 
+        { 
+            static std::string val = "string";
+            return new ngs_adapt::StringItf( val.c_str(), val.size() );         
+        }
+
+        virtual int64_t getAsI64 ( const char * path ) const
+        { 
+            return -14; 
+        }
+        virtual uint64_t getAsU64 ( const char * path ) const 
+        { 
+            return 144; 
+        }
+        virtual double getAsDouble ( const char * path ) const
+        { 
+            return 3.14; 
+        }
+        virtual ngs_adapt::StringItf * nextPath ( const char * path ) const
+        { 
+            static std::string val = "nextpath";
+            return new ngs_adapt::StringItf( val.c_str(), val.size() );         
+        }
+
+	public:
+		StatisticsItf () 
+        { 
+        }
+		
+        ~StatisticsItf () 
+        { 
+            --instanceCount;
+        }
+
+        static NGS_EXTERN  unsigned int instanceCount;
+    };
+
+} // namespace ngs_test_engine
+
+#endif // _hpp_ngs_test_engine_statisticsitf_
diff --git a/ngs-sdk/test/test_engine/test_engine.cpp b/ngs-sdk/test/test_engine/test_engine.cpp
new file mode 100644
index 0000000..5da028d
--- /dev/null
+++ b/ngs-sdk/test/test_engine/test_engine.cpp
@@ -0,0 +1,58 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "test_engine.hpp"
+
+#include "ReadCollectionItf.hpp"
+#include "ReadGroupItf.hpp"
+#include "ReferenceItf.hpp"
+#include "AlignmentItf.hpp"
+#include "ReadItf.hpp"
+#include "StatisticsItf.hpp"
+#include "PileupItf.hpp"
+#include "PileupEventItf.hpp"
+
+NGS_EXTERN  unsigned int ngs_test_engine::ReadCollectionItf::instanceCount = 0;
+NGS_EXTERN  unsigned int ngs_test_engine::ReadGroupItf::instanceCount = 0;
+NGS_EXTERN  unsigned int ngs_test_engine::ReferenceItf::instanceCount = 0;
+NGS_EXTERN  unsigned int ngs_test_engine::AlignmentItf::instanceCount = 0;
+NGS_EXTERN  unsigned int ngs_test_engine::ReadItf::instanceCount = 0;
+NGS_EXTERN  unsigned int ngs_test_engine::StatisticsItf::instanceCount = 0;
+NGS_EXTERN  unsigned int ngs_test_engine::PileupItf::instanceCount = 0;
+NGS_EXTERN  unsigned int ngs_test_engine::PileupEventItf::instanceCount = 0;
+
+namespace ngs_test_engine
+{
+
+	NGS_EXTERN  ngs::ReadCollection NGS::openReadCollection ( const String & spec ) throw ( ErrorMsg )
+	{
+        ngs_adapt::ReadCollectionItf * ad_itf = new ngs_test_engine::ReadCollectionItf ( spec . c_str () );
+        NGS_ReadCollection_v1 * c_obj = ad_itf -> Cast ();
+        ngs::ReadCollectionItf * ngs_itf = ngs::ReadCollectionItf::Cast ( c_obj );
+		return ngs::ReadCollection ( ngs_itf );
+	}
+
+}
diff --git a/ngs-sdk/test/test_engine/test_engine.hpp b/ngs-sdk/test/test_engine/test_engine.hpp
new file mode 100644
index 0000000..d5a3f5d
--- /dev/null
+++ b/ngs-sdk/test/test_engine/test_engine.hpp
@@ -0,0 +1,50 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_ngs_test_engine_
+#define _hpp_ngs_test_engine_
+
+#include <ngs/ReadCollection.hpp>
+
+namespace ngs_test_engine
+{
+	using namespace ngs;
+
+    class NGS
+    {
+    public:
+
+        /* openReadCollection
+         *  create an object representing a named collection of reads
+         *  "spec" may be a path to an object
+         *  or may be an id, accession, or URL
+         */
+        static NGS_EXTERN ReadCollection openReadCollection ( const String & spec ) throw ( ErrorMsg );
+    };
+
+} // namespace ngs_test_engine
+
+#endif // _hpp_ngs_test_engine_
diff --git a/ngs-sdk/win-configure.bat b/ngs-sdk/win-configure.bat
new file mode 100644
index 0000000..7b35820
--- /dev/null
+++ b/ngs-sdk/win-configure.bat
@@ -0,0 +1,2 @@
+perl -w ./konfigure.perl %*
+
diff --git a/ngs-sdk/win/.gitignore b/ngs-sdk/win/.gitignore
new file mode 100644
index 0000000..8a9d35c
--- /dev/null
+++ b/ngs-sdk/win/.gitignore
@@ -0,0 +1 @@
+*.user
diff --git a/ngs-sdk/win/atomic32.h b/ngs-sdk/win/atomic32.h
new file mode 100644
index 0000000..93f25a9
--- /dev/null
+++ b/ngs-sdk/win/atomic32.h
@@ -0,0 +1,77 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ngs_engine_atomic32_
+#define _h_ngs_engine_atomic32_
+
+#ifndef _h_ngs_adapter_defs_
+#include <ngs/adapter/defs.h>
+#endif
+
+#include <WINDOWS.H>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* int atomic32_read ( const atomic32_t *v ); */
+#define atomic32_read( v ) \
+    ( ( v ) -> counter )
+
+/* void atomic32_set ( atomic32_t *v, int i ); */
+#define atomic32_set( v, i ) \
+    ( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
+
+/* add to v -> counter and return the prior value */
+/* int atomic32_read_and_add ( atomic32_t *v, int i ) */
+#define atomic32_read_and_add( v, i ) \
+    InterlockedExchangeAdd ( ( volatile unsigned int * ) & ( v ) -> counter, ( i ) )
+
+/* void atomic32_dec ( atomic32_t *v ) */
+#define atomic32_dec( v ) \
+    InterlockedDecrement ( ( volatile unsigned int * ) & ( v ) -> counter )
+
+/* int atomic32_test_and_set ( atomic32_t *v, int s, int t ) */
+#define atomic32_test_and_set( v, s, t ) \
+    InterlockedCompareExchange ( ( volatile unsigned int * ) & ( v ) -> counter, ( s ), ( t ) )
+
+static __inline int atomic32_read_and_add_gt ( atomic32_t *v, int i, int t )
+{
+	int val, val_intern;
+	for ( val = atomic32_read ( v ); val > t; val = val_intern )
+	{
+		val_intern = atomic32_test_and_set ( v, val + i, val );
+		if ( val_intern == val )
+			break;
+	}
+	return val;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_ngs_engine_atomic32_ */
diff --git a/ngs-sdk/win/libadapter.vcxproj b/ngs-sdk/win/libadapter.vcxproj
new file mode 100644
index 0000000..93f7715
--- /dev/null
+++ b/ngs-sdk/win/libadapter.vcxproj
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+
+  <Import Project="ngs-common.props" />
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{B9096FEF-5B55-4308-A81F-3B52CA968BE9}</ProjectGuid>
+    <RootNamespace>libadapter</RootNamespace>
+    <ProjectName>ngs-adapt-c++</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <OutDir>$(NGS_TARGET)\lib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetExt>.lib</TargetExt>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <OutDir>$(NGS_TARGET)\lib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetExt>.lib</TargetExt>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(NGS_TARGET)\lib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetExt>.lib</TargetExt>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>$(NGS_TARGET)\lib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetExt>.lib</TargetExt>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <DisableSpecificWarnings>4251;</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MinimalRebuild>true</MinimalRebuild>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <DisableSpecificWarnings>4251;</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MinimalRebuild>true</MinimalRebuild>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClInclude Include="..\ngs\adapter\AlignmentItf.hpp" />
+    <ClInclude Include="..\ngs\adapter\defs.h" />
+    <ClInclude Include="..\ngs\adapter\ErrorMsg.hpp" />
+    <ClInclude Include="..\ngs\adapter\FragmentItf.hpp" />
+    <ClInclude Include="..\ngs\adapter\PileupEventItf.hpp" />
+    <ClInclude Include="..\ngs\adapter\PileupItf.hpp" />
+    <ClInclude Include="..\ngs\adapter\ReadCollectionItf.hpp" />
+    <ClInclude Include="..\ngs\adapter\ReadGroupItf.hpp" />
+    <ClInclude Include="..\ngs\adapter\ReadItf.hpp" />
+    <ClInclude Include="..\ngs\adapter\Refcount.hpp" />
+    <ClInclude Include="..\ngs\adapter\ReferenceItf.hpp" />
+    <ClInclude Include="..\ngs\adapter\StatisticsItf.hpp" />
+    <ClInclude Include="..\ngs\adapter\StringItf.hpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\adapter\AlignmentItf.cpp" />
+    <ClCompile Include="..\adapter\ErrBlock.cpp" />
+    <ClCompile Include="..\adapter\ErrorMsg.cpp" />
+    <ClCompile Include="..\adapter\FragmentItf.cpp" />
+    <ClCompile Include="..\adapter\PileupEventItf.cpp" />
+    <ClCompile Include="..\adapter\PileupItf.cpp" />
+    <ClCompile Include="..\adapter\ReadCollectionItf.cpp" />
+    <ClCompile Include="..\adapter\ReadGroupItf.cpp" />
+    <ClCompile Include="..\adapter\ReadItf.cpp" />
+    <ClCompile Include="..\adapter\Refcount.cpp" />
+    <ClCompile Include="..\adapter\ReferenceItf.cpp" />
+    <ClCompile Include="..\adapter\StatisticsItf.cpp" />
+    <ClCompile Include="..\adapter\StringItf.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/libadapter.vcxproj.filters b/ngs-sdk/win/libadapter.vcxproj.filters
new file mode 100644
index 0000000..6ddd7f0
--- /dev/null
+++ b/ngs-sdk/win/libadapter.vcxproj.filters
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\ngs\adapter\AlignmentItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\ErrorMsg.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\FragmentItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\PileupEventItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\PileupItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\ReadCollectionItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\ReadGroupItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\ReadItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\Refcount.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\ReferenceItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\StatisticsItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\StringItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\adapter\defs.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\adapter\AlignmentItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\ErrorMsg.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\FragmentItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\PileupEventItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\PileupItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\ReadCollectionItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\ReadGroupItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\ReadItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\Refcount.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\ReferenceItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\StatisticsItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\StringItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\adapter\ErrBlock.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/libdispatch.vcxproj b/ngs-sdk/win/libdispatch.vcxproj
new file mode 100644
index 0000000..0063877
--- /dev/null
+++ b/ngs-sdk/win/libdispatch.vcxproj
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+
+  <Import Project="ngs-common.props" />
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{06FA485F-8AA9-4F3B-B1E3-D8CF1993637B}</ProjectGuid>
+    <RootNamespace>libdispatch</RootNamespace>
+    <ProjectName>ngs-disp</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <TargetExt>.lib</TargetExt>
+    <OutDir>$(NGS_TARGET)\ilib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <TargetExt>.lib</TargetExt>
+    <OutDir>$(NGS_TARGET)\ilib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(NGS_TARGET)\ilib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetExt>.lib</TargetExt>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>$(NGS_TARGET)\ilib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetExt>.lib</TargetExt>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <DisableSpecificWarnings>4251;</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <MinimalRebuild>true</MinimalRebuild>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClInclude Include="..\ngs\itf\AlignmentItf.h" />
+    <ClInclude Include="..\ngs\itf\AlignmentItf.hpp" />
+    <ClInclude Include="..\ngs\itf\defs.h" />
+    <ClInclude Include="..\ngs\itf\ErrBlock.h" />
+    <ClInclude Include="..\ngs\itf\ErrBlock.hpp" />
+    <ClInclude Include="..\ngs\itf\ErrorMsg.hpp" />
+    <ClInclude Include="..\ngs\itf\FragmentItf.h" />
+    <ClInclude Include="..\ngs\itf\FragmentItf.hpp" />
+    <ClInclude Include="..\ngs\itf\PileupEventItf.h" />
+    <ClInclude Include="..\ngs\itf\PileupEventItf.hpp" />
+    <ClInclude Include="..\ngs\itf\PileupItf.h" />
+    <ClInclude Include="..\ngs\itf\PileupItf.hpp" />
+    <ClInclude Include="..\ngs\itf\ReadCollectionItf.h" />
+    <ClInclude Include="..\ngs\itf\ReadCollectionItf.hpp" />
+    <ClInclude Include="..\ngs\itf\ReadGroupItf.h" />
+    <ClInclude Include="..\ngs\itf\ReadGroupItf.hpp" />
+    <ClInclude Include="..\ngs\itf\ReadItf.h" />
+    <ClInclude Include="..\ngs\itf\ReadItf.hpp" />
+    <ClInclude Include="..\ngs\itf\Refcount.h" />
+    <ClInclude Include="..\ngs\itf\Refcount.hpp" />
+    <ClInclude Include="..\ngs\itf\ReferenceItf.h" />
+    <ClInclude Include="..\ngs\itf\ReferenceItf.hpp" />
+    <ClInclude Include="..\ngs\itf\StatisticsItf.h" />
+    <ClInclude Include="..\ngs\itf\StatisticsItf.hpp" />
+    <ClInclude Include="..\ngs\itf\StringItf.h" />
+    <ClInclude Include="..\ngs\itf\StringItf.hpp" />
+    <ClInclude Include="..\ngs\itf\VTable.h" />
+    <ClInclude Include="..\ngs\itf\VTable.hpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\dispatch\AlignmentItf.cpp" />
+    <ClCompile Include="..\dispatch\ErrBlock.cpp" />
+    <ClCompile Include="..\dispatch\ErrorMsg.cpp" />
+    <ClCompile Include="..\dispatch\FragmentItf.cpp" />
+    <ClCompile Include="..\dispatch\PileupEventItf.cpp" />
+    <ClCompile Include="..\dispatch\PileupItf.cpp" />
+    <ClCompile Include="..\dispatch\ReadCollectionItf.cpp" />
+    <ClCompile Include="..\dispatch\ReadGroupItf.cpp" />
+    <ClCompile Include="..\dispatch\ReadItf.cpp" />
+    <ClCompile Include="..\dispatch\Refcount.cpp" />
+    <ClCompile Include="..\dispatch\ReferenceItf.cpp" />
+    <ClCompile Include="..\dispatch\StatisticsItf.cpp" />
+    <ClCompile Include="..\dispatch\StringItf.cpp" />
+    <ClCompile Include="..\dispatch\VTable.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/libdispatch.vcxproj.filters b/ngs-sdk/win/libdispatch.vcxproj.filters
new file mode 100644
index 0000000..8fce513
--- /dev/null
+++ b/ngs-sdk/win/libdispatch.vcxproj.filters
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\ngs\itf\AlignmentItf.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\AlignmentItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\defs.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\ErrBlock.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\ErrBlock.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\ErrorMsg.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\FragmentItf.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\FragmentItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\PileupEventItf.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\PileupEventItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\PileupItf.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\PileupItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\ReadCollectionItf.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\ReadCollectionItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\ReadGroupItf.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\ReadGroupItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\ReadItf.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\ReadItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\Refcount.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\Refcount.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\ReferenceItf.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\ReferenceItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\StatisticsItf.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\StatisticsItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\StringItf.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\StringItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\VTable.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\itf\VTable.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\dispatch\AlignmentItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\VTable.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ErrBlock.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ErrorMsg.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\FragmentItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\PileupEventItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\PileupItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ReadCollectionItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ReadGroupItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ReadItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\Refcount.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ReferenceItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\StatisticsItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\StringItf.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/libngs-c++.vcxproj b/ngs-sdk/win/libngs-c++.vcxproj
new file mode 100644
index 0000000..0ffdd0e
--- /dev/null
+++ b/ngs-sdk/win/libngs-c++.vcxproj
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\language\c++\Alignment.cpp" />
+    <ClCompile Include="..\language\c++\AlignmentIterator.cpp" />
+    <ClCompile Include="..\language\c++\Fragment.cpp" />
+    <ClCompile Include="..\language\c++\FragmentIterator.cpp" />
+    <ClCompile Include="..\language\c++\Pileup.cpp" />
+    <ClCompile Include="..\language\c++\PileupEvent.cpp" />
+    <ClCompile Include="..\language\c++\PileupEventIterator.cpp" />
+    <ClCompile Include="..\language\c++\PileupIterator.cpp" />
+    <ClCompile Include="..\language\c++\Read.cpp" />
+    <ClCompile Include="..\language\c++\ReadCollection.cpp" />
+    <ClCompile Include="..\language\c++\ReadGroup.cpp" />
+    <ClCompile Include="..\language\c++\ReadGroupIterator.cpp" />
+    <ClCompile Include="..\language\c++\ReadIterator.cpp" />
+    <ClCompile Include="..\language\c++\Reference.cpp" />
+    <ClCompile Include="..\language\c++\ReferenceIterator.cpp" />
+    <ClCompile Include="..\language\c++\Statistics.cpp" />
+    <ClCompile Include="..\language\c++\StringRef.cpp" />
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{A8AC88D2-FADA-4458-A251-DB2E039678A4}</ProjectGuid>
+    <RootNamespace>libngsc</RootNamespace>
+    <NGS_OUTDIR>$(USERPROFILE)\win\cl\</NGS_OUTDIR>
+    <NGS_TARGET>$(NGS_OUTDIR)\$(Platform)\$(Configuration)\</NGS_TARGET>
+    <ProjectName>ngs-bind-c++</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <TargetExt>.lib</TargetExt>
+    <OutDir>$(NGS_TARGET)\ilib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <TargetExt>.lib</TargetExt>
+    <OutDir>$(NGS_TARGET)\ilib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <TargetExt>.lib</TargetExt>
+    <OutDir>$(NGS_TARGET)\ilib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <TargetExt>.lib</TargetExt>
+    <OutDir>$(NGS_TARGET)\ilib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>lib$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/libngs-c++.vcxproj.filters b/ngs-sdk/win/libngs-c++.vcxproj.filters
new file mode 100644
index 0000000..135518a
--- /dev/null
+++ b/ngs-sdk/win/libngs-c++.vcxproj.filters
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\language\c++\Alignment.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\AlignmentIterator.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\Fragment.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\FragmentIterator.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\Pileup.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\PileupEvent.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\PileupEventIterator.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\PileupIterator.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\Read.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\ReadCollection.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\ReadGroup.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\ReadGroupIterator.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\ReadIterator.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\Reference.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\ReferenceIterator.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\Statistics.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\StringRef.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/libngs.vcxproj b/ngs-sdk/win/libngs.vcxproj
new file mode 100644
index 0000000..c6b120f
--- /dev/null
+++ b/ngs-sdk/win/libngs.vcxproj
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{50EEF5E6-0B42-4529-8F01-D5C6DF91CAAE}</ProjectGuid>
+    <RootNamespace>libngs</RootNamespace>
+    <NGS_OUTDIR>$(USERPROFILE)\win\cl\</NGS_OUTDIR>
+    <NGS_TARGET>$(NGS_OUTDIR)\$(Platform)\$(Configuration)\</NGS_TARGET>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <TargetExt>.lib</TargetExt>
+    <OutDir>$(NGS_TARGET)\lib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>libngs-sdk</TargetName>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <TargetExt>.lib</TargetExt>
+    <OutDir>$(NGS_TARGET)\lib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>libngs-sdk</TargetName>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <TargetExt>.lib</TargetExt>
+    <OutDir>$(NGS_TARGET)\lib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>libngs-sdk</TargetName>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <TargetExt>.lib</TargetExt>
+    <OutDir>$(NGS_TARGET)\lib\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>libngs-sdk</TargetName>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <NoEntryPoint>true</NoEntryPoint>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <NoEntryPoint>true</NoEntryPoint>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <NoEntryPoint>true</NoEntryPoint>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <NoEntryPoint>true</NoEntryPoint>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ProjectReference Include="libdispatch.vcxproj">
+      <Project>{06fa485f-8aa9-4f3b-b1e3-d8cf1993637b}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\ngs\Alignment.hpp" />
+    <ClInclude Include="..\ngs\AlignmentIterator.hpp" />
+    <ClInclude Include="..\ngs\ErrorMsg.hpp" />
+    <ClInclude Include="..\ngs\Fragment.hpp" />
+    <ClInclude Include="..\ngs\FragmentIterator.hpp" />
+    <ClInclude Include="..\ngs\inl\Alignment.hpp" />
+    <ClInclude Include="..\ngs\inl\AlignmentIterator.hpp" />
+    <ClInclude Include="..\ngs\inl\Fragment.hpp" />
+    <ClInclude Include="..\ngs\inl\FragmentIterator.hpp" />
+    <ClInclude Include="..\ngs\inl\Pileup.hpp" />
+    <ClInclude Include="..\ngs\inl\PileupEvent.hpp" />
+    <ClInclude Include="..\ngs\inl\PileupEventIterator.hpp" />
+    <ClInclude Include="..\ngs\inl\PileupIterator.hpp" />
+    <ClInclude Include="..\ngs\inl\Read.hpp" />
+    <ClInclude Include="..\ngs\inl\ReadCollection.hpp" />
+    <ClInclude Include="..\ngs\inl\ReadGroup.hpp" />
+    <ClInclude Include="..\ngs\inl\ReadGroupIterator.hpp" />
+    <ClInclude Include="..\ngs\inl\ReadIterator.hpp" />
+    <ClInclude Include="..\ngs\inl\Reference.hpp" />
+    <ClInclude Include="..\ngs\inl\ReferenceIterator.hpp" />
+    <ClInclude Include="..\ngs\inl\Statistics.hpp" />
+    <ClInclude Include="..\ngs\inl\StringRef.hpp" />
+    <ClInclude Include="..\ngs\Pileup.hpp" />
+    <ClInclude Include="..\ngs\PileupEvent.hpp" />
+    <ClInclude Include="..\ngs\PileupEventIterator.hpp" />
+    <ClInclude Include="..\ngs\PileupIterator.hpp" />
+    <ClInclude Include="..\ngs\Read.hpp" />
+    <ClInclude Include="..\ngs\ReadCollection.hpp" />
+    <ClInclude Include="..\ngs\ReadGroup.hpp" />
+    <ClInclude Include="..\ngs\ReadGroupIterator.hpp" />
+    <ClInclude Include="..\ngs\ReadIterator.hpp" />
+    <ClInclude Include="..\ngs\Reference.hpp" />
+    <ClInclude Include="..\ngs\ReferenceIterator.hpp" />
+    <ClInclude Include="..\ngs\Statistics.hpp" />
+    <ClInclude Include="..\ngs\StringRef.hpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/libngs.vcxproj.filters b/ngs-sdk/win/libngs.vcxproj.filters
new file mode 100644
index 0000000..e759adc
--- /dev/null
+++ b/ngs-sdk/win/libngs.vcxproj.filters
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Header Files\inl">
+      <UniqueIdentifier>{8802bed9-e96d-4c55-8f6e-47bc3f32c439}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\ngs\inl\Alignment.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\AlignmentIterator.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\Fragment.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\FragmentIterator.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\Pileup.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\PileupEvent.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\PileupEventIterator.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\PileupIterator.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\Read.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\ReadCollection.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\ReadGroup.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\ReadGroupIterator.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\ReadIterator.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\Reference.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\ReferenceIterator.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\Statistics.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\inl\StringRef.hpp">
+      <Filter>Header Files\inl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\Alignment.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\AlignmentIterator.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\ErrorMsg.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\Fragment.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\FragmentIterator.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\Pileup.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\PileupEvent.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\PileupEventIterator.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\PileupIterator.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\Read.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\ReadCollection.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\ReadGroup.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\ReadGroupIterator.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\ReadIterator.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\Reference.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\ReferenceIterator.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\Statistics.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ngs\StringRef.hpp">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/libtest_engine.vcxproj b/ngs-sdk/win/libtest_engine.vcxproj
new file mode 100644
index 0000000..c41ed48
--- /dev/null
+++ b/ngs-sdk/win/libtest_engine.vcxproj
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+
+  <Import Project="ngs-common.props" />
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{FB574D6F-8684-45AE-A0AF-B52BA67E9FDE}</ProjectGuid>
+    <RootNamespace>libtest_engine</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <TargetExt>.dll</TargetExt>
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <TargetExt>.dll</TargetExt>
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <TargetExt>.dll</TargetExt>
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <TargetExt>.dll</TargetExt>
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <PreprocessorDefinitions>_LIBRARY;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <NoEntryPoint>false</NoEntryPoint>
+      <ImportLibrary>$(OutDir)\$(ProjectName).lib</ImportLibrary>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <PreprocessorDefinitions>_LIBRARY;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <NoEntryPoint>false</NoEntryPoint>
+      <ImportLibrary>$(OutDir)\$(ProjectName).lib</ImportLibrary>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <PreprocessorDefinitions>_LIBRARY;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <NoEntryPoint>false</NoEntryPoint>
+      <ImportLibrary>$(OutDir)\$(ProjectName).lib</ImportLibrary>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <PreprocessorDefinitions>_LIBRARY;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <NoEntryPoint>false</NoEntryPoint>
+      <ImportLibrary>$(OutDir)\$(ProjectName).lib</ImportLibrary>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\test\test_engine\test_engine.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\test\test_engine\AlignmentItf.hpp" />
+    <ClInclude Include="..\test\test_engine\PileupEventItf.hpp" />
+    <ClInclude Include="..\test\test_engine\PileupItf.hpp" />
+    <ClInclude Include="..\test\test_engine\ReadCollectionItf.hpp" />
+    <ClInclude Include="..\test\test_engine\ReadGroupItf.hpp" />
+    <ClInclude Include="..\test\test_engine\ReadItf.hpp" />
+    <ClInclude Include="..\test\test_engine\ReferenceItf.hpp" />
+    <ClInclude Include="..\test\test_engine\StatisticsItf.hpp" />
+    <ClInclude Include="..\test\test_engine\test_engine.hpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="libadapter.vcxproj">
+      <Project>{b9096fef-5b55-4308-a81f-3b52ca968be9}</Project>
+    </ProjectReference>
+    <ProjectReference Include="libdispatch.vcxproj">
+      <Project>{06fa485f-8aa9-4f3b-b1e3-d8cf1993637b}</Project>
+    </ProjectReference>
+    <ProjectReference Include="libngs-c++.vcxproj">
+      <Project>{a8ac88d2-fada-4458-a251-db2e039678a4}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/libtest_engine.vcxproj.filters b/ngs-sdk/win/libtest_engine.vcxproj.filters
new file mode 100644
index 0000000..1ac26cd
--- /dev/null
+++ b/ngs-sdk/win/libtest_engine.vcxproj.filters
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\test\test_engine\test_engine.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\test\test_engine\AlignmentItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\test\test_engine\PileupEventItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\test\test_engine\PileupItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\test\test_engine\ReadCollectionItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\test\test_engine\ReadGroupItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\test\test_engine\ReadItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\test\test_engine\ReferenceItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\test\test_engine\StatisticsItf.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\test\test_engine\test_engine.hpp">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/ngs-common.props b/ngs-sdk/win/ngs-common.props
new file mode 100644
index 0000000..d385a72
--- /dev/null
+++ b/ngs-sdk/win/ngs-common.props
@@ -0,0 +1,14 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
+
+  <Import Condition="Exists('$(ProjectDir)..\Makefile.config.win')" Project="$(ProjectDir)..\Makefile.config.win" />
+
+  <PropertyGroup Label="Globals">
+    <Platform Condition="'$(Platform)' == ''">x64</Platform>
+    <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
+    
+    <NGS_OUTDIR Condition="'$(NGS_OUTDIR)' == ''">$(USERPROFILE)\</NGS_OUTDIR>
+    <NGS_ROOT Condition="'$(NGS_ROOT)' == ''">$(ProjectDir)..\</NGS_ROOT>
+    <NGS_TARGET Condition="'$(NGS_TARGET)' == ''">$(NGS_OUTDIR)win\cl\$(Platform)\$(Configuration)\</NGS_TARGET>    
+  </PropertyGroup>
+  
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/ngs-sdk.sln b/ngs-sdk/win/ngs-sdk.sln
new file mode 100644
index 0000000..0b053a1
--- /dev/null
+++ b/ngs-sdk/win/ngs-sdk.sln
@@ -0,0 +1,123 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ngs-adapt-c++", "libadapter.vcxproj", "{B9096FEF-5B55-4308-A81F-3B52CA968BE9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ngs-disp", "libdispatch.vcxproj", "{06FA485F-8AA9-4F3B-B1E3-D8CF1993637B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ngs-bind-c++", "libngs-c++.vcxproj", "{A8AC88D2-FADA-4458-A251-DB2E039678A4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtest_engine", "libtest_engine.vcxproj", "{FB574D6F-8684-45AE-A0AF-B52BA67E9FDE}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ngs-test", "ngs-test.vcxproj", "{33E73C44-6EEB-4CAE-8DE6-2546E7DE2133}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HeaderFiles", "HeaderFiles", "{3F19C31D-C662-4909-84F1-FCB983178DEE}"
+	ProjectSection(SolutionItems) = preProject
+		..\ngs\Alignment.hpp = ..\ngs\Alignment.hpp
+		..\ngs\defs.h = ..\ngs\defs.h
+		..\ngs\AlignmentIterator.hpp = ..\ngs\AlignmentIterator.hpp
+		..\ngs\ErrorMsg.hpp = ..\ngs\ErrorMsg.hpp
+		..\ngs\Fragment.hpp = ..\ngs\Fragment.hpp
+		..\ngs\FragmentIterator.hpp = ..\ngs\FragmentIterator.hpp
+		..\ngs\Pileup.hpp = ..\ngs\Pileup.hpp
+		..\ngs\PileupEvent.hpp = ..\ngs\PileupEvent.hpp
+		..\ngs\PileupEventIterator.hpp = ..\ngs\PileupEventIterator.hpp
+		..\ngs\PileupIterator.hpp = ..\ngs\PileupIterator.hpp
+		..\ngs\Read.hpp = ..\ngs\Read.hpp
+		..\ngs\ReadCollection.hpp = ..\ngs\ReadCollection.hpp
+		..\ngs\ReadGroup.hpp = ..\ngs\ReadGroup.hpp
+		..\ngs\ReadGroupIterator.hpp = ..\ngs\ReadGroupIterator.hpp
+		..\ngs\ReadIterator.hpp = ..\ngs\ReadIterator.hpp
+		..\ngs\Reference.hpp = ..\ngs\Reference.hpp
+		..\ngs\ReferenceIterator.hpp = ..\ngs\ReferenceIterator.hpp
+		..\ngs\Statistics.hpp = ..\ngs\Statistics.hpp
+		..\ngs\StringRef.hpp = ..\ngs\StringRef.hpp
+	EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "inl", "inl", "{D3CE4594-5886-4BD8-97A0-69449C45820E}"
+	ProjectSection(SolutionItems) = preProject
+		..\ngs\inl\Alignment.hpp = ..\ngs\inl\Alignment.hpp
+		..\ngs\inl\AlignmentIterator.hpp = ..\ngs\inl\AlignmentIterator.hpp
+		..\ngs\inl\Fragment.hpp = ..\ngs\inl\Fragment.hpp
+		..\ngs\inl\FragmentIterator.hpp = ..\ngs\inl\FragmentIterator.hpp
+		..\ngs\inl\Pileup.hpp = ..\ngs\inl\Pileup.hpp
+		..\ngs\inl\PileupEvent.hpp = ..\ngs\inl\PileupEvent.hpp
+		..\ngs\inl\PileupEventIterator.hpp = ..\ngs\inl\PileupEventIterator.hpp
+		..\ngs\inl\PileupIterator.hpp = ..\ngs\inl\PileupIterator.hpp
+		..\ngs\inl\Read.hpp = ..\ngs\inl\Read.hpp
+		..\ngs\inl\ReadCollection.hpp = ..\ngs\inl\ReadCollection.hpp
+		..\ngs\inl\ReadGroup.hpp = ..\ngs\inl\ReadGroup.hpp
+		..\ngs\inl\ReadGroupIterator.hpp = ..\ngs\inl\ReadGroupIterator.hpp
+		..\ngs\inl\ReadIterator.hpp = ..\ngs\inl\ReadIterator.hpp
+		..\ngs\inl\Reference.hpp = ..\ngs\inl\Reference.hpp
+		..\ngs\inl\ReferenceIterator.hpp = ..\ngs\inl\ReferenceIterator.hpp
+		..\ngs\inl\Statistics.hpp = ..\ngs\inl\Statistics.hpp
+		..\ngs\inl\StringRef.hpp = ..\ngs\inl\StringRef.hpp
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ngs-sdk", "ngs-sdk.vcxproj", "{A6A46CB4-760E-4F16-9499-BC712E99FB5D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{B9096FEF-5B55-4308-A81F-3B52CA968BE9}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B9096FEF-5B55-4308-A81F-3B52CA968BE9}.Debug|Win32.Build.0 = Debug|Win32
+		{B9096FEF-5B55-4308-A81F-3B52CA968BE9}.Debug|x64.ActiveCfg = Debug|x64
+		{B9096FEF-5B55-4308-A81F-3B52CA968BE9}.Debug|x64.Build.0 = Debug|x64
+		{B9096FEF-5B55-4308-A81F-3B52CA968BE9}.Release|Win32.ActiveCfg = Release|Win32
+		{B9096FEF-5B55-4308-A81F-3B52CA968BE9}.Release|Win32.Build.0 = Release|Win32
+		{B9096FEF-5B55-4308-A81F-3B52CA968BE9}.Release|x64.ActiveCfg = Release|x64
+		{B9096FEF-5B55-4308-A81F-3B52CA968BE9}.Release|x64.Build.0 = Release|x64
+		{06FA485F-8AA9-4F3B-B1E3-D8CF1993637B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{06FA485F-8AA9-4F3B-B1E3-D8CF1993637B}.Debug|Win32.Build.0 = Debug|Win32
+		{06FA485F-8AA9-4F3B-B1E3-D8CF1993637B}.Debug|x64.ActiveCfg = Debug|x64
+		{06FA485F-8AA9-4F3B-B1E3-D8CF1993637B}.Debug|x64.Build.0 = Debug|x64
+		{06FA485F-8AA9-4F3B-B1E3-D8CF1993637B}.Release|Win32.ActiveCfg = Release|Win32
+		{06FA485F-8AA9-4F3B-B1E3-D8CF1993637B}.Release|Win32.Build.0 = Release|Win32
+		{06FA485F-8AA9-4F3B-B1E3-D8CF1993637B}.Release|x64.ActiveCfg = Release|x64
+		{06FA485F-8AA9-4F3B-B1E3-D8CF1993637B}.Release|x64.Build.0 = Release|x64
+		{A8AC88D2-FADA-4458-A251-DB2E039678A4}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A8AC88D2-FADA-4458-A251-DB2E039678A4}.Debug|Win32.Build.0 = Debug|Win32
+		{A8AC88D2-FADA-4458-A251-DB2E039678A4}.Debug|x64.ActiveCfg = Debug|x64
+		{A8AC88D2-FADA-4458-A251-DB2E039678A4}.Debug|x64.Build.0 = Debug|x64
+		{A8AC88D2-FADA-4458-A251-DB2E039678A4}.Release|Win32.ActiveCfg = Release|Win32
+		{A8AC88D2-FADA-4458-A251-DB2E039678A4}.Release|Win32.Build.0 = Release|Win32
+		{A8AC88D2-FADA-4458-A251-DB2E039678A4}.Release|x64.ActiveCfg = Release|x64
+		{A8AC88D2-FADA-4458-A251-DB2E039678A4}.Release|x64.Build.0 = Release|x64
+		{FB574D6F-8684-45AE-A0AF-B52BA67E9FDE}.Debug|Win32.ActiveCfg = Debug|Win32
+		{FB574D6F-8684-45AE-A0AF-B52BA67E9FDE}.Debug|Win32.Build.0 = Debug|Win32
+		{FB574D6F-8684-45AE-A0AF-B52BA67E9FDE}.Debug|x64.ActiveCfg = Debug|x64
+		{FB574D6F-8684-45AE-A0AF-B52BA67E9FDE}.Debug|x64.Build.0 = Debug|x64
+		{FB574D6F-8684-45AE-A0AF-B52BA67E9FDE}.Release|Win32.ActiveCfg = Release|Win32
+		{FB574D6F-8684-45AE-A0AF-B52BA67E9FDE}.Release|Win32.Build.0 = Release|Win32
+		{FB574D6F-8684-45AE-A0AF-B52BA67E9FDE}.Release|x64.ActiveCfg = Release|x64
+		{FB574D6F-8684-45AE-A0AF-B52BA67E9FDE}.Release|x64.Build.0 = Release|x64
+		{33E73C44-6EEB-4CAE-8DE6-2546E7DE2133}.Debug|Win32.ActiveCfg = Debug|Win32
+		{33E73C44-6EEB-4CAE-8DE6-2546E7DE2133}.Debug|Win32.Build.0 = Debug|Win32
+		{33E73C44-6EEB-4CAE-8DE6-2546E7DE2133}.Debug|x64.ActiveCfg = Debug|x64
+		{33E73C44-6EEB-4CAE-8DE6-2546E7DE2133}.Debug|x64.Build.0 = Debug|x64
+		{33E73C44-6EEB-4CAE-8DE6-2546E7DE2133}.Release|Win32.ActiveCfg = Release|Win32
+		{33E73C44-6EEB-4CAE-8DE6-2546E7DE2133}.Release|Win32.Build.0 = Release|Win32
+		{33E73C44-6EEB-4CAE-8DE6-2546E7DE2133}.Release|x64.ActiveCfg = Release|x64
+		{33E73C44-6EEB-4CAE-8DE6-2546E7DE2133}.Release|x64.Build.0 = Release|x64
+		{A6A46CB4-760E-4F16-9499-BC712E99FB5D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A6A46CB4-760E-4F16-9499-BC712E99FB5D}.Debug|Win32.Build.0 = Debug|Win32
+		{A6A46CB4-760E-4F16-9499-BC712E99FB5D}.Debug|x64.ActiveCfg = Debug|x64
+		{A6A46CB4-760E-4F16-9499-BC712E99FB5D}.Debug|x64.Build.0 = Debug|x64
+		{A6A46CB4-760E-4F16-9499-BC712E99FB5D}.Release|Win32.ActiveCfg = Release|Win32
+		{A6A46CB4-760E-4F16-9499-BC712E99FB5D}.Release|Win32.Build.0 = Release|Win32
+		{A6A46CB4-760E-4F16-9499-BC712E99FB5D}.Release|x64.ActiveCfg = Release|x64
+		{A6A46CB4-760E-4F16-9499-BC712E99FB5D}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{D3CE4594-5886-4BD8-97A0-69449C45820E} = {3F19C31D-C662-4909-84F1-FCB983178DEE}
+	EndGlobalSection
+EndGlobal
diff --git a/ngs-sdk/win/ngs-sdk.vcxproj b/ngs-sdk/win/ngs-sdk.vcxproj
new file mode 100644
index 0000000..688c169
--- /dev/null
+++ b/ngs-sdk/win/ngs-sdk.vcxproj
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project="ngs-common.props" />
+
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{A6A46CB4-760E-4F16-9499-BC712E99FB5D}</ProjectGuid>
+    <RootNamespace>ngstest</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+    <TargetName>lib$(ProjectName)</TargetName>
+    <TargetExt>.dll</TargetExt>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+    <TargetName>lib$(ProjectName)</TargetName>
+    <TargetExt>.dll</TargetExt>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+    <TargetName>lib$(ProjectName)</TargetName>
+    <TargetExt>.dll</TargetExt>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+    <TargetName>lib$(ProjectName)</TargetName>
+    <TargetExt>.dll</TargetExt>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <NoEntryPoint>false</NoEntryPoint>
+    </Link>
+    <ProjectReference>
+      <UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
+    </ProjectReference>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <NoEntryPoint>false</NoEntryPoint>
+    </Link>
+    <ProjectReference>
+      <UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
+    </ProjectReference>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <NoEntryPoint>false</NoEntryPoint>
+    </Link>
+    <ProjectReference>
+      <UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
+    </ProjectReference>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_LIBRARY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <NoEntryPoint>false</NoEntryPoint>
+    </Link>
+    <ProjectReference>
+      <UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
+    </ProjectReference>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\dispatch\AlignmentItf.cpp" />
+    <ClCompile Include="..\dispatch\ErrBlock.cpp" />
+    <ClCompile Include="..\dispatch\ErrorMsg.cpp" />
+    <ClCompile Include="..\dispatch\FragmentItf.cpp" />
+    <ClCompile Include="..\dispatch\PileupEventItf.cpp" />
+    <ClCompile Include="..\dispatch\PileupItf.cpp" />
+    <ClCompile Include="..\dispatch\ReadCollectionItf.cpp" />
+    <ClCompile Include="..\dispatch\ReadGroupItf.cpp" />
+    <ClCompile Include="..\dispatch\ReadItf.cpp" />
+    <ClCompile Include="..\dispatch\Refcount.cpp" />
+    <ClCompile Include="..\dispatch\ReferenceItf.cpp" />
+    <ClCompile Include="..\dispatch\StatisticsItf.cpp" />
+    <ClCompile Include="..\dispatch\StringItf.cpp" />
+    <ClCompile Include="..\dispatch\VTable.cpp" />
+    <ClCompile Include="..\language\c++\Alignment.cpp" />
+    <ClCompile Include="..\language\c++\AlignmentIterator.cpp" />
+    <ClCompile Include="..\language\c++\Fragment.cpp" />
+    <ClCompile Include="..\language\c++\FragmentIterator.cpp" />
+    <ClCompile Include="..\language\c++\Pileup.cpp" />
+    <ClCompile Include="..\language\c++\PileupEvent.cpp" />
+    <ClCompile Include="..\language\c++\PileupEventIterator.cpp" />
+    <ClCompile Include="..\language\c++\PileupIterator.cpp" />
+    <ClCompile Include="..\language\c++\Read.cpp" />
+    <ClCompile Include="..\language\c++\ReadCollection.cpp" />
+    <ClCompile Include="..\language\c++\ReadGroup.cpp" />
+    <ClCompile Include="..\language\c++\ReadGroupIterator.cpp" />
+    <ClCompile Include="..\language\c++\ReadIterator.cpp" />
+    <ClCompile Include="..\language\c++\Reference.cpp" />
+    <ClCompile Include="..\language\c++\ReferenceIterator.cpp" />
+    <ClCompile Include="..\language\c++\Statistics.cpp" />
+    <ClCompile Include="..\language\c++\StringRef.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/ngs-sdk.vcxproj.filters b/ngs-sdk/win/ngs-sdk.vcxproj.filters
new file mode 100644
index 0000000..a645b93
--- /dev/null
+++ b/ngs-sdk/win/ngs-sdk.vcxproj.filters
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="ngs-disp-sources">
+      <UniqueIdentifier>{a7faf64f-c98f-4335-914f-4b5a5b55c299}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="ngs-bind-c++ sources">
+      <UniqueIdentifier>{514f37fa-57ab-43fb-b59c-fa261430dfde}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\language\c++\Alignment.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\AlignmentIterator.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\Fragment.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\FragmentIterator.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\Pileup.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\PileupEvent.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\PileupEventIterator.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\PileupIterator.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\Read.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\ReadCollection.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\ReadGroup.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\ReadGroupIterator.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\ReadIterator.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\Reference.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\ReferenceIterator.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\Statistics.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\language\c++\StringRef.cpp">
+      <Filter>ngs-bind-c++ sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\AlignmentItf.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\VTable.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ErrBlock.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ErrorMsg.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\FragmentItf.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\PileupEventItf.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\PileupItf.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ReadCollectionItf.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ReadGroupItf.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ReadItf.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\Refcount.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\ReferenceItf.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\StatisticsItf.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+    <ClCompile Include="..\dispatch\StringItf.cpp">
+      <Filter>ngs-disp-sources</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/ngs-test.vcxproj b/ngs-sdk/win/ngs-test.vcxproj
new file mode 100644
index 0000000..6f102c9
--- /dev/null
+++ b/ngs-sdk/win/ngs-test.vcxproj
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+
+  <Import Project="ngs-common.props" />
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{33E73C44-6EEB-4CAE-8DE6-2546E7DE2133}</ProjectGuid>
+    <RootNamespace>ngstest</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>$(NGS_TARGET)\bin\</OutDir>
+    <IntDir>$(NGS_TARGET)\obj\$(ProjectName)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DisableSpecificWarnings>4251;4290</DisableSpecificWarnings>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ProjectReference Include="libtest_engine.vcxproj">
+      <Project>{fb574d6f-8684-45ae-a0af-b52ba67e9fde}</Project>
+    </ProjectReference>
+    <ProjectReference Include="ngs-sdk.vcxproj">
+      <Project>{a6a46cb4-760e-4f16-9499-bc712e99fb5d}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\test\ngs-test\main.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  
+  
+    <Target Name="AfterBuild">
+        <Exec Command="$(OutDir)$(TargetName)$(TargetExt)" WorkingDirectory="$(ProjectDir)"/>
+    </Target>
+      
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/ngs-test.vcxproj.filters b/ngs-sdk/win/ngs-test.vcxproj.filters
new file mode 100644
index 0000000..f371d4c
--- /dev/null
+++ b/ngs-sdk/win/ngs-test.vcxproj.filters
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\test\ngs-test\main.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/ngs-sdk/win/stdbool.h b/ngs-sdk/win/stdbool.h
new file mode 100644
index 0000000..4807cb4
--- /dev/null
+++ b/ngs-sdk/win/stdbool.h
@@ -0,0 +1,46 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+
+/*--------------------------------------------------------------------------
+ * bool
+ */
+
+#ifndef __cplusplus
+typedef unsigned char bool;
+
+#undef true
+#define true 1
+
+#undef false
+#define false 0
+
+#endif
+
+
+#endif /* _STDBOOL_H */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/ngs-sdk.git



More information about the debian-med-commit mailing list