Question: Counting number of TE in a file
0
gravatar for yasjas
4.4 years ago by
yasjas70
United Kingdom
yasjas70 wrote:

hello everyone,

I am totally new in this field,I would like to count the number of  for example "LINE" in my file that I copied it below(a piece of it).does anyone know how to extract only those elements and make a count ?

thank you for your answers

           V1        V2        V3    V4            V5                 V6                V7
1      chr1    764865    765015  chr1    764975    765444           LINE
2      chr1    766165    766315  chr1    765813    766227           LINE
3      chr1    766165    766315  chr1    766266    766404           LINE
4      chr1    806905    807055  chr1    806805    807172           LINE
5      chr1    811805    811955  chr1    811640    811814  Simple_repeat
6      chr1    823425    823575  chr1    823465    823644           LINE
7      chr1    824725    824875  chr1    824336    824727            LTR
8      chr1    825805    825955  chr1    825766    825837           SINE
9      chr1    859125    859275  chr1    859231    859271 Low_complexity
10     chr1    860605    860755  chr1    860707    860770 Low_complexity
11     chr1    875645    875795  chr1    875614    875647 Low_complexity
12     chr1    875645    875795  chr1    875663    875709 Low_complexity
13     chr1    894005    894155  chr1    893930    894175           LINE
14     chr1    894585    894735  chr1    894684    894732  Simple_repeat
15     chr1    902325    902475  chr1    902408    902434 Low_complexity
16     chr1    911265    911415  chr1    911296    911338  Simple_repeat
17     chr1    934465    934615  chr1    934466    934512 Low_complexity
18     chr1    938725    938875  chr1    938758    938805            LTR
19     chr1    940705    940855  chr1    940826    940987            LTR
20     chr1    944465    944615  chr1    944204    944490           SINE
21     chr1    944465    944615  chr1    944492    944625            LTR
 

R • 1.1k views
ADD COMMENTlink modified 4.3 years ago by tszn198490 • written 4.4 years ago by yasjas70
0
gravatar for TriS
4.4 years ago by
TriS3.9k
United States, Buffalo
TriS3.9k wrote:

in R you can do it like this

m <- read.table("yourFile.txt")

sum(m$V7 == "LINE")
ADD COMMENTlink written 4.4 years ago by TriS3.9k
0
gravatar for yasjas
4.4 years ago by
yasjas70
United Kingdom
yasjas70 wrote:

Thank you for your answer TriS it was really helpful :-)

ADD COMMENTlink written 4.4 years ago by yasjas70
0
gravatar for tszn1984
4.3 years ago by
tszn198490
United States
tszn198490 wrote:

In Linux:

>grep LINE filename |wc -l

 

ADD COMMENTlink written 4.3 years ago by tszn198490

slight change: grep -cw "LINE" filename :)

ADD REPLYlink written 4.3 years ago by Prakki Rama2.3k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1579 users visited in the last hour