Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

23. I value other people more now.

Answered: 1 week ago

Question

4. Are there any disadvantages?

Answered: 1 week ago

Question

3. What are the main benefits of using more information technology?

Answered: 1 week ago

Question

start to review and develop your employability skills

Answered: 1 week ago