[BioC] Error with unique

Erik Wright eswright at wisc.edu
Tue Apr 6 16:46:46 CEST 2010


Thanks Martin,

Adding import(IRanges) to my package's NAMESPACE file fixed the problem.

- Erik


On Apr 6, 2010, at 8:26 AM, Martin Morgan wrote:

> On 04/06/2010 06:17 AM, Martin Morgan wrote:
>> On 04/06/2010 04:37 AM, Erik Wright wrote:
>>> Hi Martin,
>>> 
>>> In Writing R Extensions it says that "the import directive imports
>>> all exported variables from the specified package(s).":
>>> 
>>> http://cran.r-project.org/doc/manuals/R-exts.html#Specifying-imports-and-exports
>>> 
>>> Since my NAMESPACE file already says import(Biostrings), do I also
>>> need to use importFrom(Biostrings, x, y, z) for each x, y, z function
>>> I want to use?
>> 
>> import() is sufficient. IMHO import() defeats the developer-side purpose
>> of carefully controlling what functions the package sees.
> 
> maybe connecting the dots a little with your other email. Perhaps you
> are missing importFrom(IRanges, unique)? Martin
> 
>>> 
>>> Also, where do I get the username/password that I need to access
>>> svn?
>> 
>> username: readonly
>> password: readonly
>> 
>> (they're on the wiki page, but made more prominent now).
>> 
>> Martin
>>> 
>>> Authentication realm: <https://hedgehog.fhcrc.org:443> The
>>> bioconductor Subversion Repository Password for 'me': Authentication
>>> realm: <https://hedgehog.fhcrc.org:443> The bioconductor Subversion
>>> Repository Username: svn: OPTIONS of
>>> 'https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/codetoolsBioC':
>>> authorization failed: Could not authenticate to server: rejected
>>> Basic challenge (https://hedgehog.fhcrc.org)
>>> 
>>> Thanks!, Erik
>>> 
>>> 
>>> On Apr 5, 2010, at 10:01 PM, Martin Morgan wrote:
>>> 
>>>> On 04/05/2010 07:23 PM, Erik Wright wrote:
>>>>> Hi Sean,
>>>>> 
>>>>> Here is a simple function that creates the problem: doUnique <-
>>>>> function(myDNAStringSet) { myDNAStringSet <-
>>>>> unique(myDNAStringSet) }
>>>>> 
>>>>> Here is the output in the R Console:
>>>>>> doUnique(myDNAStringSet)
>>>>> Error in unique.default(myDNAStringSet) : unique() applies only
>>>>> to vectors
>>>> 
>>>> Likely it is a NAMESPACE issue. Either doUnique is defined in 
>>>> GoneFISHing but the NAMESPACE of GoneFISHing does not have
>>>> 
>>>> importFrom(Biostrings, unique)
>>>> 
>>>> or GoneFISHing defines and/or exports its own unique that masks the
>>>> one exported by  Biostrings. If these were packages written by
>>>> people who didn't talk with one another then you could specify
>>>> 
>>>> Biostrings::unique(myDNAStringSet)
>>>> 
>>>> but likely the solution is to develop an appropriate NAMESPACE in 
>>>> GoneFISHing. The codetoolsBioC package at
>>>> 
>>>> https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/codetoolsBioC
>>>> 
>>>> 
>>>> 
>> accessible using svn, see
>>>> 
>>>> http://wiki.fhcrc.org/bioc/SvnHowTo
>>>> 
>>>> might be helpful.
>>>> 
>>>> Martin
>>>> 
>>>>>> sessionInfo()
>>>>> R version 2.10.1 (2009-12-14) i386-apple-darwin9.8.0
>>>>> 
>>>>> locale: [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>>>>> 
>>>>> attached base packages: [1] stats     graphics  grDevices utils
>>>>> datasets  methods [7] base
>>>>> 
>>>>> other attached packages: [1] GoneFISHing_1.0.5  RSQLite_0.8-3
>>>>> DBI_0.2-5 [4] Biostrings_2.14.12 IRanges_1.4.11
>>>>> 
>>>>> loaded via a namespace (and not attached): [1] Biobase_2.6.1
>>>>> 
>>>>> Thanks again!, Erik
>>>>> 
>>>>> 
>>>>> On Apr 5, 2010, at 8:55 PM, Sean Davis wrote:
>>>>> 
>>>>>> On Mon, Apr 5, 2010 at 9:51 PM, Erik Wright <eswright at wisc.edu>
>>>>>> wrote:
>>>>>>> Hi all,
>>>>>>> 
>>>>>>> I am using the unique(x) function with a DNAStringSet in one
>>>>>>> of my own functions.  Recently my function has started
>>>>>>> returning an error, and I am not sure what changed.  The same
>>>>>>> line of code works fine in the R Console, just not in my
>>>>>>> function.  I am using the function as:
>>>>>>> 
>>>>>>> myDNAStringSet <- unique(myDNAStringSet)
>>>>>>> 
>>>>>>> When I run my function the error returned is:
>>>>>>> 
>>>>>>> Error in unique.default(myDNAStringSet) : unique() applies
>>>>>>> only to vectors
>>>>>>> 
>>>>>>> I am guessing that the R is trying to apply the unique
>>>>>>> function in the base package to the DNAStringSet rather than
>>>>>>> using the unique function in the Biostrings package.  Is
>>>>>>> there a solution to this?
>>>>>>> 
>>>>>> 
>>>>>> Hi, Erik.  A reproducible example and sessionInfo() would be
>>>>>> helpful.
>>>>>> 
>>>>>> Sean
>>>>> 
>>>>> _______________________________________________ Bioconductor
>>>>> mailing list Bioconductor at stat.math.ethz.ch 
>>>>> https://stat.ethz.ch/mailman/listinfo/bioconductor Search the
>>>>> archives:
>>>>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>>> 
>>>> 
>>>> 
>>>>> 
> 
> 
> -- 
> Martin Morgan
> Computational Biology / Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N.
> PO Box 19024 Seattle, WA 98109
> 
> Location: Arnold Building M1 B861
> Phone: (206) 667-2793



More information about the Bioconductor mailing list