Skip to content

GetWTandMutCount #14

@rabiafidan

Description

@rabiafidan

Hi,

I am trying to run Battenberg but I get an error from this function runGetDirichletProcessInfo. Could you help me understand and solve the problem?

>runGetDirichletProcessInfo(loci_file="foo.txt", allele_frequencies_file="bar.txt", cellularity_file="c.txt",subclone_file="s.txt",output_file="o.txt",gender="male", SNP.phase.file=NA,mut.phase.file=NA)
Error in if (is.na(subs.data)) { : the condition has length > 1

I could trace it back to GetWTandMutCount here is the part of the code in this repo:

GetWTandMutCount <- function(loci_file, allele_frequencies_file) {
  subs.data = tryCatch(read.table(loci_file, sep='\t', header=F, stringsAsFactors=F), error=function(e) NA)
  if (is.na(subs.data)) {
    # Empty input
    return(NULL)
  }
  subs.data = subs.data[order(subs.data[,1], subs.data[,2]),]
  #...
  #...

When I try it:

>subs.data = tryCatch(read.table("foo_loci.txt", sep='\t', header=F, stringsAsFactors=F), error=function(e) NA)
#it is not empty
> head(subs.data)
  V1      V2 V3 V4
1  1  653452  T  C
2  1  653927  A  G
3  1  962261  C  T
4  1  996120  C  T
5  1 1131436  A  G
6  1 1131439  A  G


> if (is.na(subs.data)) {
    # Empty input
    return(NULL)
  }
Error in if (is.na(subs.data)) { : the condition has length > 1

> head(is.na(subs.data))
        V1    V2    V3    V4
[1,] FALSE FALSE FALSE FALSE
[2,] FALSE FALSE FALSE FALSE
[3,] FALSE FALSE FALSE FALSE
[4,] FALSE FALSE FALSE FALSE
[5,] FALSE FALSE FALSE FALSE
[6,] FALSE FALSE FALSE FALSE

Thank you!

R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions