private CompoundSet<NucleotideCompound> getDnaCompounds() { if (dnaCompounds != null) { return dnaCompounds; } return AmbiguityDNACompoundSet.getDNACompoundSet(); }
private CompoundSet<NucleotideCompound> getDnaCompounds() { if (dnaCompounds != null) { return dnaCompounds; } return AmbiguityDNACompoundSet.getDNACompoundSet(); }
private static SubstitutionMatrix<NucleotideCompound> getNucleotideMatrix(String file) { if (!nucleotideMatrices.containsKey(file)) { nucleotideMatrices.put(file, new SimpleSubstitutionMatrix<NucleotideCompound>( AmbiguityDNACompoundSet.getDNACompoundSet(), getReader(file), file)); } return nucleotideMatrices.get(file); }
private static SubstitutionMatrix<NucleotideCompound> getNucleotideMatrix(String file) { if (!nucleotideMatrices.containsKey(file)) { nucleotideMatrices.put(file, new SimpleSubstitutionMatrix<NucleotideCompound>( AmbiguityDNACompoundSet.getDNACompoundSet(), getReader(file), file)); } return nucleotideMatrices.get(file); }
private DNASequence getRawParentSequence(String accessId) throws IOException { String seqUrlTemplate = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=%s&rettype=fasta&retmode=text"; URL url = new URL(String.format(seqUrlTemplate, accessId)); logger.trace("Getting parent DNA sequence from URL: {}", url.toString()); InputStream is = url.openConnection().getInputStream(); FastaReader<DNASequence, NucleotideCompound> parentReader = new FastaReader<DNASequence, NucleotideCompound>(is, new PlainFastaHeaderParser<DNASequence, NucleotideCompound>(), new DNASequenceCreator(AmbiguityDNACompoundSet.getDNACompoundSet())); LinkedHashMap<String, DNASequence> seq = parentReader.process(); DNASequence parentSeq = null; if (seq.size() == 1) { parentSeq = seq.values().iterator().next(); } is.close(); return parentSeq; }
private DNASequence getRawParentSequence(String accessId) throws IOException { String seqUrlTemplate = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=%s&rettype=fasta&retmode=text"; URL url = new URL(String.format(seqUrlTemplate, accessId)); logger.trace("Getting parent DNA sequence from URL: {}", url.toString()); InputStream is = url.openConnection().getInputStream(); FastaReader<DNASequence, NucleotideCompound> parentReader = new FastaReader<DNASequence, NucleotideCompound>(is, new PlainFastaHeaderParser<DNASequence, NucleotideCompound>(), new DNASequenceCreator(AmbiguityDNACompoundSet.getDNACompoundSet())); LinkedHashMap<String, DNASequence> seq = parentReader.process(); DNASequence parentSeq = null; if (seq.size() == 1) { parentSeq = seq.values().iterator().next(); } is.close(); return parentSeq; }
/** * Determines GCG type * @param cs compound set of sequences * @return GCG type */ public static <C extends Compound> String getGCGType(CompoundSet<C> cs) { return (cs == DNACompoundSet.getDNACompoundSet() || cs == AmbiguityDNACompoundSet.getDNACompoundSet()) ? "D" : (cs == RNACompoundSet.getRNACompoundSet() || cs == AmbiguityRNACompoundSet.getRNACompoundSet()) ? "R" : "P"; }
/** * Determines GCG type * @param cs compound set of sequences * @return GCG type */ public static <C extends Compound> String getGCGType(CompoundSet<C> cs) { return (cs == DNACompoundSet.getDNACompoundSet() || cs == AmbiguityDNACompoundSet.getDNACompoundSet()) ? "D" : (cs == RNACompoundSet.getRNACompoundSet() || cs == AmbiguityRNACompoundSet.getRNACompoundSet()) ? "R" : "P"; }
private Sequence<NucleotideCompound> getNucleotideSequence(String seq) { Sequence<NucleotideCompound> s = null; // first we try DNA, then RNA, them hybrid try { s = new DNASequence(seq, AmbiguityDNACompoundSet.getDNACompoundSet()); } catch (CompoundNotFoundException e){ try { s= new RNASequence(seq, AmbiguityRNACompoundSet.getRNACompoundSet()); } catch (CompoundNotFoundException ex) { try { // it could still be a hybrid, e.g. 3hoz, chain T, what to do in that case? s = new DNASequence(seq, AmbiguityDNARNAHybridCompoundSet.getDNARNAHybridCompoundSet()); logger.warn("Hybrid RNA/DNA sequence detected for sequence {}", seq); } catch (CompoundNotFoundException exc) { // not DNA, nor RNA, nor hybrid logger.warn("Could not determine compound set (neither DNA, RNA nor hybrid) for nucleotide sequence " + seq); return null; } } } return s; }
private SequencePair<DNASequence, NucleotideCompound> getPairwiseAlignment(String seq1, String seq2) { DNASequence target = null; DNASequence query = null; try { target = new DNASequence(seq1, AmbiguityDNACompoundSet.getDNACompoundSet()); query = new DNASequence(seq2, AmbiguityDNACompoundSet.getDNACompoundSet()); } catch (CompoundNotFoundException e) { String msg = "Error when creating DNASequence objects for " + seq1 + " and " + seq2 + " prior to pairwise " + "sequence alignment"; logger.error(msg, e); throw new VariantNormalizerException(msg, e); } SubstitutionMatrix<NucleotideCompound> substitutionMatrix = SubstitutionMatrixHelper.getNuc4_4(); SimpleGapPenalty gapP = new SimpleGapPenalty(); gapP.setOpenPenalty((short)5); gapP.setExtensionPenalty((short)2); SequencePair<DNASequence, NucleotideCompound> psa = Alignments.getPairwiseAlignment(query, target, Alignments.PairwiseSequenceAlignerType.GLOBAL, gapP, substitutionMatrix); return psa; }
subMatrix = temp; } else if (cs == AmbiguityDNACompoundSet.getDNACompoundSet()) { @SuppressWarnings("unchecked") // compound types must be equal since compound sets are equal SubstitutionMatrix<C> temp = (SubstitutionMatrix<C>) SubstitutionMatrixHelper.getNuc4_4();
subMatrix = temp; } else if (cs == AmbiguityDNACompoundSet.getDNACompoundSet()) { @SuppressWarnings("unchecked") // compound types must be equal since compound sets are equal SubstitutionMatrix<C> temp = (SubstitutionMatrix<C>) SubstitutionMatrixHelper.getNuc4_4();