Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

In add.gdsn(ans, nm[i], val[[i]], compress = compress, closezip = closezip, : Missing characters are converted to "". #36

Open
jingydz opened this issue Jun 13, 2024 · 1 comment

Comments

@jingydz
Copy link

jingydz commented Jun 13, 2024

Hi, when I want to add annotations to my gds file, I got this error.
Could you help me to solve this?

Warning messages:
1: In add.gdsn(ans, nm[i], val[[i]], compress = compress, closezip = closezip, :
Missing characters are converted to "".
2: In add.gdsn(ans, nm[i], val[[i]], compress = compress, closezip = closezip, :
Missing characters are converted to "".
3: In add.gdsn(ans, nm[i], val[[i]], compress = compress, closezip = closezip, :
Missing characters are converted to "".
4: In add.gdsn(ans, nm[i], val[[i]], compress = compress, closezip = closezip, :
Missing characters are converted to "".
5: In add.gdsn(ans, nm[i], val[[i]], compress = compress, closezip = closezip, :
Missing characters are converted to "".
6: In add.gdsn(ans, nm[i], val[[i]], compress = compress, closezip = closezip, :
Missing characters are converted to "".
7: In add.gdsn(ans, nm[i], val[[i]], compress = compress, closezip = closezip, :
Missing characters are converted to "".
8: In add.gdsn(ans, nm[i], val[[i]], compress = compress, closezip = closezip, :
Missing characters are converted to "".
9: In add.gdsn(ans, nm[i], val[[i]], compress = compress, closezip = closezip, :
Missing characters are converted to "".

My command is:
Rscript 0.2.3gds2agds.R 1

and the R script is:
##########################################################################

Input

##########################################################################

gds file

dir_geno <- "/xxx/variants/rare_variant/GDS_file/"
gds_file_name_1 <- "phenotype.chr"
gds_file_name_2 <- ".2802.mac1.filt.gds"

annotation file (output of Annotate.R)

dir_anno <- "/xxx/variants/rare_variant/Anno/"
anno_file_name_1 <- "Anno_chr"
anno_file_name_2 <- "_STAARpipeline.csv"

chr <- as.numeric(commandArgs(TRUE)[1])

###########################################################################

Main Function

###########################################################################

load required package

library(gdsfmt)
library(SeqArray)
library(SeqVarTools)
library(readr)

read annotation data

FunctionalAnnotation <- read_csv(paste0(dir_anno,"chr",chr,"/",anno_file_name_1,chr,anno_file_name_2),
col_types=list(col_character(),col_double(),col_double(),col_double(),col_double(),
col_double(),col_double(),col_double(),col_double(),col_double(),
col_character(),col_character(),col_character(),col_double(),col_character(),
col_character(),col_character(),col_character(),col_character(),col_double(),
col_double(),col_character()))

dim(FunctionalAnnotation)

rename colnames

colnames(FunctionalAnnotation)[2] <- "apc_conservation"
colnames(FunctionalAnnotation)[7] <- "apc_local_nucleotide_diversity"
colnames(FunctionalAnnotation)[9] <- "apc_protein_function"

open GDS

gds.path <- paste0(dir_geno,gds_file_name_1,chr,gds_file_name_2)
genofile <- seqOpen(gds.path, readonly = FALSE)

Anno.folder <- index.gdsn(genofile, "annotation/info")
add.gdsn(Anno.folder, "FunctionalAnnotation", val=FunctionalAnnotation, compress="LZMA_ra", closezip=TRUE)

seqClose(genofile)

@zhengxwen
Copy link
Owner

zhengxwen commented Jun 16, 2024

As it said, Missing characters are converted to "".

To store missing characters in GDS files, you should use SeqArray::seqAddValue() instead of add.gdsn.
See the help file of SeqArray::seqAddValue for more details.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants