SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Splitting fastq file by barcodes without producing unmatched.fq file? a.cardilini Bioinformatics 5 06-26-2014 02:03 PM
splitting the .sra file mimakaev Bioinformatics 0 11-13-2013 04:31 PM
Splitting FASTA files aw90 Bioinformatics 1 07-16-2013 04:28 AM
Splitting fasta AND quality on masked sequence mucku Bioinformatics 3 12-15-2010 11:53 AM

Reply
 
Thread Tools
Old 02-24-2015, 02:46 AM   #1
dena.dinesh
Member
 
Location: Europe

Join Date: Feb 2013
Posts: 58
Default Splitting the fasta file into 2 columns

Hi,

I have read the fasta file using "read.fasta" from "seqinr" pacakge. The file like like as follows:

Code:
>dg_TM_254_2_1
MASDHAGUWHJAHSHHGAZAGHSGBAHSHGASHJAJAWWQWDSDASJDHKHASK
ASDASDGASJGZDSGDDHASDHASGD
>dg_TM_656_2_1
MJIAKJIEQWIHAASDASJDHASHDKJASDWQOWIOQIWQLAJLSJWIOQUZZEWASD
>dg_TM_543_1_2
MUZTREQWERNBVXCYMNMVHZTOPOPOEURDASDOPOQWEUZQUIZRZIRIEIWUEWASDHASHDAHSDHAKHHSDHASHDJASHDAHUWIEUROWUOERUOWEUROOWWWW
>dg_TM_212_0_2
MQWUEGSPOZBYCVDVRFTEVWBVRVRVVSDSZTTASDZUZUZUZUADUS
I would like split the file into the names of the sequence in one column and the corresponding the sequence in another column. I tried like creating data.frame and adding names of fasta_sequences in column and the corresponding sequences in another column, but it failed in R

Can anyone please guide me.

Thanks in advance
dena.dinesh is offline   Reply With Quote
Old 02-24-2015, 03:27 AM   #2
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,480
Default

Assuming the output of read.fasta() is an object "f"
Code:
data.frame(Fragments=names(f), Seqs=unlist(getSequence(f, as.string=T)))
dpryan is offline   Reply With Quote
Old 02-24-2015, 03:51 AM   #3
dena.dinesh
Member
 
Location: Europe

Join Date: Feb 2013
Posts: 58
Default

Quote:
Originally Posted by dpryan View Post
Assuming the output of read.fasta() is an object "f"
Code:
data.frame(Fragments=names(f), Seqs=unlist(getSequence(f, as.string=T)))
Thanks Ryan..It worked.
dena.dinesh is offline   Reply With Quote
Reply

Tags
dataframe, fasta, r programming

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 07:37 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO