Skip to content

Commit

Permalink
shift and scale added to sam output
Browse files Browse the repository at this point in the history
  • Loading branch information
hasindu2008 committed Sep 8, 2023
1 parent d98d5fd commit 8ccbe93
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/eventalign.c
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,7 @@ char *emit_event_alignment_sam(char* read_name,
bam_hdr_t* base_hdr,
bam1_t* base_record,
const std::vector<event_alignment_t>& alignments, int8_t sam_out_version,
event_table* et, int64_t len_raw_signal, int64_t ref_len, int8_t rna
event_table* et, int64_t len_raw_signal, int64_t ref_len, int8_t rna, scalings_t scalings
)
{

Expand Down Expand Up @@ -1958,6 +1958,12 @@ char *emit_event_alignment_sam(char* read_name,
NEG_CHK(ret_sw);
ret_sw = bam_aux_append(base_record, "ss", 'Z', strlen(f5c_ss.ss)+1, (uint8_t*)f5c_ss.ss);
NEG_CHK(ret_sw);
float sc = scalings.scale;
ret_sw = bam_aux_append(base_record, "sc", 'f', 4, (uint8_t*)(&sc));
NEG_CHK(ret_sw);
float sh = scalings.shift;
ret_sw = bam_aux_append(base_record, "sh", 'f', 4, (uint8_t*)(&sh));
NEG_CHK(ret_sw);
ret_sw = sam_format1(base_hdr, base_record, sp);
NEG_CHK(ret_sw);
sprintf_append(sp, "\n");
Expand Down
2 changes: 1 addition & 1 deletion src/f5c.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ void eventalign_single(core_t* core, db_t* db, int32_t i){
} else if(sam_output){
int8_t sam_out_version = core->opt.sam_out_version;
int64_t ref_len = core->m_hdr->target_len[db->bam_rec[i]->core.tid];
db->event_alignment_result_str[i] = emit_event_alignment_sam(qname, core->m_hdr, db->bam_rec[i], *event_alignment_result, sam_out_version, &(db->et[i]), db->sig[i]->nsample, ref_len, rna);
db->event_alignment_result_str[i] = emit_event_alignment_sam(qname, core->m_hdr, db->bam_rec[i], *event_alignment_result, sam_out_version, &(db->et[i]), db->sig[i]->nsample, ref_len, rna, db->scalings[i]);
} else {
db->event_alignment_result_str[i] = emit_event_alignment_tsv(0,&(db->et[i]),core->model,core->kmer_size, db->scalings[i],*event_alignment_result, print_read_names, scale_events, write_samples, write_signal_index, collapse_events,
db->read_idx[i], qname, contig, db->sig[i]->sample_rate, db->sig[i]->rawptr);
Expand Down
2 changes: 1 addition & 1 deletion src/f5cmisc.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void emit_event_alignment_tsv_header(FILE* fp, int8_t print_read_names, int8_t w
void emit_sam_header(samFile* fp, const bam_hdr_t* hdr);
char *emit_event_alignment_sam(char* read_name, bam_hdr_t* base_hdr, bam1_t* base_record,
const std::vector<event_alignment_t>& alignments, int8_t sam_out_version,
event_table* et, int64_t len_raw_signal, int64_t ref_len, int8_t rna
event_table* et, int64_t len_raw_signal, int64_t ref_len, int8_t rna, scalings_t scalings
);
void realign_read(std::vector<event_alignment_t>* event_alignment_result, EventalignSummary *summary, FILE *summary_fp,char* ref,
const bam_hdr_t* hdr, const bam1_t* record, int32_t read_length,
Expand Down

0 comments on commit 8ccbe93

Please sign in to comment.