Commit e0f90724 authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 1.1.2+dfsg

parent ff988fa7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3,8 +3,8 @@
	url = https://github.com/jwalabroad/fermi-lite
[submodule "htslib"]
	path = htslib
	url = https://github.com/walaj/htslib
        branch = develop
	url = https://github.com/samtools/htslib
        branch = master
[submodule "bwa"]
	path = bwa
	url = https://github.com/jwalabroad/bwa
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ then
    ## download the test data
    mkdir test_data
    cd test_data
    wget -r -nH -nd -np -R index.html* https://data.broadinstitute.org/snowman/SeqLibTest/
    wget -r -nH -nd -np -R index.html* https://data.broadinstitute.org/snowman/SeqLib/
    cd ..
    
    export LD_LIBRARY_PATH=${BOOST_ROOT}/lib:${LD_LIBRARY_PATH}
+0 −1
Original line number Diff line number Diff line
@@ -285,7 +285,6 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
+25 −16
Original line number Diff line number Diff line
@@ -9,6 +9,13 @@ API Documentation
-----------------
[API Documentation][htmldoc]

Citation
--------
If you use SeqLib in your applications, please cite: http://bioinformatics.oxfordjournals.org/content/early/2016/12/21/bioinformatics.btw741.full.pdf+html

Note that the values for the SeqAn benchmarking in Table 2 should be corrected to 7.7 Gb memory and 33.92 seconds in CPU time, when compiling SeqAn with ``-O3 -DNDEBUG``. SeqAn also does full string decompression.
Wall times for SeqAn may be shorter than CPU time because it uses embedded multi-threading during BAM IO.

Table of contents
=================

@@ -51,7 +58,7 @@ C_INCLUDE_PATH=$C_INCLUDE_PATH:$SEQ:$SEQ/htslib
And need to link the SeqLib static library and Fermi, BWA and HTSlib libraries
```bash
SEQ=<path_to_seqlib>
LDFLAGS="$LDFLAGS -L$SEQ/bin/libseqlib.a -L$SEQ/bin/libbwa.a -L$SEQ/bin/libfml.a -L$SEQ/bin/libhts.a"
LDFLAGS="$LDFLAGS $SEQ/bin/libseqlib.a $SEQ/bin/libbwa.a $SEQ/bin/libfml.a $SEQ/bin/libhts.a"
```

To add support for reading BAMs, etc with HTTPS, FTP, S3, Google cloud, etc, you must compile and link with libcurl.
@@ -101,13 +108,14 @@ provide excellent and high quality APIs. SeqLib provides further performance enh
bioinformatics problems.

Some differences:
* SeqLib has ~2-4x faster read/write speed over BamTools and SeqAn, and lower memory footprint.
* SeqLib has ~2-4x faster read/write speed over BamTools and lower memory footprint.
* SeqLib has support for CRAM file
* SeqLib provides in memory access to BWA-MEM, BLAT, a chromosome aware interval tree and range operations, and to read correction and sequence assembly with Fermi. BamTools has more support currently for network access. 
* SeqAn provide a substantial amount of additional capabilites not in SeqLib, including graph operations and a more expanded suite of multi-sequence alignments.
* SeqLib provides in memory access to BWA-MEM, BLAT, chromosome aware interval tree, read correction, and sequence assembly with Fermi.
* SeqAn provide a substantial amount of additional capabilites not in SeqLib, including graph operations and an expanded suite of multi-sequence alignments.
* SeqAn embeds multi-threading into some functionality like BAM IO to improve wall times.

For your particular application, our hope is that SeqLib will provide a comprehensive and powerful envrionment to develop 
bioinformatics tools. Feature requests and comments are welcomed.
bioinformatics tools, or to be used in conjuction with the capablities in SeqAn and BamTools. Feature requests and comments are welcomed.

Command Line Usage
------------------
@@ -152,7 +160,7 @@ bwa.ConstructIndex(usv);
std::string querySeq = "CAGCCTCACCCAGGAAAGCAGCTGGGGGTCCACTGGGCTCAGGGAAG";
BamRecordVector results;
// hardclip=false, secondary score cutoff=0.9, max secondary alignments=10
bwa.AlignSequence("my_seq", querySeq, results, false, 0.9, 10); 
bwa.AlignSequence(querySeq, "my_seq", results, false, 0.9, 10); 

// print results to stdout
for (auto& i : results)
@@ -293,21 +301,22 @@ w.Close(); // Optional. Will close on destruction
using namespace SeqLib;

// brv is some set of reads to train the error corrector
b.TrainCorrection(brv);
for (BamRecordVector::const_iterator r = brv.begin(); r != brv.end(); ++r)
    b.AddSequence(r->Sequence().c_str(), r->Qualities().c_str(), r->Qname().c_str());
b.Train();
b.clear(); // clear the training sequences. Training parameters saved in BFC object

// brv2 is some set to correct
b.ErrorCorrect(brv2);
for (BamRecordVector::const_iterator r = brv2.begin(); r != brv2.end(); ++r)
    b.AddSequence(r->Sequence().c_str(), r->Qualities().c_str(), r->Qname().c_str());
b.ErrorCorrect();

// retrieve the sequences
UnalignedSequenceVector v;
b.GetSequences(v);

// alternatively, to train and correct the same set of reads
b.TrainAndCorrect(brv);
b.GetSequences(v);
std::string name, seq;
while (b.GetSequences(seq, name))
  v.push_back({name, seq});      			   

// alternatively, train and correct, and modify the sequence in-place
b.TrainCorrection(brv);
b.ErrorCorrectInPlace(brv);
```

Support
+27 −37
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ namespace SeqLib {
  public:
    /** Construct a new BFC engine */
    BFC() {
      m_idx = 0;
      bfc_opt_init(&bfc_opt);
      ch = NULL;
      kmer = 0;
@@ -43,57 +44,31 @@ namespace SeqLib {
	bfc_ch_destroy(ch);
    }

    /** Allocate a block of memory for the reads if the amount to enter is known 
     * @note This is not necessary, as reads will dynamically reallocate 
     */
    bool AllocateMemory(size_t n);

    /** Peform BFC error correction on the sequences stored in this object */
    bool ErrorCorrect();

    /** Train the error corrector using the reads stored in this object */
    bool Train();

    /** Add a sequence for either training or correction */
    bool AddSequence(const BamRecord& r);

    /** Add a sequence for either training or correction */
    /** Add a sequence for either training or correction 
     * @param seq A sequence to be copied into this object (A, T, C, G)
     */
    bool AddSequence(const char* seq, const char* qual, const char* name);

    /** Set the k-mer size */
    void SetKmer(int k) { kmer = k; }

    /** Train error correction using sequences from aligned reads */
    void TrainCorrection(const BamRecordVector& brv);

    /** Train error correction from raw character strings */
    void TrainCorrection(const std::vector<char*>& v);

    /** Train and error correction on same reads */
    void TrainAndCorrect(const BamRecordVector& brv);

    /** Error correct a collection of reads */
    void ErrorCorrect(const BamRecordVector& brv);

    /** Error correct in place, modify sequence, and the clear memory from this object */
    void ErrorCorrectInPlace(BamRecordVector& brv);
    
    /** Error correct and add tag with the corrected sequence data, and the clear memory from this object 
     * @param brv Aligned reads to error correct
     * @param tag Tag to assign error corrected sequence to (eg KC)
     * @exception Throws an invalid_argument if tag is not length 2
    /** Set the k-mer size for training 
     * @note zero is auto
     */
    void ErrorCorrectToTag(BamRecordVector& brv, const std::string& tag);
    void SetKmer(int k) { kmer = k; }

    /** Return the reads (error corrected if ran ErrorCorrect) */
    void GetSequences(UnalignedSequenceVector& v) const;
    /** Correct a single new sequence not stored in object 
     * @param str Sequence of string to correct (ACTG)
     * @param q Quality score of sequence to correct 
     * @value Returns true if corrected */
    bool CorrectSequence(std::string& str, const std::string& q);
    
    /** Clear the stored reads */
    void clear();

    /** Filter reads with unique k-mers. Do after error correction */
    void FilterUnique();

    /** Return the calculated kcov */
    float GetKCov() const { return kcov; }

@@ -103,8 +78,21 @@ namespace SeqLib {
    /** Return the number of sequences controlled by this */
    int NumSequences() const { return n_seqs; } 

    /** Return the next sequence stored in object 
     * @param s Empty string to be filled.
     * @param q Empty string name to be filled.
     * @value True if string was filled with sequence. False if no more sequences.
     */
    bool GetSequence(std::string& s, std::string& q);

    /** Reset the sequence iterator inside GetSequence 
     */
    void ResetGetSequence() { m_idx = 0; };

  private:

    size_t m_idx;

    // the amount of memory allocated
    size_t m_seqs_size;

@@ -146,6 +134,8 @@ namespace SeqLib {
    // assign names, qualities and seq to m_seqs
    void allocate_sequences_from_char(const std::vector<char*>& v);
    
    void allocate_sequences_from_strings(const std::vector<std::string>& v);
    
    // do the actual read correction
    void correct_reads();

Loading