MCPcopy Create free account
hub / github.com/RealTimeGenomics/rtg-tools / getValidGtStr

Method getValidGtStr

src/main/java/com/rtg/vcf/VcfUtils.java:770–779  ·  view source on GitHub ↗

Get the string GT for a sample, with validation checking @param rec record to extract the GT from @param sample the sample index @return the split GT field @throws NoTalkbackSlimException if the record does not contain GT values, or the sample is invalid.

(VcfRecord rec, int sample)

Source from the content-addressed store, hash-verified

768 * @throws NoTalkbackSlimException if the record does not contain GT values, or the sample is invalid.
769 */
770 public static String getValidGtStr(VcfRecord rec, int sample) {
771 final List<String> gtList = rec.getFormat(FORMAT_GENOTYPE);
772 if (gtList == null) {
773 throw new VcfFormatException("VCF record does not contain GT field, record: " + rec.toString());
774 }
775 if (sample >= gtList.size()) {
776 throw new VcfFormatException("Invalid sample number " + sample + ", record: " + rec.toString());
777 }
778 return gtList.get(sample);
779 }
780
781 /**
782 * Check if the record contains a well-defined variant genotype for the specified sample.

Callers 5

getValidGtMethod · 0.95
makeSimpleRecordMethod · 0.95
variantMethod · 0.95
makeSimpleRecordMethod · 0.95
resetRecordFieldsMethod · 0.95

Calls 4

toStringMethod · 0.65
getMethod · 0.65
getFormatMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected