Skip to content

Commit

Permalink
fixed an issue when platypus.subset table is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
naumenko-sa committed Jun 14, 2019
1 parent 2967f98 commit 435c223
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ function f_make_report
vcf.gatk.get_depth.sh $fprefix.subset.vcf.gz $reference
fi

#gemini.decompose.sh ${family}-platypus.vcf.gz
# gemini.decompose.sh ${family}-platypus.vcf.gz
# there might a case when platypus subset vcf is empty
fprefix=${family}-platypus-annotated-decomposed
if [ -f $fprefix.vcf.gz ]
then
Expand Down
10 changes: 6 additions & 4 deletions cre.vcf2db.R
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,13 @@ merge_reports <- function(family, samples){
platypus_file <- paste0(family, "-platypus-annotated-decomposed.table")
if(file.exists(platypus_file)){
platypus <- read.delim(platypus_file, stringsAsFactors = F)
platypus$superindex <- with(platypus, paste(paste0(CHROM,":",POS), REF, ALT, sep = '-'))
platypus[c("CHROM", "POS", "REF", "ALT")] <- NULL
ensemble <- merge(ensemble, platypus, by.x = "superindex", by.y = "superindex",
if (nrow(platypus) > 0){
platypus$superindex <- with(platypus, paste(paste0(CHROM,":",POS), REF, ALT, sep = '-'))
platypus[c("CHROM", "POS", "REF", "ALT")] <- NULL
ensemble <- merge(ensemble, platypus, by.x = "superindex", by.y = "superindex",
all.x = T, all.y = F)

for (i in 1:nrow(ensemble)){
for (i in 1:nrow(ensemble)){
#if(grepl("NA",ensemble[i,"Trio_coverage"])) - wrong, may be 10/10/NA in gatk
#if (ensemble[i,"Trio_coverage"]=="NA/NA/NA")
if (str_count(ensemble[i,"Trio_coverage"],"NA") == length(samples)){
Expand Down Expand Up @@ -503,6 +504,7 @@ merge_reports <- function(family, samples){
n_sample <- n_sample + 1
}
}
}
}

for (sample in samples){
Expand Down

0 comments on commit 435c223

Please sign in to comment.