]> git.donarmstrong.com Git - rsem.git/blobdiff - Transcript.h
Added error detection for cases such as a read's two mates having different names...
[rsem.git] / Transcript.h
index ea621f3072b98ca16c7b6d6f4e195f10e8ebb624..f7afa2b20542ebdb2f4883d1cc12631eb2b1176e 100644 (file)
 
 #include "utils.h"
 
+/**
+   If no genome is provided, seqname field is used to store the allele name.
+ */
+
 struct Interval {
        int start, end;
 
@@ -49,7 +53,7 @@ public:
        }
 
        bool operator< (const Transcript& o) const {
-               return gene_id < o.gene_id || gene_id == o.gene_id && transcript_id < o.transcript_id;
+         return gene_id < o.gene_id || (gene_id == o.gene_id && transcript_id < o.transcript_id) || (gene_id == o.gene_id && transcript_id == o.transcript_id && seqname < o.seqname);
        }
 
        const std::string& getTranscriptID() const { return transcript_id; }
@@ -113,7 +117,10 @@ void Transcript::read(std::ifstream& fin) {
        int s;
        std::string tmp;
 
-       fin>>transcript_id>>gene_id>>seqname>>tmp>>length;
+       getline(fin, transcript_id);
+       getline(fin, gene_id);
+       getline(fin, seqname);
+       fin>>tmp>>length;
        assert(tmp.length() == 1 && (tmp[0] == '+' || tmp[0] == '-'));
        strand = tmp[0];
        structure.clear();
@@ -130,7 +137,10 @@ void Transcript::read(std::ifstream& fin) {
 void Transcript::write(std::ofstream& fout) {
        int s = structure.size();
 
-       fout<<transcript_id<<" "<<gene_id<<" "<<seqname<<" "<<strand<<" "<<length<<" ";
+       fout<<transcript_id<<std::endl;
+       fout<<gene_id<<std::endl;
+       fout<<seqname<<std::endl;
+       fout<<strand<<" "<<length<<std::endl;
        fout<<s;
        for (int i = 0; i < s; i++) fout<<" "<<structure[i].start<<" "<<structure[i].end;
        fout<<std::endl;