private static void WriteGeneralAttributes(StreamWriter writer, RegulatoryElement regulatoryFeature) { if (!regulatoryFeature.Id.IsEmpty) { writer.Write($"regulatory_feature_id \"{regulatoryFeature.Id}\"; "); } writer.Write($"regulatory_feature_type \"{regulatoryFeature.Type}\"; "); }
public void RegulatoryFeatureEqualityTests() { var regulatoryFeature1 = new RegulatoryElement(2, 100, 200, CompactId.Convert("1"), RegulatoryElementType.promoter); var regulatoryFeature2 = new RegulatoryElement(2, 100, 200, CompactId.Convert("1"), RegulatoryElementType.promoter); var regulatoryFeature3 = new RegulatoryElement(4, 105, 201, CompactId.Convert("3"), RegulatoryElementType.CTCF_binding_site); Assert.Equal(regulatoryFeature1, regulatoryFeature2); Assert.False(regulatoryFeature1 == regulatoryFeature3); }
public void AddRegulatoryFeature(RegulatoryElement regulatoryFeature, VariantAlternateAllele altAllele, string[] consequences) { var regulatoryRegion = new JsonVariant.RegulatoryRegion { ID = regulatoryFeature.Id.ToString(), Type = regulatoryFeature.Type.ToString(), Consequence = consequences }; FindCorrespondingJsonVariant(altAllele); _currJsonVariant.RegulatoryRegions.Add(regulatoryRegion); }
public void ReadWriteTests() { var randomPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); var regulatoryFeature1 = new RegulatoryElement(2, 100, 200, CompactId.Convert("1"), RegulatoryElementType.promoter); var regulatoryFeature2 = new RegulatoryElement(3, 100, 200, CompactId.Convert("2"), RegulatoryElementType.enhancer); var regulatoryFeature3 = new RegulatoryElement(4, 105, 201, CompactId.Convert("3"), RegulatoryElementType.CTCF_binding_site); using (var writer = new ExtendedBinaryWriter(FileUtilities.GetCreateStream(randomPath))) { regulatoryFeature1.Write(writer); regulatoryFeature2.Write(writer); regulatoryFeature3.Write(writer); } using (var reader = new ExtendedBinaryReader(FileUtilities.GetReadStream(randomPath))) { Assert.Equal(regulatoryFeature1, RegulatoryElement.Read(reader)); Assert.Equal(regulatoryFeature2, RegulatoryElement.Read(reader)); Assert.Equal(regulatoryFeature3, RegulatoryElement.Read(reader)); } File.Delete(randomPath); }
public void RegulatoryFeatureToStringTests() { var regulatoryFeature1 = new RegulatoryElement(2, 100, 200, CompactId.Convert("1"), RegulatoryElementType.promoter); Assert.NotNull(regulatoryFeature1.ToString()); }
private static void WriteRegulatoryFeature(StreamWriter writer, string[] referenceNames, RegulatoryElement regulatoryFeature) { writer.Write($"{referenceNames[regulatoryFeature.ReferenceIndex]}\t.\tregulatory feature\t{regulatoryFeature.Start}\t{regulatoryFeature.End}\t.\t.\t.\t"); WriteGeneralAttributes(writer, regulatoryFeature); writer.WriteLine(); }