gtf需要sort不?
需要特定工具转是因为gtf的起始坐标为1
bed的起始坐标为0
【1】sort的话:用igv的sort功能
conda install igvtools
igvtools sort [options] [inputFile] [outputFile]
-m maxRecords The maximum number of records to keep in memory during the sort. The default value is 500000
【2】转:
gtf2bed < gene.sorted.gtf | head
遇到error:(maybe ensembl)
改为:
awk '{ if ($0 ~ "transcript_id") print $0; else print $0" transcript_id \"\";"; }' Homo_sapiens.GRCh38.94.chr_patch_hapl_scaff.sorted.gtf | gtf2bed | head
gtf2bed < gene.sorted.gtf > gene.bed
gtf2bed < gene.sorted.gtf | awk 'BEGIN{FS="\t";OFS="\t"}{print $1,$2,$3,$4,$5,$6}' > gene_6.bed
gtf2bed < gene.sorted.gtf | awk 'BEGIN{FS="\t| |;";OFS="\t"}{print $1,$2,$3,$23,$5,$6}' > gene_6.bed