Entering edit mode
2.2 years ago
Omics data mining
▴
260
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 :
- exportFASTA(seq1, file)
- 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
With dataframe input, still gave error. But successfully saved fasta format sequence with writeXStringSet() options.