use of javafx.scene.control.TableView in project jvarkit by lindenb.
the class BamStage method createCigarElementTable.
/* create table of CigarElement */
private TableView<CigarElement> createCigarElementTable() {
final TableView<CigarElement> table = new TableView<>();
table.getColumns().add(makeColumn("Op.", O -> O.getOperator().name()));
table.getColumns().add(makeColumn("Length", param -> param.getLength()));
table.setPlaceholder(new Label("No Cigar"));
return table;
}
use of javafx.scene.control.TableView in project jvarkit by lindenb.
the class BamStage method createSuplAlignTable.
/**
* supplementary align table ...
*/
private TableView<SuplementaryAlign> createSuplAlignTable() {
final TableView<SuplementaryAlign> table = new TableView<>();
table.getColumns().add(makeColumn("REF", O -> O.contig));
table.getColumns().add(formatIntegerColumn(makeColumn("POS", O -> O.pos)));
table.getColumns().add(makeColumn("Strand", O -> O.strand));
table.getColumns().add(makeColumn("NM", O -> O.nm));
table.getColumns().add(makeColumn("MAPQ", O -> O.mapq));
table.getColumns().add(makeColumn("Cigar", O -> O.cigar));
table.setPlaceholder(new Label("No Read or no \"SA\" tag."));
return table;
}
use of javafx.scene.control.TableView in project jvarkit by lindenb.
the class NgsStage method buildDictTab.
/**
* build a table view for a Dictionary
*/
protected Tab buildDictTab(final SAMSequenceDictionary dict) {
/* build dict Table */
final TableView<SAMSequenceRecord> table = new TableView<>(dict == null ? FXCollections.observableArrayList() : FXCollections.observableArrayList(dict.getSequences()));
table.getColumns().add(makeColumn("Name", SSR -> SSR.getSequenceName()));
table.getColumns().add(formatIntegerColumn(makeColumn("Length", SSR -> SSR.getSequenceLength())));
final Set<String> all_attributes = new HashSet<>();
for (final SAMSequenceRecord ssr : dict.getSequences()) {
all_attributes.addAll(ssr.getAttributes().stream().map(A -> A.getKey()).filter(S -> !(S.equals("Name") || S.equals("Length"))).collect(Collectors.toSet()));
}
for (final String key : all_attributes) {
if (dict.getSequences().stream().filter(S -> S.getSpecies() != null && !S.getSpecies().trim().isEmpty()).findAny().isPresent()) {
table.getColumns().add(makeColumn(key, SSR -> SSR.getAttribute(key)));
}
}
final Tab tab = new Tab("Dict", table);
tab.setClosable(false);
table.setPlaceholder(new Label("No Dictionary."));
return tab;
}
use of javafx.scene.control.TableView in project jvarkit by lindenb.
the class VcfStage method buildGenotypeTableRow.
/**
* build Genotype table
*/
private TableView<Genotype> buildGenotypeTableRow(final VCFHeader header) {
final TableView<Genotype> table = new TableView<Genotype>();
/* sample */
table.getColumns().add(makeColumn("Sample", G -> G.getSampleName()));
for (final VCFFormatHeaderLine h : header.getFormatHeaderLines()) {
final TableColumn<Genotype, String> newcol = new TableColumn<>(h.getID());
newcol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Genotype, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(CellDataFeatures<Genotype, String> param) {
final String delim;
Object o;
if (param.getTableColumn().getText().equals(VCFConstants.GENOTYPE_KEY)) {
delim = param.getValue().isPhased() ? "|" : "/";
o = param.getValue().getAlleles().stream().map(A -> allele2stringConverter.apply(A)).collect(Collectors.toList());
} else {
delim = ",";
o = param.getValue().getAnyAttribute(param.getTableColumn().getText());
}
if (o == null) {
return new ReadOnlyObjectWrapper<String>(null);
}
if (o instanceof List) {
List<?> L = (List<?>) o;
o = L.stream().map(S -> String.valueOf(S)).collect(Collectors.joining(delim)).toString();
}
return new ReadOnlyObjectWrapper<String>(String.valueOf(o));
}
});
table.getColumns().add(newcol);
}
/* type */
table.getColumns().add(makeColumn("Type", G -> G.getType().name()));
table.setPlaceholder(new Label("No Genotype."));
return table;
}
use of javafx.scene.control.TableView in project jvarkit by lindenb.
the class VcfStage method buildInfoTableRow.
/**
* build INFO table
*/
private TableView<InfoTableRow> buildInfoTableRow() {
final TableView<InfoTableRow> table = new TableView<>();
table.getColumns().add(makeColumn("Key", R -> R.key));
table.getColumns().add(makeColumn("Index", R -> R.index));
final TableColumn<InfoTableRow, Object> t = makeColumn("Value", R -> R.value);
t.setPrefWidth(300.0);
table.getColumns().add(t);
table.setPlaceholder(new Label("No INFO."));
return table;
}
Aggregations