Entering edit mode
3.4 years ago
Biologist
▴
290
I have gtf file that starts like below:
GL000008.2 StringTie transcript 19957 20594 . + . transcript_id "MSTRG.3.1"; gene_id "MSTRG.3"; xloc "XLOC_000001"; class_code "u"; tss_id "TSS1";
GL000008.2 StringTie exon 19957 20594 . + . transcript_id "MSTRG.3.1"; gene_id "MSTRG.3"; exon_number "1";
GL000008.2 StringTie transcript 29530 29803 . + . transcript_id "MSTRG.1.1"; gene_id "MSTRG.1"; xloc "XLOC_000002"; class_code "u"; tss_id "TSS2";
GL000008.2 StringTie exon 29530 29803 . + . transcript_id "MSTRG.1.1"; gene_id "MSTRG.1"; exon_number "1";
GL000008.2 StringTie transcript 83390 131159 . + . transcript_id "MSTRG.39.2"; gene_id "MSTRG.39"; xloc "XLOC_000003"; class_code "u"; tss_id "TSS3";
GL000008.2 StringTie exon 83390 83545 . + . transcript_id "MSTRG.39.2"; gene_id "MSTRG.39"; exon_number "1";
GL000008.2 StringTie exon 85567 85625 . + . transcript_id "MSTRG.39.2"; gene_id "MSTRG.39"; exon_number "2";
GL000008.2 StringTie exon 88636 88695 . + . transcript_id "MSTRG.39.2"; gene_id "MSTRG.39"; exon_number "3";
GL000008.2 StringTie exon 129985 131159 . + . transcript_id "MSTRG.39.2"; gene_id "MSTRG.39"; exon_number "4";
GL000008.2 StringTie transcript 83390 133972 . + . transcript_id "MSTRG.39.1"; gene_id "MSTRG.39"; xloc "XLOC_000003"; class_code "u"; tss_id "TSS3";
GL000008.2 StringTie exon 83390 83545 . + . transcript_id "MSTRG.39.1"; gene_id "MSTRG.39"; exon_number "1";
GL000008.2 StringTie exon 85567 85625 . + . transcript_id "MSTRG.39.1"; gene_id "MSTRG.39"; exon_number "2";
GL000008.2 StringTie exon 129985 130583 . + . transcript_id "MSTRG.39.1"; gene_id "MSTRG.39"; exon_number "3";
GL000008.2 StringTie exon 133918 133972 . + . transcript_id "MSTRG.39.1"; gene_id "MSTRG.39"; exon_number "4";
I want to extract line 1-1000, 1001-2000, 2001-3000 from chromosome 3 (chr3
) into separate gtf files. How to do that on command line?
I actually didd
grep
like thisgrep -w chr3 sample.annotated.gtf > chr3.gtf
. Could you please show me an example commandTry running
split -d -l 10 chr3.gtf chr3_chunks.
. Then, with the help of the manual (man split
), customize it to your liking.