[BioC] CharacerToFASTArecords

Hervé Pagès hpages at fhcrc.org
Tue Feb 19 20:59:18 CET 2013


Hi Murli,

On 02/15/2013 05:45 PM, Nair, Murlidharan T wrote:
> Hervé,
>
> I thought CharacterToFASTArecords() would convert it to the format when I read data using  read.fasta from bio3d package. Since I am getting the data after querying a database so I get it as a string. Is there a method that will covert it into an object returned by readDNAStringSet().

The object returned by readDNAStringSet() is DNAStringSet. So if your
question is "is there a method to convert the string I get from the
database into a DNAStringSet object?", then the answer is "yes, just
pass it to the DNAStringSet() constuctor".

Cheers,
H.

>
> Thanks ../Murli
>
>
> -----Original Message-----
> From: Hervé Pagès [mailto:hpages at fhcrc.org]
> Sent: Friday, February 15, 2013 6:47 PM
> To: Murli [guest]
> Cc: bioconductor at r-project.org; Nair, Murlidharan T
> Subject: Re: CharacerToFASTArecords
>
> Hi Murli,
>
> On 02/15/2013 11:22 AM, Murli [guest] wrote:
>> Hi,
>>
>> Is there any other method in Biostrings_2.26.3 that does what CharacterToFASTArecords does in Biostrings_2.16.9? Or do I need to install the old version and use the method from it?
>
> Here is how the function was defined:
>
>     CharacterToFASTArecords <- function(x)
>     {
>       if (!is.character(x))
>           stop("'x' must be a character vector")
>       lapply(seq_len(length(x)),
>              function(i) list(desc=names(x)[i], seq=x[[i]]))
>     }
>
> I would just put it in my script or package if I was you. Or even better, I would update my code to make use of the native DNAStringSet/AAStringSet functionalities. CharacterToFASTArecords() is from the old times when DNA (or AA) sequences were stored as an ordinary list after loading them with readFASTA() or before sending them to a file with writeFASTA(). This has been superseded by readDNAStringSet(), writeXStringSet(), etc... for at least 3 years and I cannot think of any good reason for storing sequences in an ordinary list in 2013.
>
> Cheers,
> H.
>
>>
>> Cheers../Murli
>>
>>
>>    -- output of sessionInfo():
>>
>>> sessionInfo()
>> R version 2.15.2 (2012-10-26)
>> Platform: x86_64-redhat-linux-gnu (64-bit)
>>
>> locale:
>>    [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>    [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>>    [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>>    [7] LC_PAPER=C                 LC_NAME=C
>>    [9] LC_ADDRESS=C               LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] Biostrings_2.26.3  IRanges_1.16.4     BiocGenerics_0.4.0
>>
>> loaded via a namespace (and not attached):
>> [1] parallel_2.15.2 stats4_2.15.2
>>
>> --
>> Sent via the guest posting facility at bioconductor.org.
>>
>
> --
> Hervé Pagès
>
> Program in Computational Biology
> Division of Public Health Sciences
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N, M1-B514
> P.O. Box 19024
> Seattle, WA 98109-1024
>
> E-mail: hpages at fhcrc.org
> Phone:  (206) 667-5791
> Fax:    (206) 667-1319
>

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioconductor mailing list