コード例 #1
0
ファイル: insertions.cpp プロジェクト: genome-vendor/tophat
/**
 * Print insertions in BED format.
 * Note, as per the BED-standard (http://genome.ucsc.edu/FAQ/FAQformat)
 *   -The coordinates should be 0-based
 *   -The chromEnd field should not include the actual feature
 *   -The name will be the inserted sequence
 *   -The score will be the number of supporing counts, which is capped at 1,000
 * By (my) convention, the chromStart will be the last genome postion
 * before hte insertio.
 * 
 * <chrom>\t<left>\t<left>\t<inserted sequence>\t<read count>\n
 * @param insertions_out The output file
 * @param insertions Maps from insertions to number of supporting reads
 * @param ref_sequences The table of reference sequences 
 */
void print_insertions(FILE* insertions_out, const InsertionSet& insertions, RefSequenceTable& ref_sequences){
	fprintf(insertions_out, "track name=insertions description=\"TopHat insertions\"\n");
	for(InsertionSet::const_iterator i = insertions.begin(); i != insertions.end(); ++i){
		int counts = i->second;
		if(counts > 1000){
			counts = 1000;
		}
		fprintf(insertions_out, "%s\t%d\t%d\t%s\t%d\n",
			ref_sequences.get_name(i->first.refid),
			i->first.left,
			i->first.left,
			(i->first.sequence).c_str(),
			counts);
	}
}
コード例 #2
0
ファイル: insertions.cpp プロジェクト: genome-vendor/tophat
/**
 * Add insertions from an alignment to an InsertionSet.
 * This will look for insertion in the alignment specified by bh. If the 
 * insertion is already in insertions, it will updated the count. Otherwise,
 * it will add the insertion to the set and initialize the count to 1.
 * @param bh The bowtie hit to be used to specify alignment infromation.
 * @param insertions The InsertionSet that will be updated with the insertion information from teh alignment.
 */
void insertions_from_alignment(const BowtieHit& bh, InsertionSet& insertions){

	vector<Insertion> new_insertions;
	insertions_from_spliced_hit(bh, new_insertions);

	for(size_t i = 0; i < new_insertions.size(); ++i){
		Insertion insertion = new_insertions[i];
		InsertionSet::iterator itr = insertions.find(insertion);
		if (itr != insertions.end()){
			itr->second += 1;
		}
		else{
			assert(insertion.refid != VMAXINT32);
			insertions[insertion] = 1;
		}
	}
	return;
}