-
Notifications
You must be signed in to change notification settings - Fork 3
HOWTO: Extract 2D structure from 3D coordinates
Tomasz Żok edited this page Oct 27, 2020
·
1 revision
The following snippet shows how to extract base pairs from 3D coordinates and what can be done with that information:
// get chain A only
final PdbModel model;
final PdbChain chain =
model.chains().stream()
.filter(pdbChain -> "A".equals(pdbChain.identifier()))
.findFirst()
.orElseThrow(RuntimeException::new);
// extract base pairs
final BpSeq bpSeq = CanonicalStructureExtractor.bpSeq(chain);
System.out.println("Pairs: " + bpSeq.paired().size());
// remove isolated base pairs
final BpSeq withoutIsolatedPairs = bpSeq.withoutIsolatedPairs();
System.out.println("Non-isolated pairs: " + withoutIsolatedPairs.paired().size());
// find stems
final List<Region> regions = Region.createRegions(withoutIsolatedPairs);
System.out.println("Stems: " + regions.size());
regions.forEach(
region ->
System.out.printf(
" %d-%d [length=%d]%n", region.begin(), region.end(), region.length()));
// convert to CT format
final Ct ct = Ct.fromBpSeq(bpSeq);
System.out.println("Strands: " + ct.strandCount());
// convert to dot-bracket
final Converter converter = ImmutableDefaultConverter.of();
final DotBracket dotBracket = converter.convert(bpSeq);
System.out.println("Pseudoknot order: " + dotBracket.pseudoknotOrder());
System.out.println("Dot-bracket:\n\n" + dotBracket);
The result:
Pairs: 8
Non-isolated pairs: 5
Stems: 2
7-22 [length=3]
12-33 [length=2]
Strands: 1
Pseudoknot order: 2
Dot-bracket:
>strand
gGAACCGGUGCGCAUAACCACCUCAGUGCGAGCAA
......(((.{[[....[[)))...].].}.]]..