... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Package: DominoEffect |
2 | 2 |
Type: Package |
3 | 3 |
Title: Identification and Annotation of Protein Hotspot Residues |
4 |
-Version: 0.99.4 |
|
4 |
+Version: 0.99.5 |
|
5 | 5 |
Author: Marija Buljan and Peter Blattmann |
6 | 6 |
Maintainer: Marija Buljan <[email protected]>, |
7 | 7 |
Peter Blattmann <[email protected]> |
... | ... |
@@ -5,6 +5,8 @@ map_to_func_elem <- function(hotspot_results, write_to_file = "NO", ens_release |
5 | 5 |
} |
6 | 6 |
### |
7 | 7 |
|
8 |
+ |
|
9 |
+ |
|
8 | 10 |
message (" Obtaining sequences of proteins encoded by the representative Ensembl transcripts.") |
9 | 11 |
|
10 | 12 |
if (ens_release == 73) { |
... | ... |
@@ -55,10 +57,51 @@ map_to_func_elem <- function(hotspot_results, write_to_file = "NO", ens_release |
55 | 57 |
{ |
56 | 58 |
if(nchar(unip_acc) == 6){ |
57 | 59 |
retrieve_unip <- paste("http://www.uniprot.org/uniprot/", unip_acc, ".gff", sep = "") |
58 |
- gff.file[[unip_acc]] <- read.delim(retrieve_unip, skip = 2, header = FALSE) |
|
60 |
+ |
|
61 |
+ ##### |
|
62 |
+ # to fail gracefully if Uniprot is not accessible |
|
63 |
+ # code from http://bioconductor.org/developers/how-to/web-query/ |
|
64 |
+ N.TRIES <- as.integer(5) |
|
65 |
+ stopifnot(length(N.TRIES) == 1L, !is.na(N.TRIES)) |
|
66 |
+ |
|
67 |
+ while (N.TRIES > 0L) { |
|
68 |
+ result <- tryCatch(read.delim(retrieve_unip, skip = 2, header = FALSE), error=identity) |
|
69 |
+ if (!inherits(result, "error")) |
|
70 |
+ break |
|
71 |
+ N.TRIES <- N.TRIES - 1L |
|
72 |
+ } |
|
73 |
+ |
|
74 |
+ if (N.TRIES == 0L) { |
|
75 |
+ stop("Retrieving sequence from Uniprot failed:\n", |
|
76 |
+ retrieve_unip, |
|
77 |
+ "\n error: ", conditionMessage(result)) |
|
78 |
+ } |
|
79 |
+ ##### |
|
80 |
+ gff.file[[unip_acc]] <- result |
|
59 | 81 |
|
60 | 82 |
retrieve_unip <- paste ("http://www.uniprot.org/uniprot/", unip_acc, ".fasta", sep = "") |
61 |
- uni.sequences <- c(uni.sequences, readAAStringSet(retrieve_unip)) |
|
83 |
+ |
|
84 |
+ ##### |
|
85 |
+ # to fail gracefully if Uniprot is not accessible |
|
86 |
+ # code from http://bioconductor.org/developers/how-to/web-query/ |
|
87 |
+ N.TRIES <- as.integer(5) |
|
88 |
+ stopifnot(length(N.TRIES) == 1L, !is.na(N.TRIES)) |
|
89 |
+ |
|
90 |
+ while (N.TRIES > 0L) { |
|
91 |
+ result <- tryCatch(readAAStringSet(retrieve_unip), error=identity) |
|
92 |
+ if (!inherits(result, "error")) |
|
93 |
+ break |
|
94 |
+ N.TRIES <- N.TRIES - 1L |
|
95 |
+ } |
|
96 |
+ |
|
97 |
+ if (N.TRIES == 0L) { |
|
98 |
+ stop("Reading sequence from Uniprot failed:\n", |
|
99 |
+ , retrieve_unip, |
|
100 |
+ "\n error: ", conditionMessage(result)) |
|
101 |
+ } |
|
102 |
+ ##### |
|
103 |
+ |
|
104 |
+ uni.sequences <- c(uni.sequences, result) |
|
62 | 105 |
|
63 | 106 |
}else { |
64 | 107 |
warning("IDs for following uniprot accessions could not be retrieved:", unip_acc, " that corresponds to:", gene_ens, ".") |