From 9934b0368266dbc3cd63f51b0d075b01150561d0 Mon Sep 17 00:00:00 2001 From: Suchita Lulla Date: Wed, 29 Nov 2023 18:05:52 -0700 Subject: [PATCH] update demo config with changes to variant params --- test/data/gnomad_v3.1.1_KCNQ2_SNVs.bed | 4 -- test/test.yaml | 69 ++++++++++++++------------ transcriptionary/glyphs.py | 2 +- 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/test/data/gnomad_v3.1.1_KCNQ2_SNVs.bed b/test/data/gnomad_v3.1.1_KCNQ2_SNVs.bed index b508852..f8dc882 100644 --- a/test/data/gnomad_v3.1.1_KCNQ2_SNVs.bed +++ b/test/data/gnomad_v3.1.1_KCNQ2_SNVs.bed @@ -88,7 +88,6 @@ chr20 63400800 63400801 C T 3 152200 0.000019710906701708278 missense_variant chr20 63400801 63400802 G A 3 152162 0.000019715829182055967 missense_variant chr20 63400809 63400810 C G 1 152204 0.000006570129562954982 missense_variant chr20 63400810 63400811 C T 1 152220 0.000006569438969911969 missense_variant -chr20 63400820 63400821 G A lof_flag" 1 152208 stop_gained chr20 63400821 63400822 C A 1 152206 0.000006570043230884459 missense_variant chr20 63400822 63400823 G A 1 152214 0.0000065696979252893955 missense_variant chr20 63400823 63400824 C T 21 152210 0.00013796728204454371 missense_variant @@ -1065,7 +1064,6 @@ chr20 63438464 63438465 A G 7 152110 0.00004601932811780948 missense_variant chr20 63438465 63438466 C T 2 152220 0.000013138877939823939 synonymous_variant chr20 63438474 63438475 T A 1 152112 0.000006574103292310929 synonymous_variant chr20 63438475 63438476 C A 1 152190 0.000006570733950982325 missense_variant -chr20 63438479 63438480 G A lof_flag" 2 152124 stop_gained chr20 63438479 63438480 G C 1 152124 0.000006573584707212537 missense_variant chr20 63438493 63438494 T C 2 152124 0.000013147169414425074 missense_variant chr20 63438503 63438504 G C 2 152168 0.00001314336785657957 missense_variant @@ -1075,7 +1073,6 @@ chr20 63438511 63438512 G T 2 152162 0.000013143886121370644 missense_variant chr20 63438511 63438512 G A 870 152162 0.00571759046279623 missense_variant chr20 63438514 63438515 G T 1 152178 0.000006571252086372537 missense_variant chr20 63438515 63438516 T C 1 152170 0.0000065715975553657095 missense_variant -chr20 63438520 63438521 C T lof_flag" 8 152134 stop_gained chr20 63438523 63438524 C T 7 152190 0.00004599513765687627 missense_variant chr20 63438530 63438531 C A 11 152186 0.00007227997319070085 missense_variant chr20 63438530 63438531 C T 1 152186 0.000006570906653700077 missense_variant @@ -1088,7 +1085,6 @@ chr20 63438570 63438571 A C 1 152116 0.000006573930421520419 synonymous_variant chr20 63438574 63438575 T A 2 152092 0.00001314993556531573 missense_variant chr20 63438574 63438575 T C 1 152092 0.000006574967782657865 missense_variant chr20 63438576 63438577 G A 7 152186 0.000045996346575900545 synonymous_variant -chr20 63438579 63438580 C T lof_flag" 3 152150 stop_gained chr20 63438584 63438585 A G 1 152180 0.000006571165724799579 missense_variant chr20 63438589 63438590 G C 1 152134 0.0000065731526154574255 missense_variant chr20 63438594 63438595 T C 1 152184 0.000006570993008463439 synonymous_variant diff --git a/test/test.yaml b/test/test.yaml index 72290e7..c37dedf 100755 --- a/test/test.yaml +++ b/test/test.yaml @@ -17,13 +17,20 @@ intron_size: 20 plot_UTRs: True plot_direction: True +plot_variants: True + +min_lollipop_height: 15 +lollipop_radius: 5 +lollipop_line_width: 2 + +default_y_axis: 'AC' # can be toggled with HTML output +default_y_axis_scale: 'log' # can be toggled with HTML output glyph_colors: intron: 'gray 11' exon: 'davys gray' arrow: '#e8e8e8' UTR: '#969696' - variant: 'charcoal' #default lollipop color if no severity information palettes_filepath: 'default_colors/palettes.yaml' #filepath to palettes config named_colors_filepath: 'default_colors/named_colors.yaml' #filepath to named colors config @@ -31,40 +38,40 @@ track_palette: 'bang_wong_palette' #palette to draw random track colors from; ca ... --- #variants -plot_variants: True - #VCF example -variant_format: 'vcf' -filepath: 'test/data/gnomad.exomes.chr20.subset.vcf.gz' -chrom: chr20 -info_annotations: #INFO fields to add to hover boxes (VCF only) - - pab_max - - popmax -vep: #VCF only; leave empty if not VEP annotated - field_name: vep #name of INFO field with VEP string (e.g. vep, ann, csq) - vep_fields: #vep fields to add to hover annotations - - SYMBOL - - Amino_acids - - Consequence - annotate_severity_by: max_severity #possible arguments are transcript_severity (use VEP annotations from given transcript) and max_severity (use VEP annotation from most severe transcript specified in 'transcripts' argument); these apply to vep_fields also +gnomAD_vcf: + format: 'vcf' + filepath: 'test/data/gnomad.exomes.chr20.subset.vcf.gz' + chrom: 'chr20' + info_annotations: #INFO fields to add to hover boxes (VCF only) + - pab_max + - popmax + vep: #VCF only; leave empty if not VEP annotated + field_name: vep #name of INFO field with VEP string (e.g. vep, ann, csq) + vep_fields: #vep fields to add to hover annotations + - SYMBOL + - Amino_acids + - Consequence + annotate_severity_by: transcript_severity #possible arguments are transcript_severity (use VEP annotations from given transcript) and max_severity (use VEP annotation from most severe transcript specified in 'transcripts' argument); these apply to vep_fields also + color: charcoal + variant_severity_colors: #will only be used if consequence_idx is set; overrides "color" + LOW: 'apple green' + MED: '#f6aa1c' + HIGH: '#e01e37' #BED example -# variant_format: 'bed' #can be VCF or BED -# filepath: 'test/data/gnomad_v3.1.1_KCNQ2_SNVs.bed' -# header: ['Chromosome', 'Start', 'End', 'Reference', 'Alternate', 'Allele Count', 'Allele Number', 'Allele Frequency', 'VEP Annotation'] # BED only -# chrom: chr20 - -default_y_axis: 'AC' # can be toggled with HTML output -default_y_axis_scale: 'log' # can be toggled with HTML output +# gnomAD_bed: +# format: 'bed' #can be VCF or BED +# filepath: 'test/data/gnomad_v3.1.1_KCNQ2_SNVs.bed' +# chrom: 'chr20' +# header: ['Chromosome', 'Start', 'End', 'Reference', 'Alternate', 'AC', 'AN', 'AF', 'VEP Annotation'] # BED only; if 'AC' and 'AF' fields are present, they will be used for lollipop heights +# color: saffron +# variant_severity_colors: #will only be used if consequence_idx is set; overrides "color" +# LOW: 'apple green' +# MED: '#f6aa1c' +# HIGH: '#e01e37' +# consequence_idx: 8 #0-based -min_lollipop_height: 15 -lollipop_radius: 5 -lollipop_line_width: 2 -variant_severity_colors: - LOW: 'apple green' - MED: '#f6aa1c' - HIGH: '#e01e37' - NONE: '#171717' ... --- diff --git a/transcriptionary/glyphs.py b/transcriptionary/glyphs.py index 8fdc114..d45011e 100755 --- a/transcriptionary/glyphs.py +++ b/transcriptionary/glyphs.py @@ -3,7 +3,7 @@ from .colors import color_variants,lighten_hex_color import math -def flatten(ls): return sum(ls, []) +def flatten(ls): return [i for s in ls for i in s] def center_feature(feature): center = feature[0] + (feature[1] - feature[0])/2