i have a fasta file of nucleic acid sequences with sequences beginning like
>YHR055C cdna:known chromosome:EF4:VIII:214533:214718:-1 gene:YHR055C gene_biotype:protein_coding transcript_biotype:protein_coding
ATGTTCAGCGAATTAATTAACTTCCAAAATGAAGGTCATGAGTGCCAATGCCAATGTGGT
AGCTGCAAAAATAATGAACAATGCCAAAAATCATGTAGCTGCCCAACGGGGTGTAACAGC
GACGACAAATGCCCCTGCGGTAACAAGTCTGAAGAAACCAAGAAGTCATGCTGCTCTGGG
AAATGA
but the command in R
read.fasta(file = system.file("x.fa", package = "seqinr"),
+ seqtype = "DNA", as.string = FALSE, forceDNAtolower = TRUE,
+ set.attributes = TRUE, legacy.mode = TRUE, seqonly = FALSE, strip.desc = FALSE)
Error in read.fasta(file = system.file("x.fa", package = "seqinr"), :
no line starting with a > character found
In addition: Warning message:
In file(con, "r") :
file("") only supports open = "w+" and open = "w+b": using the former
i have tried with many other files in my pc where DNA or amino acid sequences are there. but it cannot find the ">" character.
please help
2 answers
Part of your problem is that you have copy-pasted the read.fasta() command from somewhere, without understanding what it does.
The part which reads:
file = system.file("x.fa", package = "seqinr")
is looking for a file named ""x.fa" distributed with the seqinr package. There is no such file, so the command fails - admittedly, with a rather confusing error message.
If you have saved your own fasta file and called it "x.fa", then all you need is:
read.fasta("x.fa")
Assuming that the file is in the directory from which you are running R.
I think you need to take some time to learn the basics of R and in particular, how to interpret the contents of command help pages.
Your command call is wrong, possibly, dont use 'system.file'. Simply set your file like 'file = x.fa' and try again.
Log in to answer this question.
Edited to make question readable. Please format code and sequences by indenting lines with 4 spaces in future.
Also, as seen in the answers below, question title is misleading. Problem is nothing to do with seqinr not recognising ">" - it's that it can't find the file.