check this function: fn map5utr( txstart: &u32, txend: &u32, cnstart: &u32, cnend: &u32,…
- User
check this function:
fn map_5_utr(
tx_start: &u32, tx_end: &u32, cn_start: &u32, cn_end: &u32, idx: &usize,) -> (bool, UMatch) {
if idx == &0 { if tx_start == cn_start && tx_end <= cn_end { // 5' end in-frame (true, UMatch::InFrame) } else if tx_start > cn_start && tx_end <= cn_end { // 5' end truncated inside exon (true, UMatch::TruncatedExon) } else if tx_start < cn_start && tx_end == cn_end { // 5' end truncated inside intron (false, UMatch::TruncatedIntron) } else { (false, UMatch::Unknown) } } else { if tx_start == cn_start && tx_end <= cn_end { // 5' end in-frame (true, UMatch::AltPromoterInFrame) } else if tx_start > cn_start && tx_end <= cn_end { // 5' end truncated inside exon (true, UMatch::AltPromoterTruncatedExon) } else if tx_start < cn_start && tx_end == cn_end { // 5' end truncated inside intron (false, UMatch::AltPromoterTruncatedIntron) } else if tx_end < cn_start { // alternative promoter (true, UMatch::AltPromoterInIntron) } else { (false, UMatch::Unknown) } }}
Can you please make it look more elegant? Try to make it more efficient and faster too.
- Assistant
- User
this is my code:
fig, ax = plt.subplots() x.plot(kind="bar", rot=35, ax=ax)
and this is x:
00 InFrame 74290 AltPromoterInFrame 17701 AltPromoterInIntron 7981 AltPromoterTruncatedExon 4539 TruncatedExon 2654 AltPromoterTruncatedIntron 966 TruncatedIntron 87
I want to plot the number at the top of the bar + its proportion
- Assistant