public SexMemo(final SequencesReader reader,final ReferencePloidy ploidy) throws IOException {
  final Sex[] sexValues=Sex.values();
  mReferences=new ReferenceGenome[sexValues.length];
  mParMap=new MyFrickenMap[sexValues.length];
  mAutosomes=new HashSet<>();
  for (  final Sex sex : sexValues) {
    final ReferenceGenome referenceGenome=new ReferenceGenome(reader,sex,ploidy);
    mReferences[sex.ordinal()]=referenceGenome;
    final MyFrickenMap parmap=new MyFrickenMap();
    for (    ReferenceSequence rs : referenceGenome.sequences()) {
      if (sex == Sex.EITHER && rs.isSpecified() && rs.ploidy() == Ploidy.DIPLOID) {
        mAutosomes.add(rs.name());
      }
      if (rs.hasDuplicates()) {
        final String refName=rs.name();
        final EffectivePloidyList result=new EffectivePloidyList();
        for (        Pair<RegionRestriction,RegionRestriction> dup : rs.duplicates()) {
          final RegionRestriction r=dup.getA();
          final RegionRestriction s=dup.getB();
          if (refName.equals(r.getSequenceName())) {
            result.add(new Pair<>(r,Ploidy.DIPLOID));
          }
          if (refName.equals(s.getSequenceName())) {
            result.add(new Pair<>(s,Ploidy.NONE));
          }
        }
        parmap.put(refName,result);
      }
    }
    mParMap[sex.ordinal()]=parmap;
  }
}

public SexMemo ( final SequencesReader reader , final ReferencePloidy ploidy ) throws IOException { final Sex [ ] sexValues = Sex . values ( ) ; mReferences = new ReferenceGenome [ sexValues . length ] ; mParMap = new MyFrickenMap [ sexValues . length ] ; mAutosomes = new HashSet < > ( ) ; for ( final Sex sex : sexValues ) { final ReferenceGenome referenceGenome = new ReferenceGenome ( reader , sex , ploidy ) ; mReferences [ sex . ordinal ( ) ] = referenceGenome ; final MyFrickenMap parmap = new MyFrickenMap ( ) ; for ( ReferenceSequence rs : referenceGenome . sequences ( ) ) { if ( sex == Sex . EITHER && rs . isSpecified ( ) && rs . ploidy ( ) == Ploidy . DIPLOID ) { mAutosomes . add ( rs . name ( ) ) ; } if ( rs . hasDuplicates ( ) ) { final String refName = rs . name ( ) ; final EffectivePloidyList result = new EffectivePloidyList ( ) ; for ( Pair < RegionRestriction , RegionRestriction > dup : rs . duplicates ( ) ) { final RegionRestriction r = dup . getA ( ) ; final RegionRestriction s = dup . getB ( ) ; if ( refName . equals ( r . getSequenceName ( ) ) ) { result . add ( new Pair < > ( r , Ploidy . DIPLOID ) ) ; } if ( refName . equals ( s . getSequenceName ( ) ) ) { result . add ( new Pair < > ( s , Ploidy . NONE ) ) ; } } parmap . put ( refName , result ) ; } } mParMap [ sex . ordinal ( ) ] = parmap ; } }
remember information from command line and reference file to enable ploidy of a sequence to be determined given the sex of a sample .
