don't get an output of wigtoRangedData's function HMMcopy Package for detect CNV
0
0
Entering edit mode
El • 0
@el-24188
Last seen 4.0 years ago

Enter the body of text here to illustrate, I have generated a script

Code should be placed in three backticks as shown below


wigToRangedData <- function(wigfile, verbose = TRUE) {
  if (verbose) { message(paste("Slurping:", wigfile)) }
  input <- readLines(readfile, warn = FALSE)
  breaks <- c(grep("fixedStep", input), length(input) + 1)
  temp <- NULL
  span <- NULL

  for (i in 1:(length(breaks) - 1)) {
    data_range <- (breaks[i] + 1):(breaks[i + 1] - 1)
    track_info <- input[breaks[i]]
    if (verbose) { message(paste("Parsing:", track_info)) }
    tokens <- strsplit(
      sub("fixedStep chrom=(\\S+) start=(\\d+) step=(\\d+) span=(\\d+)",
          "\\1 \\2 \\3 \\4", track_info, perl = TRUE), " ")[[1]]
    span <- as.integer(tokens[4])
    chr <- rep.int(tokens[1], length(data_range))
    pos <- seq(from = as.integer(tokens[2]), by = as.integer(tokens[3]),
               length.out = length(data_range))
    val <- as.numeric(input[data_range])
    temp <- c(temp, list(data.frame(chr, pos, val)))
  }
  if (verbose) { message("Sorting by decreasing chromosome size") }
  lengths <- as.integer(lapply(temp, nrow))
  temp <- temp[order(lengths, decreasing = TRUE)]
  temp = do.call("rbind", temp)
  output <- data.table(chr = temp$chr, start = temp$pos, end = temp$pos + span,
                       value = temp$val)
  return(output)
}


# Appeler une fonction
wigToRangedData("/Users/mac/Desktop/NGS-/ERR439247-pe.wig")

# Inspecter les resultas
head(output)



# include your problematic code here with any corresponding output 
# please also include the results of running the following in an R session 

sessionInfo( )

I get > wigToRangedData("/Users/mac/Desktop/NGS-/ERR439247-pe.wig") Slurping: /Users/mac/Desktop/NGS-/ERR439247-pe.wig Error in (breaks[i] + 1):(breaks[i + 1] - 1) : NA/NaN argument

HMMcopy DNAcopy • 759 views
ADD COMMENT

Login before adding your answer.

Traffic: 560 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6