diff --git a/README.md b/README.md index 98f64a4..992b02f 100644 --- a/README.md +++ b/README.md @@ -72,15 +72,14 @@ use crate::granges::GRanges; let granges = GRanges::import_gtf("src/granges_gtf.gtf", vec!["gene_id", "gene_num"], // Names of optional fields vec!["str" , "int" ], // Types of optional fields - vec![] + vec![None , Some("0") ], // Default values, can be an empty vector if omitted ).unwrap(); - ``` The result is: ```bash seqnames ranges strand | source feature gene_num gene_id 1 1 [11869, 14409) + | transcribed_unprocessed_pseudogene gene 1 ENSG00000223972 -2 1 [11870, 14410) + | processed_transcript transcript 2 ENSG00000223972 +2 1 [11870, 14410) + | processed_transcript transcript 0 ENSG00000223972 ``` ### Read a BAM file into a GRanges object diff --git a/src/granges_gtf.gtf b/src/granges_gtf.gtf index 61ed72f..55262f7 100644 --- a/src/granges_gtf.gtf +++ b/src/granges_gtf.gtf @@ -1,2 +1,2 @@ 1 transcribed_unprocessed_pseudogene gene 11869 14409 . + . gene_id "ENSG00000223972"; gene_name "DDX11L1"; gene_source "havana"; gene_biotype "transcribed_unprocessed_pseudogene"; gene_num "1"; -1 processed_transcript transcript 11870 14410 . + . gene_id "ENSG00000223972"; transcript_id "ENST00000456328"; gene_name "DDX11L1"; gene_source "havana"; gene_biotype "transcribed_unprocessed_pseudogene"; transcript_name "DDX11L1-002"; transcript_source "havana"; gene_num "2"; +1 processed_transcript transcript 11870 14410 . + . gene_id "ENSG00000223972"; transcript_id "ENST00000456328"; gene_name "DDX11L1"; gene_source "havana"; gene_biotype "transcribed_unprocessed_pseudogene"; transcript_name "DDX11L1-002"; transcript_source "havana"; diff --git a/src/granges_gtf.rs b/src/granges_gtf.rs index c2e83f9..a349c68 100644 --- a/src/granges_gtf.rs +++ b/src/granges_gtf.rs @@ -492,7 +492,7 @@ mod tests { let granges = GRanges::import_gtf("src/granges_gtf.gtf", vec!["gene_id", "gene_num"], // Names of optional fields vec!["str" , "int" ], // Types of optional fields - vec![] + vec![None , Some("0") ], // Default values, can be an empty vector if omitted ).unwrap(); assert_eq!(granges.num_rows(), 2);