MCPcopy Create free account
hub / github.com/BirolLab/abyss / read_seqs

Function read_seqs

Align/dialign.cpp:191–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191static struct seq_col* read_seqs(const vector<string>& amb_seqs)
192{
193 struct seq_col* scol = (struct seq_col*)calloc(1, sizeof(struct seq_col));
194 struct seq* seqs = (scol->seqs = (struct seq*)calloc(amb_seqs.size(), sizeof(struct seq)));
195 if(scol==NULL || seqs==NULL) {
196 cerr << "read_seqs(): Out of memory !\n";
197 exit(EXIT_FAILURE);
198 }
199 scol->length = amb_seqs.size();
200 scol->avg_length = 0;
201
202 seq* seq;
203 for (size_t i=0; i<amb_seqs.size(); i++) {
204 assert(!amb_seqs[i].empty());
205 seq = &(scol->seqs[i]);
206 seq->max_seen = 0;
207 //seq->name = calloc(rlen, sizeof(char)); //do I need this?
208 seq->num = i;
209 seq->orf_frame=0;
210 seq->crick_strand=0;
211 //strncpy(seq->name, &(rline[1]), rlen-2);
212 seq->data = (char*)calloc(amb_seqs[i].length()+1, sizeof(char));
213 if (seq->data == NULL) {
214 cerr << "seq->data out of memory !\n";
215 exit(EXIT_FAILURE);
216 }
217 strcpy(seq->data, amb_seqs[i].c_str());
218 seq->length = amb_seqs[i].length();
219 scol->avg_length += amb_seqs[i].length();
220 if(para->DEBUG >1) printf("DEBUG: seq:%s\n", seq->data);
221 }
222 scol->avg_length /= scol->length;
223 if(para->DEBUG >1) printf("DEBUG: total # of amb_seqs: %i, avg_length: %i\n", scol->length, scol->avg_length);
224 return scol;
225}
226
227// assume initial sequences contain only a/c/g/t/n
228static string get_alignment_consensus(struct alignment *algn)

Callers 1

dialignFunction · 0.85

Calls 4

sizeMethod · 0.45
emptyMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected