Seqinr Cannot Recognize ">" Character In File
2
3
Entering edit mode
13.3 years ago
Partha ▴ 30

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

fasta • 8.3k views
ADD COMMENT
0
Entering edit mode

Edited to make question readable. Please format code and sequences by indenting lines with 4 spaces in future.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
9
Entering edit mode
13.3 years ago
Neilfws 49k

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.

ADD COMMENT
0
Entering edit mode
13.3 years ago
Michael 56k

Your command call is wrong, possibly, dont use 'system.file'. Simply set your file like 'file = x.fa' and try again.

ADD COMMENT

Login before adding your answer.

Traffic: 1542 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6