]> git.donarmstrong.com Git - rsem.git/blobdiff - extractRef.cpp
Updated samtools to 0.1.19
[rsem.git] / extractRef.cpp
index 1a56cc15e8c615f02e14c7cd15f4e8c787e5a172..fb7d3ecb586d36e586d8698a9f4c94bc0ec4cc46 100644 (file)
@@ -260,7 +260,6 @@ int main(int argc, char* argv[]) {
 
        ifstream fin;
        string line, gseq, seqname;
-       void* pt;
 
        chrvec.clear();
 
@@ -270,31 +269,31 @@ int main(int argc, char* argv[]) {
        for (int i = start; i < argc; i++) {
                fin.open(argv[i]);
                if (!fin.is_open()) { fprintf(stderr, "Cannot open %s! It may not exist.\n", argv[i]); exit(-1); }
-               pt = getline(fin, line);
-               while (pt != 0 && line[0] == '>') {
+               getline(fin, line);
+               while ((fin) && (line[0] == '>')) {
                        istringstream strin(line.substr(1));
                        strin>>seqname;
 
                        gseq = "";
-                   while((pt = getline(fin, line)) && line[0] != '>') {
-                       gseq += line;
-                   }
-
-                   size_t len = gseq.length();
-                   assert(len > 0);
-                   for (size_t j = 0; j < len; j++) gseq[j] = check(gseq[j]);
-
-                   iter = sn2tr.find(seqname);
-                   if (iter == sn2tr.end()) continue;
-
-                   chrvec.push_back(ChrInfo(seqname, len));
-
-                   vector<int>& vec = iter->second;
-                   int s = vec.size();
-                   for (int j = 0; j < s; j++) {
-                       assert(vec[j] > 0 && vec[j] <= M);
-                       transcripts.getTranscriptAt(vec[j]).extractSeq(gseq, seqs[vec[j]]);
-                   }
+                       while((getline(fin, line)) && (line[0] != '>')) {
+                         gseq += line;
+                       }
+
+                       size_t len = gseq.length();
+                       assert(len > 0);
+                       for (size_t j = 0; j < len; j++) gseq[j] = check(gseq[j]);
+                       
+                       iter = sn2tr.find(seqname);
+                       if (iter == sn2tr.end()) continue;
+                       
+                       chrvec.push_back(ChrInfo(seqname, len));
+                       
+                       vector<int>& vec = iter->second;
+                       int s = vec.size();
+                       for (int j = 0; j < s; j++) {
+                         assert(vec[j] > 0 && vec[j] <= M);
+                         transcripts.getTranscriptAt(vec[j]).extractSeq(gseq, seqs[vec[j]]);
+                       }
                }
                fin.close();