Mercurial > repos > bornea > apostl_static_bubblegraph_generator
view Static_Bubble_Plot_Cmdln.R @ 16:0a740024e014 draft
Uploaded
author | bornea |
---|---|
date | Wed, 11 May 2016 11:14:37 -0400 |
parents | 651a602e0c7f |
children | efc13028725c |
line wrap: on
line source
################################################################################################### # R-code: APOSTL Global Variables # Author: Brent Kuenzi ################################## Dependencies ################################################### library(dplyr); library(tidyr); library(ggplot2); library(ggrepel) colors <- c("Air Force blue" = "#5D8AA8", "Alice blue" = "#F0F8FF", "Alizarin crimson" = "#E32636", "Almond" = "#EFDECD", "Amaranth" = "#E52B50", "Amber" = "#FFBF00", "American rose" = "#FF033E", "Amethyst" = "#9966CC", "Android Green" = "#A4C639", "Anti flash white" = "#F2F3F4", "Antique brass" = "#CD9575", "Antique fuchsia" = "#915C83", "Antique white" = "#FAEBD7", "Ao" = "#008000", "Apple green" = "#8DB600", "Apricot" = "#FBCEB1", "Aqua" = "#00FFFF", "Aquamarine" = "#7FFFD4", "Army green" = "#4B5320", "Arsenic" = "#3B444B", "Arylide yellow" = "#E9D66B", "Ash gray" = "#B2BEB5", "Asparagus" = "#87A96B", "Atomic tangerine" = "#FF9966", "Auburn" = "#A52A2A", "Aureolin" = "#FDEE00", "AuroMetalSaurus" = "#6E7F80", "Awesome" = "#FF2052", "Azure" = "#007FFF", "Azure mist" = "#F0FFFF", "Baby blue" = "#89CFF0", "Baby blue eyes" = "#A1CAF1", "Baby pink" = "#F4C2C2", "Ball Blue" = "#21ABCD", "Banana Mania" = "#FAE7B5", "Banana yellow" = "#FFE135", "Battleship gray" = "#848482", "Bazaar" = "#98777B", "Beau blue" = "#BCD4E6", "Beaver" = "#9F8170", "Beige" = "#F5F5DC", "Bisque" = "#FFE4C4", "Bistre" = "#3D2B1F", "Bittersweet" = "#FE6F5E", "Obsidian" = "#000000", "Onyx" = "#000000", "Lost Soul" = "#000000", "Midnight" = "#000000", "Rolling Blackout" = "#000000", "Sleeping Panther" = "#000000", "Void by Armani" = "#000000", "Blanched Almond" = "#FFEBCD", "Bleu de France" = "#318CE7", "Blizzard Blue" = "#ACE5EE", "Blond" = "#FAF0BE", "Blue" = "#0000FF", "Blue Bell" = "#A2A2D0", "Blue Gray" = "#6699CC", "Blue green" = "#00DDDD", "Blue violet" = "#8A2BE2", "Blush" = "#DE5D83", "Bole" = "#79443B", "Bondi blue" = "#0095B6", "Boston University Red" = "#CC0000", "Brandeis blue" = "#0070FF", "Brass" = "#B5A642", "Brick red" = "#CB4154", "Bright cerulean" = "#1DACD6", "Bright green" = "#66FF00", "Bright lavender" = "#BF94E4", "Bright maroon" = "#C32148", "Bright pink" = "#FF007F", "Bright turquoise" = "#08E8DE", "Bright ube" = "#D19FE8", "Brilliant lavender" = "#F4BBFF", "Brilliant rose" = "#FF55A3", "Brink pink" = "#FB607F", "British racing green" = "#004225", "Bronze" = "#CD7F32", "Brown" = "#964B00", "Bubble gum" = "#FFC1CC", "Bubbles" = "#E7FEFF", "Buff" = "#F0DC82", "Bulgarian rose" = "#480607", "Burgundy" = "#800020", "Burlywood" = "#DEB887", "Burnt orange" = "#CC5500", "Burnt sienna" = "#E97451", "Burnt umber" = "#8A3324", "Byzantine" = "#BD33A4", "Byzantium" = "#702963", "Cadet" = "#536872", "Cadet blue" = "#5F9EA0", "Cadet gray" = "#91A3B0", "Cadmium Green" = "#006B3C", "Cadmium Orange" = "#ED872D", "Cadmium Red" = "#E30022", "Cadmium Yellow" = "#FFF600", "Cal Poly Pomona green" = "#1E4D2B", "Cambridge Blue" = "#A3C1AD", "Camel" = "#C19A6B", "Camouflage green" = "#78866B", "Canary yellow" = "#FFEF00", "Candy apple red" = "#FF0800", "Candy pink" = "#E4717A", "Capri" = "#00BFFF", "Caput mortuum" = "#592720", "Cardinal" = "#C41E3A", "Caribbean green" = "#00CC99", "Carmine" = "#960018", "Carmine pink" = "#EB4C42", "Carmine red" = "#FF0038", "Carnation pink" = "#FFA6C9", "Carnelian" = "#B31B1B", "Carolina blue" = "#99BADD", "Carrot orange" = "#ED9121", "Ceil" = "#92A1CF", "Celadon" = "#ACE1AF", "Celestial blue" = "#4997D0", "Cerise" = "#DE3163", "Cerise pink" = "#EC3B83", "Cerulean" = "#007BA7", "Cerulean blue" = "#2A52BE", "CG Blue" = "#007AA5", "CG Red" = "#E03C31", "Chamoisee" = "#A0785A", "Champagne" = "#F7E7CE", "Charcoal" = "#36454F", "Chartreuse" = "#DFFF00", "Cherry blossom pink" = "#FFB7C5", "Chestnut" = "#CD5C5C", "Chocolate" = "#7B3F00", "Chrome yellow" = "#FFA700", "Cinereous" = "#98817B", "Cinnabar" = "#E34234", "Cinnamon" = "#D2691E", "Citrine" = "#E4D00A", "Classic rose" = "#FBCCE7", "Cobalt" = "#0047AB", "Coffee" = "#C86428", "Columbia blue" = "#9BDDFF", "Cool black" = "#002E63", "Cool gray" = "#8C92AC", "Copper" = "#B87333", "Copper rose" = "#996666", "Coquelicot" = "#FF3800", "Coral" = "#FF7F50", "Coral pink" = "#F88379", "Coral red" = "#FF4040", "Cordovan" = "#893F45", "Corn" = "#FBEC5D", "Cornflower blue" = "#6495ED", "Cornsilk" = "#FFF8DC", "Cosmic latte" = "#FFF8E7", "Cotton candy" = "#FFBCD9", "Cream" = "#FFFDD0", "Crimson" = "#DC143C", "Crimson glory" = "#BE0032", "Cyan" = "#00B7EB", "Daffodil" = "#FFFF31", "Dandelion" = "#F0E130", "Dark blue" = "#00008B", "Dark brown" = "#654321", "Dark byzantium" = "#5D3954", "Dark candy apple red" = "#A40000", "Dark cerulean" = "#08457E", "Dark champagne" = "#C2B280", "Dark chestnut" = "#986960", "Dark coral" = "#CD5B45", "Dark cyan" = "#008B8B", "Dark electric blue" = "#536878", "Dark goldenrod" = "#B8860B", "Dark gray" = "#A9A9A9", "Dark green" = "#013220", "Dark jungle green" = "#1A2421", "Dark khaki" = "#BDB76B", "Dark lava" = "#483C32", "Dark lavender" = "#734F96", "Dark magenta" = "#8B008B", "Dark midnight blue" = "#003366", "Dark olive green" = "#556B2F", "Dark orange" = "#FF8C00", "Dark orchid" = "#9932CC", "Dark pastel blue" = "#779ECB", "Dark pastel green" = "#03C03C", "Dark pastel purple" = "#966FD6", "Dark pastel red" = "#C23B22", "Dark pink" = "#E75480", "Dark powder blue" = "#003399", "Dark raspberry" = "#872657", "Dark red" = "#8B0000", "Dark salmon" = "#E9967A", "Dark scarlet" = "#560319", "Dark sea green" = "#8FBC8F", "Dark sienna" = "#3C1414", "Dark slate blue" = "#483D8B", "Dark slate gray" = "#2F4F4F", "Dark spring green" = "#177245", "Dark tan" = "#918151", "Dark tangerine" = "#FFA812", "Dark terra cotta" = "#CC4E5C", "Dark turquoise" = "#00CED1", "Dark violet" = "#9400D3", "Dartmouth green" = "#00693E", "Davy's gray" = "#555555", "Debian red" = "#D70A53", "Deep carmine" = "#A9203E", "Deep carmine pink" = "#EF3038", "Deep carrot orange" = "#E9692C", "Deep cerise" = "#DA3287", "Deep champagne" = "#FAD6A5", "Deep chestnut" = "#B94E48", "Deep fuchsia" = "#C154C1", "Deep jungle green" = "#004B49", "Deep lilac" = "#9955BB", "Deep magenta" = "#CC00CC", "Deep peach" = "#FFCBA4", "Deep pink" = "#FF1493", "Deep saffron" = "#FF9933", "Denim" = "#1560BD", "Desert sand" = "#EDC9AF", "Dim gray" = "#696969", "Dodger blue" = "#1E90FF", "Dogwood rose" = "#D71868", "Dollar bill" = "#85BB65", "Drab" = "#967117", "Duke blue" = "#00009C", "Earth yellow" = "#E1A95F", "Eggplant" = "#614051", "Eggshell" = "#F0EAD6", "Egyptian blue" = "#1034A6", "Electric blue" = "#7DF9FF", "Electric crimson" = "#FF003F", "Electric green" = "#00FE00", "Electric indigo" = "#6F00FF", "Electric lime" = "#CCFF00", "Electric purple" = "#BF00FF", "Electric ultramarine" = "#3F00FF", "Electric violet" = "#8F00FF", "Electric yellow" = "#FFFE00", "Emerald" = "#50C878", "Eton blue" = "#96C8A2", "Falu red" = "#801818", "Fandango" = "#B53389", "Fashion fuchsia" = "#F400A1", "Fawn" = "#E5AA70", "Feldgrau" = "#4D5D53", "Fern green" = "#4F7942", "Ferrari Red" = "#FF2800", "Field drab" = "#6C541E", "Firebrick" = "#B22222", "Fire engine red" = "#CE2029", "Flame" = "#E25822", "Flamingo pink" = "#FC8EAC", "Flavescent" = "#F7E98E", "Flax" = "#EEDC82", "Floral white" = "#FFFAF0", "Folly" = "#FF004F", "Forest green" = "#014421", "French beige" = "#A67B5B", "French blue" = "#0072BB", "French lilac" = "#86608E", "French rose" = "#F64A8A", "Fuchsia" = "#FF00FF", "Fuchsia pink" = "#FF77FF", "Fulvous" = "#E48400", "Fuzzy Wuzzy" = "#CC6666", "Gainsboro" = "#DCDCDC", "Gamboge" = "#E49B0F", "Ghost white" = "#F8F8FF", "Ginger" = "#B06500", "Glaucous" = "#6082B6", "Gold" = "#D4AF37", "Golden brown" = "#996515", "Golden poppy" = "#FCC200", "Goldenrod" = "#DAA520", "Golden yellow" = "#FFDF00", "Granny Smith Apple" = "#A8E4A0", "Gray" = "#808080", "Gray asparagus" = "#465945", "Green" = "#00FF00", "Green yellow" = "#ADFF2F", "Grullo" = "#A99A86", "Guppie green" = "#00FF7F", "Halaya ube" = "#663854", "Han blue" = "#446CCF", "Han purple" = "#5218FA", "Harlequin" = "#3FFF00", "Harvard crimson" = "#C90016", "Harvest Gold" = "#DA9100", "Heliotrope" = "#DF73FF", "Honeydew" = "#F0FFF0", "Hooker's green" = "#007000", "Hot magenta" = "#FF1DCE", "Hot pink" = "#FF69B4", "Hunter green" = "#355E3B", "Iceberg" = "#71A6D2", "Icterine" = "#FCF75E", "Inchworm" = "#B2EC5D", "India green" = "#138808", "Indian yellow" = "#E3A857", "Indigo" = "#00416A", "International Klein Blue" = "#002FA7", "International orange" = "#FF4F00", "Iris" = "#5A4FCF", "Isabelline" = "#F4F0EC", "Islamic green" = "#009000", "Ivory" = "#FFFFF0", "Jade" = "#00A86B", "Jasmine" = "#F8DE7E", "Jasper" = "#D73B3E", "Jazzberry jam" = "#A50B5E", "Jonquil" = "#FADA5E", "June bud" = "#BDDA57", "Jungle green" = "#29AB87", "Kelly green" = "#4CBB17", "Khaki" = "#C3B091", "KU Crimson" = "#E8000D", "Languid lavender" = "#D6CADD", "Lapis lazuli" = "#26619C", "La Salle Green" = "#087830", "Laser Lemon" = "#FEFE22", "Lava" = "#CF1020", "Lavender" = "#B57EDC", "Lavender blue" = "#CCCCFF", "Lavender blush" = "#FFF0F5", "Lavender gray" = "#C4C3D0", "Lavender indigo" = "#9457EB", "Lavender magenta" = "#EE82EE", "Lavender mist" = "#E6E6FA", "Lavender pink" = "#FBAED2", "Lavender purple" = "#967BB6", "Lavender rose" = "#FBA0E3", "Lawn green" = "#7CFC00", "Lemon" = "#FFF700", "Lemon chiffon" = "#FFFACD", "Light apricot" = "#FDD5B1", "Light blue" = "#ADD8E6", "Light brown" = "#B5651D", "Light carmine pink" = "#E66771", "Light coral" = "#F08080", "Light cornflower blue" = "#93CCEA", "Light Crimson" = "#F56991", "Light cyan" = "#E0FFFF", "Light fuchsia pink" = "#F984EF", "Light goldenrod yellow" = "#FAFAD2", "Light gray" = "#D3D3D3", "Light green" = "#90EE90", "Light khaki" = "#F0E68C", "Light mauve" = "#DCD0FF", "Light pastel purple" = "#B19CD9", "Light pink" = "#FFB6C1", "Light salmon" = "#FFA07A", "Light salmon pink" = "#FF9999", "Light sea green" = "#20B2AA", "Light sky blue" = "#87CEFA", "Light slate gray" = "#778899", "Light taupe" = "#B38B6D", "Light Thulian pink" = "#E68FAC", "Light yellow" = "#FFFFED", "Lilac" = "#C8A2C8", "Lime" = "#BFFF00", "Lime green" = "#32CD32", "Lincoln green" = "#195905", "Linen" = "#FAF0E6", "Liver" = "#534B4F", "Lust" = "#E62020", "Magenta" = "#CA1F7B", "Magic mint" = "#AAF0D1", "Magnolia" = "#F8F4FF", "Mahogany" = "#C04000", "Majorelle Blue" = "#6050DC", "Malachite" = "#0BDA51", "Manatee" = "#979AAA", "Mango Tango" = "#FF8243", "Maroon" = "#800000", "Mauve" = "#E0B0FF", "Mauvelous" = "#EF98AA", "Mauve taupe" = "#915F6D", "Maya blue" = "#73C2FB", "Meat brown" = "#E5B73B", "Medium aquamarine" = "#66DDAA", "Medium blue" = "#0000CD", "Medium candy apple red" = "#E2062C", "Medium carmine" = "#AF4035", "Medium champagne" = "#F3E5AB", "Medium electric blue" = "#035096", "Medium jungle green" = "#1C352D", "Medium lavender magenta" = "#DDA0DD", "Medium orchid" = "#BA55D3", "Medium Persian blue" = "#0067A5", "Medium purple" = "#9370DB", "Medium red violet" = "#BB3385", "Medium sea green" = "#3CB371", "Medium slate blue" = "#7B68EE", "Medium spring bud" = "#C9DC87", "Medium spring green" = "#00FA9A", "Medium taupe" = "#674C47", "Medium teal blue" = "#0054B4", "Medium turquoise" = "#48D1CC", "Medium violet red" = "#C71585", "Melon" = "#FDBCB4", "Midnight blue" = "#191970", "Midnight green" = "#004953", "Mikado yellow" = "#FFC40C", "Mint" = "#3EB489", "Mint cream" = "#F5FFFA", "Mint green" = "#98FF98", "Misty rose" = "#FFE4E1", "Moonstone blue" = "#73A9C2", "Mordant red 19" = "#AE0C00", "Moss green" = "#ADDFAD", "Mountain Meadow" = "#30BA8F", "Mountbatten pink" = "#997A8D", "MSU Green" = "#18453B", "Mulberry" = "#C54B8C", "Mustard" = "#FFDB58", "Myrtle" = "#21421E", "Nadeshiko pink" = "#F6ADC6", "Napier green" = "#2A8000", "Navajo white" = "#FFDEAD", "Navy" = "#000080", "Neon Carrot" = "#FFA343", "Neon fuchsia" = "#FE59C2", "Neon green" = "#39FF14", "Non photo blue" = "#A4DDED", "Ocean Boat Blue" = "#0077BE", "Ochre" = "#CC7722", "Old gold" = "#CFB53B", "Old lace" = "#FDF5E6", "Old lavender" = "#796878", "Old mauve" = "#673147", "Old rose" = "#C08081", "Olive" = "#808000", "Olive Drab" = "#6B8E23", "Olive Drab 7" = "#3C341F", "Olivine" = "#9AB973", "Opera mauve" = "#B784A7", "Orange" = "#FF7F00", "Orange peel" = "#FF9F00", "Orange red" = "#FF4500", "Orchid" = "#DA70D6", "OU Crimson Red" = "#990000", "Outer Space" = "#414A4C", "Outrageous Orange" = "#FF6E4A", "Oxford Blue" = "#002147", "Pakistan green" = "#006600", "Palatinate blue" = "#273BE2", "Palatinate purple" = "#682860", "Pale blue" = "#AFEEEE", "Pale brown" = "#987654", "Pale cerulean" = "#9BC4E2", "Pale chestnut" = "#DDADAF", "Pale copper" = "#DA8A67", "Pale cornflower blue" = "#ABCDEF", "Pale gold" = "#E6BE8A", "Pale goldenrod" = "#EEE8AA", "Pale green" = "#98FB98", "Pale magenta" = "#F984E5", "Pale pink" = "#FADADD", "Pale red violet" = "#DB7093", "Pale robin egg blue" = "#96DED1", "Pale silver" = "#C9C0BB", "Pale spring bud" = "#ECEBBD", "Pale taupe" = "#BC987E", "Pansy purple" = "#78184A", "Papaya whip" = "#FFEFD5", "Pastel blue" = "#AEC6CF", "Pastel brown" = "#836953", "Pastel gray" = "#CFCFC4", "Pastel green" = "#77DD77", "Pastel magenta" = "#F49AC2", "Pastel orange" = "#FFB347", "Pastel pink" = "#FFD1DC", "Pastel purple" = "#B39EB5", "Pastel red" = "#FF6961", "Pastel violet" = "#CB99C9", "Pastel yellow" = "#FDFD96", "Patriarch" = "#800080", "Payne's gray" = "#40404F", "Peach" = "#FFE5B4", "Peach orange" = "#FFCC99", "Peach puff" = "#FFDAB9", "Peach yellow" = "#FADFAD", "Pear" = "#D1E231", "Pearl Aqua" = "#88D8C0", "Peridot" = "#E6E200", "Persian blue" = "#1C39BB", "Persian green" = "#00A693", "Persian indigo" = "#32127A", "Persian orange" = "#D99058", "Persian pink" = "#F77FBE", "Persian plum" = "#701C1C", "Persian red" = "#CC3333", "Persian rose" = "#FE28A2", "Persimmon" = "#EC5800", "Phlox" = "#DF00FF", "Phthalo blue" = "#000F89", "Phthalo green" = "#123524", "Piggy pink" = "#FDDDE6", "Pine green" = "#01796F", "Pink" = "#FFC0CB", "Pink pearl" = "#E7ACCF", "Pink Sherbet" = "#F78FA7", "Pistachio" = "#93C572", "Platinum" = "#E5E4E2", "Plum" = "#8E4585", "Portland Orange" = "#FF5A36", "Powder blue" = "#B0E0E6", "Princeton orange" = "#FF8F00", "Prussian blue" = "#003153", "Puce" = "#CC8899", "Pumpkin" = "#FF7518", "Purple" = "#9F00C5", "Purple Heart" = "#69359C", "Purple mountain majesty" = "#9678B6", "Purple pizzazz" = "#FE4EDA", "Purple taupe" = "#50404D", "Quartz" = "#51484F", "Radical Red" = "#FF355E", "Raspberry" = "#E30B5D", "Raspberry pink" = "#E25098", "Raspberry rose" = "#B3446C", "Raw umber" = "#826644", "Razzle dazzle rose" = "#FF33CC", "Razzmatazz" = "#E3256B", "Red" = "#FF0000", "Redwood" = "#AB4E52", "Regalia" = "#522D80", "Rich black" = "#004040", "Rich brilliant lavender" = "#F1A7FE", "Rich carmine" = "#D70040", "Rich electric blue" = "#0892D0", "Rich lavender" = "#A76BCF", "Rich lilac" = "#B666D2", "Rich maroon" = "#B03060", "Rifle green" = "#414833", "Robin egg blue" = "#00CCCC", "Rose bonbon" = "#F9429E", "Rose ebony" = "#674846", "Rose gold" = "#B76E79", "Rose pink" = "#FF66CC", "Rose quartz" = "#AA98A9", "Rose taupe" = "#905D5D", "Rosewood" = "#65000B", "Rosso corsa" = "#D40000", "Rosy brown" = "#BC8F8F", "Royal azure" = "#0038A8", "Royal blue" = "#002366", "Royal fuchsia" = "#CA2C92", "Royal purple" = "#7851A9", "Ruby" = "#E0115F", "Ruddy" = "#FF0028", "Ruddy brown" = "#BB6528", "Ruddy pink" = "#E18E96", "Rufous" = "#A81C07", "Russet" = "#80461B", "Rust" = "#B7410E", "Sacramento State green" = "#00563F", "Saddle brown" = "#8B4513", "Safety orange" = "#FF6700", "Saffron" = "#F4C430", "Salmon" = "#FF8C69", "Salmon pink" = "#FF91A4", "Sandstorm" = "#ECD540", "Sandy brown" = "#F4A460", "Sangria" = "#92000A", "Sap green" = "#507D2A", "Sapphire" = "#082567", "Satin sheen gold" = "#CBA135", "Scarlet" = "#FF2400", "School bus yellow" = "#FFD800", "Screamin' Green" = "#76FF7A", "Sea green" = "#2E8B57", "Seal brown" = "#321414", "Seashell" = "#FFF5EE", "Selective yellow" = "#FFBA00", "Sepia" = "#704214", "Shadow" = "#8A795D", "Shamrock green" = "#009E60", "Shocking pink" = "#FC0FC0", "Sienna" = "#882D17", "Silver" = "#C0C0C0", "Sinopia" = "#CB410B", "Skobeloff" = "#007474", "Sky blue" = "#87CEEB", "Sky magenta" = "#CF71AF", "Slate blue" = "#6A5ACD", "Slate gray" = "#708090", "Smokey topaz" = "#933D41", "Smoky black" = "#100C08", "Snow" = "#FFFAFA", "Spiro Disco Ball" = "#0FC0FC", "Splashed white" = "#FEFDFF", "Spring bud" = "#A7FC00", "Steel blue" = "#4682B4", "St. Patrick's blue" = "#23297A", "Straw" = "#E4D96F", "Sunglow" = "#FFCC33", "Tan" = "#D2B48C", "Tangelo" = "#F94D00", "Tangerine" = "#F28500", "Tangerine yellow" = "#FFCC00", "Taupe gray" = "#8B8589", "Tea green" = "#D0F0C0", "Teal" = "#008080", "Teal blue" = "#367588", "Teal green" = "#006D5B", "Tenné" = "#CD5700", "Terra cotta" = "#E2725B", "Thistle" = "#D8BFD8", "Thulian pink" = "#DE6FA1", "Tickle Me Pink" = "#FC89AC", "Tiffany Blue" = "#0ABAB5", "Tiger's eye" = "#E08D3C", "Timberwolf" = "#DBD7D2", "Titanium yellow" = "#EEE600", "Tomato" = "#FF6347", "Toolbox" = "#746CC0", "Topaz" = "#FFC87C", "Tractor red" = "#FD0E35", "Tropical rain forest" = "#00755E", "True Blue" = "#0073CF", "Tufts Blue" = "#417DC1", "Tumbleweed" = "#DEAA88", "Turkish rose" = "#B57281", "Turquoise" = "#30D5C8", "Turquoise blue" = "#00FFEF", "Turquoise green" = "#A0D6B4", "Tuscan red" = "#66424D", "Twilight lavender" = "#8A496B", "Tyrian purple" = "#66023C", "UA blue" = "#0033AA", "UA red" = "#D9004C", "Ube" = "#8878C3", "UCLA Blue" = "#536895", "UCLA Gold" = "#FFB300", "UFO Green" = "#3CD070", "Ultramarine" = "#120A8F", "Ultramarine blue" = "#4166F5", "Ultra pink" = "#FF6FFF", "Umber" = "#635147", "United Nations blue" = "#5B92E5", "University of California Gold" = "#B78727", "Unmellow Yellow" = "#FFFF66", "UP Maroon" = "#7B1113", "Upsdell red" = "#AE2029", "Urobilin" = "#E1AD21", "Utah Crimson" = "#D3003F", "Vegas gold" = "#C5B358", "Venetian red" = "#C80815", "Verdigris" = "#43B3AE", "Veronica" = "#A020F0", "Violet" = "#7F00FF", "Viridian" = "#40826D", "Vivid auburn" = "#922724", "Vivid burgundy" = "#9F1D35", "Vivid cerise" = "#DA1D81", "Vivid tangerine" = "#FFA089", "Vivid violet" = "#9F00FF", "Warm black" = "#004242", "Wenge" = "#645452", "Wheat" = "#F5DEB3", "White" = "#FFFFFF", "White smoke" = "#F5F5F5", "Wild blue yonder" = "#A2ADD0", "Wild Strawberry" = "#FF43A4", "Wild Watermelon" = "#FC6C85", "Wine" = "#722F37", "Wisteria" = "#C9A0DC", "Xanadu" = "#738678", "Yale Blue" = "#0F4D92", "Yellow" = "#FFFF00", "Yellow green" = "#9ACD32", "Yellow Orange" = "#FFEF02", "Zaffre" = "#0014A8", "Zinnwaldite brown" = "#2C1608") ################################# Read in Data #################################################### ## REQUIRED INPUTS ## # 1) listfile (filename) listfile <- "EGFR_list.txt" # 2) Prey File (filename) preyfile <- "EGFR_prey.txt" # 3) crapome File (filename or FALSE) crapfile <- "EGFR_crap.txt" # 4) Inter File (filename) interfile <- "inter.txt" # 5) X axis ("ln(NSAF)","SpecSum", "log2(FoldChange)", "SaintScore", "logOddsScore","NSAFScore") input.main.x <- "ln(NSAF)" # 6) Y axis ("ln(NSAF)","SpecSum", "log2(FoldChange)", "SaintScore", "logOddsScore","NSAFScore") input.main.y <- "log2(FoldChange)" # 7) Bubble Size ("ln(NSAF)","SpecSum", "log2(FoldChange)", "SaintScore", "logOddsScore","NSAFScore") input.main.size <- "SpecSum" # 8) Coloring ("fixed" or "crapome") input.main.color <- "crapome" # 9) Saint Score Cutoff (0 - 1) input.SS_cutoff <- 0.8 # 10) Fold change Cutoff (-inf - inf) input.FC_cutoff <- 0 # 11) NSAF Score Cutoff (-inf - inf) input.NS_cutoff <- 0 # 12) Plotting Theme ("Default","b/w","minimal","classic","dark","linedraw") input.plot_theme <- "Default" # 13) Bubble Labels ("none",">cutoff","all") input.bubble_label <- ">cutoff" # 14) Label Color ("white","black") input.label_color <- "black" # 15) Bubble Color (colors listed above) input.bubble_color <- colors[["Alizarin crimson"]] # 16) Bubble outline color ("white","black") input.outline_color <- "black" # 17) CRAPome Filtered Bubble Color (colors listed above) input.filt_color <- colors[["Tan"]] # 18) Bubble scale ((0-100),(0-100)) # SECOND NUMBER MUST BE LARGER THAN OR EQUAL TO THE FIRST input.plot_scale <- c(0,10) # 19) File Type (".pdf",".png",".tif",".svg",".eps",".jpg") input.file_type <- ".png" ################################################################################ # Define merge function and calculate crapome % merge_files <- function(SAINT_DF, prey_DF, crapome=FALSE) { SAINT <- read.table(SAINT_DF, sep='\t', header=TRUE) prey <- read.table(prey_DF, sep='\t', header=FALSE); colnames(prey) <- c("Prey", "Length", "PreyGene") DF <- merge(SAINT,prey) if(crapome!=FALSE) { crapome <- read.table(crapome, sep='\t', header=TRUE) colnames(crapome) <- c("Prey", "Symbol", "Num.of.Exp", "Ave.SC", "Max.SC") DF1 <- merge(DF, crapome); as.character(DF1$Num.of.Exp); DF1$Symbol <- NULL; DF1$Ave.SC <- NULL; DF1$Max.SC <- NULL #remove unnecessary columns DF1$Num.of.Exp <- sub("^$", "0 / 1", DF1$Num.of.Exp ) #replace blank values with 0 / 1 DF <- DF1 %>% separate(Num.of.Exp, c("NumExp", "TotalExp"), " / ") #split into 2 columns DF$CrapomePCT <- round(100 - (as.integer(DF$NumExp) / as.integer(DF$TotalExp) * 100), digits=2) #calculate crapome % } DF$FoldChange <- round(log2(DF$FoldChange),digits=2) colnames(DF)[(colnames(DF)=="FoldChange")] <- "log2(FoldChange)" DF$SAF <- DF$AvgSpec / DF$Length by_bait <- DF %>% group_by(Bait) %>% mutate("NSAF" = SAF/sum(SAF)) by_bait$SAF <- NULL return(by_bait[!duplicated(by_bait),]) } ################################################################################ bubblebeam <- function(main.data,main.exclude,main.x,main.y,main.size,main.color,SS_cutoff,FC_cutoff,NS_cutoff, plot_theme,bubble_label,label_color,bubble_color, outline_color,filt_color,plot_scale, file_type){ str_x=paste0(main.x) str_y=paste0(main.y) str_color=paste0(main.color) str_size=paste0(main.size) str_cutoff= paste0(SS_cutoff) str_label= bubble_label scl_size = plot_scale main.data2 <- main.data[!(main.data$PreyGene %in% main.exclude),] main.data2 <- subset(main.data2, main.data2[(colnames(main.data2)=="log2(FoldChange)")] >= FC_cutoff) main.data2 <- subset(main.data2, main.data2[(colnames(main.data2)=="NSAFScore")] >= NS_cutoff) c <- subset(main.data2, SaintScore>=as.numeric(str_cutoff), select = c(str_x,str_y,"Bait","PreyGene",str_size)) colnames(c) <- c("x","y","Bait","PreyGene","size") p <- ggplot(data=c, x=x, y=y,size=size)+ geom_point(data=c, aes(x=x, y=y,size=size), fill=bubble_color,color=outline_color,pch=21) + scale_size(range=scl_size) p <- p + labs(x=str_x, y=str_y, size=str_size) + scale_size(range=scl_size) if(length(levels(c$Bait) > 1)) {p <- p + facet_wrap(~Bait)} if(str_label== 'all' & length(c$x)>=1) {set.seed=42; p <- p + ggrepel::geom_text_repel(data=c, aes(x=x,y=y,label=PreyGene), segment.color="black",force=1, fontface='bold', box.padding=unit(0.25,'lines'), point.padding=unit(0.25,'lines'), max.iter=1e4, segment.size=0.5)} if(plot_theme== "classic") {p <- p + theme_classic()} if(plot_theme== "b/w") {p <- p + theme_bw()} if(plot_theme== "minimal") {p <- p + theme_minimal()} if(plot_theme== "dark") {p <- p + theme_dark()} if(plot_theme== "linedraw") {p <- p + theme_linedraw()} if(str_color=="crapome") { a <- subset(main.data2, CrapomePCT <80 & SaintScore >=as.numeric(str_cutoff), select = c(str_x,str_y,"Bait","PreyGene",str_size,"CrapomePCT")) b <- subset(main.data2, CrapomePCT >=80 & SaintScore >=as.numeric(str_cutoff), select = c(str_x,str_y,"Bait","PreyGene",str_size,"CrapomePCT")) colnames(a) <- c("x","y","Bait","PreyGene","size", "CrapomePCT") colnames(b) <- c("x","y","Bait","PreyGene","size","CrapomePCT") p <- ggplot(data=a, x=x, y=y,size=size) + geom_point(data=a,aes(x=x,y=y,size=size),fill=filt_color,pch=21,color=outline_color) + scale_size(range=scl_size) if(length(levels(a$Bait) > 1)) {p <- p + facet_wrap(~Bait)} if(str_label== "all" & length(a$x)>=1) {set.seed=42; p <- p + ggrepel::geom_text_repel(data=a, aes(x=x,y=y,label=PreyGene), segment.color=label_color,force=1, fontface='bold', box.padding=unit(0.25,'lines'), point.padding=unit(0.25,'lines'), color=label_color, max.iter=1e4, segment.size=0.5)} p <- p + geom_point(data=b, aes(x=x, y=y, size=size, fill=CrapomePCT),color=outline_color,pch=21) + scale_fill_gradient(limits=c(80, 100), low=filt_color, high=bubble_color) + labs(colour="CRAPome Probability \nof Specific Interaction (%)", x=str_x, y=str_y,size=str_size) if(str_label== '>cutoff' & length(b$x)>=1) {set.seed=42; p <- p + ggrepel::geom_text_repel(data=b, aes(x=x,y=y,label=PreyGene), segment.color=label_color,force=1, fontface='bold', box.padding=unit(0.25,'lines'), point.padding=unit(0.25,'lines'), color=label_color, max.iter=1e4, segment.size=0.5)} if(str_label== 'all' & length(b$x)>=1) {set.seed=42; p <- p + ggrepel::geom_text_repel(data=b, aes(x=x,y=y,label=PreyGene), segment.color=label_color,force=1, fontface='bold', box.padding=unit(0.25,'lines'), point.padding=unit(0.25,'lines'), color=label_color, max.iter=1e4, segment.size=0.5)} if(plot_theme== "classic") {p <- p + theme_classic()} if(plot_theme== "b/w") {p <- p + theme_bw()} if(plot_theme== "minimal") {p <- p + theme_minimal()} if(plot_theme== "dark") {p <- p + theme_dark()} if(plot_theme== "linedraw") {p <- p + theme_linedraw()} } p <- p + theme(axis.title.y = element_text(size=rel(1.5),face="bold"), axis.title.x = element_text(size=rel(1.5),face="bold"), axis.text.x = element_text(size=rel(1.5),face="bold"), axis.text.y = element_text(size=rel(1.5),face="bold"), strip.text.x = element_text(size=rel(1.5),face="bold"), legend.text = element_text(face="bold"), legend.title = element_text(face="bold")) if(file_type == ".png"){png(paste("BubbleGraph",file_type,sep="")); print(p); dev.off()} if(file_type == ".pdf"){pdf(paste("BubbleGraph",file_type,sep="")); print(p); dev.off()} if(file_type == ".tif"){tiff(paste("BubbleGraph",file_type,sep="")); print(p); dev.off()} if(file_type == ".jpg"){jpeg(paste("BubbleGraph",file_type,sep="")); print(p); dev.off()} if(file_type == ".svg"){svg(paste("BubbleGraph",file_type,sep="")); print(p); dev.off()} if(file_type == ".eps"){postscript(paste("BubbleGraph",file_type,sep="")); print(p); dev.off()} } ################################################################################ args <- commandArgs(trailingOnly = TRUE) working <- as.data.frame(merge_files(args[1], args[2], args[3])) inter_df <- read.table(args[4], sep='\t', header=FALSE) working$temp <- strsplit(as.character(working$ctrlCounts),"[|]") cnt <- 0 for(i in working$temp){ cnt <- cnt+1 working$ctrl_mean[cnt] <- mean(as.numeric(unlist(i))) working$ctrl_number[cnt] <- length(i)} working$ctrl_SAF <- working$ctrl_mean / working$Length main.data <- working %>% group_by(Bait) %>% mutate("control_NSAF" = ctrl_SAF/sum(ctrl_SAF)) ctrl_SAF_constant <- 1/mean(main.data$ctrl_SAF) # add ctrl_SAF_constant to prevent dividing by 0 cnt <- 0 for(i in main.data$control_NSAF){ cnt <- cnt + 1 main.data$nsafScore[cnt] <- ((main.data$NSAF[cnt])+ctrl_SAF_constant)/((i/main.data$ctrl_number[cnt])+ctrl_SAF_constant) } main.data$NSAF <- log(main.data$NSAF) main.data$nsafScore <- log(main.data$nsafScore) main.data <- filter(main.data, NSAF > -Inf) colnames(main.data)[colnames(main.data)=="NSAF"] <- "ln(NSAF)" colnames(main.data)[colnames(main.data)=="nsafScore"] <- "NSAFScore" main.data$SAF <- NULL; main.data$ctrl_SAF <- NULL main.data$control_NSAF <- NULL; main.data$temp <- NULL main.data$ctrl_mean <- NULL ################################################################################ bubblebeam(main.data = main.data, main.exclude = FALSE,main.x = args[5], main.y = args[6],main.size = args[7],main.color = colors[[args[8]]], SS_cutoff = args[8],FC_cutoff = args[9], NS_cutoff = args[10], plot_theme = args[11], bubble_label = args[12],label_color = args[13], bubble_color = colors[[args[14]]], outline_color = args[15], filt_color = colors[[args[16]]], plot_scale = c(0,10), file_type = ".png") ################################################################################