Question: Converting from BED to SAF/GFF
0
gravatar for ccag
2.9 years ago by
ccag30
Boston, MA
ccag30 wrote:

I called peaks using MACS2 and now would like to use my narrowPeak file to do featureCounts. As far as I can tell, featureCOunts only uses SAF or GFF formats. Does anyone know an easy way to convert between a bed and these file types for Dm3?

featurecount gff bed saf • 3.7k views
ADD COMMENTlink modified 17 months ago by ATpoint26k • written 2.9 years ago by ccag30
1
gravatar for ATpoint
17 months ago by
ATpoint26k
Germany
ATpoint26k wrote:
awk 'OFS="\t" {print $1"."$2+1"."$3, $1, $2+1, $3, "."}' in.narrowPeak > out.saf

The +1 on $2 because narrowPeak is 0-based, but SAF is 1-based. $1 is the GeneID, I typically use a simple concat of the genomic coordinates, and $5 is just "." because MACS peaks are not strand-specific.

ADD COMMENTlink modified 17 months ago • written 17 months ago by ATpoint26k

Thanks for the code.

According to the manual of Rsubread. The SAF file should also include a header line, otherwise featureCounts would terminate with the error "ERROR: no features were loaded in format SAF.".

awk 'BEGIN{FS=OFS="\t"; print "GeneID\tChr\tStart\tEnd\tStrand"}{print $4, $1, $2+1, $3, "."}' ${sample}_peaks.narrowPeak > ${sample}_peaks.saf
ADD REPLYlink written 8 months ago by niuyw30
0
gravatar for Jeffin Rockey
2.9 years ago by
Jeffin Rockey1.1k
Karimannoor
Jeffin Rockey1.1k wrote:

Option 1 :GenomeTools

Option 2: Go to galaxy oqtans page here and on the left pane there is "GFF Toolkit" which has BED_to_GFF3 converter .

Option 3: A long route. From here make use of bedToGenePred followed by genePredToGtf to get a gtf file at first. Then you can make use of the lot of tools that does a gtf to gff3 conversion.

I am mentioning multiple options because depending on whether you bed file is 6 column or 12 column or so, some may not be applicable.

ADD COMMENTlink modified 2.9 years ago • written 2.9 years ago by Jeffin Rockey1.1k
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: 1301 users visited in the last hour