convert bed12 to sorted gtf
1
0
Entering edit mode
2.3 years ago
maria • 0

Hello I m trying to convert bed12 to sorted gtf but output file 'Precapture_uniq.gff' is empty i m very new for this work if you can help me to solve this i appreciate it.

awk -f bed12togff  Postcapture_uniq_chr.bed12 | sort -k1,1 -k4,4n -k5,5n "$@" > Precapture_uniq.gff

and my bed12togff is like that:

#! /bin/awk -f
# converts BED12 input into GFF

{
    split($11,sz,",");
    split($12,st,",");
    for(i=1; i<=$10; i++)
    {
        line[i]=$1"\thts\texon\t"($2+st[i]+1)"\t"($2+st[i]+sz[i])"\t.\t"$6"\t.\tgene_id \""$4"\"; transcri$
    }
    if(rev==""||rev==0)
    {
        for(i=1; i<=$10; i++)
        {
            print line[i];
        }
    }
    else
    {
        for(i=$10; i>=1; i--)
        {
            print line[i];
        }
    }
}
bed12 gtf gff awk • 949 views
ADD COMMENT
1
Entering edit mode

You might prefer to use existing tools like agat_convert_bed2gff.pl from AGAT

ADD REPLY
0
Entering edit mode
14 months ago
alejandrogzi ▴ 140

Hi! I there are this two tools that you could use:

bed2gtf, a GTF-to-BED converter written in Rust that overcomes the limitations of using C binaries.

gtfsort, a fast and efficient chr/pos/feature GTF sorter also in Rust that outperforms current tools by far (such as gff3sort, AGAT, GNU, etc)!

and recently bed2gff, that includes a sorting step, so the output .gff3 is naturally sorted (a similar approach used in gtfsort).

ADD COMMENT

Login before adding your answer.

Traffic: 2046 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6