Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用R中的for循环查找重叠区域_R_Bioinformatics_Genome - Fatal编程技术网

使用R中的for循环查找重叠区域

使用R中的for循环查找重叠区域,r,bioinformatics,genome,R,Bioinformatics,Genome,我正在寻找并返回人类基因组注释文件中与R中给定基因组区域重叠的元素,但它必须是一个for循环 到目前为止,这是我拥有的代码,但我不确定它是否正确,因为我不确定要返回的确切内容,并且它不断给我错误。感谢您的帮助: genome <- "gencode.v31.annotation.gff3.gz" cat("Loading", genome, "at", date()) genomeTable <- read.table(genome, header = F, sep = "

我正在寻找并返回人类基因组注释文件中与R中给定基因组区域重叠的元素,但它必须是一个for循环

到目前为止,这是我拥有的代码,但我不确定它是否正确,因为我不确定要返回的确切内容,并且它不断给我错误。感谢您的帮助:

 genome <- "gencode.v31.annotation.gff3.gz"
 cat("Loading", genome, "at", date())


 genomeTable <- read.table(genome, header = F, sep = "\t", nrows = 1000)

 colnames(genomeTable) <- c("seqid", "source", "type", "start", "end", 
 "score", "strand", "phase", "attributes")

chr = 10
q.start = 10000
q.end = 20000

for(i in genomeTable){

  if (i < q.start) {

   return FALSE
  }

  if (i > q.end){
   return FALSE
  } else {
    return TRUE
  }

} #END FOR LOOP

genome请提供一个可复制的示例如果我理解正确,您应该使用
intersect
函数和/或其他set操作。为什么您坚持使用for循环?有许多更好/更快/更通用的功能可以轻松超越for-loop。嗨!我必须为一个类分配找到具有许多不同函数的重叠区域,for循环就是其中之一。