Help with glib

Title: Help with glib

I would greatly appreciate some help with using glib functions for dynamic memory allocation and growth.
I have a number of miRNA text input files. Each file contains a miRNA data block followed by a variable
number of  gene_transcript data blocks representing the biological property of a miRNA to bind to many gene_transcripts, as as outlined in the following:

-  miRNA data block
- gene_transcript_1
- gene_transcript_2
- gene_transcript_n

A miRNA data block is made up of the following records
- miRNA identifier  (mandatory)
- miRNA description (optional)
- miRNA sequence  (mandatory)

A gene_trascript data block is made up of the following records
- gene_trascript identifier  (mandatory)
- gene_trascript description (optional)
- gene_trascript sequence  (mandatory)

Basically it reperesents a Biology natural fact. That is, a miRNA can match many gene_transcripts.
I have already developed a function that reads into a structure either a miRNA or a gene_transcript
data block. But I am struggling with the following tasks.
As I read a miRNA file I have to:

(1)  grow a vector where I append the miRNA identifier
(2)  grow a vector where I append each gene_transcript identifier
(3)  grow a binary matrix whose elements are set to 1 for those (miRNA, gene_transcript) pairs
      otherwise it is set to 0

Task (1) and (2) are easily accomplished through two GArrays where the respective identifiers are appended as they are read through function g_array_append_val.
Task (3) is giving me a lot of headache. Basically for each newly read miRNA identifier I allocate a column
of Integer containing as many 0-elements as the number of gene_transcripts previously read and as many 1-elements as the number of gene_transcripts binding to the current miRNA.
I use function g_ptr_array_new to allocate a GPtrArray. Then I use g_array_new to allocate a column of Integer. My problem is how to pile up the pointer to the new Integer column, returned by g_array_new, into the GPtrArray. At run time I keep getting Segmentation Fault when I try to fill in the Integer column.
Can someone help me, please ?

Another complication at representing such Biology phenomena is that the same gene_transcript can bind
to different miRNAs. Therefore I can read the same gene_transcript from different miRNA files.
This case must be detected as each miRNA as well as each gene_transcript identifier must be uniquely saved. I think I will handle this uniqueness through a binary tree.

If it is useful I can send a few C lines that implement the scenario illustrated above.

Thank you very much in advance.
Maura E.M

Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM!
Vai su

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]