Skip to content

Commit 63f5cf2

Browse files
committed
Extract SARS-CoV-2 feature coordinates to JSON file
1 parent 016d370 commit 63f5cf2

7 files changed

Lines changed: 38 additions & 29 deletions

File tree

.test/targets.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,7 @@ REPORT_QMD:
4242
"template.qmd"
4343
FEATURES_JSON:
4444
"config/sarscov2_features.json"
45+
COORDINATES_JSON:
46+
"config/sarscov2_coordinates.json"
4547
GENETIC_CODE_JSON:
4648
"config/standard_genetic_code.json"

config/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ All of the following variables are pre-defined in [config.yaml](/config/config.y
131131
- `ALIGNMENT_REFERENCE`: NCBI accession number of the reference record for sequence alignment.
132132
- `PROBLEMATIC_VCF`: URL or path of a VCF file containing problematic genome positions for masking.
133133
- `FEATURES_JSON`: path of a JSON file containing name equivalences of genome features for data visualization.
134+
- `COORDINATES_JSON`: path of a JSON file containing genome feature coordinates for data visualization.
134135
- `GENETIC_CODE_JSON`: path of a JSON file containing a genetic code for gene translation.
135136
- `TREE_MODEL`: substitution model used by IQTREE (see [docs](http://www.iqtree.org/doc/Substitution-Models)).
136137
- `UFBOOT_REPS`: ultrafast bootstrap replicates for IQTREE (see [UFBoot](https://doi.org/10.1093/molbev/msx281)).

config/config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ PROBLEMATIC_VCF:
44
"https://raw.githubusercontent.com/W-L/ProblematicSites_SARS-CoV2/da322c32004f7b16bdaa6a8ee7fd24d56e79d9dc/problematic_sites_sarsCov2.vcf"
55
FEATURES_JSON:
66
"config/sarscov2_features.json"
7+
COORDINATES_JSON:
8+
"config/sarscov2_coordinates.json"
79
GENETIC_CODE_JSON:
810
"config/standard_genetic_code.json"
911
TREE_MODEL:

config/sarscov2_coordinates.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"five_prime_UTR": [1, 265],
3+
"orf1ab": [266, 21555],
4+
"Intergenic_1": [21556, 21562],
5+
"S": [21563, 25384],
6+
"Intergenic_2": [25385, 25392],
7+
"ORF3a": [25393, 26220],
8+
"Intergenic_3": [26221, 26244],
9+
"E": [26245, 26472],
10+
"Intergenic_4": [26473, 26522],
11+
"M": [26523, 27191],
12+
"Intergenic_5": [27192, 27201],
13+
"ORF6": [27202, 27387],
14+
"Intergenic_6": [27388, 27393],
15+
"ORF7": [27394, 27759],
16+
"Intergenic_7": [27760, 27893],
17+
"ORF8": [27894, 28259],
18+
"Intergenic_8": [28260, 28273],
19+
"N": [28274, 29533],
20+
"Intergenic_9": [29534, 29557],
21+
"ORF10": [29558, 29674],
22+
"three_prime_UTR": [29675, 29903]
23+
}

workflow/Snakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import subprocess
66

77
min_version("7.19")
88

9-
__version__ = "1.2.2"
9+
__version__ = "1.3.0"
1010

1111
containerized: "docker://ahmig/vipera:v" + __version__
1212

workflow/rules/report.smk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ rule general_NV_description:
9999
samples = expand("{sample}", sample = iter_samples()),
100100
design = config["PLOTS"],
101101
regions = config["PLOT_GENOME_REGIONS"],
102+
coordinates = config["COORDINATES_JSON"],
102103
window = config["WINDOW"]["WIDTH"],
103104
step = config["WINDOW"]["STEP"],
104105
max_alt_freq = 1.0 - config["VC"]["IVAR_FREQ"]

workflow/scripts/report/NV_description.R

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,10 @@ log_threshold(INFO)
1616
# Import file with plots style
1717
source(snakemake@params[["design"]])
1818

19-
# SARS-CoV-2 anotation for genome scheme
20-
SCov2_annotation <- list(
21-
"five_prime_UTR" = c(1:265),
22-
"orf1ab" = c(266:21555),
23-
"Intergenic_1" = c(21556:21562),
24-
"S" = c(21563:25384),
25-
"Intergenic_2" = c(25385:25392),
26-
"ORF3a" = c(25393:26220),
27-
"Intergenic_3" = c(26221:26244),
28-
"E" = c(26245:26472),
29-
"Intergenic_4" = c(26473:26522),
30-
"M" = c(26523:27191),
31-
"Intergenic_5" = c(27192:27201),
32-
"ORF6" = c(27202:27387),
33-
"Intergenic_6" = c(27388:27393),
34-
"ORF7" = c(27394:27759),
35-
"Intergenic_7" = c(27760:27893),
36-
"ORF8" = c(27894:28259),
37-
"Intergenic_8" = c(28260:28273),
38-
"N" = c(28274:29533),
39-
"Intergenic_9" = c(29534:29557),
40-
"ORF10" = c(29558:29674),
41-
"three_prime_UTR" = c(29675:29903)
42-
)
19+
log_info("Reading inputs")
20+
21+
# Anotation for genome scheme
22+
coordinates <- read_json(snakemake@input$coordinates)
4323

4424
vcf <- read_delim(snakemake@input[["vcf"]])
4525
vcf_snp <- vcf
@@ -78,20 +58,20 @@ vcf <- vcf %>%
7858
ALT
7959
)
8060

81-
# Df with gene length for scheme
61+
# Create dataframe with gene length for scheme
8262
notation_empty <- data.frame(
8363
gene = "",
8464
len = 0
8565
) %>%
8666
filter(len != 0)
8767

8868
notation <- lapply(
89-
names(SCov2_annotation),
69+
names(coordinates),
9070
function(x) {
9171
add_row(
9272
notation_empty,
9373
gene = x,
94-
len = length(SCov2_annotation[[x]])
74+
len = length(coordinates[[x]])
9575
)
9676
}
9777
) %>%
@@ -184,7 +164,7 @@ variants <- vcf %>%
184164
aes(
185165
x = len,
186166
y = 0.3,
187-
fill = factor(gene, rev(names(SCov2_annotation)))
167+
fill = factor(gene, rev(names(coordinates)))
188168
),
189169
inherit.aes = FALSE,
190170
width = 0.3

0 commit comments

Comments
 (0)