/** * Get the length of the sequence. * Lazy load for efficiency - may be called repeatedly. * * @return The length */ public int getSequenceLength() { if (sequenceLength == 0) { final String seq = getSequence(); if (seq == null) { throw new IllegalStateException("Protein sequence was NULL"); } sequenceLength = seq.length(); } return sequenceLength; }
/** * Writes out all protein matches for the specified protein (GFF formatted). * * @param protein containing matches to be written out * @return the number of rows printed (i.e. the number of Locations on Matches). * @throws java.io.IOException in the event of I/O problem writing out the file. */ public int write(Protein protein) throws IOException { List<String> proteinIdsForGFF = getProteinAccessions(protein); int sequenceLength = protein.getSequenceLength(); String md5 = protein.getMd5(); String date = dmyFormat.format(new Date()); Set<Match> matches = protein.getMatches(); //Write sequence region information for (String proteinIdForGFF: proteinIdsForGFF) { if (matches.size() > 0) { //Check if protein accessions are GFF3 valid proteinIdForGFF = ProteinMatchesGFFResultWriter.getValidGFF3SeqId(proteinIdForGFF); //Write sequence-region super.gffWriter.write("##sequence-region " + proteinIdForGFF + " 1 " + sequenceLength); if (writeFullGFF) { writeReferenceLine(proteinIdForGFF, sequenceLength, md5); addFASTASeqToMap(proteinIdForGFF, protein.getSequence()); } processMatches(matches, proteinIdForGFF, date, protein, proteinIdForGFF, writeFullGFF); }//end match size check } return 0; }
/** * Writes out all protein matches for the specified protein (GFF formatted). * * @param protein containing matches to be written out * @return the number of rows printed (i.e. the number of Locations on Matches). * @throws java.io.IOException in the event of I/O problem writing out the file. */ public int write(Protein protein) throws IOException { List<String> proteinIdsForGFF = getProteinAccessions(protein); int sequenceLength = protein.getSequenceLength(); String md5 = protein.getMd5(); String date = dmyFormat.format(new Date()); Set<Match> matches = protein.getMatches(); //Write sequence region information for (String proteinIdForGFF: proteinIdsForGFF) { if (matches.size() > 0) { //Check if protein accessions are GFF3 valid proteinIdForGFF = ProteinMatchesGFFResultWriter.getValidGFF3SeqId(proteinIdForGFF); //Write sequence-region super.gffWriter.write("##sequence-region " + proteinIdForGFF + " 1 " + sequenceLength); if (writeFullGFF) { writeReferenceLine(proteinIdForGFF, sequenceLength, md5); addFASTASeqToMap(proteinIdForGFF, protein.getSequence()); } processMatches(matches, proteinIdForGFF, date, protein, proteinIdForGFF, writeFullGFF); }//end match size check } return 0; }
@XmlElement(name = "sequence") private Sequence getSequenceObject() { return new Sequence(getSequence(), getMd5()); }
final String sequence = protein.getSequence(); final String crc64 = getCrc64(sequence); String date = dmyFormat.format(new Date());
String seq = protein.getSequence();
final String sequence = protein.getSequence(); final String crc64 = getCrc64(sequence); String date = dmyFormat.format(new Date());
/** * Returns sequence alignment. * * @return Sequence alignment. */ @XmlElement(required = true) public String getAlignment() { if (cigarAlignment == null) { return null; } AlignmentEncoder encoder = new CigarAlignmentEncoder(); return encoder.decode(getMatch().getProtein().getSequence(), cigarAlignment, getStart(), getEnd()); }
addFASTASeqToMap(proteinIdForGFF, protein.getSequence());
/** * Returns sequence alignment. * * @return Sequence alignment. */ @XmlElement(required = true) public String getAlignment() { if (cigarAlignment == null) { return null; } AlignmentEncoder encoder = new CigarAlignmentEncoder(); return encoder.decode(getMatch().getProtein().getSequence(), cigarAlignment, getStart(), getEnd()); }
addFASTASeqToMap(proteinIdForGFF, protein.getSequence());
throw new IllegalStateException("Cannot access the Protein via the protein primary key from the RawProtein object."); final String sequence = protein.getSequence(); final boolean tyrosineOK = SMART_TYR_REGEX.matcher(sequence).matches(); final boolean serineThreonineOK = SMART_SER_THR_REGEX.matcher(sequence).matches();
final int sequenceLength = protein.getSequence().length(); final int endIndex = (locEnd > sequenceLength) ? sequenceLength : locEnd; addFASTASeqToMap(matchIdLocation.toString(), protein.getSequence().substring(locStart - 1, endIndex));
final int sequenceLength = protein.getSequence().length(); final int endIndex = (locEnd > sequenceLength) ? sequenceLength : locEnd; addFASTASeqToMap(matchIdLocation.toString(), protein.getSequence().substring(locStart - 1, endIndex));
addFASTASeqToMap(proteinIdForGFF, protein.getSequence());
addFASTASeqToMap(proteinIdForGFF, protein.getSequence());