SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Python counting bases fasta file illinu Bioinformatics 9 08-22-2013 08:17 AM
counting tags in bam file james4545 Bioinformatics 2 01-10-2013 08:03 AM
VarScan shift in counting of bases! AlbertZANG Bioinformatics 0 06-18-2012 10:29 AM
Counting coverage bases batsal Bioinformatics 0 02-17-2012 10:46 AM
Counting mapped nucleotides in a bam file moriah Bioinformatics 7 08-22-2011 01:30 AM

Reply
 
Thread Tools
Old 11-25-2013, 05:29 PM   #1
morning latte
Member
 
Location: MI

Join Date: Jun 2013
Posts: 91
Default counting total bases in a fasta file

Hello,

I have a fasta file like below.

>NODE_1476_length_303_cov_5.280528
TTAAGTGGGATTTCGTTTAGTGAGGTAGGTACTTTTACTTGGATTTCCATAATTGTATAAG
TCTTTTAGTCGTTTTTGTATTCCTTAGCCAATACATAAGAGTAGGCTTGAGCTAACATTTGA......
>NODE_2306_length_339_cov_2.926254
.
.
.

I want to get total base-pair count from this file. I tried fastx toolkit but it did not work as my fasta format is not what fastx wants (guess fastx wants one line of sequences while mine has two lines of sequences). Could somebody suggest any tool or command for it? Thanks.
morning latte is offline   Reply With Quote
Old 11-25-2013, 11:36 PM   #2
martinghunt
Junior Member
 
Location: Cambridge

Join Date: Jul 2013
Posts: 5
Default

Here's a quick unix hack:
grep -v ">" file.fasta | wc | awk '{print $3-$1}'
martinghunt is offline   Reply With Quote
Old 11-26-2013, 10:23 AM   #3
morning latte
Member
 
Location: MI

Join Date: Jun 2013
Posts: 91
Default

Thanks, it works very well.
morning latte is offline   Reply With Quote
Old 09-23-2016, 05:16 AM   #4
na_sd
Junior Member
 
Location: USA

Join Date: Nov 2015
Posts: 3
Default

The number of contigs

I am given a fasta file like this file that you can download it. This file is de novo assembled genome.

I have two very simple questions:

1- How many contigs are present in this file? (my guess: it is equal to the number of rows in the file?!)

2- what is the total genomic length of the assembly?
(my guess: it is 'len=245876' which has been written in the first line)

I am new in DNA sequence analysis stuff, thanks for your kind help.
na_sd is offline   Reply With Quote
Old 09-23-2016, 05:31 AM   #5
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 6,885
Default

Quote:
Originally Posted by na_sd View Post
The number of contigs

I am given a fasta file like this file that you can download it. This file is de novo assembled genome.

I have two very simple questions:

1- How many contigs are present in this file? (my guess: it is equal to the number of rows in the file?!)
@Brian and I had answered some of these questions in your Biostars post but looks like you are not convinced. The answers are still going to be the same.

If you do
Code:
grep -c "^>" your_file
that will give you a number for the contigs present in your file.
Quote:
2- what is the total genomic length of the assembly?
(my guess: it is 'len=245876' which has been written in the first line)

I am new in DNA sequence analysis stuff, thanks for your kind help.
That may just be the length of first contig. Does each of your contigs have such a number? We don't know if the contigs you have overlap so it may not be possible to answer this question directly.

PS: I am not going to download the file from dropbox to test.
GenoMax is offline   Reply With Quote
Old 09-23-2016, 05:36 AM   #6
na_sd
Junior Member
 
Location: USA

Join Date: Nov 2015
Posts: 3
Default

Quote:
Originally Posted by GenoMax View Post
@Brian and I had answered some of these questions in your Biostars post but looks like you are not convinced. The answers are still going to be the same.

If you do
Code:
grep -c "^>" your_file
that will give you a number for the contigs present in your file.


That may just be the length of first contig. Does each of your contigs have such a number? We don't know if the contigs you have overlap so it may not be possible to answer this question directly.

PS: I am not going to download the file from dropbox to test.

Thanks.
I am not convinced because my file is not like general fasta file. It has ONLY one line with '>'. The person has asked me about the number of contigs in this file and I am sure that it is greater than 1.
I wish you had downloaded the file and then answered my question.
na_sd is offline   Reply With Quote
Old 09-23-2016, 05:58 AM   #7
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 6,885
Default

Quote:
Originally Posted by na_sd View Post
Thanks.
I am not convinced because my file is not like general fasta file. It has ONLY one line with '>'. The person has asked me about the number of contigs in this file and I am sure that it is greater than 1.
I wish you had downloaded the file and then answered my question.
If there is only one line starting with ">" in your file then

a> Your file is either incomplete or
b> the sequence got assembled as a single contig

note: You appear to have removed the file from dropbox.

Last edited by GenoMax; 09-23-2016 at 06:23 AM.
GenoMax is offline   Reply With Quote
Reply

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 08:39 PM.


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