All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.poznan.put.structure.formats.CombinedStrand Maven / Gradle / Ivy

package pl.poznan.put.structure.formats;

import org.immutables.value.Value;
import pl.poznan.put.structure.DotBracketSymbol;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/** A dot-bracket encoded structure made from combining one or more strands. */
@Value.Immutable
public abstract class CombinedStrand extends AbstractCombinedStrand {
  /** @return The list of input strands. */
  @Override
  @Value.Parameter(order = 1)
  protected abstract List inputStrands();

  @Override
  @Value.Lazy
  @Value.Auxiliary
  public List symbols() {
    return super.symbols();
  }

  @Override
  @Value.Lazy
  @Value.Auxiliary
  public List strands() {
    return super.strands();
  }

  @Override
  public final String toString() {
    final String builder = strands().stream().map(Strand::name).collect(Collectors.joining());
    return ">strand_" + builder + '\n' + sequence() + '\n' + structure();
  }

  @Override
  public final List combineStrands() {
    return Collections.singletonList(this);
  }

  @Override
  @Value.Lazy
  @Value.Auxiliary
  public Map pairs() {
    return super.pairs();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy