Question: written in C #define SIZE 100 Need help writing a function that splices and inserts a new sequence. The function is called with the paramater

written in C

#define SIZE 100

Need help writing a function that splices and inserts a new sequence. The function is called with the paramater of a char array. originalArray[401] which conatins a sequence of characters such as CAGTAGATATTAAACGGAGTACATTAGGG only char of A C G T . the length can be w.e like 10 char or 100 char. so the function is called by addSplice(originalArray);

addSplice(char originalArray[])

{

char Seq1[SIZE];

char Seq2[SIZE];

in the function you first as the user to input what sequence they want to add and where to add that sequence.

printf("What new Sequence would you like to add to the list? ")

fgets(Seq1, SIZE, stdin);

ex input : GAT

printf("After what would you like to add the new Sequence? ");

fgets(Seq2, SIZE, stdin);

ex input: ATTA

so the Array of char that was sent was CAGTAGATATTAAACGGAGTACATTAGGG we first have to find the ATTA in that array and then add GAT after that so the finaly array would look like this

CAGTAGATATTAgatAACGGAGTACATTAgatGGG i just added the gat lower case to see how it would look but it doesnt make a difference. Once the new sequence has been added after finding where to insert. The array needs to be truncated to fit the size of 401 and can not be any bigger so you can just cut the end off if its too big.

was thinking of using a char *ptr = originalArray; and using

ptr = strstr(originalArray, Seq1) to first time where each of the sequence are that we need to find.

then use a while loop while(ptr != NULL)

use any way to create this function this is not the only way you have to do it i just was thinking of it but is not the only way can also use a for loop

for(int i = 0; i < Seqlen; i++) SeqLen is the length of the originalArray that is being sent.

Any way you like is fine i just need to see a way to write this function. If you would like to see the whole program please leave your email and i will send it to you. The rest of the program is fine just needed some help with this function. Thank you. i will reply to any question or clerifications via email or just the comments.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!