• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VCFCodec类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中htsjdk.variant.vcf.VCFCodec的典型用法代码示例。如果您正苦于以下问题:Java VCFCodec类的具体用法?Java VCFCodec怎么用?Java VCFCodec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VCFCodec类属于htsjdk.variant.vcf包,在下文中一共展示了VCFCodec类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: RODContentProvider

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
public RODContentProvider(String name, VcfRecordPartition partition, GenomeLocParser genomeLocParser) {
    this.name = name;
    VCFCodec codec = new VCFCodec();
    VCFHeaderLineIterable headerLineIterable = new VCFHeaderLineIterable(partition.vcfHeader());
    vcfFileHeader = (VCFHeader) codec.readActualHeader(headerLineIterable);

    ArrayList<VariantContext> vcfRecords = new ArrayList<>();
    CollectionConverter.asJavaList(partition.records())
            .forEach(record -> vcfRecords.add(codec.decode(record.toString())));

    //为vcfRecord进行排序
    Collections.sort(vcfRecords,
            (record1, record2) -> record1.getStart() - record2.getStart());

    vcfRecords.forEach(context ->
            features.add(new GATKFeature.TribbleGATKFeature(genomeLocParser, context, name)));
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:18,代码来源:RODContentProvider.java


示例2: getStaticDataInstance

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
public static StaticData getStaticDataInstance(RefContigInfo refContigInfo,
                                               boolean useGVCF,
                                               SamHeaderInfo samHeaderInfo,
                                               VcfHeaderInfo vcfHeaderInfo) {
    StaticData data = new StaticData();
    SAMSequenceDictionary samSequenceDictionary = SAMSequenceDictTransfer.transfer(refContigInfo);
    data.genomeLocParser = new GenomeLocParser(samSequenceDictionary);
    samHeaderInfo.addReadGroupInfo(ReadGroupInfo.apply("rg1", "sample1"));
    SAMFileHeader header = SAMHeaderTransfer.transfer(samHeaderInfo);
    List<SAMReadGroupRecord> readGroupInfos = header.getReadGroups();
    List<String> samples = new ArrayList<>();
    for (SAMReadGroupRecord readGroup : readGroupInfos) {
        samples.add(readGroup.getSample());
    }
    data.haplotypeCaller = new HaplotypeCaller(data.genomeLocParser, samples, useGVCF);
    data.basic2SAMRecordTransfer = new Basic2SAMRecordTransfer(header);

    VCFCodec codec = new VCFCodec();
    VCFHeaderLineIterable headerLineIterable = new VCFHeaderLineIterable(vcfHeaderInfo);
    data.vcfFileHeader = (VCFHeader) codec.readActualHeader(headerLineIterable);
    data.codec = codec;
    return data;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:24,代码来源:HaplotypeCallerAdapter.java


示例3: toActiveRegionMapData

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
public ActiveRegionMapData toActiveRegionMapData(GenomeLocParser parser,
                                                 Basic2SAMRecordTransfer samTransfer,
                                                 VCFHeader vcfFileHeader,
                                                 VCFCodec codec) {
    List<GATKSAMRecord> gatksamRecords = new ArrayList<>(reads.size());
    for (BasicSamRecord record : reads) {
        gatksamRecords.add(new GATKSAMRecord(samTransfer.transfer(record)));
    }
    this.activeRegion.setReads(gatksamRecords);
    this.activeRegion.setGenomeLocParser(parser);

    List<VariantContext> vcs = new ArrayList<>(rods.size());
    for (VcfRecord vcfRecord : rods) {
        vcs.add(codec.decode(vcfRecord.toString()));
    }
    RODContentProvider dbsnpProvider = new RODContentProvider(RODNames.DBSNP, vcfFileHeader, vcs, parser);
    RODTraverser traverser = new RODTraverser(dbsnpProvider);
    final List<RODRecordList> bindings = new ArrayList<>(1);
    bindings.add(traverser.getOverlap(activeRegion.getExtendedLoc()));
    RefMetaDataTracker tracker = new RefMetaDataTracker(bindings);

    return new ActiveRegionMapData(activeRegion, tracker, fullReferenceWithPadding, refBases);
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:24,代码来源:SerializableActiveRegionMapData.java


示例4: readVariations

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
/**
 * Reads the variations data from the VCF file and loads it into a track
 * @param vcfFile data source
 * @param track for loading data
 * @param chromosome reference sequence
 * @param sampleIndex determines fro which sample from the file variations are loaded
 * @param loadInfo if true data from the INFO fields from VCF file will be loaded into the track,
 *                 otherwise it will be ignored
 * @return {@code Track} filled with variations from a specified {@code VcfFile}
 * @throws VcfReadingException
 */
@Override
public Track<Variation> readVariations(VcfFile vcfFile, final Track<Variation> track, Chromosome chromosome,
                                       final Integer sampleIndex, final boolean loadInfo, final boolean collapse)
        throws VcfReadingException {
    try (FeatureReader<VariantContext> reader = AbstractFeatureReader.getFeatureReader(vcfFile.getPath(),
            vcfFile.getIndex().getPath(), new VCFCodec(), true)) {
        if (checkBounds(vcfFile, track, chromosome, loadInfo)) {
            return track;
        }
        try (CloseableIterator<VariantContext> iterator = Utils.query(reader, chromosome.getName(), track
                .getStartIndex(), track.getEndIndex())) {
            VCFHeader header = (VCFHeader) reader.getHeader();
            track.setBlocks(doReadVariations(iterator, track, header, vcfFile, sampleIndex, loadInfo, collapse));
        }
    } catch (IOException e) {
        throw new VcfReadingException(vcfFile, e);
    }
    return track;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:31,代码来源:VcfFileReader.java


示例5: makeVcfReader

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
/**
 * Create a VCFFile reader for given reference and fileName in application's file system, optionally uses index.
 *
 * @param vcfFile  {@code VcfFile} a VcfFile object, representing a file in the system with set id, name and
 *                 compressed options.
 * @return {@code VCFFileReader} a reader to work with VCF file
 */
public FeatureReader<VariantContext> makeVcfReader(VcfFile vcfFile) {
    File file = new File(vcfFile.getPath());
    Assert.isTrue(file.exists(), getMessage(MessagesConstants.ERROR_FILE_NOT_FOUND, vcfFile.getPath()));

    FeatureReader<VariantContext> reader;
    double time1;
    double time2;
    if (vcfFile.getIndex() != null && StringUtils.isNotBlank(vcfFile.getIndex().getPath())) {
        Assert.notNull(vcfFile.getIndex(), "VCF file should have an index");
        File indexFile = new File(vcfFile.getIndex().getPath());
        Assert.isTrue(indexFile.exists(), getMessage(MessagesConstants.ERROR_FILE_NOT_FOUND,
                                                     vcfFile.getIndex().getPath()));
        time1 = Utils.getSystemTimeMilliseconds();
        reader = AbstractFeatureReader.getFeatureReader(vcfFile.getPath(), vcfFile.getIndex().getPath(),
                                                        new VCFCodec(), true);
        time2 = Utils.getSystemTimeMilliseconds();
    } else {
        time1 = Utils.getSystemTimeMilliseconds();
        reader = AbstractFeatureReader.getFeatureReader(vcfFile.getPath(), new VCFCodec(), false);
        time2 = Utils.getSystemTimeMilliseconds();
    }
    LOGGER.debug(getMessage(MessagesConstants.DEBUG_FILE_OPENING, vcfFile.getPath(), time2 - time1));
    return reader;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:32,代码来源:FileManager.java


示例6: readSingleHeader

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
public void readSingleHeader(Path vcfPath, Configuration conf) throws IOException {
	FileSystem fs = vcfPath.getFileSystem(conf);
	if(!fs.exists(vcfPath))
		throw new RuntimeException(vcfPath.toString() + " don't exists.");
	if(!fs.isFile(vcfPath)) {
		throw new RuntimeException(vcfPath.toString() + " is not a file. GaeaSingleVcfHeader parser only support one vcf file.");
	}
	FSDataInputStream in = fs.open(vcfPath);
	AsciiLineReaderIterator it = new AsciiLineReaderIterator(new AsciiLineReader(in));
    VCFCodec codec = new VCFCodec();
    Object header = codec.readHeader(it);
	vcfHeader = (VCFHeader)(((FeatureCodecHeader)header).getHeaderValue());
	sampleNames.addAll(vcfHeader.getGenotypeSamples());
	buildHeaderInfo();
	it.close();
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:17,代码来源:SingleVCFHeader.java


示例7: processSV

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
private static Collection<EligibilityReport> processSV(final String patient, final File vcf, final BachelorEligibility eligibility) {
    LOGGER.info("process sv: {}", vcf.getPath());

    final StructuralVariantFactory factory = new StructuralVariantFactory();
    try {
        try (final AbstractFeatureReader<VariantContext, LineIterator> reader = AbstractFeatureReader.getFeatureReader(vcf.getPath(),
                new VCFCodec(), false)) {
            reader.iterator().forEach(factory::addVariantContext);
        }
    } catch (IOException e) {
        LOGGER.error("error with SV file {}: {}", vcf.getPath(), e.getMessage());
        return Collections.emptyList();
    }

    return eligibility.processStructuralVariants(patient, factory.results());
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:17,代码来源:BachelorApplication.java


示例8: fromVCFFile

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
@NotNull
public List<SomaticVariant> fromVCFFile(@NotNull final String sample, @NotNull final String vcfFile) throws IOException {
    final List<SomaticVariant> variants = Lists.newArrayList();

    try (final AbstractFeatureReader<VariantContext, LineIterator> reader = getFeatureReader(vcfFile, new VCFCodec(), false)) {

        final VCFHeader header = (VCFHeader) reader.getHeader();
        if (!sampleInFile(sample, header)) {
            throw new IllegalArgumentException("Sample " + sample + " not found in vcf file " + vcfFile);
        }

        if (!header.hasFormatLine("AD")) {
            throw new IllegalArgumentException("Allelic depths is a required format field in vcf file " + vcfFile);
        }

        for (final VariantContext context : reader.iterator()) {
            createVariant(sample, context).ifPresent(variants::add);
        }
    }

    return variants;
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:23,代码来源:SomaticVariantFactory.java


示例9: addLineToIndex

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
/** Set vcfHeader and vcfCodec to null if reading non-vcf line.
 * */
private void addLineToIndex(String line, TabixIndexCreator indexCreator, long filePosition, TabixFormat fmt, VCFHeader vcfHeader, VCFCodec vcfCodec) throws InvalidRecordException {

	if(fmt.equals(TabixFormat.BED)){
		
		BedLineCodec bedCodec= new BedLineCodec();
		BedLine bed = bedCodec.decode(line);
		indexCreator.addFeature(bed, filePosition);
	
	} else if(fmt.equals(TabixFormat.GFF)){
		GtfLine gtf= new GtfLine(line.split("\t"));
		indexCreator.addFeature(gtf, filePosition);
	
	} else if(fmt.equals(TabixFormat.VCF)) {

		VariantContext vcf = vcfCodec.decode(line);
		indexCreator.addFeature(vcf, filePosition);
		
	} else {
		System.err.println("Unexpected TabixFormat: " + fmt.sequenceColumn + " " + fmt.startPositionColumn);
		throw new InvalidRecordException();
	}	
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:25,代码来源:MakeTabixIndex.java


示例10: IntervalFeature

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
/**
 * Create an IntervalFeature from a String. Typically this is a line read from file.
 * vcfHeader can be null if trackformat is not VCF.
 */
public IntervalFeature(String line, TrackFormat format, VCFCodec vcfCodec) throws InvalidGenomicCoordsException{
	if(format.equals(TrackFormat.BED) || format.equals(TrackFormat.BEDGRAPH) || format.equals(TrackFormat.BIGBED)){
		this.intervalFeatureFromBedLine(line);
		this.trackFormat= TrackFormat.BED;
	
	} else if(format.equals(TrackFormat.GFF) || format.equals(TrackFormat.GTF)){
		this.intervalFeatureFromGtfLine(line);
		this.trackFormat= TrackFormat.GFF;
				
	} else if(format.equals(TrackFormat.VCF)) {
		this.variantContext= vcfCodec.decode(line);
		this.setRaw(line);
		this.trackFormat= TrackFormat.VCF;
		this.chrom= this.variantContext.getContig();
		this.from= this.setFromForVCF();
		this.to= this.setToForVCF();
		this.name= this.variantContext.getID();

	} else {
		System.err.println("Format " + format + " not supported");
		throw new RuntimeException();
	}
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:28,代码来源:IntervalFeature.java


示例11: canFormatVCFLineStructVar

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
@Test
public void canFormatVCFLineStructVar() throws InvalidGenomicCoordsException, InvalidColourException, IOException, InvalidConfigException{
	
	List<Double> rulerMap= new ArrayList<Double>();
	for(int i= 1; i < 100; i++){
		rulerMap.add((double)i);
	}
	
	// Prepare header
	VCFFileReader reader = new VCFFileReader(new File("test_data/ALL.wgs.mergedSV.v8.20130502.svs.genotypes.vcf.gz"));
	VCFHeader vcfHeader= reader.getFileHeader();
	reader.close();
	VCFCodec vcfCodec= new VCFCodec();
	vcfCodec.setVCFHeader(vcfHeader, Utils.getVCFHeaderVersion(vcfHeader));

	String vcfLine= "1 668630 DUP_delly_DUP20532 G <CN2> . PASS AC=64;AF=0.0127795;AFR_AF=0.0015;AMR_AF=0;AN=5008;CIEND=-150,150;CIPOS=-150,150;CS=DUP_delly;EAS_AF=0.0595;END=850204;EUR_AF=0.001;IMPRECISE;NS=2504;SAS_AF=0.001;SITEPOST=1;SVTYPE=DUP GT 0|0 0|0 0|0".replaceAll(" ", "\t");
	IntervalFeature ift= new IntervalFeature(vcfLine, TrackFormat.VCF, vcfCodec);
	ift.mapToScreen(rulerMap);
	assertEquals(850204, ift.getTo());
	assertEquals("|", ift.getIdeogram(true, true).get(0).format(true));
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:22,代码来源:IntervalFeatureTest.java


示例12: reindexVcfFile

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
/**
 * Creates a feature index for {@link VcfFile}. If an index already exists, it will be deleted and created
 * from scratch
 * @param vcfFileId an ID of VCF file to reindex.
 * @throws FeatureIndexException if an error occurred while writing index
 */
public VcfFile reindexVcfFile(long vcfFileId) throws FeatureIndexException {
    VcfFile vcfFile = vcfFileManager.loadVcfFile(vcfFileId);
    Reference reference = referenceGenomeManager.loadReferenceGenome(vcfFile.getReferenceId());
    Map<String, Chromosome> chromosomeMap = reference.getChromosomes().stream().collect(
        Collectors.toMap(BaseEntity::getName, chromosome -> chromosome));
    List<GeneFile> geneFiles = reference.getGeneFile() != null ?
                               Collections.singletonList(reference.getGeneFile()) :
                               Collections.emptyList();

    try {
        fileManager.deleteFileFeatureIndex(vcfFile);

        try (FeatureReader<VariantContext> reader = AbstractFeatureReader.getFeatureReader(vcfFile.getPath(),
                                                                                           new VCFCodec(), false)) {
            VcfFilterInfo info = getFiltersInfo(reader);
            featureIndexManager.makeIndexForVcfReader(vcfFile, reader, geneFiles, chromosomeMap, info);
        }
    } catch (IOException e) {
        throw new FeatureIndexException(vcfFile, e);
    }

    return vcfFile;
}
 
开发者ID:epam,项目名称:NGB,代码行数:30,代码来源:VcfManager.java


示例13: createVcfFromUrl

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
private VcfFile createVcfFromUrl(final IndexedFileRegistrationRequest request,
                                  final Map<String, Chromosome> chromosomeMap, Reference reference) {
    final VcfFile vcfFile;
    try (FeatureReader<VariantContext> reader = AbstractFeatureReader.getFeatureReader(request.getPath(),
                                       request.getIndexPath(), new VCFCodec(), true)) {
        vcfFile = createVcfFile(request, reader);
        boolean hasVariations = false;
        for (Map.Entry<String, Chromosome> chrEntry : chromosomeMap.entrySet()) {
            CloseableIterator<VariantContext> iterator = Utils.query(reader, chrEntry.getKey(), 1,
                                                                     chrEntry.getValue().getSize());
            if (iterator.hasNext()) {
                hasVariations = true;
                break;
            }
        }

        Assert.isTrue(hasVariations, getMessage(MessagesConstants.ERROR_FILE_CORRUPTED_OR_EMPTY, request.getPath(),
                                                reference.getName()));
    }  catch (IOException e) {
        throw new RegistrationException(getMessage(ERROR_REGISTER_FILE, request.getName()), e);
    }
    biologicalDataItemManager.createBiologicalDataItem(vcfFile.getIndex());
    vcfFileManager.createVcfFile(vcfFile);
    return vcfFile;
}
 
开发者ID:epam,项目名称:NGB,代码行数:26,代码来源:VcfManager.java


示例14: serialisationTest

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
@Test
public void serialisationTest() throws IOException, ClassNotFoundException {
    Resource resource = context.getResource("classpath:templates/samples.vcf");
    List<VcfIndexEntry> writtenEntries = new ArrayList<>();
    List<VcfIndexEntry> diskBasedList = new DiskBasedList<VcfIndexEntry>(MAX_IN_MEMORY_ITEMS_COUNT).adaptToList();

    try (FeatureReader<VariantContext> reader = AbstractFeatureReader
            .getFeatureReader(resource.getFile().getAbsolutePath(), new VCFCodec(), false)
    ) {

        for (VariantContext variantContext : reader.iterator()) {

            VcfIndexEntry vcfIndexEntry = createTestEntry(variantContext);

            writtenEntries.add(vcfIndexEntry);
            diskBasedList.add(vcfIndexEntry);
        }
    }

    for (int i = 0; i < 3; i++) {
        assertLists(writtenEntries, diskBasedList);
    }

}
 
开发者ID:epam,项目名称:NGB,代码行数:25,代码来源:DiskBasedListTest.java


示例15: testVariantAdapter

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
@Test(dataProvider = "VariantDataProvider")
public void testVariantAdapter(final List<Variant> expectedVariantList) {
    // The test suite for reading in VCF files is FeatureDataSourceUnitTest.
    try (FeatureDataSource<VariantContext> featureSource = new FeatureDataSource<>(QUERY_TEST_VCF, new VCFCodec())) {
        List<Variant> variantList = new ArrayList<>();
        for (VariantContext feature : featureSource) {
            VariantContextVariantAdapter va = new VariantContextVariantAdapter(feature);
            variantList.add(va);
        }
        // Now, test to see that every variant is in in the expected set.
        Assert.assertEquals(variantList.size(), expectedVariantList.size());
        for (Variant v : variantList) {
            boolean matchFound = false;
            for (Variant vv : expectedVariantList) {
                if (VariantUtils.variantsAreEqual(v, vv)) {
                    matchFound = true;
                }
            }
            Assert.assertTrue(matchFound, v.toString());
        }
    }
}
 
开发者ID:broadinstitute,项目名称:gatk-dataflow,代码行数:23,代码来源:VariantSourceUnitTest.java


示例16: getVariantContexts

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
/**
 * Returns a list of VariantContext records from a VCF file
 *
 * @param vcfFile VCF file
 * @return list of VariantContext records
 * @throws IOException if the file does not exist or can not be opened
 */
private static List<VariantContext> getVariantContexts(final File vcfFile) throws IOException {
    final VCFCodec codec = new VCFCodec();
    final FileInputStream s = new FileInputStream(vcfFile);
    final LineIterator lineIteratorVCF = codec.makeSourceFromStream(new PositionalBufferedStream(s));
    codec.readHeader(lineIteratorVCF);

    final List<VariantContext> VCs = new ArrayList<>();
    while (lineIteratorVCF.hasNext()) {
        final String line = lineIteratorVCF.next();
        Assert.assertFalse(line == null);
        VCs.add(codec.decode(line));
    }

    return VCs;
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:23,代码来源:GenotypeGVCFsIntegrationTest.java


示例17: assertGatherProducesCorrectVariants

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
private void assertGatherProducesCorrectVariants(GatherVcfsCloud.GatherType gatherType, File expected, List<File> inputs) throws IOException {
    final File output = createTempFile("gathered", ".vcf.gz");
    final ArgumentsBuilder args = new ArgumentsBuilder();
    inputs.forEach(args::addInput);
    args.addOutput(output)
            .addArgument(GatherVcfsCloud.GATHER_TYPE_LONG_NAME, gatherType.toString());
    runCommandLine(args);

    try (final AbstractFeatureReader<VariantContext, ?> actualReader = AbstractFeatureReader.getFeatureReader(output.getAbsolutePath(), null, new VCFCodec(), false, Function.identity(), Function.identity());
         final AbstractFeatureReader<VariantContext, ?> expectedReader = AbstractFeatureReader.getFeatureReader(expected.getAbsolutePath(), null, new VCFCodec(), false, Function.identity(), Function.identity())) {

        final List<VariantContext> actualVariants = StreamSupport.stream(Spliterators.spliteratorUnknownSize(actualReader.iterator(),Spliterator.ORDERED), false).collect(Collectors.toList());
        final List<VariantContext> expectedVariants = StreamSupport.stream(Spliterators.spliteratorUnknownSize(expectedReader.iterator(),Spliterator.ORDERED), false).collect(Collectors.toList());
        VariantContextTestUtils.assertEqualVariants(actualVariants, expectedVariants);

        Assert.assertEquals(((VCFHeader) actualReader.getHeader()).getMetaDataInInputOrder(),
                ((VCFHeader) expectedReader.getHeader()).getMetaDataInInputOrder());
    }
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:21,代码来源:GatherVcfsCloudIntegrationTest.java


示例18: AbstractVCFParser

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
public AbstractVCFParser(final FormatWithRef format, final String path) {
	super(format);
	this.codec = new VCFCodec();

	IOUtil.assertInputIsValid(path);
	readHeaderFiles(new File(path));
}
 
开发者ID:mulinlab,项目名称:vanno,代码行数:8,代码来源:AbstractVCFParser.java


示例19: outVCFHeader

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
public VCFHeader outVCFHeader() {
	try {
		if(vcfHeaderPath == null) {
			System.out.println("*** Note: Your output format is vcf, you should define header-path for vcf header or we won't output header.");
			return null;
		} else {
			IOUtil.assertInputIsValid(vcfHeaderPath);
			return (VCFHeader)(new VCFCodec()).readActualHeader(new LineIteratorImpl(new File(vcfHeaderPath)));
		}
	} catch (FileNotFoundException e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:mulinlab,项目名称:vanno,代码行数:15,代码来源:BEDParserQuery.java


示例20: callVariants

import htsjdk.variant.vcf.VCFCodec; //导入依赖的package包/类
public static List<VcfRecord> callVariants(RefContigInfo refContigInfo,
                                           List<SerializableActiveRegionMapData> serializableActiveRegionMapDataList,
                                           boolean useGVCF,
                                           SamHeaderInfo samHeaderInfo,
                                           VcfHeaderInfo vcfHeaderInfo) {
    StaticData staticData = getStaticDataInstance(refContigInfo, false, samHeaderInfo, vcfHeaderInfo);
    GenomeLocParser parser = staticData.genomeLocParser;
    HaplotypeCaller haplotypeCaller = staticData.haplotypeCaller;
    Basic2SAMRecordTransfer basic2SAMRecordTransfer = staticData.basic2SAMRecordTransfer;
    VCFHeader vcfFileHeader = staticData.vcfFileHeader;
    VCFCodec codec = staticData.codec;

    List<VariantContext> variantContexts = new ArrayList<>();

    for(SerializableActiveRegionMapData mapData: serializableActiveRegionMapDataList) {
        ActiveRegionMapData activeRegionMapData = mapData.toActiveRegionMapData(
                parser, basic2SAMRecordTransfer, vcfFileHeader, codec);
        variantContexts.addAll(haplotypeCaller.map(activeRegionMapData));
    }

    // 如果使用了gvcf,则需要加一个genotypeGVCFs
    List<VariantContext> finalResult = variantContexts;

    VCFHeader header = StandardWGSVCFHeader.getHeader();
    VC2VcfRecordTransfer transfer = new VC2VcfRecordTransfer(header, refContigInfo);
    List<VcfRecord> vcfRecords = new ArrayList<>(finalResult.size());
    finalResult.forEach(vc -> vcfRecords.add(transfer.transfer(vc)));
    return vcfRecords;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:30,代码来源:HaplotypeCallerAdapter.java



注:本文中的htsjdk.variant.vcf.VCFCodec类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LocalUserServiceTestConfig类代码示例发布时间:2022-05-21
下一篇:
Java AppStateManager类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap