This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get TSS information from GFF3 file depending on strand

Hello everyone,

I would like to extract my gene's TSS information from my gff3 file, depending on the strand they are on. I would like to do so in order to plot chip-seq peaks occupancy near TSS with deeptools computeMatrix reference-point.

These are the first lines of my gff and basically I extracted the information of colum 4 or 5 depending on the + or - strand and created a new file. Of course when I did that it did not respect the gff format anymore and computeMatrix did not accept it. Do you have any simple way of making this work?

    ##gff-version 3
chrI    Li et al. 2017 (maj TFW mars 2018)  Gene    7295    16807   .   +   .   ID=TrA0001W
chrI    Li et al. 2017 (maj TFW mars 2018)  Gene    17180   19774   .   -   .   ID=TrA0002C
chrI    Li et al. 2017 (maj TFW mars 2018)  Gene    20663   21727   .   +   .   ID=TrA0003W
chrI    Li et al. 2017 (maj TFW mars 2018)  Gene    22342   23250   .   +   .   ID=TrA0004W
chrI    Li et al. 2017 (maj TFW mars 2018)  Gene    23673   24498   .   +   .   ID=TrA0005W
chrI    Li et al. 2017 (maj TFW mars 2018)  Gene    25499   26482   .   +   .   ID=TrA0006W
chrI    Li et al. 2017 (maj TFW mars 2018)  Gene    27933   28859   .   +   .   ID=TrA0007W
chrI    Li et al. 2017 (maj TFW mars 2018)  Gene    30438   31469   .   +   .   ID=TrA0008W
chrI    Li et al. 2017 (maj TFW mars 2018)  Gene    32807   33574   .   +   .   ID=TrA0009W
chrI    Li et al. 2017 (maj TFW mars 2018)  Gene    33924   35719   .   -   .   ID=TrA0010C
chrI    Li et al. 2017 (maj TFW mars 2018)  Gene    36766   38443   .   -   .   ID=TrA0011C

Thank you for your help!

tss gff

1 answer

You could try

grep -i "+" input.gff3 > output.positive.gff3

and

grep -i "-" input.gff3 > output.negative.gff3

This probably will work better

awk '$7 == "+"' input.gff3 | awk '{print $4, $5}' > output.positive.gff3

awk '$7 == "-"' input.gff3 | awk '{print $4, $5}' > output.negative.gff3

Thank you for your answer! I tried to extract the information like that but then computeMatrix did not accept my file. I guess I just need guidance on what structure my file must have and how I should get it in instance for me to give to computeMatrix.

Log in to answer this question.