bio_flutter 0.0.9
bio_flutter: ^0.0.9 copied to clipboard
Cross-platform representation and visualization of biological data in flutter
Cross-platform representation and visualization of biological data in flutter.
Features #
Widgets:
- Projection Data Visualizer:
Biological Data Classes:
- Protein
- Sequence: AminoAcidSequence, NucleotideSequence
- Protein-Protein Interaction
- Taxonomy
Protein Representation and Data Analysis:
- Embedding: PerSequence, PerResidue
- UMAP
File handling:
Name | fasta | csv | json |
---|---|---|---|
Protein | ✅ | ❌ | ❌ |
ProteinProteinInteraction | ✅ | ❌ | ❌ |
Embedding | ❌ | ❌ | ✅ |
ProjectionData | ❌ | ✅ | ❌ |
CustomAttributes | ❌ | ✅ | ❌ |
Usage #
Load and write a protein fasta file:
import 'package:flutter_test/flutter_test.dart';
Future<List<Protein>> readFastaFileProtein(String pathToFile) async {
BioFileHandlerContext<Protein>? handler = BioFileHandler<Protein>().create(pathToFile);
Map<String, Protein> proteins = await handler.read();
return proteins.values.toList();
}
Future<void> saveProteins(List<Protein> proteins, String pathToFile) async {
// Saves the file on desktop/mobile, downloads on web
BioFileHandlerContext<Protein>? handler = BioFileHandler<Protein>().create(pathToFile);
await handler.write(proteins.asMap().map((_, value) => MapEntry(value.id, value)));
}
Add custom attributes to your proteins:
import 'package:flutter_test/flutter_test.dart';
Future<List<Protein>> addCustomAttributes(List<Protein> proteins, String pathToFile) async {
BioFileHandlerContext<CustomAttributes>? handler = BioFileHandler<CustomAttributes>().create(pathToFile);
Map<String, CustomAttributes> attributes = await handler.read();
List<Protein> updatedProteins = [];
for (Protein protein in proteins) {
if (attributes.containsKey(protein.id)) {
Protein updated = protein.updateFromCustomAttributes(attributes[protein.id]!);
updatedProteins.add(updated);
}
}
return updatedProteins;
}
Create a UMAP Visualizer Widget with random coordinates:
Widget createProjectionWidget(List<ProteinProteinInteraction> interactionData) {
return ProjectionVisualizer(
projectionData: ProjectionData.random(interactionData.length),
pointIdentifierKey: "id",
pointData: interactionData.map((interaction) => interaction.toMap()).toList()); // Also works with protein data
}
Additional information #
The correctness of the provided operations is the most important focus of this package in order to be useful for scientists and practitioners in research and development. We are grateful for every reported bug and contribution to the codebase on GitHub!
Current Roadmap:
- Increase test coverage
- Improve documentation
- Support more file formats for all data types
- Add 3D protein visualization