int n = msa.getSize(); DistanceMatrix DM = new BasicSymmetricalDistanceMatrix(n); int totalloopcount = (n / 2) * (n + 1); int end = msa.getLength(); sequenceString[i] = msa.getAlignedSequence(i + 1) .getSequenceAsString(); List<C> seqs = msa.getAlignedSequences(); DM.setValue(i, j, 0.0); else { double dS = (M.getMaxValue() - score / msa.getLength()) / (M.getMaxValue() - M.getMinValue());
String aligIndFormat = "%-" + Math.max(1, width / 2) + "d %" + Math.max(1, width - (width / 2) - 1) + "d%n"; for (int i = 0; i < getLength(); i += width) { int start = i + 1, end = Math.min(getLength(), i + width); if (i > 0) { s.append(String.format("%n")); counter++; if (webDisplay && sequences.size() == 2) { printSequenceAlignmentWeb(s, counter, idFormat, start, end); } else { if (idFormat != null) { printConservation(s, idFormat, start, end, webDisplay); s.append(String.format(idFormat, as.getAccession())); for (int i = 0; i < getLength(); i += width) { int start = i + 1, end = Math.min(getLength(), i + width); s.append(as.getSubSequence(start, end).getSequenceAsString()); s.append(String.format("%n"));
int n = msa.getSize(); String[] sequenceString = new String[n]; for (int i = 0; i < n; i++) { sequenceString[i] = msa.getAlignedSequence(i + 1) .getSequenceAsString(); logger.info("{}:{}", "Determining Distances", (loopcount * 100) / totalloopcount); distance.setIdentifier(i, msa.getAlignedSequence(i + 1) .getAccession().getID());
/** * Convert a BioJava {@link MultipleSequenceAlignment} to a forester * {@link Msa}. The easiest way to convert them is writting the msa as a * FASTA file and then parsing it with the forester {@link FastaParser}. * * @param msa * BioJava MultipleSequenceAlignment * @return forester Msa object * @throws IOException * if the conversion was not possible */ public static <C extends Sequence<D>, D extends Compound> Msa convert( MultipleSequenceAlignment<C, D> msa) throws IOException { // Convert the biojava MSA to a FASTA String OutputStream os = new ByteArrayOutputStream(); FastaWriter<C, D> fastaW = new FastaWriter<C, D>(os, msa.getAlignedSequences(), new FastaHeaderFormatInterface<C, D>() { @Override public String getHeader(C sequence) { return sequence.getAccession().toString(); }; }); fastaW.process(); String fastaMSA = os.toString(); // Parse the FASTA file in forester return FastaParser.parseMsa(fastaMSA); }
MultipleSequenceAlignment<ProteinSequence, AminoAcidCompound> msa = new MultipleSequenceAlignment<ProteinSequence, AminoAcidCompound>(); ProteinSequence pseq = new ProteinSequence(seqs.get(i)); pseq.setAccession(acc); msa.addAlignedSequence(pseq);
/** * * @param s * @param counter * @param idFormat * @param start * @param end */ private void printSequenceAlignmentWeb(StringBuilder s, int counter, String idFormat, int start, int end) { S as = sequences.get(counter - 1), seq1 = sequences.get(0), seq2 = sequences.get(1); if (idFormat != null) { s.append(String.format(idFormat, as.getAccession())); } String mySeq = as.getSubSequence(start, end).getSequenceAsString(); String s1 = seq1.getSubSequence(start, end).getSequenceAsString(); String s2 = seq2.getSubSequence(start, end).getSequenceAsString(); CompoundSet<C> cs = getCompoundSet(); for (int i = 0; i < s1.length(); i++) { if (i >= s2.length() || i >= mySeq.length()) break; char c1 = s1.charAt(i); char c2 = s2.charAt(i); char c = mySeq.charAt(i); s.append(IOUtils.getPDBCharacter(true, c1, c2, cs.compoundsEquivalent(seq1.getCompoundAt(i), seq2.getCompoundAt(i)), c)); } s.append(String.format("%n")); }
int n = msa.getSize(); DistanceMatrix DM = new BasicSymmetricalDistanceMatrix(n); int totalloopcount = (n / 2) * (n + 1); int end = msa.getLength(); sequenceString[i] = msa.getAlignedSequence(i + 1) .getSequenceAsString(); List<C> seqs = msa.getAlignedSequences(); DM.setValue(i, j, 0.0); else { double dS = (M.getMaxValue() - score / msa.getLength()) / (M.getMaxValue() - M.getMinValue());
String aligIndFormat = "%-" + Math.max(1, width / 2) + "d %" + Math.max(1, width - (width / 2) - 1) + "d%n"; for (int i = 0; i < getLength(); i += width) { int start = i + 1, end = Math.min(getLength(), i + width); if (i > 0) { s.append(String.format("%n")); counter++; if (webDisplay && sequences.size() == 2) { printSequenceAlignmentWeb(s, counter, idFormat, start, end); } else { if (idFormat != null) { printConservation(s, idFormat, start, end, webDisplay); s.append(String.format(idFormat, as.getAccession())); for (int i = 0; i < getLength(); i += width) { int start = i + 1, end = Math.min(getLength(), i + width); s.append(as.getSubSequence(start, end).getSequenceAsString()); s.append(String.format("%n"));
int n = msa.getSize(); String[] sequenceString = new String[n]; for (int i = 0; i < n; i++) { sequenceString[i] = msa.getAlignedSequence(i + 1) .getSequenceAsString(); logger.info("{}:{}", "Determining Distances", (loopcount * 100) / totalloopcount); distance.setIdentifier(i, msa.getAlignedSequence(i + 1) .getAccession().getID());
/** * Convert a BioJava {@link MultipleSequenceAlignment} to a forester * {@link Msa}. The easiest way to convert them is writting the msa as a * FASTA file and then parsing it with the forester {@link FastaParser}. * * @param msa * BioJava MultipleSequenceAlignment * @return forester Msa object * @throws IOException * if the conversion was not possible */ public static <C extends Sequence<D>, D extends Compound> Msa convert( MultipleSequenceAlignment<C, D> msa) throws IOException { // Convert the biojava MSA to a FASTA String OutputStream os = new ByteArrayOutputStream(); FastaWriter<C, D> fastaW = new FastaWriter<C, D>(os, msa.getAlignedSequences(), new FastaHeaderFormatInterface<C, D>() { @Override public String getHeader(C sequence) { return sequence.getAccession().toString(); }; }); fastaW.process(); String fastaMSA = os.toString(); // Parse the FASTA file in forester return FastaParser.parseMsa(fastaMSA); }
/** * * @param s * @param idFormat * @param start * @param end * @param webDisplay */ private void printConservation(StringBuilder s, String idFormat, int start, int end, boolean webDisplay) { S seq1 = sequences.get(0), seq2 = sequences.get(1); if (idFormat != null) { AccessionID ac1 = sequences.get(0).getAccession(); String id1 = (ac1 == null) ? "null" : ac1.getID(); id1 = id1.replaceAll(".", " "); s.append(String.format(idFormat, id1)); } String s1 = seq1.getSubSequence(start, end).getSequenceAsString(); String s2 = seq2.getSubSequence(start, end).getSequenceAsString(); CompoundSet<C> cs = getCompoundSet(); for (int i = 0; i < s1.length(); i++) { if (i >= s2.length()) break; char c1 = s1.charAt(i); char c2 = s2.charAt(i); s.append(IOUtils.getPDBConservation(webDisplay, c1, c2, cs.compoundsEquivalent(seq1.getCompoundAt(i), seq2.getCompoundAt(i)))); } s.append(String.format("%n")); }
int n = msa.getSize(); DistanceMatrix DM = new BasicSymmetricalDistanceMatrix(n); int totalloopcount = (n / 2) * (n + 1); int end = msa.getLength(); sequenceString[i] = msa.getAlignedSequence(i + 1) .getSequenceAsString(); List<C> seqs = msa.getAlignedSequences(); DM.setValue(i, j, 0.0); else { double dS = (M.getMaxValue() - score / msa.getLength()) / (M.getMaxValue() - M.getMinValue());
int n = msa.getSize(); String[] sequenceString = new String[n]; for (int i = 0; i < n; i++) { sequenceString[i] = msa.getAlignedSequence(i + 1) .getSequenceAsString(); logger.info("{}:{}", "Determining Distances", (loopcount * 100) / totalloopcount); distance.setIdentifier(i, msa.getAlignedSequence(i + 1) .getAccession().getID());
/** * Convert a BioJava {@link MultipleSequenceAlignment} to a forester * {@link Msa}. The easiest way to convert them is writting the msa as a * FASTA file and then parsing it with the forester {@link FastaParser}. * * @param msa * BioJava MultipleSequenceAlignment * @return forester Msa object * @throws IOException * if the conversion was not possible */ public static <C extends Sequence<D>, D extends Compound> Msa convert( MultipleSequenceAlignment<C, D> msa) throws IOException { // Convert the biojava MSA to a FASTA String OutputStream os = new ByteArrayOutputStream(); FastaWriter<C, D> fastaW = new FastaWriter<C, D>(os, msa.getAlignedSequences(), new FastaHeaderFormatInterface<C, D>() { @Override public String getHeader(C sequence) { return sequence.getAccession().toString(); }; }); fastaW.process(); String fastaMSA = os.toString(); // Parse the FASTA file in forester return FastaParser.parseMsa(fastaMSA); }
/** * * @param s * @param idFormat * @param start * @param end * @param webDisplay */ private void printConservation(StringBuilder s, String idFormat, int start, int end, boolean webDisplay) { S seq1 = sequences.get(0), seq2 = sequences.get(1); if (idFormat != null) { AccessionID ac1 = sequences.get(0).getAccession(); String id1 = (ac1 == null) ? "null" : ac1.getID(); id1 = id1.replaceAll(".", " "); s.append(String.format(idFormat, id1)); } String s1 = seq1.getSubSequence(start, end).getSequenceAsString(); String s2 = seq2.getSubSequence(start, end).getSequenceAsString(); CompoundSet<C> cs = getCompoundSet(); for (int i = 0; i < s1.length(); i++) { if (i >= s2.length()) break; char c1 = s1.charAt(i); char c2 = s2.charAt(i); s.append(IOUtils.getPDBConservation(webDisplay, c1, c2, cs.compoundsEquivalent(seq1.getCompoundAt(i), seq2.getCompoundAt(i)))); } s.append(String.format("%n")); }
int n = msa.getSize(); String[] sequenceString = new String[n]; for (int i = 0; i < n; i++) { sequenceString[i] = msa.getAlignedSequence(i + 1) .getSequenceAsString(); List<C> seqs = msa.getAlignedSequences(); int end = msa.getLength(); int loopcount = 0; DM.setIdentifier(i, msa.getAlignedSequence(i + 1).getAccession() .getID());
/** * * @param s * @param counter * @param idFormat * @param start * @param end */ private void printSequenceAlignmentWeb(StringBuilder s, int counter, String idFormat, int start, int end) { S as = sequences.get(counter - 1), seq1 = sequences.get(0), seq2 = sequences.get(1); if (idFormat != null) { s.append(String.format(idFormat, as.getAccession())); } String mySeq = as.getSubSequence(start, end).getSequenceAsString(); String s1 = seq1.getSubSequence(start, end).getSequenceAsString(); String s2 = seq2.getSubSequence(start, end).getSequenceAsString(); CompoundSet<C> cs = getCompoundSet(); for (int i = 0; i < s1.length(); i++) { if (i >= s2.length() || i >= mySeq.length()) break; char c1 = s1.charAt(i); char c2 = s2.charAt(i); char c = mySeq.charAt(i); s.append(IOUtils.getPDBCharacter(true, c1, c2, cs.compoundsEquivalent(seq1.getCompoundAt(i), seq2.getCompoundAt(i)), c)); } s.append(String.format("%n")); }
int n = msa.getSize(); String[] sequenceString = new String[n]; for (int i = 0; i < n; i++) { sequenceString[i] = msa.getAlignedSequence(i + 1) .getSequenceAsString(); List<C> seqs = msa.getAlignedSequences(); int end = msa.getLength(); int loopcount = 0; DM.setIdentifier(i, msa.getAlignedSequence(i + 1).getAccession() .getID());