Skip to content

Instantly share code, notes, and snippets.

@tomkinsc
Last active August 22, 2022 20:11
Show Gist options
  • Save tomkinsc/49e8519e0ec13bba6ed48ed9fa53cf61 to your computer and use it in GitHub Desktop.
Save tomkinsc/49e8519e0ec13bba6ed48ed9fa53cf61 to your computer and use it in GitHub Desktop.
This replaces basecall quality scores with graphical equivalents. Based on pyemojify and fastqe, but self-contained without dependencies external to the standard library.
#!/usr/bin/env python
import re, sys, os
from stat import S_ISFIFO
import argparse
# quick and dirty script to show emoji or bars for samtools mpileup quality scrores
# extra verbose so this does not require any external libraries
# based on fastqe and emojify:
# https://raw.githubusercontent.com/fastqe/fastqe/master/fastqe/fastqe_map.py
# https://github.com/lord63/pyemojify
seq_emoji_map = {
'A': ':apple:', # avocado? differnet colours?
'C': ':corn:',
'T': ':tomato:',
'G': ':grapes:',
'N': ':question: '
}
all_qualities = r"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
#From https://en.wikipedia.org/wiki/FASTQ_format
# note order not exact here
fastq_emoji_map = {
'!': ':no_entry_sign:',
'\"': ':x:',
'#': ':japanese_goblin:',
'$': ':broken_heart:',
'%': ':no_good:',
'&': ':space_invader:',
'\'': ':imp:',
'(': ':skull:',
')': ':ghost:',
#'': ':pouting_cat:',
'*': ':see_no_evil:',
'+': ':hear_no_evil:',
',': ':speak_no_evil:',
'/': ':pouting_cat:',
'-': ':monkey_face:',
'.': ':crying_cat_face:',
'0': ':scream_cat:',
'1': ':bomb:',
'2': ':fire:',
'3': ':rage:',
'4': ':poop:',
'5': ':warning:',
'6': ':grinning:',
'7': ':sweat_smile:',
'8': ':smirk:',
'9': ':blush:',
':': ':kissing_smiling_eyes:',
';': ':kissing:',
'<': ':kissing_closed_eyes:',
'>': ':kissing_heart:',
'@': ':smile:',
'=': ':smiley:',
'?': ':laughing:',
'A': ':yum:',
'B': ':relaxed:',
'D': ':stuck_out_tongue:',
'C': ':stuck_out_tongue_closed_eyes:',
'E': ':stuck_out_tongue_winking_eye:',
'G': ':grin:',
'H': ':smile:',
'I': ':sunglasses:',
'J': ':heart_eyes:',
'F': ':wink:'
}
# only use 0 to 50 use same emoji
# binning - i.e https://www.illumina.com/documents/products/technotes/technote_understanding_quality_scores.pdf
fastq_emoji_map_binned= {
#N (no call) N (no call)
'!': ':no_entry_sign:',
'"': ':no_entry_sign:',
#2โ€“9 6
'#': ':skull:',
'$': ':skull:',
'%': ':skull:',
'&': ':skull:',
'\'': ':skull:',
'(': ':skull:',
')': ':skull:',
'*': ':skull:',
#10โ€“19 15
'+': ':poop:' ,
',': ':poop:' ,
'-': ':poop:' ,
'.': ':poop:' ,
'/': ':poop:' ,
'0': ':poop:' ,
'1': ':poop:' ,
'2': ':poop:' ,
'3': ':poop:' ,
'4': ':poop:' ,
#20โ€“24 22
'5': ':warning:',
'6': ':warning:',
'7': ':warning:',
'8': ':warning:',
'9': ':warning:',
#25โ€“29 27
':': ':smile:',
';': ':smile:',
'<': ':smile:',
'=': ':smile:',
'>': ':smile:',
#30โ€“34 33
'?': ':laughing:',
'@': ':laughing:',
'A': ':laughing:',
'B': ':laughing:',
'C': ':laughing:',
#35โ€“39 37
'D': ':sunglasses:',
'E': ':sunglasses:',
'F': ':sunglasses:',
'G': ':sunglasses:',
'H': ':sunglasses:',
#โ‰ฅ 40 40
'I': ':heart_eyes:',
'J': ':heart_eyes:',
}
# emoji map
emoji_table = {
':smile:': u'๐Ÿ˜„',
':smiley:': u'๐Ÿ˜ƒ',
':grinning:': u'๐Ÿ˜€',
':blush:': u'๐Ÿ˜Š',
':relaxed:': u'โ˜บ๏ธ',
':wink:': u'๐Ÿ˜‰',
':heart_eyes:': u'๐Ÿ˜',
':kissing_heart:': u'๐Ÿ˜˜',
':kissing_closed_eyes:': u'๐Ÿ˜š',
':kissing:': u'๐Ÿ˜—',
':kissing_smiling_eyes:': u'๐Ÿ˜™',
':stuck_out_tongue_winking_eye:': u'๐Ÿ˜œ',
':stuck_out_tongue_closed_eyes:': u'๐Ÿ˜',
':stuck_out_tongue:': u'๐Ÿ˜›',
':flushed:': u'๐Ÿ˜ณ',
':grin:': u'๐Ÿ˜',
':pensive:': u'๐Ÿ˜”',
':relieved:': u'๐Ÿ˜Œ',
':unamused:': u'๐Ÿ˜’',
':disappointed:': u'๐Ÿ˜ž',
':persevere:': u'๐Ÿ˜ฃ',
':cry:': u'๐Ÿ˜ข',
':joy:': u'๐Ÿ˜‚',
':sob:': u'๐Ÿ˜ญ',
':sleepy:': u'๐Ÿ˜ช',
':disappointed_relieved:': u'๐Ÿ˜ฅ',
':cold_sweat:': u'๐Ÿ˜ฐ',
':sweat_smile:': u'๐Ÿ˜…',
':sweat:': u'๐Ÿ˜“',
':weary:': u'๐Ÿ˜ฉ',
':tired_face:': u'๐Ÿ˜ซ',
':fearful:': u'๐Ÿ˜จ',
':scream:': u'๐Ÿ˜ฑ',
':angry:': u'๐Ÿ˜ ',
':rage:': u'๐Ÿ˜ก',
':triumph:': u'๐Ÿ˜ค',
':confounded:': u'๐Ÿ˜–',
':laughing:': u'๐Ÿ˜†',
':satisfied:': u'๐Ÿ˜†',
':yum:': u'๐Ÿ˜‹',
':mask:': u'๐Ÿ˜ท',
':sunglasses:': u'๐Ÿ˜Ž',
':sleeping:': u'๐Ÿ˜ด',
':dizzy_face:': u'๐Ÿ˜ต',
':astonished:': u'๐Ÿ˜ฒ',
':worried:': u'๐Ÿ˜Ÿ',
':frowning:': u'๐Ÿ˜ฆ',
':anguished:': u'๐Ÿ˜ง',
':smiling_imp:': u'๐Ÿ˜ˆ',
':imp:': u'๐Ÿ‘ฟ',
':open_mouth:': u'๐Ÿ˜ฎ',
':grimacing:': u'๐Ÿ˜ฌ',
':neutral_face:': u'๐Ÿ˜',
':confused:': u'๐Ÿ˜•',
':hushed:': u'๐Ÿ˜ฏ',
':no_mouth:': u'๐Ÿ˜ถ',
':innocent:': u'๐Ÿ˜‡',
':smirk:': u'๐Ÿ˜',
':expressionless:': u'๐Ÿ˜‘',
':man_with_gua_pi_mao:': u'๐Ÿ‘ฒ',
':man_with_turban:': u'๐Ÿ‘ณ',
':cop:': u'๐Ÿ‘ฎ',
':construction_worker:': u'๐Ÿ‘ท',
':guardsman:': u'๐Ÿ’‚',
':baby:': u'๐Ÿ‘ถ',
':boy:': u'๐Ÿ‘ฆ',
':girl:': u'๐Ÿ‘ง',
':man:': u'๐Ÿ‘จ',
':woman:': u'๐Ÿ‘ฉ',
':older_man:': u'๐Ÿ‘ด',
':older_woman:': u'๐Ÿ‘ต',
':person_with_blond_hair:': u'๐Ÿ‘ฑ',
':angel:': u'๐Ÿ‘ผ',
':princess:': u'๐Ÿ‘ธ',
':smiley_cat:': u'๐Ÿ˜บ',
':smile_cat:': u'๐Ÿ˜ธ',
':heart_eyes_cat:': u'๐Ÿ˜ป',
':kissing_cat:': u'๐Ÿ˜ฝ',
':smirk_cat:': u'๐Ÿ˜ผ',
':scream_cat:': u'๐Ÿ™€',
':crying_cat_face:': u'๐Ÿ˜ฟ',
':joy_cat:': u'๐Ÿ˜น',
':pouting_cat:': u'๐Ÿ˜พ',
':japanese_ogre:': u'๐Ÿ‘น',
':japanese_goblin:': u'๐Ÿ‘บ',
':see_no_evil:': u'๐Ÿ™ˆ',
':hear_no_evil:': u'๐Ÿ™‰',
':speak_no_evil:': u'๐Ÿ™Š',
':skull:': u'๐Ÿ’€',
':alien:': u'๐Ÿ‘ฝ',
':hankey:': u'๐Ÿ’ฉ',
':poop:': u'๐Ÿ’ฉ',
':shit:': u'๐Ÿ’ฉ',
':fire:': u'๐Ÿ”ฅ',
':sparkles:': u'โœจ',
':star2:': u'๐ŸŒŸ',
':dizzy:': u'๐Ÿ’ซ',
':boom:': u'๐Ÿ’ฅ',
':collision:': u'๐Ÿ’ฅ',
':anger:': u'๐Ÿ’ข',
':sweat_drops:': u'๐Ÿ’ฆ',
':droplet:': u'๐Ÿ’ง',
':zzz:': u'๐Ÿ’ค',
':dash:': u'๐Ÿ’จ',
':ear:': u'๐Ÿ‘‚',
':eyes:': u'๐Ÿ‘€',
':nose:': u'๐Ÿ‘ƒ',
':tongue:': u'๐Ÿ‘…',
':lips:': u'๐Ÿ‘„',
':+1:': u'๐Ÿ‘',
':thumbsup:': u'๐Ÿ‘',
':-1:': u'๐Ÿ‘Ž',
':thumbsdown:': u'๐Ÿ‘Ž',
':ok_hand:': u'๐Ÿ‘Œ',
':facepunch:': u'๐Ÿ‘Š',
':punch:': u'๐Ÿ‘Š',
':fist:': u'โœŠ',
':v:': u'โœŒ๏ธ',
':wave:': u'๐Ÿ‘‹',
':hand:': u'โœ‹',
':raised_hand:': u'โœ‹',
':open_hands:': u'๐Ÿ‘',
':point_up_2:': u'๐Ÿ‘†',
':point_down:': u'๐Ÿ‘‡',
':point_right:': u'๐Ÿ‘‰',
':point_left:': u'๐Ÿ‘ˆ',
':raised_hands:': u'๐Ÿ™Œ',
':pray:': u'๐Ÿ™',
':point_up:': u'โ˜๏ธ',
':clap:': u'๐Ÿ‘',
':muscle:': u'๐Ÿ’ช',
':walking:': u'๐Ÿšถ',
':runner:': u'๐Ÿƒ',
':running:': u'๐Ÿƒ',
':dancer:': u'๐Ÿ’ƒ',
':couple:': u'๐Ÿ‘ซ',
':family:': u'๐Ÿ‘ช',
':two_men_holding_hands:': u'๐Ÿ‘ฌ',
':two_women_holding_hands:': u'๐Ÿ‘ญ',
':couplekiss:': u'๐Ÿ’',
':couple_with_heart:': u'๐Ÿ’‘',
':dancers:': u'๐Ÿ‘ฏ',
':ok_woman:': u'๐Ÿ™†',
':no_good:': u'๐Ÿ™…',
':information_desk_person:': u'๐Ÿ’',
':raising_hand:': u'๐Ÿ™‹',
':massage:': u'๐Ÿ’†',
':haircut:': u'๐Ÿ’‡',
':nail_care:': u'๐Ÿ’…',
':bride_with_veil:': u'๐Ÿ‘ฐ',
':person_with_pouting_face:': u'๐Ÿ™Ž',
':person_frowning:': u'๐Ÿ™',
':bow:': u'๐Ÿ™‡',
':tophat:': u'๐ŸŽฉ',
':crown:': u'๐Ÿ‘‘',
':womans_hat:': u'๐Ÿ‘’',
':athletic_shoe:': u'๐Ÿ‘Ÿ',
':mans_shoe:': u'๐Ÿ‘ž',
':shoe:': u'๐Ÿ‘ž',
':sandal:': u'๐Ÿ‘ก',
':high_heel:': u'๐Ÿ‘ ',
':boot:': u'๐Ÿ‘ข',
':shirt:': u'๐Ÿ‘•',
':tshirt:': u'๐Ÿ‘•',
':necktie:': u'๐Ÿ‘”',
':womans_clothes:': u'๐Ÿ‘š',
':dress:': u'๐Ÿ‘—',
':running_shirt_with_sash:': u'๐ŸŽฝ',
':jeans:': u'๐Ÿ‘–',
':kimono:': u'๐Ÿ‘˜',
':bikini:': u'๐Ÿ‘™',
':briefcase:': u'๐Ÿ’ผ',
':handbag:': u'๐Ÿ‘œ',
':pouch:': u'๐Ÿ‘',
':purse:': u'๐Ÿ‘›',
':eyeglasses:': u'๐Ÿ‘“',
':ribbon:': u'๐ŸŽ€',
':closed_umbrella:': u'๐ŸŒ‚',
':lipstick:': u'๐Ÿ’„',
':yellow_heart:': u'๐Ÿ’›',
':blue_heart:': u'๐Ÿ’™',
':purple_heart:': u'๐Ÿ’œ',
':green_heart:': u'๐Ÿ’š',
':heart:': u'โค๏ธ',
':broken_heart:': u'๐Ÿ’”',
':heartpulse:': u'๐Ÿ’—',
':heartbeat:': u'๐Ÿ’“',
':two_hearts:': u'๐Ÿ’•',
':sparkling_heart:': u'๐Ÿ’–',
':revolving_hearts:': u'๐Ÿ’ž',
':cupid:': u'๐Ÿ’˜',
':love_letter:': u'๐Ÿ’Œ',
':kiss:': u'๐Ÿ’‹',
':ring:': u'๐Ÿ’',
':gem:': u'๐Ÿ’Ž',
':bust_in_silhouette:': u'๐Ÿ‘ค',
':busts_in_silhouette:': u'๐Ÿ‘ฅ',
':speech_balloon:': u'๐Ÿ’ฌ',
':footprints:': u'๐Ÿ‘ฃ',
':thought_balloon:': u'๐Ÿ’ญ',
':dog:': u'๐Ÿถ',
':wolf:': u'๐Ÿบ',
':cat:': u'๐Ÿฑ',
':mouse:': u'๐Ÿญ',
':hamster:': u'๐Ÿน',
':rabbit:': u'๐Ÿฐ',
':frog:': u'๐Ÿธ',
':tiger:': u'๐Ÿฏ',
':koala:': u'๐Ÿจ',
':bear:': u'๐Ÿป',
':pig:': u'๐Ÿท',
':pig_nose:': u'๐Ÿฝ',
':cow:': u'๐Ÿฎ',
':boar:': u'๐Ÿ—',
':monkey_face:': u'๐Ÿต',
':monkey:': u'๐Ÿ’',
':horse:': u'๐Ÿด',
':sheep:': u'๐Ÿ‘',
':elephant:': u'๐Ÿ˜',
':panda_face:': u'๐Ÿผ',
':penguin:': u'๐Ÿง',
':bird:': u'๐Ÿฆ',
':baby_chick:': u'๐Ÿค',
':hatched_chick:': u'๐Ÿฅ',
':hatching_chick:': u'๐Ÿฃ',
':chicken:': u'๐Ÿ”',
':snake:': u'๐Ÿ',
':turtle:': u'๐Ÿข',
':bug:': u'๐Ÿ›',
':bee:': u'๐Ÿ',
':honeybee:': u'๐Ÿ',
':ant:': u'๐Ÿœ',
':beetle:': u'๐Ÿž',
':snail:': u'๐ŸŒ',
':octopus:': u'๐Ÿ™',
':shell:': u'๐Ÿš',
':tropical_fish:': u'๐Ÿ ',
':fish:': u'๐ŸŸ',
':dolphin:': u'๐Ÿฌ',
':flipper:': u'๐Ÿฌ',
':whale:': u'๐Ÿณ',
':whale2:': u'๐Ÿ‹',
':cow2:': u'๐Ÿ„',
':ram:': u'๐Ÿ',
':rat:': u'๐Ÿ€',
':water_buffalo:': u'๐Ÿƒ',
':tiger2:': u'๐Ÿ…',
':rabbit2:': u'๐Ÿ‡',
':dragon:': u'๐Ÿ‰',
':racehorse:': u'๐ŸŽ',
':goat:': u'๐Ÿ',
':rooster:': u'๐Ÿ“',
':dog2:': u'๐Ÿ•',
':pig2:': u'๐Ÿ–',
':mouse2:': u'๐Ÿ',
':ox:': u'๐Ÿ‚',
':dragon_face:': u'๐Ÿฒ',
':blowfish:': u'๐Ÿก',
':crocodile:': u'๐ŸŠ',
':camel:': u'๐Ÿซ',
':dromedary_camel:': u'๐Ÿช',
':leopard:': u'๐Ÿ†',
':cat2:': u'๐Ÿˆ',
':poodle:': u'๐Ÿฉ',
':feet:': u'๐Ÿพ',
':paw_prints:': u'๐Ÿพ',
':bouquet:': u'๐Ÿ’',
':cherry_blossom:': u'๐ŸŒธ',
':tulip:': u'๐ŸŒท',
':four_leaf_clover:': u'๐Ÿ€',
':rose:': u'๐ŸŒน',
':sunflower:': u'๐ŸŒป',
':hibiscus:': u'๐ŸŒบ',
':maple_leaf:': u'๐Ÿ',
':leaves:': u'๐Ÿƒ',
':fallen_leaf:': u'๐Ÿ‚',
':herb:': u'๐ŸŒฟ',
':ear_of_rice:': u'๐ŸŒพ',
':mushroom:': u'๐Ÿ„',
':cactus:': u'๐ŸŒต',
':palm_tree:': u'๐ŸŒด',
':evergreen_tree:': u'๐ŸŒฒ',
':deciduous_tree:': u'๐ŸŒณ',
':chestnut:': u'๐ŸŒฐ',
':seedling:': u'๐ŸŒฑ',
':blossom:': u'๐ŸŒผ',
':globe_with_meridians:': u'๐ŸŒ',
':sun_with_face:': u'๐ŸŒž',
':full_moon_with_face:': u'๐ŸŒ',
':new_moon_with_face:': u'๐ŸŒš',
':new_moon:': u'๐ŸŒ‘',
':waxing_crescent_moon:': u'๐ŸŒ’',
':first_quarter_moon:': u'๐ŸŒ“',
':moon:': u'๐ŸŒ”',
':waxing_gibbous_moon:': u'๐ŸŒ”',
':full_moon:': u'๐ŸŒ•',
':waning_gibbous_moon:': u'๐ŸŒ–',
':last_quarter_moon:': u'๐ŸŒ—',
':waning_crescent_moon:': u'๐ŸŒ˜',
':last_quarter_moon_with_face:': u'๐ŸŒœ',
':first_quarter_moon_with_face:': u'๐ŸŒ›',
':crescent_moon:': u'๐ŸŒ™',
':earth_africa:': u'๐ŸŒ',
':earth_americas:': u'๐ŸŒŽ',
':earth_asia:': u'๐ŸŒ',
':volcano:': u'๐ŸŒ‹',
':milky_way:': u'๐ŸŒŒ',
':stars:': u'๐ŸŒ ',
':star:': u'โญ',
':sunny:': u'โ˜€๏ธ',
':partly_sunny:': u'โ›…',
':cloud:': u'โ˜๏ธ',
':zap:': u'โšก',
':umbrella:': u'โ˜”',
':snowflake:': u'โ„๏ธ',
':snowman:': u'โ›„',
':cyclone:': u'๐ŸŒ€',
':foggy:': u'๐ŸŒ',
':rainbow:': u'๐ŸŒˆ',
':ocean:': u'๐ŸŒŠ',
':bamboo:': u'๐ŸŽ',
':gift_heart:': u'๐Ÿ’',
':dolls:': u'๐ŸŽŽ',
':school_satchel:': u'๐ŸŽ’',
':mortar_board:': u'๐ŸŽ“',
':flags:': u'๐ŸŽ',
':fireworks:': u'๐ŸŽ†',
':sparkler:': u'๐ŸŽ‡',
':wind_chime:': u'๐ŸŽ',
':rice_scene:': u'๐ŸŽ‘',
':jack_o_lantern:': u'๐ŸŽƒ',
':ghost:': u'๐Ÿ‘ป',
':santa:': u'๐ŸŽ…',
':christmas_tree:': u'๐ŸŽ„',
':gift:': u'๐ŸŽ',
':tanabata_tree:': u'๐ŸŽ‹',
':tada:': u'๐ŸŽ‰',
':confetti_ball:': u'๐ŸŽŠ',
':balloon:': u'๐ŸŽˆ',
':crossed_flags:': u'๐ŸŽŒ',
':crystal_ball:': u'๐Ÿ”ฎ',
':movie_camera:': u'๐ŸŽฅ',
':camera:': u'๐Ÿ“ท',
':video_camera:': u'๐Ÿ“น',
':vhs:': u'๐Ÿ“ผ',
':cd:': u'๐Ÿ’ฟ',
':dvd:': u'๐Ÿ“€',
':minidisc:': u'๐Ÿ’ฝ',
':floppy_disk:': u'๐Ÿ’พ',
':computer:': u'๐Ÿ’ป',
':iphone:': u'๐Ÿ“ฑ',
':phone:': u'โ˜Ž๏ธ',
':telephone:': u'โ˜Ž๏ธ',
':telephone_receiver:': u'๐Ÿ“ž',
':pager:': u'๐Ÿ“Ÿ',
':fax:': u'๐Ÿ“ ',
':satellite:': u'๐Ÿ“ก',
':tv:': u'๐Ÿ“บ',
':radio:': u'๐Ÿ“ป',
':loud_sound:': u'๐Ÿ”Š',
':sound:': u'๐Ÿ”‰',
':speaker:': u'๐Ÿ”ˆ',
':mute:': u'๐Ÿ”‡',
':bell:': u'๐Ÿ””',
':no_bell:': u'๐Ÿ”•',
':loudspeaker:': u'๐Ÿ“ข',
':mega:': u'๐Ÿ“ฃ',
':hourglass_flowing_sand:': u'โณ',
':hourglass:': u'โŒ›',
':alarm_clock:': u'โฐ',
':watch:': u'โŒš',
':unlock:': u'๐Ÿ”“',
':lock:': u'๐Ÿ”’',
':lock_with_ink_pen:': u'๐Ÿ”',
':closed_lock_with_key:': u'๐Ÿ”',
':key:': u'๐Ÿ”‘',
':mag_right:': u'๐Ÿ”Ž',
':bulb:': u'๐Ÿ’ก',
':flashlight:': u'๐Ÿ”ฆ',
':high_brightness:': u'๐Ÿ”†',
':low_brightness:': u'๐Ÿ”…',
':electric_plug:': u'๐Ÿ”Œ',
':battery:': u'๐Ÿ”‹',
':mag:': u'๐Ÿ”',
':bathtub:': u'๐Ÿ›',
':bath:': u'๐Ÿ›€',
':shower:': u'๐Ÿšฟ',
':toilet:': u'๐Ÿšฝ',
':wrench:': u'๐Ÿ”ง',
':nut_and_bolt:': u'๐Ÿ”ฉ',
':hammer:': u'๐Ÿ”จ',
':door:': u'๐Ÿšช',
':smoking:': u'๐Ÿšฌ',
':bomb:': u'๐Ÿ’ฃ',
':gun:': u'๐Ÿ”ซ',
':hocho:': u'๐Ÿ”ช',
':knife:': u'๐Ÿ”ช',
':pill:': u'๐Ÿ’Š',
':syringe:': u'๐Ÿ’‰',
':moneybag:': u'๐Ÿ’ฐ',
':yen:': u'๐Ÿ’ด',
':dollar:': u'๐Ÿ’ต',
':pound:': u'๐Ÿ’ท',
':euro:': u'๐Ÿ’ถ',
':credit_card:': u'๐Ÿ’ณ',
':money_with_wings:': u'๐Ÿ’ธ',
':calling:': u'๐Ÿ“ฒ',
':e-mail:': u'๐Ÿ“ง',
':inbox_tray:': u'๐Ÿ“ฅ',
':outbox_tray:': u'๐Ÿ“ค',
':email:': u'โœ‰๏ธ',
':envelope:': u'โœ‰๏ธ',
':envelope_with_arrow:': u'๐Ÿ“ฉ',
':incoming_envelope:': u'๐Ÿ“จ',
':postal_horn:': u'๐Ÿ“ฏ',
':mailbox:': u'๐Ÿ“ซ',
':mailbox_closed:': u'๐Ÿ“ช',
':mailbox_with_mail:': u'๐Ÿ“ฌ',
':mailbox_with_no_mail:': u'๐Ÿ“ญ',
':postbox:': u'๐Ÿ“ฎ',
':package:': u'๐Ÿ“ฆ',
':memo:': u'๐Ÿ“',
':pencil:': u'๐Ÿ“',
':page_facing_up:': u'๐Ÿ“„',
':page_with_curl:': u'๐Ÿ“ƒ',
':bookmark_tabs:': u'๐Ÿ“‘',
':bar_chart:': u'๐Ÿ“Š',
':chart_with_upwards_trend:': u'๐Ÿ“ˆ',
':chart_with_downwards_trend:': u'๐Ÿ“‰',
':scroll:': u'๐Ÿ“œ',
':clipboard:': u'๐Ÿ“‹',
':date:': u'๐Ÿ“…',
':calendar:': u'๐Ÿ“†',
':card_index:': u'๐Ÿ“‡',
':file_folder:': u'๐Ÿ“',
':open_file_folder:': u'๐Ÿ“‚',
':scissors:': u'โœ‚๏ธ',
':pushpin:': u'๐Ÿ“Œ',
':paperclip:': u'๐Ÿ“Ž',
':black_nib:': u'โœ’๏ธ',
':pencil2:': u'โœ๏ธ',
':straight_ruler:': u'๐Ÿ“',
':triangular_ruler:': u'๐Ÿ“',
':closed_book:': u'๐Ÿ“•',
':green_book:': u'๐Ÿ“—',
':blue_book:': u'๐Ÿ“˜',
':orange_book:': u'๐Ÿ“™',
':notebook:': u'๐Ÿ““',
':notebook_with_decorative_cover:': u'๐Ÿ“”',
':ledger:': u'๐Ÿ“’',
':books:': u'๐Ÿ“š',
':book:': u'๐Ÿ“–',
':open_book:': u'๐Ÿ“–',
':bookmark:': u'๐Ÿ”–',
':name_badge:': u'๐Ÿ“›',
':microscope:': u'๐Ÿ”ฌ',
':telescope:': u'๐Ÿ”ญ',
':newspaper:': u'๐Ÿ“ฐ',
':art:': u'๐ŸŽจ',
':clapper:': u'๐ŸŽฌ',
':microphone:': u'๐ŸŽค',
':headphones:': u'๐ŸŽง',
':musical_score:': u'๐ŸŽผ',
':musical_note:': u'๐ŸŽต',
':notes:': u'๐ŸŽถ',
':musical_keyboard:': u'๐ŸŽน',
':violin:': u'๐ŸŽป',
':trumpet:': u'๐ŸŽบ',
':saxophone:': u'๐ŸŽท',
':guitar:': u'๐ŸŽธ',
':space_invader:': u'๐Ÿ‘พ',
':video_game:': u'๐ŸŽฎ',
':black_joker:': u'๐Ÿƒ',
':flower_playing_cards:': u'๐ŸŽด',
':mahjong:': u'๐Ÿ€„',
':game_die:': u'๐ŸŽฒ',
':dart:': u'๐ŸŽฏ',
':football:': u'๐Ÿˆ',
':basketball:': u'๐Ÿ€',
':soccer:': u'โšฝ',
':baseball:': u'โšพ๏ธ',
':tennis:': u'๐ŸŽพ',
':8ball:': u'๐ŸŽฑ',
':rugby_football:': u'๐Ÿ‰',
':bowling:': u'๐ŸŽณ',
':golf:': u'โ›ณ',
':mountain_bicyclist:': u'๐Ÿšต',
':bicyclist:': u'๐Ÿšด',
':checkered_flag:': u'๐Ÿ',
':horse_racing:': u'๐Ÿ‡',
':trophy:': u'๐Ÿ†',
':ski:': u'๐ŸŽฟ',
':snowboarder:': u'๐Ÿ‚',
':swimmer:': u'๐ŸŠ',
':surfer:': u'๐Ÿ„',
':fishing_pole_and_fish:': u'๐ŸŽฃ',
':coffee:': u'โ˜•',
':tea:': u'๐Ÿต',
':sake:': u'๐Ÿถ',
':baby_bottle:': u'๐Ÿผ',
':beer:': u'๐Ÿบ',
':beers:': u'๐Ÿป',
':cocktail:': u'๐Ÿธ',
':tropical_drink:': u'๐Ÿน',
':wine_glass:': u'๐Ÿท',
':fork_and_knife:': u'๐Ÿด',
':pizza:': u'๐Ÿ•',
':hamburger:': u'๐Ÿ”',
':fries:': u'๐ŸŸ',
':poultry_leg:': u'๐Ÿ—',
':meat_on_bone:': u'๐Ÿ–',
':spaghetti:': u'๐Ÿ',
':curry:': u'๐Ÿ›',
':fried_shrimp:': u'๐Ÿค',
':bento:': u'๐Ÿฑ',
':sushi:': u'๐Ÿฃ',
':fish_cake:': u'๐Ÿฅ',
':rice_ball:': u'๐Ÿ™',
':rice_cracker:': u'๐Ÿ˜',
':rice:': u'๐Ÿš',
':ramen:': u'๐Ÿœ',
':stew:': u'๐Ÿฒ',
':oden:': u'๐Ÿข',
':dango:': u'๐Ÿก',
':egg:': u'๐Ÿณ',
':bread:': u'๐Ÿž',
':doughnut:': u'๐Ÿฉ',
':custard:': u'๐Ÿฎ',
':icecream:': u'๐Ÿฆ',
':ice_cream:': u'๐Ÿจ',
':shaved_ice:': u'๐Ÿง',
':birthday:': u'๐ŸŽ‚',
':cake:': u'๐Ÿฐ',
':cookie:': u'๐Ÿช',
':chocolate_bar:': u'๐Ÿซ',
':candy:': u'๐Ÿฌ',
':lollipop:': u'๐Ÿญ',
':honey_pot:': u'๐Ÿฏ',
':apple:': u'๐ŸŽ',
':green_apple:': u'๐Ÿ',
':tangerine:': u'๐ŸŠ',
':lemon:': u'๐Ÿ‹',
':cherries:': u'๐Ÿ’',
':grapes:': u'๐Ÿ‡',
':watermelon:': u'๐Ÿ‰',
':strawberry:': u'๐Ÿ“',
':peach:': u'๐Ÿ‘',
':melon:': u'๐Ÿˆ',
':banana:': u'๐ŸŒ',
':pear:': u'๐Ÿ',
':pineapple:': u'๐Ÿ',
':sweet_potato:': u'๐Ÿ ',
':eggplant:': u'๐Ÿ†',
':tomato:': u'๐Ÿ…',
':corn:': u'๐ŸŒฝ',
':house:': u'๐Ÿ ',
':house_with_garden:': u'๐Ÿก',
':school:': u'๐Ÿซ',
':office:': u'๐Ÿข',
':post_office:': u'๐Ÿฃ',
':hospital:': u'๐Ÿฅ',
':bank:': u'๐Ÿฆ',
':convenience_store:': u'๐Ÿช',
':love_hotel:': u'๐Ÿฉ',
':hotel:': u'๐Ÿจ',
':wedding:': u'๐Ÿ’’',
':church:': u'โ›ช',
':department_store:': u'๐Ÿฌ',
':european_post_office:': u'๐Ÿค',
':city_sunrise:': u'๐ŸŒ‡',
':city_sunset:': u'๐ŸŒ†',
':japanese_castle:': u'๐Ÿฏ',
':european_castle:': u'๐Ÿฐ',
':tent:': u'โ›บ',
':factory:': u'๐Ÿญ',
':tokyo_tower:': u'๐Ÿ—ผ',
':japan:': u'๐Ÿ—พ',
':mount_fuji:': u'๐Ÿ—ป',
':sunrise_over_mountains:': u'๐ŸŒ„',
':sunrise:': u'๐ŸŒ…',
':night_with_stars:': u'๐ŸŒƒ',
':statue_of_liberty:': u'๐Ÿ—ฝ',
':bridge_at_night:': u'๐ŸŒ‰',
':carousel_horse:': u'๐ŸŽ ',
':ferris_wheel:': u'๐ŸŽก',
':fountain:': u'โ›ฒ',
':roller_coaster:': u'๐ŸŽข',
':ship:': u'๐Ÿšข',
':boat:': u'โ›ต',
':sailboat:': u'โ›ต',
':speedboat:': u'๐Ÿšค',
':rowboat:': u'๐Ÿšฃ',
':anchor:': u'โš“',
':rocket:': u'๐Ÿš€',
':airplane:': u'โœˆ๏ธ',
':seat:': u'๐Ÿ’บ',
':helicopter:': u'๐Ÿš',
':steam_locomotive:': u'๐Ÿš‚',
':tram:': u'๐ŸšŠ',
':station:': u'๐Ÿš‰',
':mountain_railway:': u'๐Ÿšž',
':train2:': u'๐Ÿš†',
':bullettrain_side:': u'๐Ÿš„',
':bullettrain_front:': u'๐Ÿš…',
':light_rail:': u'๐Ÿšˆ',
':metro:': u'๐Ÿš‡',
':monorail:': u'๐Ÿš',
':train:': u'๐Ÿš‹',
':railway_car:': u'๐Ÿšƒ',
':trolleybus:': u'๐ŸšŽ',
':bus:': u'๐ŸšŒ',
':oncoming_bus:': u'๐Ÿš',
':blue_car:': u'๐Ÿš™',
':oncoming_automobile:': u'๐Ÿš˜',
':car:': u'๐Ÿš—',
':red_car:': u'๐Ÿš—',
':taxi:': u'๐Ÿš•',
':oncoming_taxi:': u'๐Ÿš–',
':articulated_lorry:': u'๐Ÿš›',
':truck:': u'๐Ÿšš',
':rotating_light:': u'๐Ÿšจ',
':police_car:': u'๐Ÿš“',
':oncoming_police_car:': u'๐Ÿš”',
':fire_engine:': u'๐Ÿš’',
':ambulance:': u'๐Ÿš‘',
':minibus:': u'๐Ÿš',
':bike:': u'๐Ÿšฒ',
':aerial_tramway:': u'๐Ÿšก',
':suspension_railway:': u'๐ŸšŸ',
':mountain_cableway:': u'๐Ÿš ',
':tractor:': u'๐Ÿšœ',
':barber:': u'๐Ÿ’ˆ',
':busstop:': u'๐Ÿš',
':ticket:': u'๐ŸŽซ',
':vertical_traffic_light:': u'๐Ÿšฆ',
':traffic_light:': u'๐Ÿšฅ',
':warning:': u'โš ๏ธ',
':construction:': u'๐Ÿšง',
':beginner:': u'๐Ÿ”ฐ',
':fuelpump:': u'โ›ฝ',
':izakaya_lantern:': u'๐Ÿฎ',
':lantern:': u'๐Ÿฎ',
':slot_machine:': u'๐ŸŽฐ',
':hotsprings:': u'โ™จ๏ธ',
':moyai:': u'๐Ÿ—ฟ',
':circus_tent:': u'๐ŸŽช',
':performing_arts:': u'๐ŸŽญ',
':round_pushpin:': u'๐Ÿ“',
':triangular_flag_on_post:': u'๐Ÿšฉ',
':jp:': u'๐Ÿ‡ฏ๐Ÿ‡ต',
':kr:': u'๐Ÿ‡ฐ๐Ÿ‡ท',
':de:': u'๐Ÿ‡ฉ๐Ÿ‡ช',
':cn:': u'๐Ÿ‡จ๐Ÿ‡ณ',
':us:': u'๐Ÿ‡บ๐Ÿ‡ธ',
':fr:': u'๐Ÿ‡ซ๐Ÿ‡ท',
':es:': u'๐Ÿ‡ช๐Ÿ‡ธ',
':it:': u'๐Ÿ‡ฎ๐Ÿ‡น',
':ru:': u'๐Ÿ‡ท๐Ÿ‡บ',
':gb:': u'๐Ÿ‡ฌ๐Ÿ‡ง',
':uk:': u'๐Ÿ‡ฌ๐Ÿ‡ง',
':one:': u'1๏ธโƒฃ',
':two:': u'2๏ธโƒฃ',
':three:': u'3๏ธโƒฃ',
':four:': u'4๏ธโƒฃ',
':five:': u'5๏ธโƒฃ',
':six:': u'6๏ธโƒฃ',
':seven:': u'7๏ธโƒฃ',
':eight:': u'8๏ธโƒฃ',
':nine:': u'9๏ธโƒฃ',
':zero:': u'0๏ธโƒฃ',
':keycap_ten:': u'๐Ÿ”Ÿ',
':1234:': u'๐Ÿ”ข',
':hash:': u'#๏ธโƒฃ',
':symbols:': u'๐Ÿ”ฃ',
':arrow_up:': u'โฌ†๏ธ',
':arrow_down:': u'โฌ‡๏ธ',
':arrow_left:': u'โฌ…๏ธ',
':arrow_right:': u'โžก๏ธ',
':capital_abcd:': u'๐Ÿ” ',
':abcd:': u'๐Ÿ”ก',
':abc:': u'๐Ÿ”ค',
':arrow_upper_right:': u'โ†—๏ธ',
':arrow_upper_left:': u'โ†–๏ธ',
':arrow_lower_right:': u'โ†˜๏ธ',
':arrow_lower_left:': u'โ†™๏ธ',
':left_right_arrow:': u'โ†”๏ธ',
':arrow_up_down:': u'โ†•๏ธ',
':arrows_counterclockwise:': u'๐Ÿ”„',
':arrow_backward:': u'โ—€๏ธ',
':arrow_forward:': u'โ–ถ๏ธ',
':arrow_up_small:': u'๐Ÿ”ผ',
':arrow_down_small:': u'๐Ÿ”ฝ',
':leftwards_arrow_with_hook:': u'โ†ฉ๏ธ',
':arrow_right_hook:': u'โ†ช๏ธ',
':information_source:': u'โ„น๏ธ',
':rewind:': u'โช',
':fast_forward:': u'โฉ',
':arrow_double_up:': u'โซ',
':arrow_double_down:': u'โฌ',
':arrow_heading_down:': u'โคต๏ธ',
':arrow_heading_up:': u'โคด๏ธ',
':ok:': u'๐Ÿ†—',
':twisted_rightwards_arrows:': u'๐Ÿ”€',
':repeat:': u'๐Ÿ”',
':repeat_one:': u'๐Ÿ”‚',
':new:': u'๐Ÿ†•',
':up:': u'๐Ÿ†™',
':cool:': u'๐Ÿ†’',
':free:': u'๐Ÿ†“',
':ng:': u'๐Ÿ†–',
':signal_strength:': u'๐Ÿ“ถ',
':cinema:': u'๐ŸŽฆ',
':koko:': u'๐Ÿˆ',
':u6307:': u'๐Ÿˆฏ',
':u7a7a:': u'๐Ÿˆณ',
':u6e80:': u'๐Ÿˆต',
':u5408:': u'๐Ÿˆด',
':u7981:': u'๐Ÿˆฒ',
':ideograph_advantage:': u'๐Ÿ‰',
':u5272:': u'๐Ÿˆน',
':u55b6:': u'๐Ÿˆบ',
':u6709:': u'๐Ÿˆถ',
':u7121:': u'๐Ÿˆš',
':restroom:': u'๐Ÿšป',
':mens:': u'๐Ÿšน',
':womens:': u'๐Ÿšบ',
':baby_symbol:': u'๐Ÿšผ',
':wc:': u'๐Ÿšพ',
':potable_water:': u'๐Ÿšฐ',
':put_litter_in_its_place:': u'๐Ÿšฎ',
':parking:': u'๐Ÿ…ฟ๏ธ',
':wheelchair:': u'โ™ฟ',
':no_smoking:': u'๐Ÿšญ',
':u6708:': u'๐Ÿˆท๏ธ',
':u7533:': u'๐Ÿˆธ',
':sa:': u'๐Ÿˆ‚๏ธ',
':m:': u'โ“‚๏ธ',
':passport_control:': u'๐Ÿ›‚',
':baggage_claim:': u'๐Ÿ›„',
':left_luggage:': u'๐Ÿ›…',
':customs:': u'๐Ÿ›ƒ',
':accept:': u'๐Ÿ‰‘',
':secret:': u'ใŠ™๏ธ',
':congratulations:': u'ใŠ—๏ธ',
':cl:': u'๐Ÿ†‘',
':sos:': u'๐Ÿ†˜',
':id:': u'๐Ÿ†”',
':no_entry_sign:': u'๐Ÿšซ',
':underage:': u'๐Ÿ”ž',
':no_mobile_phones:': u'๐Ÿ“ต',
':do_not_litter:': u'๐Ÿšฏ',
':non-potable_water:': u'๐Ÿšฑ',
':no_bicycles:': u'๐Ÿšณ',
':no_pedestrians:': u'๐Ÿšท',
':children_crossing:': u'๐Ÿšธ',
':no_entry:': u'โ›”',
':eight_spoked_asterisk:': u'โœณ๏ธ',
':sparkle:': u'โ‡๏ธ',
':negative_squared_cross_mark:': u'โŽ',
':white_check_mark:': u'โœ…',
':eight_pointed_black_star:': u'โœด๏ธ',
':heart_decoration:': u'๐Ÿ’Ÿ',
':vs:': u'๐Ÿ†š',
':vibration_mode:': u'๐Ÿ“ณ',
':mobile_phone_off:': u'๐Ÿ“ด',
':a:': u'๐Ÿ…ฐ๏ธ',
':b:': u'๐Ÿ…ฑ๏ธ',
':ab:': u'๐Ÿ†Ž',
':o2:': u'๐Ÿ…พ๏ธ',
':diamond_shape_with_a_dot_inside:': u'๐Ÿ’ ',
':loop:': u'โžฟ',
':recycle:': u'โ™ป๏ธ',
':aries:': u'โ™ˆ',
':taurus:': u'โ™‰',
':gemini:': u'โ™Š',
':cancer:': u'โ™‹',
':leo:': u'โ™Œ',
':virgo:': u'โ™',
':libra:': u'โ™Ž',
':scorpius:': u'โ™',
':sagittarius:': u'โ™',
':capricorn:': u'โ™‘',
':aquarius:': u'โ™’',
':pisces:': u'โ™“',
':ophiuchus:': u'โ›Ž',
':six_pointed_star:': u'๐Ÿ”ฏ',
':atm:': u'๐Ÿง',
':chart:': u'๐Ÿ’น',
':heavy_dollar_sign:': u'๐Ÿ’ฒ',
':currency_exchange:': u'๐Ÿ’ฑ',
':copyright:': u'ยฉ๏ธ',
':registered:': u'ยฎ๏ธ',
':tm:': u'โ„ข๏ธ',
':x:': u'โŒ',
':bangbang:': u'โ€ผ๏ธ',
':interrobang:': u'โ‰๏ธ',
':exclamation:': u'โ—',
':heavy_exclamation_mark:': u'โ—',
':question:': u'โ“',
':grey_exclamation:': u'โ•',
':grey_question:': u'โ”',
':o:': u'โญ•',
':top:': u'๐Ÿ”',
':end:': u'๐Ÿ”š',
':back:': u'๐Ÿ”™',
':on:': u'๐Ÿ”›',
':soon:': u'๐Ÿ”œ',
':arrows_clockwise:': u'๐Ÿ”ƒ',
':clock12:': u'๐Ÿ•›',
':clock1230:': u'๐Ÿ•ง',
':clock1:': u'๐Ÿ•',
':clock130:': u'๐Ÿ•œ',
':clock2:': u'๐Ÿ•‘',
':clock230:': u'๐Ÿ•',
':clock3:': u'๐Ÿ•’',
':clock330:': u'๐Ÿ•ž',
':clock4:': u'๐Ÿ•“',
':clock430:': u'๐Ÿ•Ÿ',
':clock5:': u'๐Ÿ•”',
':clock530:': u'๐Ÿ• ',
':clock6:': u'๐Ÿ••',
':clock7:': u'๐Ÿ•–',
':clock8:': u'๐Ÿ•—',
':clock9:': u'๐Ÿ•˜',
':clock10:': u'๐Ÿ•™',
':clock11:': u'๐Ÿ•š',
':clock630:': u'๐Ÿ•ก',
':clock730:': u'๐Ÿ•ข',
':clock830:': u'๐Ÿ•ฃ',
':clock930:': u'๐Ÿ•ค',
':clock1030:': u'๐Ÿ•ฅ',
':clock1130:': u'๐Ÿ•ฆ',
':heavy_multiplication_x:': u'โœ–๏ธ',
':heavy_plus_sign:': u'โž•',
':heavy_minus_sign:': u'โž–',
':heavy_division_sign:': u'โž—',
':spades:': u'โ™ ๏ธ',
':hearts:': u'โ™ฅ๏ธ',
':clubs:': u'โ™ฃ๏ธ',
':diamonds:': u'โ™ฆ๏ธ',
':white_flower:': u'๐Ÿ’ฎ',
':100:': u'๐Ÿ’ฏ',
':heavy_check_mark:': u'โœ”๏ธ',
':ballot_box_with_check:': u'โ˜‘๏ธ',
':radio_button:': u'๐Ÿ”˜',
':link:': u'๐Ÿ”—',
':curly_loop:': u'โžฐ',
':wavy_dash:': u'ใ€ฐ๏ธ',
':part_alternation_mark:': u'ใ€ฝ๏ธ',
':trident:': u'๐Ÿ”ฑ',
':black_medium_square:': u'โ—ผ๏ธ',
':white_medium_square:': u'โ—ป๏ธ',
':black_medium_small_square:': u'โ—พ',
':white_medium_small_square:': u'โ—ฝ',
':black_small_square:': u'โ–ช๏ธ',
':white_small_square:': u'โ–ซ๏ธ',
':small_red_triangle:': u'๐Ÿ”บ',
':black_square_button:': u'๐Ÿ”ฒ',
':white_square_button:': u'๐Ÿ”ณ',
':black_circle:': u'โšซ',
':white_circle:': u'โšช',
':red_circle:': u'๐Ÿ”ด',
':large_blue_circle:': u'๐Ÿ”ต',
':small_red_triangle_down:': u'๐Ÿ”ป',
':white_large_square:': u'โฌœ',
':black_large_square:': u'โฌ›',
':large_orange_diamond:': u'๐Ÿ”ถ',
':large_blue_diamond:': u'๐Ÿ”ท',
':small_orange_diamond:': u'๐Ÿ”ธ',
':small_blue_diamond:': u'๐Ÿ”น',
}
# binning - i.e https://www.illumina.com/documents/products/technotes/technote_understanding_quality_scores.pdf
fastq_noemoji_map = {
#N (no call) N (no call)
'!': 'โ–',
'"': 'โ–',
#2โ€“9 6
'#': 'โ–‚',
'$': 'โ–‚',
'%': 'โ–‚',
'&': 'โ–‚',
'\'': 'โ–‚',
'(': 'โ–‚',
')': 'โ–‚',
'*': 'โ–‚',
#10โ€“19 15
'+': 'โ–ƒ' ,
',': 'โ–ƒ' ,
'-': 'โ–ƒ' ,
'.': 'โ–ƒ' ,
'/': 'โ–ƒ' ,
'0': 'โ–ƒ' ,
'1': 'โ–ƒ' ,
'2': 'โ–ƒ' ,
'3': 'โ–ƒ' ,
'4': 'โ–ƒ' ,
#20โ€“24 22
'5': 'โ–„',
'6': 'โ–„',
'7': 'โ–„',
'8': 'โ–„',
'9': 'โ–„',
#25โ€“29 27
':': 'โ–…',
';': 'โ–…',
'<': 'โ–…',
'=': 'โ–…',
'>': 'โ–…',
#30โ€“34 33
'?': 'โ–†',
'@': 'โ–†',
'A': 'โ–†',
'B': 'โ–†',
'C': 'โ–†',
#35โ€“39 37
'D': 'โ–‡',
'E': 'โ–‡',
'F': 'โ–‡',
'G': 'โ–‡',
'H': 'โ–‡',
#โ‰ฅ 40 40
'I': 'โ–ˆ',
'J': 'โ–ˆ',
}
def emojify(text):
emoji_keys = re.findall(r':\S+:', text)
for emoji_key in emoji_keys:
raw_emoji = emoji_table.get(emoji_key, emoji_key)
text = text.replace(emoji_key, raw_emoji)
return text
class HelpFormatter(argparse.HelpFormatter):
def add_usage(self, usage, actions, groups, prefix=None):
if prefix is None:
prefix = 'Usage: samtools mpileup ... | '
return super(HelpFormatter, self).add_usage(
usage, actions, groups, prefix)
parser = argparse.ArgumentParser(
description="""This replaces basecall quality scores with graphical equivalents.""",
formatter_class=HelpFormatter
)
parser.add_argument("inputdata", type=argparse.FileType('r'), nargs='?', help="intended to be piped from 'samtools mpileup'", default=sys.stdin)
group = parser.add_mutually_exclusive_group()
group.add_argument("--bars", action='store_const', dest='output_fmt', help="default", const=fastq_noemoji_map)
group.add_argument("--emoji", action='store_const', dest='output_fmt', const=fastq_emoji_map)
group.add_argument("--emoji-binned", action='store_const', dest='output_fmt', const=fastq_emoji_map_binned)
parser.set_defaults(inputdata="-", output_fmt=fastq_noemoji_map)
if __name__ == "__main__":
args = parser.parse_args()
replacements_dict = args.output_fmt
if not S_ISFIFO(os.fstat(0).st_mode) and args.inputdata.name=="<stdin>": # if not piped and no file specified
parser.print_help()
else:
for line in args.inputdata:
columns = line.split("\t")
columns[5] = "".join([chr(ord(c)) if (ord(c)-33) < 41 else chr(40+33) for c in columns[5]])
strs_to_replace_re = re.compile(r'|'.join(re.escape(key) for key in replacements_dict.keys()))
columns[5] = strs_to_replace_re.sub(lambda x: replacements_dict.get(x.group(), "_"), columns[5]).replace("::",": :")
columns[5] = emojify(columns[5]).replace(" ","")
out_line = '\t'.join(columns)
print(f"{out_line}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment