本文整理汇总了Java中htsjdk.samtools.SAMFileHeader.getSortOrder方法的典型用法代码示例。如果您正苦于以下问题:Java SAMFileHeader.getSortOrder方法的具体用法?Java SAMFileHeader.getSortOrder怎么用?Java SAMFileHeader.getSortOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.samtools.SAMFileHeader
的用法示例。
在下文中一共展示了SAMFileHeader.getSortOrder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadHeaders
import htsjdk.samtools.SAMFileHeader; //导入方法依赖的package包/类
private SAMFileHeader loadHeaders(){
List<SAMFileHeader> headersList = new ArrayList<SAMFileHeader>();
SAMFileHeader.SortOrder sortOrder = null;
for(AlignmentReader reader: readers){
SAMFileHeader curHeader = reader.getFileHeader();
if(curHeader != null) {
headersList.add(curHeader);
sortOrder = curHeader.getSortOrder();
}
}
if(sortOrder != null){
SamFileHeaderMerger headerMerger = new SamFileHeaderMerger(sortOrder, headersList, true);
return headerMerger.getMergedHeader();
}
return null;
}
示例2: onTraversalStart
import htsjdk.samtools.SAMFileHeader; //导入方法依赖的package包/类
@Override
public void onTraversalStart() {
final SAMFileHeader headerFromReads = getHeaderForReads();
// log some information for errors
final SAMFileHeader.SortOrder order = headerFromReads.getSortOrder();
if (order.equals(SAMFileHeader.SortOrder.coordinate) || order
.equals(SAMFileHeader.SortOrder.duplicate)) {
logger.warn(
"Input is sorted by {} and ReadTools does not handle FASTQ files in this order.",
order);
logger.warn(
"FASTQ output files are expected to be sorted by queryname, and this could cause downstream problems");
headerFromReads.setSortOrder(SAMFileHeader.SortOrder.queryname);
}
writer = outputBamArgumentCollection.outputWriter(headerFromReads,
() -> getProgramRecord(headerFromReads), true, getReferenceFile()
);
}
示例3: isPresorted
import htsjdk.samtools.SAMFileHeader; //导入方法依赖的package包/类
/**
* Returns {@code true} if the parameters suggest that the files are pre-sorted; {@code false}
* otherwise.
*
* @param header header for checking the sort order.
*/
private boolean isPresorted(final SAMFileHeader header) {
// if the requested order is unsorted
return SAMFileHeader.SortOrder.unsorted == sortOrder
// if the header is the same sort order than the one requested
|| header.getSortOrder() == sortOrder;
}
示例4: getSamFileHeader
import htsjdk.samtools.SAMFileHeader; //导入方法依赖的package包/类
private SAMFileHeader getSamFileHeader(final ReadsSourceHandler handler) {
final SAMFileHeader header = handler.getHeader();
SAMFileHeader.SortOrder order = header.getSortOrder();
SAMFileHeader.GroupOrder groupOrder = header.getGroupOrder();
if (isPaired()) {
switch (order) {
// both coordinate/duplicate sorting are not allowed here if it is paired
case coordinate:
case duplicate:
throw new UserException.BadInput(String.format(
"Pair-end read source %s sorted by '%s'. ReadTools requires pairs to be together: either sorted or grouped by queryname.",
handler.getHandledSource(), order));
// both unsorted and unknown
case unsorted:
case unknown:
logger.warn(
"Pair-end read source {} with '{}' order grouped by '{}': Assuming that reads are grouped by {} (keeping pairs together).",
handler.getHandledSource(), order, groupOrder, SAMFileHeader.GroupOrder.query);
order = SAMFileHeader.SortOrder.unsorted;
groupOrder = SAMFileHeader.GroupOrder.query;
break;
case queryname:
// TODO - remove this limitation
logger.warn("Output might reflect '%s' even if '%s' is specified in pair-end source %s. This limitation may be removed in the future.",
order, SAMFileHeader.SortOrder.queryname, handler.getHandledSource());
break;
default:
throw new GATKException("Unknown sort order: " + header.getSortOrder());
}
}
// log always a warning for queryname order
if (SAMFileHeader.SortOrder.queryname.equals(order)) {
logger.warn(
"Sort order by '{}' is assumed to follow the Picard specifications. This limitation may be removed in the future.",
SAMFileHeader.SortOrder.queryname);
}
// finally, set the sort order
header.setSortOrder(order);
// this should be done like this because of a null pointer exception
if (! SAMFileHeader.GroupOrder.none.equals(groupOrder)) {
header.setGroupOrder(groupOrder);
}
return header;
}