/// <summary> /// Factory method for implementations of this interface /// </summary> /// <returns>The expression data.</returns> /// <param name="filename">Filename.</param> /// <param name="rnaType">Rna type.</param> /// <param name="filetype">Filetype.</param> /// <param name="annotation">Annotation.</param> public static IExpressionData LoadExpressionData(string filename, string rnaType, string filetype, IAnnotation annotation) { Console.WriteLine("\tLoading expression file " + filename + " ... "); IExpressionData data = null; if (filetype == "gtf" || filetype == ".gtf") { data = IUnknown.QueryInterface <IExpressionData>(new GtfExpressionFile(GtfExpressionFile.ExpressionTypeFromString(rnaType), filename, annotation)); } else { data = IUnknown.QueryInterface <IExpressionData>(new BedExpressionFile(filename, BedFile.BedExpression, annotation)); } Console.WriteLine("\ttranscript count: " + data.Transcripts.Count); Console.WriteLine("\tgene count: " + data.Genes.Count); return(data); }
/// <summary> /// Gets the link lengths orientated by TSS strand /// </summary> /// <returns>The link lengths.</returns> /// <param name="expressionData">Expression data.</param> public List <int> DirectionalLinkLengths(IExpressionData expressionData) { return(this.Links.Select(x => expressionData.Transcripts.ContainsKey(x.TranscriptName) ? (expressionData.Transcripts[x.TranscriptName].Strand == "+" ? x.LinkLength : -x.LinkLength) : x.LinkLength).ToList()); }