exportFASTA not working
1
0
Entering edit mode
2.2 years ago

I am trying to use the biomart to extract genomic sequence based on the coordinate information and saving output in fasta format file. Here are few lines of code :

mart <- useMart("ensembl", dataset="hsapiens_gene_ensembl")

seq1 <- getSeq(x = hg38, names = chromosome, start =start, end =  end)
head(seq)
exportFASTA(seq1, file="test.fa")

With output:

**DNAStringSet object of length 6:
    width seq                                               names               
[1]  1043 GGGGCCGTAGACAAGCAATTAAA...TTAGGGGAGGGATCGGGGGAGGG chr12
[2]   450 CCCCCTTCCCTTCCCTCCCCACC...GGCTGGGCTCGGGCTGGTCGCCG chr2
[3]   665 AGCGGCGGGGGAGGGGAGGAGAC...CGCTGAGGAGACCAAGGACAAAG chr7
[4]   580 TAACCGGCCGCGGCCCGATGGCG...GGGATGTCCGCGAGGTCGGCCTA chr2
[5]   124 AAATCCGAGTTTCGCGGGAGGAC...ACCCGGGCTGCCGCCGCCGCCTC chr6
[6]   608 CAGCCCCACGTTACTTTGATTGA...TCACACACTTGTATATTATTTTG chr9**

Error :

  1. exportFASTA(seq1, file)
  2. stop("No data.frame given to write FASTA. The data.frame should be the output of the getSequence function.")

I would appreciate all the suggestion.

Thanks

exportFASTA biomart getSeq • 625 views
ADD COMMENT
0
Entering edit mode
2.2 years ago
ATpoint 85k

As the error tells you the function expects a data.frame. However, you can use Biostrings::writeXStringSet() to write a DNAStringset as fasta.

ADD COMMENT
0
Entering edit mode

With dataframe input, still gave error. But successfully saved fasta format sequence with writeXStringSet() options.

ADD REPLY

Login before adding your answer.

Traffic: 2375 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