method to initialize map of transform nucleotides
180903
private static void initMapTransformNucleotides() {
		transformNucleotides = new HashMap<String, String>();
		for (Map.Entry e : nucleotides.entrySet()) {
			transformNucleotides.put(e.getValue().toString(), e.getKey().toString());
		}
	}
1177193
def _init_nt(self, flds):
        """"""
        term = flds[1]
        genes_str = flds[5]
        # pylint: disable=bad-whitespace
        return self.ntobj(
            Category   =       flds[0],
            GO         =       term[:10], #  1  GO:0045202~synapse
            name       =       term[10:], #  1  GO:0045202~synapse
            Count      =   int(flds[2]),  #  2  94
            Perc       = float(flds[3]),  #  3  9.456740442655935
            PValue     = float(flds[4]),  #  4  6.102654380458156E-20
            Genes      =      genes_str, # 5 ['ENSMUSG00000052613', ...]
            Genes_set  = self.get_genes(genes_str), # 5 ['ENSMUSG00000052613', ...]
            List_Total =   int(flds[6]),  #  6  920
            Pop_Hits   =   int(flds[7]),  #  7  444
            Pop_Total  =   int(flds[8]),  #  8  12002
            Fold_Enrichment = float(flds[9]), # 9 2.7619173521347435
            Bonferroni = float(flds[10]), # 10  3.3930758355347344E-17
            Benjamini  = float(flds[11]), # 11  3.3930758355347344E-17
            FDR        = float(flds[12]))
196264
final public void MapData() throws ParseException {
                          /*@bgen(jjtree) MapData */
  AstMapData jjtn000 = new AstMapData(JJTMAPDATA);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(START_SET_OR_MAP);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case START_SET_OR_MAP:
      case INTEGER_LITERAL:
      case FLOATING_POINT_LITERAL:
      case STRING_LITERAL:
      case TRUE:
      case FALSE:
      case NULL:
      case LPAREN:
      case LBRACK:
      case NOT0:
      case NOT1:
      case EMPTY:
      case MINUS:
      case IDENTIFIER:
        MapEntry();
        label_18:
        while (true) {
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case COMMA:
            ;
            break;
          default:
            jj_la1[46] = jj_gen;
            break label_18;
          }
          jj_consume_token(COMMA);
          MapEntry();
        }
        break;
      default:
        jj_la1[47] = jj_gen;
        ;
      }
      jj_consume_token(RBRACE);
    } catch (Throwable jjte000) {
      if (jjtc000) {
        jjtree.clearNodeScope(jjtn000);
        jjtc000 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte000 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte000;}
      }
      if (jjte000 instanceof ParseException) {
        {if (true) throw (ParseException)jjte000;}
      }
      {if (true) throw (Error)jjte000;}
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
  }
966991
def main(args):

  
  sys.stderr.write("reading reference genome\n")
  ref = FASTAData(open(args.genome).read())
  sys.stderr.write("read in "+str(len(ref.keys()))+" chromosomes\n")

  """ Next make the transcriptome """
  txome = {}
  sys.stderr.write("write the transcriptome\n")
  inf = None
  if args.gpd[-3:] == '.gz':
    inf = gzip.open(args.gpd)
  else:
    inf = open(args.gpd)
  stream = GPDStream(inf)
  tof = open(args.tempdir+'/transcriptome.fa','w')
  z = 0
  for gpd in stream:
    z += 1
    if gpd.transcript_name in txome:
      sys.stderr.write("WARNING already have a transcript "+gpd.transcript_name+" ignoring line "+str(z)+" of the gpd\n")
      continue
    txome[gpd.transcript_name] = gpd.gene_name
    tof.write('>'+gpd.transcript_name+"\n"+str(gpd.get_sequence(ref))+"\n")
  tof.close()
  inf.close()
  sys.stderr.write("wrote "+str(len(txome.keys()))+" transcripts\n")

  """Build the salmon index"""
  sys.stderr.write("building a salmon index\n")
  cmd = 'salmon index -p '+str(args.numThreads)+' -t '+args.tempdir+'/transcriptome.fa -i '+args.tempdir+'/salmon_index'
  p = Popen(cmd.split())
  p.communicate()
  sys.stderr.write("finished building the index\n")

  """Use the index to quanitfy"""
  sys.stderr.write("quanitfy reads\n")
  reads = ''
  if args.rU:
    reads = '-r '+args.rU
  else:
    reads = '-1 '+args.r1+' -2 '+args.r2
  cmd = 'salmon quant -p '+str(args.numThreads)+' -i '+args.tempdir+'/salmon_index -l A '+reads+' -o '+args.tempdir+'/output_quant'
  p = Popen(cmd.split())
  p.communicate()
  sys.stderr.write("finished quanitfying\n")

  """Now parse the salmon output to add gene name"""
  salmon = {}
  with open(args.tempdir+'/output_quant/quant.sf') as inf:
    header = inf.readline()
    for line in inf:
      f = line.rstrip().split("\t")
      # by each transcript name hold a data strcture of the information
      salmon[f[0]] = {'name':f[0],'length':int(f[1]),'EffectiveLength':float(f[2]),'TPM':float(f[3]),'NumReads':float(f[4])}
  genes = {}
  for name in salmon:
    gene = txome[name]
    if gene not in genes: genes[gene] = []
    genes[gene].append(salmon[name])
  genetot = {}
  for gene in genes:
    tot = sum([x['TPM'] for x in genes[gene]])
    genetot[gene] = tot
  ordered_gene_names = sorted(genetot.keys(), key=lambda x: genetot[x],reverse=True)
      
  """Collected enough information to make output"""
  sys.stderr.write("generating output\n")
  of = sys.stdout
  if args.output != '-':
    of = open(args.output,'w')
  of.write("geneName\ttranscriptName\tlength\tEffectiveLength\ttxTPM\tNumReads\tgeneTPM\n")
  for gene in ordered_gene_names:
    txs = sorted(genes[gene],key=lambda x: x['TPM'],reverse=True)
    for tx in txs:
      of.write(gene+"\t"+tx['name']+"\t"+str(tx['length'])+"\t"+str(tx['EffectiveLength'])+"\t"+str(tx['TPM'])+"\t"+str(tx['NumReads'])+"\t"+str(genetot[gene])+"\n")
  of.close()

  # Temporary working directory step 3 of 3 - Cleanup
  if not args.specific_tempdir:
    rmtree(args.tempdir)
492702
def _init_map(self, record_types=None, **kwargs):
        """"""

        osid_objects.OsidContainableForm._init_map(self)
        osid_objects.OsidSourceableForm._init_map(self)
        osid_objects.OsidObjectForm._init_map(self, record_types=record_types)
        self._my_map['childIds'] = self._children_default
        self._my_map['assignedRepositoryIds'] = [str(kwargs['repository_id'])]
655724
private void cloneAndSortMappings(IReaction reaction, IReaction copyOfReaction,
            Map<IAtomContainer, int[]> permutationMap) {

        // make a lookup for the indices of the atoms in the copy
        final Map<IChemObject, Integer> indexMap = new HashMap<IChemObject, Integer>();
        List<IAtomContainer> all = ReactionManipulator.getAllAtomContainers(copyOfReaction);
        int globalIndex = 0;
        for (IAtomContainer ac : all) {
            for (IAtom atom : ac.atoms()) {
                indexMap.put(atom, globalIndex);
                globalIndex++;
            }
        }

        Map<IAtom, IAtom> atomAtomMap = atomAtomMap(reaction, copyOfReaction, permutationMap);
        List<IMapping> map = cloneMappings(reaction, atomAtomMap);

        Comparator<IMapping> mappingSorter = new Comparator<IMapping>() {

            /**
             * {@inheritDoc}
             */
            @Override
            public int compare(IMapping o1, IMapping o2) {
                IChemObject o10 = o1.getChemObject(0);
                IChemObject o20 = o2.getChemObject(0);
                return indexMap.get(o10).compareTo(indexMap.get(o20));
            }

        };
        Collections.sort(map, mappingSorter);
        int mappingIndex = 0;
        for (IMapping mapping : map) {
            mapping.getChemObject(0).setProperty(CDKConstants.ATOM_ATOM_MAPPING, mappingIndex);
            mapping.getChemObject(1).setProperty(CDKConstants.ATOM_ATOM_MAPPING, mappingIndex);
            copyOfReaction.addMapping(mapping);
            mappingIndex++;
        }

    }
889682
private void storeBioassemblyInformation(Map<String, Integer> chainIdToIndexMap, Map<Integer, BioAssemblyInfo> inputBioAss) {
		int bioAssemblyIndex = 0;
		for (Entry<Integer, BioAssemblyInfo> entry : inputBioAss.entrySet()) {
			Map<double[], int[]> transformMap = MmtfUtils.getTransformMap(entry.getValue(), chainIdToIndexMap);
			for(Entry<double[], int[]> transformEntry : transformMap.entrySet()) {
				mmtfDecoderInterface.setBioAssemblyTrans(bioAssemblyIndex, transformEntry.getValue(), transformEntry.getKey(), entry.getKey().toString());
			}
			bioAssemblyIndex++;
		}
	}
1184566
def translate_features_to_letter_annotations(protein, more_sites=None):
        """"""
        from ssbio.databases.uniprot import longname_sites
        from collections import defaultdict

        sites = longname_sites  ## longname_sites = ["active site", "binding site", "metal ion-binding site", "site"]
        sites.append('nucleotide phosphate-binding region')
        sites.append('DNA-binding region')
        sites.append('intramembrane region')
        sites.append("transmembrane region")
        sites.append("catalyticResidue")

        ## ADD MORE IF YOU WANT
        if more_sites:
            more_sites = ssbio.utils.force_list(more_sites)
            sites.extend(more_sites)

        sites = list(set(sites))

        for site in sites:
            protein.representative_sequence.letter_annotations[site] = [False] * protein.representative_sequence.seq_len

        to_store = defaultdict(list)
        for f in protein.representative_sequence.features:
            if f.type in sites:
                to_store[f.type].append(f)

        for site, feature in to_store.items():
            try:
                positions = [int(f.location.start) for f in feature]
            except TypeError:
                log.error('Protein {}, SeqProp {}: unable to translate feature {} into letter annotation'.format(protein.id, protein.representative_sequence.id, site))
                continue
            feat_letter_anno = []
            for x in range(protein.representative_sequence.seq_len):
                if x in positions:
                    idx = positions.index(x)
                    if 'description' in feature[idx].qualifiers:
                        feat_letter_anno.append(feature[idx].qualifiers['description'])
                    else:
                        feat_letter_anno.append(True)
                else:
                    feat_letter_anno.append(False)
            protein.representative_sequence.letter_annotations[site] = feat_letter_anno
93013
def _init_map(self):
        """"""
        DecimalValuesFormRecord._init_map(self)
        IntegerValuesFormRecord._init_map(self)
        TextAnswerFormRecord._init_map(self)
        super(MultiLanguageCalculationInteractionFeedbackAndFilesAnswerFormRecord, self)._init_map()
        self.my_osid_object_form._my_map['toleranceMode'] = \
            self._tolerance_mode_metadata['default_string_values'][0]
1122319
def _init_map(self, record_types=None, **kwargs):
        """"""
        osid_objects.OsidCatalogForm._init_map(self, record_types, **kwargs)
1196226
void initIRGB(int[] pTemp) {
        final int x = (1 << TRUNCBITS);        // 8 the size of 1 Dimension of each quantized cell
        final int xsqr = 1 << (TRUNCBITS * 2); // 64 - twice the smallest step size vale of quantized colors
        final int xsqr2 = xsqr + xsqr;

        for (int i = 0; i < numColors; ++i) {
            if (i == transparentIndex) {
                // Skip the transparent pixel
                continue;
            }

            int red, r, rdist, rinc, rxx;
            int green, g, gdist, ginc, gxx;
            int blue, b, bdist, binc, bxx;

            // HaraldK 20040801: Added support for int[]
            if (rgbMapByte != null) {
                red = rgbMapByte[i * 4] & 0xFF;
                green = rgbMapByte[i * 4 + 1] & 0xFF;
                blue = rgbMapByte[i * 4 + 2] & 0xFF;
            }
            else if (rgbMapInt != null) {
                red = (rgbMapInt[i] >> 16) & 0xFF;
                green = (rgbMapInt[i] >> 8) & 0xFF;
                blue = rgbMapInt[i] & 0xFF;
            }
            else {
                throw new IllegalStateException("colormap == null");
            }

            rdist = red - x / 2;   // distance of red to center of current cell
            gdist = green - x / 2; // green
            bdist = blue - x / 2;  // blue
            rdist = rdist * rdist + gdist * gdist + bdist * bdist;

            rinc = 2 * (xsqr - (red << TRUNCBITS));
            ginc = 2 * (xsqr - (green << TRUNCBITS));
            binc = 2 * (xsqr - (blue << TRUNCBITS));

            int rgbI = 0;
            for (r = 0, rxx = rinc; r < MAXQUANTVAL; rdist += rxx, ++r, rxx += xsqr2) {
                for (g = 0, gdist = rdist, gxx = ginc; g < MAXQUANTVAL; gdist += gxx, ++g, gxx += xsqr2) {
                    for (b = 0, bdist = gdist, bxx = binc; b < MAXQUANTVAL; bdist += bxx, ++b, ++rgbI, bxx += xsqr2) {
                        if (i == 0 || pTemp[rgbI] > bdist) {
                            pTemp[rgbI] = bdist;
                            inverseRGB[rgbI] = (byte) i;
                        }
                    }
                }
            }
        }
    }
473075
def _init_map(self):
        """"""
        ItemTextsFormRecord._init_map(self)
        ItemFilesFormRecord._init_map(self)
        edXBaseFormRecord._init_map(self)
        IRTItemFormRecord._init_map(self)
        TimeValueFormRecord._init_map(self)
        ProvenanceFormRecord._init_map(self)
        super(edXItemFormRecord, self)._init_map()
112166
def rename_sequences(self, mapping, new_path=None, in_place=False):
        """"""
        # Where is the new file #
        if new_path is None: new_fasta = self.__class__(new_temp_path())
        else:                new_fasta = self.__class__(new_path)
        # Do it #
        new_fasta.create()
        for seq in self:
            new_name = mapping[seq.description]
            nucleotides = str(seq.seq)
            new_fasta.add_str(nucleotides, new_name)
        new_fasta.close()
        # Return #
        if in_place:
            os.remove(self.path)
            shutil.move(new_fasta, self.path)
            return self
        else: return new_fasta
1273679
public void init(Node segref, String path, char predelim0, char predelim1, StringBuffer res, Document document,
                     HashMap<String, String> predefs, HashMap<String, String> valids) {
        super.init(segref, path, predelim0, predelim1, res, document, predefs, valids);
    }
862174
def initialize(
            self, M_c, M_r, T, seed, initialization=b'from_the_prior',
            row_initialization=-1, n_chains=1,
            ROW_CRP_ALPHA_GRID=(), COLUMN_CRP_ALPHA_GRID=(),
            S_GRID=(), MU_GRID=(), N_GRID=31,):
        
        # FIXME: why is M_r passed?
        arg_tuples = self.get_initialize_arg_tuples(
            M_c, M_r, T, initialization, row_initialization, n_chains,
            ROW_CRP_ALPHA_GRID, COLUMN_CRP_ALPHA_GRID, S_GRID, MU_GRID, N_GRID,
            make_get_next_seed(seed),)

        chain_tuples = self.mapper(self.do_initialize, arg_tuples)
        X_L_list, X_D_list = zip(*chain_tuples)
        if n_chains == 1:
            X_L_list, X_D_list = X_L_list[0], X_D_list[0]

        return X_L_list, X_D_list
447691
def _init_map(self, record_types=None):
        """"""
        OsidForm._init_map(self)
        self._my_map['displayName'] = dict(self._display_name_default)
        self._my_map['description'] = dict(self._description_default)
        self._my_map['genusTypeId'] = self._genus_type_default
        OsidExtensibleForm._init_map(self, record_types)
187927
public Map<Frame, Sequence<AminoAcidCompound>> multipleFrameTranslation(
			Sequence<NucleotideCompound> dna, Frame... frames) {
		Map<Frame, Sequence<AminoAcidCompound>> results = new EnumMap<Frame, Sequence<AminoAcidCompound>>(
				Frame.class);
		for (Frame frame : frames) {
			Sequence<NucleotideCompound> rna = getDnaRnaTranslator()
					.createSequence(dna, frame);
			Sequence<AminoAcidCompound> peptide = getRnaAminoAcidTranslator()
					.createSequence(rna);
			results.put(frame, peptide);
		}
		return results;
	}