File: FASTASequence.hpp

package info (click to toggle)
pbseqlib 5.3.4%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 7,020 kB
  • sloc: cpp: 77,246; python: 331; sh: 103; makefile: 42
file content (81 lines) | stat: -rw-r--r-- 1,917 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef _BLASR_FASTA_SEQUENCE_HPP_
#define _BLASR_FASTA_SEQUENCE_HPP_

#include <cstdint>
#include <cstring>
#include <iostream>
#include <ostream>
#include <string>
#include <string>

#include <pbdata/Enumerations.h>
#include <pbdata/Types.h>
#include <pbdata/DNASequence.hpp>
#include <pbdata/NucConversion.hpp>
#include <pbdata/reads/ZMWGroupEntry.hpp>

//
// NO proteins for now.
class FASTASequence : public DNASequence
{
private:
    // Whether or not to delete title in Free()
    // regardless of deleteOnExit (to prevent memory leak
    // when ReferenceSubstring and CopyTitle are called together).
    bool deleteTitleOnExit;

public:
    char *title;
    int titleLength;

    FASTASequence();
    inline ~FASTASequence();

    void PrintSeq(std::ostream &out, int lineLength = 50, char delim = '>') const;

    int GetStorageSize() const;

    std::string GetName() const;

    void ShallowCopy(const FASTASequence &rhs);

    std::string GetTitle() const;

    void DeleteTitle();

    void CopyTitle(const char *str, int strlen);

    void CopyTitle(std::string str);

    void GetFASTATitle(std::string &fastaTitle) const;

    void CopySubsequence(FASTASequence &rhs, int readStart, int readEnd = -1);

    void AppendToTitle(std::string str);

    void Assign(FASTASequence &rhs);

    void MakeRC(FASTASequence &rhs, DNALength rhsPos = 0, DNALength rhsLength = 0);

    // Reverse complement sequence, and leave title as is.
    FASTASequence &ReverseComplementSelf(void);

    void operator=(const FASTASequence &rhs);

    void Copy(const FASTASequence &rhs);

    void Copy(const std::string &rhsTitle, const std::string &rhsSeq);

    void Copy(const std::string &rhsSeq);

#ifdef USE_PBBAM
    /// Copies a BamRecord as a FASTASequence.
    void Copy(const PacBio::BAM::BamRecord &record);
#endif

    void Free();
};

inline FASTASequence::~FASTASequence() { FASTASequence::Free(); }

#endif