public void write ( Writer writer ) throws IOException { GFF3Writer . writeVersionPragma ( writer ) ; GFF3Writer . writeRegionPragma ( writer , entry . getPrimaryAccession ( ) , windowBeginPosition , windowEndPosition ) ; int ID = 0 ; if ( show . contains ( SHOW_GENE ) ) { locusTagGeneMap = new HashMap < String , GFF3Gene > ( ) ; geneNameGeneMap = new HashMap < String , GFF3Gene > ( ) ; } for ( Feature feature : entry . getFeatures ( ) ) { Long minPosition = feature . getLocations ( ) . getMinPosition ( ) ; Long maxPosition = feature . getLocations ( ) . getMaxPosition ( ) ; // Remove global complement. feature . getLocations ( ) . removeGlobalComplement ( ) ; String geneName = feature . getSingleQualifierValue ( Qualifier . GENE_QUALIFIER_NAME ) ; String locusTag = feature . getSingleQualifierValue ( Qualifier . LOCUS_TAG_QUALIFIER_NAME ) ; if ( show . contains ( SHOW_GENE ) ) { addGeneSegment ( geneName , locusTag , minPosition , maxPosition ) ; } if ( show . contains ( SHOW_FEATURE ) ) { ++ ID ; writeFeature ( writer , feature , geneName , locusTag , ID , minPosition , maxPosition ) ; for ( Location location : feature . getLocations ( ) . getLocations ( ) ) { int parentID = ID ; ++ ID ; writeFeatureSegment ( writer , feature , geneName , locusTag , location , parentID , ID ) ; } } } if ( show . contains ( SHOW_GENE ) ) { for ( GFF3Gene gene : locusTagGeneMap . values ( ) ) { ++ ID ; writeGene ( writer , gene , ID ) ; } for ( GFF3Gene gene : geneNameGeneMap . values ( ) ) { ++ ID ; writeGene ( writer , gene , ID ) ; } } if ( show . contains ( SHOW_CONTIG ) ) { Long contigPosition = 1L ; for ( Location location : entry . getSequence ( ) . getContigs ( ) ) { ++ ID ; contigPosition = writeContig ( writer , location , ID , contigPosition ) ; } } if ( show . contains ( SHOW_ASSEMBLY ) ) { for ( Assembly assembly : entry . getAssemblies ( ) ) { ++ ID ; writeAssembly ( writer , assembly , ID ) ; } } }
Writes the GFF3 file .