write.dna command

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

write.dna command

Mogjib Salek
Hi all,

I am learning R by "doing". And this is my first post.

I want to use R: 1- to fetch a DNA sequence from a databank (see bellow)
and 2- store it as FASTA file.

The problem: neither an error is prompted nor the fasta file is created.
Testing the code (see bellow), I notice that everything works until
the *"write.dna"
*command - which is not creating the fasta file.

Here is my code:

####Get gene sequence from GenBank and store it as fasta file
####16 June 2017

#1- Set the working directory and make sure the right libraries are
installed
(make sure 'ape' and 'seqinr' packages are installed)

WD <- "~Documents/Scripting/R_Studio/Sequences/"
setwd <- (WD)

#2- Fetch a sequence ( bellow, "enter  manually the desired DNA ID") from
GenBank and store it as fasta file.

      DNAid <- "JF806202"

    # Store the sequence in lst (a list)
      lst <- read.GenBank(DNAid, as.character = T)

      # convert the sequence to fasta format
       write.dna (lst, file = "DNAseq.fasta", format = "fasta", append =
FALSE,
           nbcol= 6, colsep= " ", colw= 10)


Any help will be appreciated.
Thank you.

Kelas

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: write.dna command

Jeff Newmiller
I suspect you meant

WD <- "~/Documents/Scripting/R_Studio/Sequences/"

but I am entirely unfamiliar with the packages you are using, and know nothing about what is on your hard drive.

For future reference:

A) Read the Posting Guide.  This is a plain text email list, and your html formatting gets removed leaving a mess that is not always readable.

B) Most frequent users of R change their working directory to where their project files are before they start R. If you are using RStudio, the use of Projects will take care of this for you. Then you don't have to put in your whole working path in the script and you can copy/move your R and data files elsewhere without breaking everything.
--
Sent from my phone. Please excuse my brevity.

On June 17, 2017 7:26:42 AM PDT, Mogjib Salek <[hidden email]> wrote:

>Hi all,
>
>I am learning R by "doing". And this is my first post.
>
>I want to use R: 1- to fetch a DNA sequence from a databank (see
>bellow)
>and 2- store it as FASTA file.
>
>The problem: neither an error is prompted nor the fasta file is
>created.
>Testing the code (see bellow), I notice that everything works until
>the *"write.dna"
>*command - which is not creating the fasta file.
>
>Here is my code:
>
>####Get gene sequence from GenBank and store it as fasta file
>####16 June 2017
>
>#1- Set the working directory and make sure the right libraries are
>installed
>(make sure 'ape' and 'seqinr' packages are installed)
>
>WD <- "~Documents/Scripting/R_Studio/Sequences/"
>setwd <- (WD)
>
>#2- Fetch a sequence ( bellow, "enter  manually the desired DNA ID")
>from
>GenBank and store it as fasta file.
>
>      DNAid <- "JF806202"
>
>    # Store the sequence in lst (a list)
>      lst <- read.GenBank(DNAid, as.character = T)
>
>      # convert the sequence to fasta format
>      write.dna (lst, file = "DNAseq.fasta", format = "fasta", append =
>FALSE,
>           nbcol= 6, colsep= " ", colw= 10)
>
>
>Any help will be appreciated.
>Thank you.
>
>Kelas
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: write.dna command

R help mailing list-2
We'll need more information on the packages you're using. Can you post the
output of:

> sessionInfo()

Finally, is this a Bioconductor question? They have their own support site:

https://support.bioconductor.org

HTH,

William Michels, Ph.D.


On Sat, Jun 17, 2017 at 11:05 AM, Jeff Newmiller <[hidden email]>
wrote:

> I suspect you meant
>
> WD <- "~/Documents/Scripting/R_Studio/Sequences/"
>
> but I am entirely unfamiliar with the packages you are using, and know
> nothing about what is on your hard drive.
>
> For future reference:
>
> A) Read the Posting Guide.  This is a plain text email list, and your html
> formatting gets removed leaving a mess that is not always readable.
>
> B) Most frequent users of R change their working directory to where their
> project files are before they start R. If you are using RStudio, the use of
> Projects will take care of this for you. Then you don't have to put in your
> whole working path in the script and you can copy/move your R and data
> files elsewhere without breaking everything.
> --
> Sent from my phone. Please excuse my brevity.
>
> On June 17, 2017 7:26:42 AM PDT, Mogjib Salek <[hidden email]> wrote:
> >Hi all,
> >
> >I am learning R by "doing". And this is my first post.
> >
> >I want to use R: 1- to fetch a DNA sequence from a databank (see
> >bellow)
> >and 2- store it as FASTA file.
> >
> >The problem: neither an error is prompted nor the fasta file is
> >created.
> >Testing the code (see bellow), I notice that everything works until
> >the *"write.dna"
> >*command - which is not creating the fasta file.
> >
> >Here is my code:
> >
> >####Get gene sequence from GenBank and store it as fasta file
> >####16 June 2017
> >
> >#1- Set the working directory and make sure the right libraries are
> >installed
> >(make sure 'ape' and 'seqinr' packages are installed)
> >
> >WD <- "~Documents/Scripting/R_Studio/Sequences/"
> >setwd <- (WD)
> >
> >#2- Fetch a sequence ( bellow, "enter  manually the desired DNA ID")
> >from
> >GenBank and store it as fasta file.
> >
> >      DNAid <- "JF806202"
> >
> >    # Store the sequence in lst (a list)
> >      lst <- read.GenBank(DNAid, as.character = T)
> >
> >      # convert the sequence to fasta format
> >      write.dna (lst, file = "DNAseq.fasta", format = "fasta", append =
> >FALSE,
> >           nbcol= 6, colsep= " ", colw= 10)
> >
> >
> >Any help will be appreciated.
> >Thank you.
> >
> >Kelas
> >
> >       [[alternative HTML version deleted]]
> >
> >______________________________________________
> >[hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide
> >http://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: write.dna command

R help mailing list-2
In reply to this post by Mogjib Salek
Hi Mogjib,

Does the following solve your issue?

> setwd(WD)



On Sat, Jun 17, 2017 at 7:26 AM, Mogjib Salek <[hidden email]> wrote:

> Hi all,
>
> I am learning R by "doing". And this is my first post.
>
> I want to use R: 1- to fetch a DNA sequence from a databank (see bellow)
> and 2- store it as FASTA file.
>
> The problem: neither an error is prompted nor the fasta file is created.
> Testing the code (see bellow), I notice that everything works until
> the *"write.dna"
> *command - which is not creating the fasta file.
>
> Here is my code:
>
> ####Get gene sequence from GenBank and store it as fasta file
> ####16 June 2017
>
> #1- Set the working directory and make sure the right libraries are
> installed
> (make sure 'ape' and 'seqinr' packages are installed)
>
> WD <- "~Documents/Scripting/R_Studio/Sequences/"
> setwd <- (WD)
>
> #2- Fetch a sequence ( bellow, "enter  manually the desired DNA ID") from
> GenBank and store it as fasta file.
>
>       DNAid <- "JF806202"
>
>     # Store the sequence in lst (a list)
>       lst <- read.GenBank(DNAid, as.character = T)
>
>       # convert the sequence to fasta format
>        write.dna (lst, file = "DNAseq.fasta", format = "fasta", append =
> FALSE,
>            nbcol= 6, colsep= " ", colw= 10)
>
>
> Any help will be appreciated.
> Thank you.
>
> Kelas
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Loading...