Skip to content

Commit

Permalink
Merge pull request #8 from mklarqvist/yon_block
Browse files Browse the repository at this point in the history
Release 0.6.0
  • Loading branch information
mklarqvist authored Sep 25, 2018
2 parents 9409ec8 + aedf4ba commit 408ac83
Show file tree
Hide file tree
Showing 176 changed files with 18,245 additions and 18,382 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ bin/
openssl/
zstd/

# Binary
# Binary and library
tachyon
lib*.so.*
4 changes: 2 additions & 2 deletions .settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(g?cc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-939566099868401782" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-353402777504187126" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand All @@ -17,7 +17,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-939566099868401782" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-353402777504187126" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ before_install:
- git clone https://github.com/facebook/zstd
- cd zstd && make -j4 && sudo make install && cd ..
- git clone https://github.com/samtools/htslib
- cd htslib && autoheader && autoconf && ./configure && make -j 4 && sudo make install && cd ..
- cd htslib && git checkout 1832d3a1b75133e55fb6abffc3f50f8a6ed5ceae
- autoheader && autoconf && ./configure && make -j 4 && sudo make install && cd ..

script:
- git submodule update --recursive
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build Status](https://travis-ci.org/mklarqvist/tachyon.svg?branch=master)](https://travis-ci.org/mklarqvist/tachyon)
[![Release](https://img.shields.io/badge/Release-beta_0.5.0-blue.svg)](https://github.com/mklarqvist/Tachyon/releases)
[![Release](https://img.shields.io/badge/Release-beta_0.6.0-blue.svg)](https://github.com/mklarqvist/Tachyon/releases)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

<div align="center">
Expand Down Expand Up @@ -66,7 +66,6 @@ When installing locally the required dependencies are downloaded and built in th
* Overview.
* [Building and installing](docs/building.md)
* [Getting started](docs/getting_started.md)
* [Summary of example programs](docs/example_programs.md).
* [Performance benchmarks](docs/benchmarks.md)

### Contributing
Expand All @@ -77,7 +76,7 @@ Interested in contributing? Fork and submit a pull request and it will be review
We are actively developing Tachyon and are always interested in improving its quality. If you run into an issue, please report the problem on our Issue tracker. Be sure to add enough detail to your report that we can reproduce the problem and address it. We have not reached version 1.0 and as such the specification and/or the API interfaces may change.

### Version
This is Tachyon 0.5.0. Tachyon follows [semantic versioning](https://semver.org/).
This is Tachyon 0.6.0. Tachyon follows [semantic versioning](https://semver.org/).

### History
Tachyon grew out of the [Tomahawk][tomahawk] project for calculating genome-wide linkage-disequilibrium.
Expand Down
4 changes: 0 additions & 4 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ git clone --recursive https://github.com/mklarqvist/tachyon
cd tachyon
make
```
Tachyon comes bundled with several API-examples in the `lib_example` directory. They are built by default but should you want to rebuild them execute the command:
```bash
make examples
```

## Installation
For Ubuntu, Debian, and Mac systems, installation is easy: just run
Expand Down
26 changes: 0 additions & 26 deletions docs/example_programs.md

This file was deleted.

6 changes: 1 addition & 5 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
- [Field-slicing](#field-slicing)
- [Searching for genomic regions](#searching-for-genomic-regions)
- [Annotating meta-data](#annotating-meta-data)
- [C++ API Examples](#c-api-examples)

---

Expand Down Expand Up @@ -132,7 +131,4 @@ tachyon view -i example_dataset.yon -GHX
Output
```
Contig110_arrow 672 . A T 525.07 basic_filtering AC=10;AF=0.217;AN=46;BaseQRankSum=0.967;DP=72;ExcessHet=0.8113;FS=54.73;InbreedingCoeff=-0.0525;MLEAC=11;MLEAF=0.239;MQ=31.05;MQRankSum=1.38;QD=18.11;ReadPosRankSum=-0.431;SOR=5.889;FS_A=11.5091,0;NM=26;AC_FWD=21,2;AC_REV=15,8;HWE_P=0.25072;VT=SNP
```

## C++ API Examples
We provide several API examples in the `lib_example` directory. Get started by `make examples`: this requires you to have compiled the shared library first.
```
175 changes: 68 additions & 107 deletions lib/io/basic_buffer.h → include/buffer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
#ifndef BASICBUFFER__H_
#define BASICBUFFER__H_
/*
Copyright (C) 2017-current Genome Research Ltd.
Author: Marcus D. R. Klarqvist <mk819@cam.ac.uk>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
==============================================================================*/
#ifndef TACHYON_BUFFER_H_
#define TACHYON_BUFFER_H_

#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
Expand All @@ -9,15 +31,14 @@
#include <stdint.h>
#include <cassert>

#include "support/helpers.h"
#include "containers/components/generic_iterator.h"
#include "utility.h"
#include "generic_iterator.h"

namespace tachyon {
namespace io{

struct BasicBuffer{
struct yon_buffer_t {
public:
typedef BasicBuffer self_type;
typedef yon_buffer_t self_type;
typedef char value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
Expand All @@ -30,14 +51,15 @@ struct BasicBuffer{
typedef yonRawIterator<const value_type> const_iterator;

public:
BasicBuffer();
BasicBuffer(const uint64_t size);
BasicBuffer(char* target, const size_t length);
BasicBuffer(const uint64_t size, char* target);
BasicBuffer(const self_type& other);
virtual ~BasicBuffer();
yon_buffer_t();
yon_buffer_t(const uint64_t size);
yon_buffer_t(char* target, const size_t length);
yon_buffer_t(const uint64_t size, char* target);
yon_buffer_t(const self_type& other);
yon_buffer_t(self_type&& other) noexcept;
self_type& operator=(const self_type& other);
self_type& operator=(self_type&& other) noexcept;
~yon_buffer_t();

inline reference back(void){ return(this->buffer_[this->n_chars_-1]); }
inline reference front(void){ return(this->buffer_[0]); }
Expand All @@ -52,26 +74,9 @@ struct BasicBuffer{
inline const_iterator cbegin() const{ return const_iterator(&this->buffer_[0]); }
inline const_iterator cend() const{ return const_iterator(&this->buffer_[this->n_chars_]); }

inline void set(const size_t size){
this->n_chars_ = 0;
this->width_ = size;
if(this->buffer_ != nullptr)
delete [] this->buffer_;

this->buffer_ = new char[size];
}

inline void set(const size_t size, char* target){
this->n_chars_ = 0;
this->width_ = size;
this->buffer_ = target;
}

inline void set(char* target){
this->n_chars_ = 0;
this->width_ = 0;
this->buffer_ = target;
}
inline void set(const size_t size);
inline void set(const size_t size, char* target);
inline void set(char* target);

inline void reset(){ this->n_chars_ = 0; this->iterator_position_ = 0; }
inline void resetIterator(){ this->iterator_position_ = 0; }
Expand All @@ -86,6 +91,7 @@ struct BasicBuffer{
void AddReadble(const int8_t& value);
void AddReadble(const int16_t& value);
void AddReadble(const int32_t& value);
void AddReadble(const int64_t& value);
void AddReadble(const uint8_t& value);
void AddReadble(const uint16_t& value);
void AddReadble(const uint32_t& value);
Expand Down Expand Up @@ -120,91 +126,46 @@ struct BasicBuffer{
}

private:
friend self_type& operator>>(self_type& data, uint8_t& target){
target = *reinterpret_cast<uint8_t*>(&data.buffer_[data.iterator_position_++]);
return(data);
}

friend self_type& operator>>(self_type& data, uint16_t& target){
target = *reinterpret_cast<uint16_t*>(&data.buffer_[data.iterator_position_]);
data.iterator_position_ += sizeof(uint16_t);
return(data);
}

friend self_type& operator>>(self_type& data, uint32_t& target){
target = *reinterpret_cast<uint32_t*>(&data.buffer_[data.iterator_position_]);
data.iterator_position_ += sizeof(uint32_t);
return(data);
}

friend self_type& operator>>(self_type& data, uint64_t& target){
target = *reinterpret_cast<uint64_t*>(&data.buffer_[data.iterator_position_]);
data.iterator_position_ += sizeof(uint64_t);
return(data);
}

friend self_type& operator>>(self_type& data, int8_t& target){
target = *reinterpret_cast<int8_t*>(&data.buffer_[data.iterator_position_++]);
return(data);
}

friend self_type& operator>>(self_type& data, int16_t& target){
target = *reinterpret_cast<int16_t*>(&data.buffer_[data.iterator_position_]);
data.iterator_position_ += sizeof(int16_t);
return(data);
}

friend self_type& operator>>(self_type& data, int32_t& target){
target = *reinterpret_cast<int32_t*>(&data.buffer_[data.iterator_position_]);
data.iterator_position_ += sizeof(int32_t);
return(data);
}

friend self_type& operator>>(self_type& data, int64_t& target){
target = *reinterpret_cast<int64_t*>(&data.buffer_[data.iterator_position_]);
data.iterator_position_ += sizeof(int64_t);
return(data);
}

friend self_type& operator>>(self_type& data, float& target){
target = *reinterpret_cast<float*>(&data.buffer_[data.iterator_position_]);
data.iterator_position_ += sizeof(float);
return(data);
}

friend self_type& operator>>(self_type& data, double& target){
target = *reinterpret_cast<double*>(&data.buffer_[data.iterator_position_]);
data.iterator_position_ += sizeof(double);
return(data);
}

friend std::ostream& operator<<(std::ostream& out, const self_type& data){
out.write(data.data(), data.size());
return(out);
}
friend self_type& operator>>(self_type& data, uint8_t& target);
friend self_type& operator>>(self_type& data, uint16_t& target);
friend self_type& operator>>(self_type& data, uint32_t& target);
friend self_type& operator>>(self_type& data, uint64_t& target);
friend self_type& operator>>(self_type& data, int8_t& target);
friend self_type& operator>>(self_type& data, int16_t& target);
friend self_type& operator>>(self_type& data, int32_t& target);
friend self_type& operator>>(self_type& data, int64_t& target);
friend self_type& operator>>(self_type& data, float& target);
friend self_type& operator>>(self_type& data, double& target);

friend std::ostream& operator<<(std::ostream& out, const self_type& data);

public:
bool owns_data_;
uint64_t n_chars_;
uint64_t width_;
uint64_t iterator_position_;
pointer buffer_;
bool owns_data_;
uint64_t n_chars_;
uint64_t width_;
uint64_t iterator_position_;
pointer buffer_;
};

void SerializeString(const std::string& string, io::BasicBuffer& buffer);
void DeserializeString(std::string& string, io::BasicBuffer& buffer);
/**<
* Supportive functions for serializing/deserialize data to/from a byte
* stream.
* @param value Src value.
* @param buffer Dst buffer reference.
*/
void SerializeString(const std::string& string, yon_buffer_t& buffer);
void DeserializeString(std::string& string, yon_buffer_t& buffer);

template <class T>
static void SerializePrimitive(const T& value, io::BasicBuffer& buffer){
static void SerializePrimitive(const T& value, yon_buffer_t& buffer){
buffer += value;
}

template <class T>
static void DeserializePrimitive(T& value, io::BasicBuffer& buffer){
static void DeserializePrimitive(T& value, yon_buffer_t& buffer){
buffer >> value;
}

} /* namespace IO */
} /* namespace Tomahawk */
}

#endif /* BASICBUFFER__H_ */
#endif
Loading

0 comments on commit 408ac83

Please sign in to comment.