Skip to content

Commit

Permalink
Update helper-functions.R
Browse files Browse the repository at this point in the history
remove seqlevelsStyle(bsgenome) to prevent accessing ftp server
  • Loading branch information
AtaJadidAhari authored Jan 14, 2025
1 parent 19affb3 commit feff38d
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions R/helper-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -710,10 +710,7 @@ updateSeqlevelsStyle <- function(bsgenome, genome_assembly, new_style, old_style

response <- httr::GET(file_url, httr::write_disk(conversion_dict_path, overwrite = TRUE))

if (response$status_code == 200) {
assembly_report <- fread(conversion_dict_path)
}
else {
if (response$status_code != 200) {
stop(paste0("Failed to download the file. Status code:", response$status_code,
".\nPlease download the file manually from ", file_url, " to the following directory: ", conversion_dict_path))
}
Expand All @@ -728,12 +725,10 @@ updateSeqlevelsStyle <- function(bsgenome, genome_assembly, new_style, old_style

response <- httr::GET(file_url, httr::write_disk(conversion_dict_path, overwrite = TRUE))

if (response$status_code == 200) {
assembly_report <- fread(conversion_dict_path)
} else {
if (response$status_code != 200) {
stop(paste0("Failed to download the file. Status code:", response$status_code,
".\nPlease download the file manually from ", file_url, " to the following directory: ", conversion_dict_path))
}
}
}
assembly_report <- fread(conversion_dict_path)
}
Expand All @@ -757,8 +752,9 @@ updateSeqlevelsStyle <- function(bsgenome, genome_assembly, new_style, old_style
else if (new_style == "NCBI" & old_style=="UCSC"){ # new_style == "NCBI"
seqinfo(bsgenome)@genome <- assembly_report[!(is.na(UCSC_Genome_Name) | UCSC_Genome_Name == ""), UCSC_Genome_Name]
}

seqlevelsStyle(bsgenome) <- new_style

## Next line also accesses ftp and won't work behind a proxy.
# seqlevelsStyle(bsgenome) <- new_style

return (bsgenome)
}

0 comments on commit feff38d

Please sign in to comment.