Question: Rcpp adding circular ranges to GRanges object in c++
0
gravatar for hauken_heyken
16 months ago by
hauken_heyken40 wrote:

Hey, I have the circular Ecoli genome, and I want to construct a GRanges object of all ORFs in the fasta file from ncbi.

 

I made a c++ function to do it, but of course since some of the orfs that starts just before the stop of the genome, and ends after the start, will make IRanges() constructor output error (negative widths not allowed), I want to something like in R where you can set the metacolumn of the GRangesobject to include isCircular() = vector(T,T,T,...),

Here is the sample from c++ and error:

 

#include <Rcpp.h>

Function GRangesC("GRanges", Environment::namespace_env("GenomicRanges"));
Function IRangesC("IRanges", Environment::namespace_env("IRanges"));


std::vector<int> ORFdef = orfs_as_vector(fastaSeq); // <- get all orfs from fasta

Seqnames.insert(Seqnames.end(), ORFdef.size() / 2, 1);
strands.insert(strands.end(),ORFdef.size() / 2,"+");

return(GRangesC(wrap(Seqnames),
                  IRangesC(wrap(result_value[0]),
                    wrap(result_value[1])),wrap(strands)));

Error in find_ORFs :
  Evaluation error: solving row 149014: negative widths are not allowed.
iranges granges rcpp circular • 313 views
ADD COMMENTlink written 16 months ago by hauken_heyken40

In more simple terms, what I am saying is:

How do you allow negative widths on IRanges ?

ADD REPLYlink written 15 months ago by hauken_heyken40
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 311 users visited in the last hour