-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b70f4e9
commit 9372072
Showing
10 changed files
with
195 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
build | ||
node_modules | ||
package-lock.json | ||
BrAPI.js | ||
BrAPI.js | ||
/nbproject/private/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# fjFile = FEATURES | ||
gene1 2H 14.3 16.2 | ||
gene2 2H 20 35 | ||
gene3 2H 49 63 | ||
gene4 2H 34 48 | ||
gene5 2H 20 54 | ||
gene6 2H 30 41 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default class Feature { | ||
constructor(name, chromosome, startPosition, endPosition) { | ||
this.name = name; | ||
this.chromosome = chromosome; | ||
this.start = startPosition; | ||
this.end = endPosition; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
//import Marker from './Marker'; | ||
import Feature from './Feature'; | ||
import Chromosome from './Chromosome'; | ||
import GenomeMap from './GenomeMap'; | ||
|
||
export default class FeatureImporter { | ||
constructor() { | ||
this.featureNames = []; | ||
this.featureData = []; | ||
this.chromosomeNames = new Set(); | ||
} | ||
|
||
processFeatureFileLine(line) { | ||
if (line.startsWith('#') || (!line || line.length === 0) || line.startsWith('\t')) { | ||
return; | ||
} | ||
|
||
// Only parse our default map file lines (i.e. not the special fixes for | ||
// exactly specifying the chromosome length) | ||
// http://flapjack.hutton.ac.uk/en/latest/projects_&_data_formats.html#data-sets-maps-and-genotypes | ||
const tokens = line.split('\t'); | ||
if (tokens.length === 4) { | ||
const featureName = tokens[0]; | ||
const chromosome = tokens[1]; | ||
const startPos = tokens[2]; | ||
const endPos = tokens[3]; | ||
|
||
// Keep track of the chromosomes that we've found | ||
this.chromosomeNames.add(chromosome); | ||
|
||
// Create a marker object and add it to our array of markers | ||
const feature = new Feature(featureName, chromosome, parseFloat(startPos.replace(/,/g, ''), 10), parseFloat(endPos.replace(/,/g, ''), 10)); | ||
this.featureData.push(feature); | ||
} | ||
} | ||
|
||
createFeatures(genomeMap) { | ||
genomeMap.chromosomes.forEach(chromosome => { | ||
const chromosomeFeatures = this.featureData.filter(m => m.chromosome === chromosome.name); | ||
chromosome.insertFeatures(chromosomeFeatures); | ||
}); | ||
return genomeMap; | ||
} | ||
|
||
parseFile(fileContents, genomeMap) { | ||
const features = fileContents.split(/\r?\n/); | ||
for (let feature = 0; feature < features.length; feature += 1) { | ||
this.processFeatureFileLine(features[feature]); | ||
} | ||
|
||
const map = this.createFeatures(genomeMap); | ||
|
||
return map; | ||
} | ||
|
||
// A method which converts BrAPI markerpositions into Flapjack markers for | ||
// rendering | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters