<opt
  name="chadofeatconv"
  date="20040821"
  >
 
  <title>Chado DB Feature info</title>
  <about>
    These are configurations for converting chado feature table dumps to
    standard feature/sequence files. Most of these configs specify how to
    process and convert various features extracted from chado db.
    These are tied to methods in Bulkfiles::FeatureWriter.pm)

    Tags with OLD_USAGE_ are depreciated settings (no longer active).
  </about>
  
  <informat>feature_table</informat>  
  
  <outformats>fff</outformats>
  <outformats>gff</outformats>
  <outformats>fasta</outformats>

  <gff_addchromosome>0</gff_addchromosome>

  <!-- copied from db-release config files .. this is mostly common info,
    but db-release config can override @featset, %featmap -->

  <!--  moved featset/featmap tags to separate config file -->
    
  <!-- 
    rename_child_type affects whether these non-coding genes are 
    segregated at gene level or at (pseudo)rna/transcript level.
    Esp. affecting which files get the nc type sequence : gene, pseudogene, ncRNA
    old usage kept nc seq from gene subset, putting in p,nc subsets
    new usage puts in both.
    See FeatureWriter.update1ParentKidLinks
  -->
  <OLD_USAGE_rename_child_type>pseudogene|\w+RNA</OLD_USAGE_rename_child_type>

  <mergematch></mergematch>
  
  <noforwards_gff>1</noforwards_gff>
  
  <!-- remapType: append this name pattern to type; works with maptype below -->
  <name2type_pattern>[-_](repeatmasker|genscan|piecegenie|twinscan|genewise|trnascan)</name2type_pattern>

  <!-- dont warn if these types have Parent oid not in data; e.g  chromosome parent -->
  <maptype_ignore_missingparent>^(match_part|match|gene|cytology|chromosome_band|oligo|BAC|protein_binding_site|rescue_fragment)</maptype_ignore_missingparent>

  <!-- drop lengthy program.source from match name 
  
  |pred
  
  match_sim4_na_EST_complete_dros RE37642.5prime-2L_wgs2cex-na_EST.complete.dros
  also fix these ugly names repeating feature types;
  match:sim4:na_STS.dros  BACN11E12-T7-211000022278175-na_STS.dros-sim4
    cuttype=1

  -->
  
<!-- 
add dpse name patches
      gene00028109_GENSCAN_predicted_peptide_1 -> gene00028109
  ## clean out dpse unwieldy predictor names: contig...contig...
  elsif ($type =~ /^(gene|mRNA)/ && $name =~ s/Contig[_\d]+//g) { 
    if ($name =~ m/^(twinscan|genewise|genscan)/i) { $name= "${id}_${name}"; }
    }
    
feb05: dmelr4.1 fixes; new name for matches oligos .. cytology .. BAC
2L    dmel_r3_to_dmel_r4_migration:dmel_r3_affy_oligos        match   83300   83324   .       
-       .       ID=145509_at_1026-hsp:34277

2L    aubrey_cytolocator:cytology     match   -204333 -153714 .        ID=band-21A1-hsp

2L      175979  match:bdgp_unknown_clonelocator:scaffoldBACs    BACR22C14-hsp   -       175979..
339439  BACR22C14-hsp           

  mapname_pattern name="bac2" type="^BAC" from="(\-hsp.*)" to=""

nov05: dpse2; remove redundant messy Dpse\\ prefix from GA00 genes (not in tr; prot names)

-->

  <mapname_pattern name="1match" type="^(match|oligo)" cuttype="1" from="null" to="null"/>
  <mapname_pattern name="2match" type="^(match|oligo)" from="\-AE\d\S+$" to=""/>
  <mapname_pattern name="6match" type="^match.*" from=";$" to=""/>

 
  <mapname_pattern name="4oligo" type="^oligo" from="\-hsp\S*$" to=""/>
  <mapname_pattern name="4cytol" type="(chromosome_band|cytology)" from="\-hsp\S*$" to=""/>
  <mapname_pattern name="bac" type="^BAC" from="(hit\-|\-hsp|\-cl\-scaffoldBACs)" to=""/>

  <mapname_pattern name="7match" type="^match.*" from="(\..prime)-.*$" to="$1"/>

  <mapname_pattern name="genscann" type="genscan" from="_GENSCAN_predicted_peptide.*" to=""/>
  <mapname_pattern name="pinsert"  type="pinsertion" from="\-insertion\-on\-.*$" to=""/>

  <mapname_pattern name="dpsegn1" type="gene" from="Dpse\\GA" to="GA"/>

  <mapname_pattern name="dum" from="\-dummy\-" to=""/>
  <mapname_pattern name="tep" type="transposable_element_pred" from="JOSHTRANSPOSON\-" to=""/>


  <!-- drop dbxref extra DB: prefix to real DBname: prefix added by old gff loader -->
  <mapattr_pattern name="1DBexcess" type="^dbxref" from="^DB:(\w+:\w+)" to="$1"/>
  <mapattr_pattern name="1FBexcess" type="^dbxref" from="^FlyBase Annotation IDs" to="FBannot"/>


<!--
  dmel r4 ugly match names: all the data appended  ! see above cuttype=1
match:tblastxwrap_masked:na_baylorf1_scfchunk.dpse 
Dpf1glom15-1-AE002603.4_22263978_22335911-na_baylorf1_scfchunk.d 

assembly:path-AE002603.4
-->
    <!-- dpse data ; move to dpse config ? -->
  <maptype_pattern name="1match" from=":rui.chen" to=""/>
  <maptype_pattern name="2match" from=":Brian.Bettencourt" to=""/>
  <maptype_pattern name="3masked" from="_masked" to=""/>
  <!-- <maptype_pattern name="3match" from=":Dmel r3.1" to="dmel_r31"/> -->

  <!-- CDS_spanType is ambiguous in chado: both polypeptide and  protein used -->
  <maptype_pattern name="4polypep" from="polypeptide" to="protein"/>

  <maptype_pattern name="simwrap" from="sim4:wrap.*" to="sim4:wrap"/>
  <maptype_pattern name="null" typename="noname" from="null" to="null"/>  

<!--
  dmel r4 ugly match types: see below maptype changes
   
match:sim4:na_DGC.in_process.dros=match:sim4:na_DGC.dros
match:sim4:na_HDP_RNAi.dmel=match_RNAiHDP 
match:sim4:na_HDP_mRNA.dmel=match_HDP
match:sim4:na_gadfly.dros.RELEASE2=match:sim4:na_gadfly.dmel_r2
match:sim4:na_transcript.dmel.RELEASE31=match:sim4:na_transcript.dmel_r31
match:sim4:na_transcript.dmel.RELEASE32=match:sim4:na_transcript.dmel_r32
match:tblastxwrap_masked:na_baylorf1_scfchunk.dpse=match:tblastx:na_dpse
match:tblastxwrap_masked:na_scf_chunk_agambiae.fa=match:tblastx:na_agambiae
-->

<!--
## SONG/so Revision: 1.45
## !date:                 Tue May 11 15:18:44 PDT 2004
##     @is_a@oligo ; SO:0000696 ; SOFA:SOFA ; synonym:oligonucleotide
## 'so' is no longer valid
##   old value: @is_a@so ; SO:1000000
##  options are limited: located_sequence_feature, SO:0000110 ??
##  in flybase, 'so' seems used for protein blast matches?
## segment not in this    
## alt choices ...
#      @is_a@assembly ; SO:0000353 ; SOFA:SOFA
# **    @is_a@golden_path ; SO:0000688 ; SOFA:SOFA   <<
# **    @is_a@supercontig ; SO:0000148 ; SOFA:SOFA ; synonym:scaffold    <<
#     @is_a@tiling_path ; SO:0000472 ; SOFA:SOFA
#     @is_a@virtual_sequence ; SO:0000499 ; SOFA:SOFA
#     @is_a@chromosome ; SO:0000340
#     @part_of@chromosome_arm ; SO:0000105

## aug04: add new analysis features (HDP,RNAiHDP,fgenesh,)
## these are like exons but parent feature lacks featureloc 
## - need to join together by object_oid/parent_oid and compute parent feature (has name)
## SO type.subtype should be match.program
## SONG: match, match_part match_set nucleotide_match cross_genome_match cDNA_match EST_match
#? use '.' instead of '_' for part type? would that throw gnomap/gbrowse usage? probably

## Sep04 - Dpse chado r2.1 uses 'ultra_scaffold' as name of chromosomes
  >> recode to ? golden_path / no that is for Genbank Units (scaffolds)
  
Date: Thu, 30 Sep 2004 18:06:05 -0500 (EST)
From: Don Gilbert <gilbertd@bio.indiana.edu>
To: song-devel@lists.sourceforge.net, suzi@fruitfly.org

This is what it looks like to me, but you all have more experience:

contig
  => supercontig/scaffold/golden_path_fragment 
   [  databank_scaffold  ]   
    => golden_path/ultracontig 
      => chromosome/chromosome_arm

Here is a suggested term:
  databank_scaffold ; def: A golden_path_fragment unit for genbank/embl/ddbj databank
 submission ; syn: genbank_entry, embl_entry, ddbj_entry

golden_path_region, not SO term is now used in flybase chadodb as databank_scaffold 
  
-->

  
   <!-- dpse chado duplicate 0-length chromosome entries; why? -->
  <nozombiechromosomes>1</nozombiechromosomes>
  
  <gene_is_complex>0</gene_is_complex> 
  <GModelParents>mRNA</GModelParents>
  <GModelParts>protein,CDS,three_prime_UTR,five_prime_UTR</GModelParts>
  <CDS_spanType>protein</CDS_spanType>
  <CDS_exonType>CDS</CDS_exonType>

  <about id="feat_model"><![CDATA[
    feat_model:
    revision of above mess for gene models; handle pseudogene; ncRNAs ...
  
    feat_model keys:
    id = ? type of feature, cant do with multiples
    simple = 1; not structure for this, write just span 
      (gene may be span or structured); replaces "simplefeat" list
    types   = list of types (replaces id?)
    submodels = list of features in kid array that become new structured features
    parent  = feature holding all kid objects (e.g. exons) (for submodel)
        ? is this valid, use featob->parent instead
    typelabel = what to write in place of id type (protein -> CDS)
    hasspan = this feature has start,stop (e.g. gene, mRNA, protein)
        discard/cut parts that fall outside
    part(s) = array of kid types (e.g. exons, UTRs) making structure
    makepartsfrom = list? of parts to make parts from if not given
      (e.g. exons => cds)
  ]]></about>
  
  <!-- 3 level model here -->
  <feat_model id="gene" simple="1" >
<!--     <submodels>mRNA</submodels>   -->
    <submodels>tRNA</submodels> 
      <!-- data may or may not have gene parent for other rnas ; pseudogene ? -->
  </feat_model>
  
  <feat_model id="mRNA">
    <parts>exon</parts> 
<!--     <parts>three_prime_UTR</parts>   -->
<!--     <parts>five_prime_UTR</parts>  -->
    
    <submodels>protein</submodels> 
    <submodels>five_prime_UTR</submodels> 
    <submodels>three_prime_UTR</submodels> 
    <submodels>intron</submodels> 
  </feat_model>
  
   <!-- chado ambiguity: protein and polypeptide both used for this; recode one? -->
  <feat_model id="protein" 
    typelabel="CDS" 
    parent="mRNA" 
    hasspan="1" 
    NOT_makemethod="getCDSexons" 
    makepartsfrom="exon" 
    >
    <parts>CDS</parts> <!-- exon equivalent may need to create from exons -->
  </feat_model>

  <!-- to create UTR, intron from mRNA>exon,protein model -->
  <feat_model id="five_prime_UTR" 
    makemethod="makeUtr5" 
    makepartsfrom="exon|protein" 
    >
    <parts>five_prime_UTR</parts>  
  </feat_model>
  <feat_model id="three_prime_UTR" 
    makemethod="makeUtr3" 
    makepartsfrom="exon|protein" 
    >
    <parts>three_prime_UTR</parts>  
  </feat_model>
  <feat_model id="intron" 
    makemethod="makeIntrons" 
    makepartsfrom="exon" 
    >
    <parts>intron</parts>  
  </feat_model>
  
  <!-- default structure for non-simple 'mRNA' types -->
  <feat_model id="rnatype" types="pseudogene tRNA snRNA snoRNA rRNA tRNA miRNA ncRNA">
    <parts>exon</parts> 
  </feat_model>
  
  <!-- flybase chado has these with fmin == 1-origin, others are 0-origin; why?? -->
  <origin_one
    chromosome_arm="1"
    chromosome_band="1"
    chromosome="1"
    golden_path="1"
    transposable_element_insertion_site="1"
    />

  <topsort
    chromosome_arm="1"
    chromosome="1"
    golden_path="1"
    />
    
  <segmentfeats 
    BAC="1"
    chromosome_arm="1"
    chromosome_band="1"
    chromosome="1"
    golden_path_region="1"
    golden_path_fragment="1"
    golden_path="1"
    databank_scaffold="1"
    scaffold="1"
    segment="1"
    source="1"
    syntenic_region="1"
    />
  <!-- 
      ## segment no longer valid SO; supercontig or golden_path are best
  -->
  
  <!-- simplefeat == segmentfeats + others 
    not mature_peptide="1" which has structure  
    gene is problematic - flybase = simple start/stop, sgd == mrna
    NOT_gene="1" NOT_pseudogene="1" DONT include these; messes mrna assigments
    -->
  <simplefeat 
    BAC="1"
    chromosome_arm="1"
    chromosome_band="1"
    chromosome="1"
    golden_path_region="1"
    golden_path_fragment="1"
    golden_path="1"
    databank_scaffold="1"
    scaffold="1"
    oligo="1" oligonucleotide="1"
    point_mutation="1"
    region="1"
    repeat_region="1"
    segment="1"
    source="1"
    transcription_start_site="1"
    orthologous_region="1"
    syntenic_region="1"
    />
    
    <!-- skipaskid is subset of simplefeat ; drop -->
  <skipaskid 
    point_mutation="1"
    region="1"
    repeat_region="1"
    pinsertion="1"
    />

    
  <dropname 
    transcription_start_site="1"
    mRNA_genscan="1"
    match_genscan="1"
    mRNA_piecegenie="1"
    match_piecegenie="1"
    tRNA_trnascan="1"
    match_trnascan="1"
    repeat_region="1"
    match_repeatmasker="1"
    
    match_blastn_na_dbEST_dpse="1"
    match_blastz="1"
    />
    
    <!-- nameisid include ones with only id => name ; similar to dropid ; NOT for gff ? -->
  <nameisid 
    BAC="1"
    chromosome_band="1"
    oligo="1" oligonucleotide="1"
    />
    
  <!-- feb05: need for ESTs with same id at diff locs -->  
  <oidisid_gff 
    match_sim4_na_dbEST_same_dmel="1"
    match_sim4_na_dbEST_diff_dmel="1"
    match_sim4_na_DGC_dros="1"
    match_part_sim4_na_dbEST_same_dmel="1"
    match_part_sim4_na_dbEST_diff_dmel="1"
    match_part_sim4_na_DGC_dros="1"
    />
     
  <dropid 
    BAC="1"
    cDNA_clone="1"
    chromosome_band="1"
    EST="1"
    exon="1"
    OLD_USAGE_intron="1"
    OLD_USAGE_CDS="1"
    OLD_USAGE_three_prime_UTR="1"
    OLD_USAGE_five_prime_UTR="1"
    match_part="1"
    oligo="1" oligonucleotide="1"
    processed_transcript="1"
    repeat_region="1"
    transcription_start_site="1"
    transposable_element_pred="1"
    />
    
  <dropfeat_fff 
    CDS_exon="1"
    CDS="1"
    exon="1"
    intron="1"
    remark="1"
    OLD_USAGE_five_prime_UTR="1"
    OLD_USAGE_three_prime_UTR="1"
    />
    
  <dropfeat_gff 
    CDS_exon="1"
    remark="1"
    />

    
    <!-- 
      keepstrand features: must preserve -1,0,+1 values in fff/gnomap which
      uses GenBank/EMBL feature loc syntax: join() = [0,1]; complement() = [-1]
      distinguish 0 from 1 with note: strand=0
      .. possibly more/many features belong here
    -->
  <keepstrand 
    pinsertion="1"
    transposable_element_insertion_site="1"
    transcription_start_site="1"
    />

  <hasdups 
    three_prime_UTR="1" 
    intron="1" 
    five_prime_UTR="1" 
    exon="1" 
    repeat_region="1"
    match_blastn_na_dbEST_dpse="1"
    />
    
 <!--  <duptype_pattern>(match_sim4|match_blast|match_tblast)</duptype_pattern> -->
 
<!--  not good ; problem is each has diff name; need to keep that
  many of the match: things are at same loc given no id/name are dups 
    
    match_blastn_na_dbEST_dpse="1"
    match_sim4_na_dbEST_same_dmel="1"
    match_sim4_na_dbEST_diff_dmel="1"
    match_sim4_na_transcript_dmel_r31="1"
    match_sim4_na_gadfly_dmel_r2="1"

-->

<!-- 
name2type_pattern>[-_](repeatmasker|genscan|piecegenie|twinscan|genewise|trnascan

2L      9043    9068    1       match:dmel_r3_to_dmel_r4_migration:dmel_r3_affy_oligos          
145501_at_1338-hsp:33875        8419290 parent_oid      8419291
2L      22221   324485  0       match:aubrey_cytolocator:cytology               band-21B-hsp    
8342450 parent_oid      8342451
2L      22221   98619   0       match:aubrey_cytolocator:cytology               band-21B1-hsp   
8331270 parent_oid      8331271

mar05: dpse1.04 - these are not public features:
golden_path_region      Contig4967_Contig2069
However, Dmel chado uses golden_path_region for databank_scaffold !
  golden_path_region="scaffold"
retype in dpse db all dpse golden_path_region to supercontig
   UPDATE feature set type_id = 556 where organism_id = 3 and type_id = 553;

jan06: OLD_USAGE_: 
  changed CDS/CDS_exon mapping to GFFv3 usage: CDS == coding_exon not mRNA-like span

mar06: replaced chado 'reporting' UTR, intron calculated features with 
       better local calc; five_prime_untranslated_region=skip now
 
-->
    
  <maptype 
    
    OLD_USAGE_protein="CDS"
    OLD_USAGE_CDS="CDS_exon"
    OLD_USAGE_five_prime_untranslated_region="five_prime_UTR"
    OLD_USAGE_three_prime_untranslated_region="three_prime_UTR"
    five_prime_untranslated_region="skip"
    three_prime_untranslated_region="skip"
    CDS="skip"
    intron="skip"
    
    golden_path_region="scaffold"
    supercontig="skip"
    oligonucleotide="oligo"
    transposable_element_pred="transposable_element_pred"
    
    mRNA_genewise="mRNA:genewise"
    mRNA_twinscan="mRNA:twinscan"
    mRNA_genscan="mRNA:genscan"
    mRNA_piecegenie="mRNA:piecegenie"

    gene_genewise="gene:genewise"
    gene_twinscan="gene:twinscan"
    gene_genscan="gene:genscan"
    gene_piecegenie="gene:piecegenie"
    
    mRNA_trnascan="tRNA:trnascan"
    gene_trnascan="tRNA:trnascan"
    match_tRNAscan_SE="tRNA:trnascan"

    match_clonelocator_scaffoldBACs="BAC"
    match_part_clonelocator_scaffoldBACs="skip"

    match_bdgp_unknown_clonelocator_scaffoldBACs="BAC"
    match_part_bdgp_unknown_clonelocator_scaffoldBACs="skip"

    match_promoter="transcription_start_site"
    match_part_promoter="skip"
    
    match_locator_cytology="chromosome_band"
    match_part_locator_cytology="skip"

    match_aubrey_cytolocator_cytology="chromosome_band"
    match_part_aubrey_cytolocator_cytology="skip"
     
    match_JOSHTRANSPOSON_Sept="transposable_element_pred"
    match_repeatmasker="repeat_region"
    _repeatmasker="repeat_region"
    match_repeat_runner_seg="repeat_region"

    pinsertion="skip"
    match_sim4_na_affy_oligo_dros="oligo"
    match_dmel_r3_to_dmel_r4_migration_dmel_r3_affy_oligos="oligo"
    
    match_sim4_na_users_i_dros="skip"
    match_part_sim4_na_users_i_dros="skip"
    match_sim4_aa_users_i_dros="skip"
    match_part_sim4_aa_users_i_dros="skip"

    match_sim4_na_DGC_in_process_dros="match:sim4:na_DGC_dros"
    match_sim4_na_HDP_RNAi_dmel="match:RNAiHDP"
    match_sim4_na_HDP_mRNA_dmel="match:HDP"
    match_sim4_na_gadfly_dros_RELEASE2="match:sim4:na_gadfly_dmel_r2"
    match_sim4_na_transcript_dmel_RELEASE31="match:sim4:na_transcript_dmel_r31"
    match_sim4_na_transcript_dmel_RELEASE32="match:sim4:na_transcript_dmel_r32"
    match_tblastxwrap_na_baylorf1_scfchunk_dpse="match:tblastx:na_dpse"
    match_tblastxwrap_na_scf_chunk_agambiae_fa="match:tblastx:na_agambiae"

    match_part_sim4_na_DGC_in_process_dros="match_part:sim4:na_DGC_dros"
    match_part_sim4_na_HDP_RNAi_dmel="match_part:RNAiHDP"
    match_part_sim4_na_HDP_mRNA_dmel="match_part:HDP"
    match_part_sim4_na_gadfly_dros_RELEASE2="match_part:sim4:na_gadfly_dmel_r2"
    match_part_sim4_na_transcript_dmel_RELEASE31="match_part:sim4:na_transcript_dmel_r31"
    match_part_sim4_na_transcript_dmel_RELEASE32="match_part:sim4:na_transcript_dmel_r32"
    match_part_tblastxwrap_na_baylorf1_scfchunk_dpse="match_part:tblastx:na_dpse"
    match_part_tblastxwrap_na_scf_chunk_agambiae_fa="match_part:tblastx:na_agambiae"

    />
  
  <!-- nov04; dmel rel4 changes
    NOT_match_promoter="skip" .. becomes transcription_start_site
    fix messy names .. match:tblastxwrap:na_baylorf1_scfchunk.dpse  
  -->

  <!-- oct04; dmel_chado: this may be a skip; may be same ; yes.
     as  transposable_element_insertion_site ::   pinsertion="1"
    match:promoter == transcription_start_site; keep 2nd or retype 1st
   -->
  <!--
    match_fgenesh="match:fgenesh"
    match_HDP="match:HDP"
    match_RNAiHDP="match:RNAiHDP"

    match_fgenesh="match_fgenesh"
    match_HDP="match_HDP"
    match_RNAiHDP="match_RNAiHDP"
    match_promoter="promoter"
       match:sim4:na_affy_oligo.dros

  .. analysis sql  bug - repeatmasker dumped w/ NO type ???
  .. change above older match_ and _genscan/piecegenie/.. to newer match:prog:db format ..
  .. also fix maptype_gff ..
  so => "located_sequence_feature", ## leave in for now; no replacement for so ; SO:1000000
  -->

  <maptype_gff>
    <transposable_element_pred>transposable_element:predicted</transposable_element_pred>
    <match_fgenesh>match:fgenesh</match_fgenesh>
    <match_part_fgenesh>match_part:fgenesh</match_part_fgenesh>
    <match_HDP>match:HDP</match_HDP>
    <match_part_HDP>match_part:HDP</match_part_HDP>
    <match_RNAiHDP>match:RNAiHDP</match_RNAiHDP>
    <match_part_RNAiHDP>match_part:RNAiHDP</match_part_RNAiHDP>
    <mRNA_genscan>mRNA:genscan</mRNA_genscan>
    <mRNA_piecegenie>mRNA:piecegenie</mRNA_piecegenie>
    <tRNA_trnascan>tRNA:trnascan</tRNA_trnascan>
  </maptype_gff>
  
  
</opt>
