Getfasta with split and strand option shows error.

488 views
Skip to first unread message

das...@gmail.com

unread,
Sep 19, 2014, 12:07:21 PM9/19/14
to bedtools...@googlegroups.com
I derived a bed12 formatted file from a gff file as needed for the getfasta -split option with blocks.  Where the gff file had the cds feature on the '-' strand, the Start was greater than End.  This got carried forward to the bed12 file with -ve values in the block start column (last col).    When running getfasta, it gives me, "Error: malformed BED entry at line 2. Start was greater than end. Exiting".

What do I do next?  Do I need to swap the start and end cols, then how do I handle the strand information?  I am a bit confused how to proceed to the next step.  Need help. 

Sudhansu Dash

$ bedtools getfasta -name -s -split -fi data/aradu.A01.80col.fa  -bed test.bed12.bed -fo output-test.fa
Error: malformed BED entry at line 2. Start was greater than end. Exiting.



less test.bed12.bed
Aradu.A01       17735939        17738558        Aradu.B2QWP.1   0       +       0       0       0       5       578,29,567,100,1        0,1071,1297,2387,2619
Aradu.A01       17732533        17732132        Aradu.CQ8LU.1   0       -       0       0       0       3       54,175,161      0,-256,-561
Aradu.A01       12796408        12793295        Aradu.AA2QE.1   0       -       0       0       0       12      54,96,69,42,146,49,96,100,206,78,126,243        0,-414,-588,-965,-1201,-1464,-1652,-1951,-2210,-2461,-2780,-3355
Aradu.A01       29826   30182   Aradu.20JM2.1   0       +       0       0       0       2       298,38  0,319
Aradu.A01       68326   64034   Aradu.DSK8P.1   0       -       0       0       0       10      102,115,80,76,65,63,82,160,69,688       0,-332,-492,-1551,-1699,-1849,-3233,-3468,-4084,-4979
Aradu.A01       6001120 6000464 Aradu.0AD0I.1   0       -       0       0       0       2       174,1029        0,-1684
Aradu.A01       6062762 6061116 Aradu.Z3YP0.1   0       -       0       0       0       3       42,312,198      0,-1396,-1843
Aradu.A01       17102382        17103448        Aradu.78U9P.1   0       +       0       0       0       4       112,77,102,120  0,599,800,947
Aradu.A01       20494873        20495185        Aradu.UXK5V.1   0       +       0       0       0       2       147,72  0,241
Aradu.A01       14328562        14325384        Aradu.RG31X.1   0       -       0       0       0       9       401,26,31,34,146,45,89,176,219  0,-173,-444,-636,-910,-1056,-1254,-1743,-3396
Aradu.A01       17913108        17912231        Aradu.99SFJ.1   0       -       0       0       0       2       81,618  0,-1494
Aradu.A01       17292832        17297904        Aradu.UU2AI.1   0       +       0       0       0       12      33,183,84,69,138,117,70,105,128,108,108,372     0,831,1155,2031,2623,2956,3147,3374,3723,3923,4137,4701
Aradu.A01       13368143        13366833        Aradu.HQ5ZD.1   0       -       0       0       0       5       85,82,10,95,79  0,-92,-605,-936,-1388
Aradu.A01       13343690        13343222        Aradu.FZ5QH.1   0       -       0       0       0       4       166,193,40,348  0,-350,-397,-815
Aradu.A01       13342378        13342346        Aradu.G38P4.1   0       -       0       0       0       2       153,51  0,-82
Aradu.A01       13074819        13070314        Aradu.45QUK.1   0       -       0       0       0       16      512,163,75,101,116,212,92,115,104,46,65,87,55,89,85,81  0,-559,-746,-941,-1151,-1644,-2008,-2268,-2471,-2772,-2963,-3149,-3530,-3704,-3875,-4585
Aradu.A01       13065113        13064888        Aradu.VZI74.1   0       -       0       0       0       3       61,123,77       0,-169,-301
Aradu.A01       21181608        21186334        Aradu.I6C6R.1   0       +       0       0       0       3       2,229,63        0,3835,4664
Aradu.A01       21223749        21225383        Aradu.Z0LGY.1   0       +       0       0       0       2       440,979 0,656
Aradu.A01       21194658        21196697        Aradu.C3MP1.1   0       +       0       0       0       9       6,43,242,57,42,72,180,108,135   0,265,735,1155,1257,1403,1484,1752,1905
Aradu.A01       15035262        15038144        Aradu.8KW68.1   0       +       0       0       0       4       472,236,141,264 0,1609,1919,2619

Aaron Quinlan

unread,
Sep 19, 2014, 12:20:18 PM9/19/14
to bedtools...@googlegroups.com
Yes, you need to swap your coordinates in the case of "-" stand records.  BED format always maintains start < end, regardless of strand.

Use:

awk '{if ($6=="-") {tmp=$2; $2=$3; $3=tmp;} print $0}' test.bed12.bed > test.bed12.swapped.bed

--
You received this message because you are subscribed to the Google Groups "bedtools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bedtools-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages