Skip to content

Commit

Permalink
hs1 testing
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 6, 2024
1 parent 27e9f71 commit 768d1a0
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 8 deletions.
18 changes: 10 additions & 8 deletions plugins/bed/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export interface TranscriptFeat extends MinimalFeature {
subfeatures: MinimalFeature[]
}

const SPECIFIC_LENGTH_OF_REPEAT_MASKER_DESCRIPTION_FIELDS = 15

export function ucscProcessedTranscript(feature: TranscriptFeat) {
const {
subfeatures: oldSubfeatures,
Expand Down Expand Up @@ -299,8 +297,7 @@ export function isUcscProcessedTranscript({
thickStart &&
blockCount &&
strand !== 0 &&
description?.trim().split(' ').length !==
SPECIFIC_LENGTH_OF_REPEAT_MASKER_DESCRIPTION_FIELDS
!isRepeatMaskerDescriptionField(description)
)
}

Expand All @@ -312,11 +309,16 @@ export function arrayify(f?: string | number[]) {
: undefined
}

function isRepeatMaskerDescriptionField(
description?: string,
): description is string {
const ret = description?.trim().split(' ')
return [0, 1, 2, 3, 5, 6].every(s =>
ret?.[s] !== undefined ? !Number.isNaN(+ret[s]) : false,
)
}
export function makeRepeatTrackDescription(description?: string) {
if (
description?.trim().split(' ').length ===
SPECIFIC_LENGTH_OF_REPEAT_MASKER_DESCRIPTION_FIELDS
) {
if (isRepeatMaskerDescriptionField(description)) {
const [
bitsw_score,
percent_div,
Expand Down
62 changes: 62 additions & 0 deletions test_data/hs1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"assemblies": [
{
"name": "hs1",
"displayName": "Homo sapiens (hs1/T2T-CHM13v2.0)",
"sequence": {
"type": "ReferenceSequenceTrack",
"trackId": "hs1-reference",
"adapter": {
"type": "TwoBitAdapter",
"twoBitLocation": {
"uri": "https://hgdownload.soe.ucsc.edu/goldenPath/hs1/bigZips/hs1.2bit",
"locationType": "UriLocation"
},
"chromSizesLocation": {
"uri": "https://hgdownload.soe.ucsc.edu/goldenPath/hs1/bigZips/hs1.chrom.sizes.txt",
"locationType": "UriLocation"
}
}
},
"refNameAliases": {
"adapter": {
"type": "RefNameAliasAdapter",
"location": {
"uri": "https://hgdownload.soe.ucsc.edu/goldenPath/hs1/bigZips/hs1.chromAlias.txt",
"locationType": "UriLocation"
}
}
},
"cytobands": {
"adapter": {
"type": "BigBedAdapter",
"bigBedLocation": {
"uri": "https://hgdownload.soe.ucsc.edu/gbdb/hs1/cytoBandMapped/cytoBandMapped.bb"
}
}
}
}
],
"tracks": [
{
"type": "FeatureTrack",
"trackId": "RepeatMasker.sorted.bed",
"name": "RepeatMasker.sorted.bed",
"adapter": {
"type": "BedTabixAdapter",
"bedGzLocation": {
"uri": "RepeatMasker.sorted.bed.gz",
"locationType": "UriLocation"
},
"index": {
"location": {
"uri": "RepeatMasker.sorted.bed.gz.tbi",
"locationType": "UriLocation"
},
"indexType": "TBI"
}
},
"assemblyNames": ["hs1"]
}
]
}

0 comments on commit 768d1a0

Please sign in to comment.