@gmod/vcf
Version:
High performance streaming Variant Call Format (VCF) parser in pure JavaScript
14 lines (12 loc) • 386 B
text/typescript
import { processGenotypes } from './processGenotypes.ts'
export function parseGenotypesOnly(
format: string,
prerest: string,
samples: string[],
) {
const genotypes = Object.create(null) as Record<string, string>
processGenotypes(format, prerest, samples.length, (str, start, end, idx) => {
genotypes[samples[idx] ?? ''] = str.slice(start, end)
})
return genotypes
}