File size: 2,355 Bytes
8efb4bd | 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 | #ifndef CROSS_LINK_H
#define CROSS_LINK_H
#include <fstream>
#include <iostream>
#include <vector>
class CrossLink {
public:
CrossLink()
: residueNumber1_(0), chainId1_(" "),
residueNumber2_(0), chainId2_(" "),
minDistance_(0.0), maxDistance_(0.0), weight_(1.0) {}
CrossLink(int residueNumber1, std::string chainId1,
int residueNumber2, std::string chainId2,
float minDistance, float maxDistance, float weight=1.0)
: residueNumber1_(residueNumber1), residueSequenceID1_(std::to_string(residueNumber1)), chainId1_(chainId1),
residueNumber2_(residueNumber2), residueSequenceID2_(std::to_string(residueNumber2)), chainId2_(chainId2),
minDistance_(minDistance), maxDistance_(maxDistance), weight_(weight) {}
int getResidue1() const { return residueNumber1_; }
int getResidue2() const { return residueNumber2_; }
std::string getResidueSequenceID1() const { return residueSequenceID1_; }
std::string getResidueSequenceID2() const { return residueSequenceID2_; }
std::string getChain1() const { return chainId1_; }
std::string getChain2() const { return chainId2_; }
float getMinDistance() const { return minDistance_; }
float getMaxDistance() const { return maxDistance_; }
float getWeight() const { return weight_; }
bool operator==(const CrossLink& cl) const;
bool isInList(const std::vector<CrossLink>& crossLinks) const;
CrossLink getReversed() const;
friend std::ostream& operator<<(std::ostream& q, const CrossLink& cl);
friend std::istream& operator>>(std::istream& s, CrossLink& cl);
protected:
int residueNumber1_;
std::string residueSequenceID1_; // to support numbering of type 99A
std::string chainId1_;
int residueNumber2_;
std::string residueSequenceID2_;
std::string chainId2_;
float minDistance_;
float maxDistance_;
float weight_;
};
int readCrossLinkFile(const std::string& fileName,
std::vector<CrossLink>& crossLinks,
bool addReverse = false);
void writeCrossLinkFile(const std::string& fileName,
const std::vector<CrossLink>& crossLinks);
void writeXLAnalizerFile(const std::string& fileName,
const std::vector<CrossLink>& crossLinks);
#endif
|