bio_flutter 0.0.9 copy "bio_flutter: ^0.0.9" to clipboard
bio_flutter: ^0.0.9 copied to clipboard

Cross-platform representation and visualization of biological data in flutter

example/example.dart

import 'package:bio_flutter/bio_flutter.dart';
import 'package:flutter/material.dart';

List<Protein> sampleData() {
  Taxonomy human = const Taxonomy(id: 9606, name: "Homo sapiens", family: "Hominidae");
  Taxonomy lyssaVirus = const Taxonomy(id: 11286, name: "Lyssavirus", family: "Rhabdoviridae");
  return [
    Protein("Seq1", sequence: Sequence.buildVerifiedFromString("SEQWENCE")!, taxonomy: human),
    Protein("Seq2", sequence: Sequence.buildVerifiedFromString("PRTEIN")!, taxonomy: lyssaVirus),
    Protein("Seq3", sequence: Sequence.buildVerifiedFromString("SEQVENCEPRTEI")!, taxonomy: human),
    Protein("Seq4", sequence: Sequence.buildVerifiedFromString("SEQ")!, taxonomy: lyssaVirus),
    Protein("Seq5", sequence: Sequence.buildVerifiedFromString("PRTEINSEQWENCE")!, taxonomy: lyssaVirus)
  ];
}

void main() {
  final List<Protein> proteinExampleData = sampleData();
  runApp(BioFlutterUMAPExample(
    proteinExampleData: proteinExampleData,
  ));
}

class BioFlutterUMAPExample extends StatelessWidget {
  final List<Protein> proteinExampleData;

  const BioFlutterUMAPExample({super.key, required this.proteinExampleData});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'bio_flutter UMAP Example',
      theme: ThemeData(
        useMaterial3: false,
        primaryColor: const Color(0xFF321F5D),
        fontFamily: 'Georgia',
      ),
      home: UMAPViewerPage(proteinExampleData: proteinExampleData),
    );
  }
}

class UMAPViewerPage extends StatelessWidget {
  final List<Protein> proteinExampleData;

  const UMAPViewerPage({super.key, required this.proteinExampleData});

  @override
  Widget build(BuildContext context) {
    return Center(
        child: ProjectionVisualizer2D(
      projectionData: ProjectionData.random(proteinExampleData.length, 2),
      pointData: proteinExampleData
          .map((protein) =>
              Map.fromEntries(protein.toMap().entries.map((entry) => MapEntry(entry.key, entry.value.toString()))))
          .toList(),
      pointIdentifierKey: "id",
    ));
  }
}
2
likes
130
points
85
downloads

Publisher

verified publisherbiocentral.cloud

Weekly Downloads

Cross-platform representation and visualization of biological data in flutter

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

async, equatable, fl_chart, flutter, fpdart, ml_linalg, universal_html, universal_io, vector_math

More

Packages that depend on bio_flutter