public void IndexCreation_multiChromosome() { var jsonStream = new BlockGZipStream(ResourceUtilities.GetReadStream(Resources.TopPath("cosmicv72.indels.json.gz")), CompressionMode.Decompress); var writeStream = new MemoryStream(); using (var indexCreator = new IndexCreator(jsonStream, writeStream)) { indexCreator.CreateIndex(); } JasixIndex readBackIndex; var readStream = new MemoryStream(writeStream.ToArray()); readStream.Seek(0, SeekOrigin.Begin); using (readStream) { readBackIndex = new JasixIndex(readStream); } Assert.Equal(2268, readBackIndex.GetFirstVariantPosition("chr1", 9775924, 9775924)); Assert.Equal(14035925971, readBackIndex.GetFirstVariantPosition("chr2", 16081096, 16081096)); Assert.Equal(433156622693, readBackIndex.GetFirstVariantPosition("chr20", 36026164, 36026164)); Assert.Equal(439602269527, readBackIndex.GetFirstVariantPosition("chrX", 66765044, 66765044)); }
private void btnCreateIndex_Click(object sender, EventArgs e) { string sql = "SELECT VerseID, VerseText FROM Verse"; using (SqlCeConnection conn = new SqlCeConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString)) { conn.Open(); var rdr = new SqlCeCommand(sql, conn).ExecuteReader(); var context = new TextFileAccessContext("Bible", IndexDir, new CultureInfo("en-US")); var textIndexSaver = new TextIndexSaver <int>(context); var wordBreaker = new DefaultWordBreaker(new WordBreakingInformationRetriever(context.Directory, context.Culture)) { DatabasePath = context.Directory }; var textIndexFiller = new TextIndexFiller <int>(wordBreaker); var indexCreator = new IndexCreator <int>(textIndexFiller); var index = indexCreator.CreateIndex(new BibleVersuses(rdr)); textIndexSaver.SaveIndex(index); rdr.Close(); } }
public static IIndex Provide(string name, DateTime startDate, DateTime endDate, string frequency) { var historicalData = ReadDataFromFile.ReadDataSeriesFromFile( DownloadedFile.ProvideHistoridalDataFile(name, startDate, endDate, frequency)); var currentPrice = new DataPoint(); //currently not available var listOfStocks = new List <IStock>(); //currently not available var index = IndexCreator.CreateIndex(name, currentPrice, listOfStocks, historicalData); return(index); }
public void WhenIIndexThePeople() { var people = ScenarioContext.Current.Get<IEnumerable<Person>>(); var mock = new Mock<IWordBreakingInformationRetriever>(); mock.Setup(x => x.GetWordBreakingInformation()) .Returns(new WordBreakingInformation{NoiseWords = new Dictionary<string, string>(), Substitutions = new Dictionary<string, string>(), Whitespace = new List<char>()}); var indexCreator = new IndexCreator<int>(new TextIndexFiller<int>(new DefaultWordBreaker(mock.Object))); var phrases = people.Select(x => new Phrase<int> {Key = x.Key, Text = x.FirstName + " " + x.LastName}); var index = indexCreator.CreateIndex(phrases); ScenarioContext.Current.Set(index); }
public void WhenIIndexThePeople() { var people = ScenarioContext.Current.Get <IEnumerable <Person> >(); var mock = new Mock <IWordBreakingInformationRetriever>(); mock.Setup(x => x.GetWordBreakingInformation()) .Returns(new WordBreakingInformation { NoiseWords = new Dictionary <string, string>(), Substitutions = new Dictionary <string, string>(), Whitespace = new List <char>() }); var indexCreator = new IndexCreator <int>(new TextIndexFiller <int>(new DefaultWordBreaker(mock.Object))); var phrases = people.Select(x => new Phrase <int> { Key = x.Key, Text = x.FirstName + " " + x.LastName }); var index = indexCreator.CreateIndex(phrases); ScenarioContext.Current.Set(index); }
public void TestIndexCreation() { var readStream = new BlockGZipStream(ResourceUtilities.GetReadStream(Resources.TopPath("cosmicv72.indels.json.gz")), CompressionMode.Decompress); var tempFile = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); using (var indexCreator = new IndexCreator(readStream, FileUtilities.GetCreateStream(tempFile))) { indexCreator.CreateIndex(); } JasixIndex readBackIndex; using (var stream = FileUtilities.GetReadStream(tempFile)) { readBackIndex = new JasixIndex(stream); } Assert.Equal(1591, readBackIndex.GetFirstVariantPosition("chr1", 9775924, 9775924)); Assert.Equal(11500956299, readBackIndex.GetFirstVariantPosition("chr2", 16081096, 16081096)); Assert.Equal(372100991296, readBackIndex.GetFirstVariantPosition("chr20", 36026164, 36026164)); Assert.Equal(377682846863, readBackIndex.GetFirstVariantPosition("chrX", 66765044, 66765044)); File.Delete(tempFile); }
private static void Main(string[] args) { IConfiguration config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build(); var directoryPath = config.GetValue <string>("DirectoryPath"); var client = new ElasticClientFactory(config).CreateElasticClient(); var queryCreator = new QueryCreator(); var searcher = new Searcher(client, queryCreator, Index); var consoleView = new ConsoleView(); var controller = new Controller(consoleView, searcher); if (!IsIndexExisting(Index, client)) { var indexCreator = new IndexCreator(client); indexCreator.CreateIndex(Index); var fileReader = new DocFileReader(); var docCreator = new DocFactory(fileReader); var importer = new Importer <Doc>(client); importer.Import(docCreator.GetAllDocuments(directoryPath), Index); } controller.Run(); }