UVA 612 DNA Sorting Data Set Generator

Instruction:
This code is not the solution to this problem it only generates input for testing.

This code generates data set for uva problem 612 DNA Sorting. It outputs generated data to console. Since i haven’t found any good data sets for this problem so i decided to create my own.

The previous program had some error since i forgot to give the line count and length. This is the fixed version. The output of this program can be fed directly to the input of UVA 612 dna sorting problem.

Click here to go to this problem in uva online judge.

Code:
/*
 * Author: Quickgrid ( Asif Ahmed )
 * Site: https://quickgrid.wordpress.com
 */

#include<stdio.h>
#include<time.h>
#include<stdlib.h>

#define N 1
#define W 50
#define T 100

int main(){
    srand(time(NULL));

    /**
     * Uncomment the code below and replace the capital N, W, T with small letters
     * Or, Just change the define above to desired size
     */

    /*
    int n, t ,w;
    scanf("Enter number inputs to generate 'n':\n");
    scanf("%d", &n);
    scanf("Enter sequence length 'w':\n");
    scanf("%d", &w);
    scanf("Enter sequence count 'n':\n");
    scanf("%d", &t);
    */

    printf("%d\n\n%d %d\n", N, W, T);
    for(int k = 0; k < N; ++k ){
        for(int i = 0; i < T; ++i){
            for(int j = 0; j < W; ++j){
                switch(rand() & 3){
                case 0:
                    printf("A");
                    break;
                case 1:
                    printf("C");
                    break;
                case 2:
                    printf("G");
                    break;
                case 3:
                    printf("T");
                }
            }
            printf("\n");
        }
    }
    return 0;
}

Sample Output From this Code:

1

50 100
ACAAAAGGCCTGGGCCGTGAAGGATGCAGTTAAGGGCCCTAGTTACCGAG
TAATACCGCAATACGCCCGCCTTGCATTCGAGGCTTAGTAAATGCTGACG
CGTGGCTCACCATTCTCAGACGGTTCGGCCGCAGTTCTTCGTCGACCATA
GGATGGCCGCCGTCTTCGCCGCCGAATCGGACACTGGCAATCCCGTATAA
CCTAGATTACACACTAGCATATTCGCCGCCCCGAATATGTAGGGATACCT
CAGTGGGGCTCCAAGTTCTCCTGCGCTTTACACGCTGTAACCCGCGTACT
AATAGAGCCCATCATGCGGCCTTCAGATCAGCGTGCCCTGGCGTGTCTTG
CAATCGGAACGAGGCCATGGAGTTTGTCCGGGATCACCTATTATCGGAGC
CCTGTTCAAGAGGGTTAGCGATTTTAGGATAATCGCTCCCCGGCAGGTGC
CAATCGCCTGTGGATCGCGCTTTGGTGGAAGGTAACCTACGGTCTACTTG
ATTCCAGGTGTCATCCGCGTTATACAAAGGCCCAACTCATAGCTCCCAAA
GCTGATATCGAGAGGGTAGGCATGTCACCAGATGTTACCGGTGTTAGTCC
CCCCTGCCCCCGGTGCTTGTGGTGCCAACCACAAAGAGGACTTGGTTTTG
TAGCACTACCAGATAGCGTTAATGGTGGCAAATAGAAATATAGATAAGGC
TTCCTCCCAGGTCCGCAAAACGCATCTTAGCAAAGGGGCCGCACGGTCTT
ACGACGTACCCCTTTATATAGTTGACACAATTAGCTCGTCCGGTTCTCAT
GTAGACGAGTTTCTTAGAGTTATCTATTACAGTTGTAGGCCCCCTGTGGC
ACCCTGAACATGACTACGTCTCTGGTAGGCAATGTAATGTTCTTCCCGGG
GGTAGCCCCGCAAATTACTCACTCAACGGCTTTCACCAAGAGAATATTAA
ATTGCCTCATCGATAGTACGCTAGTCAGAAACTTCTTCGGACGTTTCCTT
CGCTGGCGTCGGTAACAGAAATTACCGCCTGTCGATCGTTCCCGGGGGAA
TTGAGGTCTCAGGTGCGTCGCGAGCATCTGTGCCGCCGTCATGTCCGTGG
GGTATACTAGCATGGTTGAGCTGGATCCAACACGCATTGACGCCAGGACT
TTGCAGCCGACATTCTTAGTAGAATAACACCCCACCAACAGGTAAAGTAA
TATGTTGGCGCCGGAGGGAACGAGCGAGCACCGGTTGCTGTTGCAAGACA
CCTGTATTTGCAGTAGTGTCTCATCCACTTTGTAGTAGGAATGCTCAGCT
ATATGGGACTCGAGGATTTGCTATCCTAGATCAGGTAATTTCTGGTCGAC
TAAGTGCGATTGGAAATGTCGCTGATTCGCACGCATCCGTATGGGGTACT
CCATAACAGATGATGAAAGACAATTGGACTGTCAGCGGGGTCCCTTATAT
CGCAAATAACGTACAGCGCATATGACCGATCGTAGCAGCTGTTCAGAAAG
GGTTCATTGGGGGAACAGTACTCGTCCCAACGAAAGGAAGTAGATCAGAT
GGAACTGACTATGGAGAGAACTTATAACTTCCCGCGCGCAGACGCCCAAG
CCTCGTGTGAATAGACACTGTGCTGTTATGAACAGCCTTCAGCGTTTGCC
CAATGCTATGGCTCGACTTGGCTTACAAGTCGATCCCCCATATTTTGAGG
ATTTGTGATGAATAAACGCATGCGCCGGAGTGCCCCCGTGGTGGTTCGAC
AGCAGTAACCCCCCCGGAACGATCACGAGGTGAGTCGTCGACACAAACAG
AGAGGGGATCAACAGAGCCATCTGCGAGGGATATGTCATATTATGCGCCA
TTGACTCAACACCTAGGTGGCAATTAGATCCGTTTGTAGTGCCGCCCCAT
CTGCAAAGGCTTCTGGCCGGTTATGCGCGGGTACTGGCGGCAAACTAAAA
ACCATTGGCATTGGCTAATAATAGTTCGCGATCAGGTACCGGCTGCTCCT
GATGGCACGCCAGGTACCTGTGCGGGATTTCGTCTGTGGGTGTCCCAAGG
CTCCCCCTCCTCCCTGAATCTCAGCCGACCGTTAGTAGTAAGGTCGCCGA
TTCGGGCGATGTAGGAGGAGGATACCCGCCACGGCGAAACTTTCACGCGA
GCCTAAGACATGAAAATCGGCCTGAATGGTCTGGCGAAAGCGACAAGTTT
CTGACCATAAATTCACATTATAAATACGTCCGAGCGACCTTGGCCCTTCT
CTATTTCAGCTCACTCTAAACTCGCAGGAACGCGGCGTACCGTTCGTTAG
GAAAATCCGGTTGCCACACTGAACCGACTAATCTACTCGTGAACTGTGGT
TATTACAACTTATACTATTAATAATCATAAACGCCACTCAAATTAATTTG
GAGCTGTAGGACTAATGCTGGGATACAAGGGCTCCAAGGGACGGATGCGA
CTGGGCCGTTGGCCTTCACAGGGGAGCGAATACCGCGCTGCGTGACAGGG
CAACATAGCCGATACCACAAAGGCGGGGATTGATAGTTTCCATACGGGGT
AGGACTGGCTTAGTTTCGTGCATTAAGCACATCGCGTCAGTCTTCGCCCA
GAGGGGCGCCGGAGCCTGCGTGCTGGCGTGGCGCCAGCGTGGGAAGGGGG
ATTTTGATGATACAGCTGAATGCAGAACCCGATTATAGTAAATCGGGACT
TAACTTTCGCCACGCTTTGGCTGCTTATTGCAATAATACAAAACCGCGTA
TTGTCACACGAATACGAAGCACGCAACGAGAAAAATCATTTAGACAAGAC
GTTGGTGGGCGATCCGCCGGAATATTCTCGAGCTAGGAGTTTTGTCGCAA
ACCGCTCGAGGCTATTCTCTAGAATAAGGAGATGCTCAATGCCCTGGCTG
AAATGACCTTTTGCGAAGGAGATTCCGCATGGGTCATTGGTATTATGAGT
GTCTTCTACACTCATAAGCCGTAATAATTGATTACGCGGAAATTCTTTCA
ATCTGCGCTTCCCAGTAAGGGATCACTATCAATTTGGGGTAAAGGTGGAC
TTAACGTACTGACGGGTCTTCCTGTACACGAACTGATTCATTACTTCCGA
GAAACGTAAACGCTTGTCCGCCTAGCATCGAGGGTACGACTCAAGCACAC
TATTATTGGCCTCATTGATAGAACAATGTATCCATGCAAGGGCGCCCACC
AGCCCGCTATCGTCTAGGTGTTACGCAGCGTGTGATGGCCGGGAAGAATT
GGGTTTTTCTGTGTATCGCTTCAAGCTGCCTGCAACATATCTAAAGACGT
ATGTTCAGTTGTACGTGAAGCTATAGGCGAAGGCTCCGGGATTCACTTTG
CATGGGCATAGTGGACGAACGGTATATTCCTGTACAGATCCAAAGACTGT
AACGTCATTCACTAATACGTTTGCCTGACTCATCTCACATGCAGCAGATC
ACACTGAGTCCCCTTGTTGGATAGCCTGTAGACGGTATGGCTTCTCTGTG
GTAATTGCCGCGCTCTCCCGCTAACTTGAACTAAAGCGATGCCTCAAAGG
CCACACTTCCCGGCGCTACGTTGCGGCACAACGAACAAAGCTGTGGGGGG
ATTACTGACACTATGATCCCAGGTATAGTTCGCCAGAATCGGATCCGAAT
TATCCGGGGGCAACAACGGGGATAGCTTGCTCGAGCGAAAGGCGTGCATA
TTTGAATAGCCTCCGCAACAGCCCGTGTCCTTACGGGAGGTACCACGACA
GGCCTACAAATTGAAGGCATCTCGAATTACGTATACAGAGGGAGTTTCCG
GAGAACTTTGGTCACTTTAACTACGTCTGCCGCCGCCTGTGGCTCGTCTA
GCACGATATAAATCACCCTGCATTAATTTGTCTGTTTATTGTCCTGTAGC
GATCTCCTCGAGTATGAACAAGGACAAGGGTATTGGCAGTGTAAATGTGG
GCATTGCCAAGTGTAGAACAACTGCACAAGGATGTAAGAACCGTACACGT
TCTCTTATGCACTGAATTTTTCAATTCTAATGATTGGTCCACTACACTGT
GGAACGTCACGTCGTTACAAACGACTAGCGTAGTCGATAGTGCGGGATCC
GTCAAGGACACCTGTCGCAGGTATGCTTAATTTCTCTGGGTGCGCCAAGG
GTTGATTAACGTTGTATCCGATTACGCCTGCGGTCCTTTTCTGGGTTCCT
AGGTAGCAAGGATTAGAGCGTGGGCTTGGCCAAAGAGCCGAAGCCTATGT
CCCGGCGCAGATTAACCTCTAATTTGCCGTCTCAACTACTTTGGGGACGT
GCTTCTCGGACGACTGACTCTTGTTATTAATCAAGTCCTTCGGTATATGA
TGTAGTTAGGCTGATTCTTTTCAGCGAAAACAGTCGTGGGTAGACGACTT
TGTCGAGAAAGCCAGCCCAGCGGATCGTGAGCGTATAACCCTACTTCAAC
GTTATTCACACTATTCCGCGCACCACCTATCGGGCACCTTACCCGCGTAT
CGTGGGTCGTTGCAGTGGCCCCCCTAAATTTCAATGATCATTGTTAGCGG
TAACGCGTGATAACTACCGGCGGTATTAAACATCTCCATGTAGCCTCTCT
AACAGTTCCCGGACAAGATTCCAAGAGGTTGTGGTGATCTGAGAGTATCG
TGACCCCACGTCGCCGATGTTCCTGCTTCACTTAAAGTGCACTGTTAGAA
GTCAGAGTAGATCTCCGTTGGTCATAGGTATAAAGAGCAGAGCCGGGGCG
ACTTGGCCGCTGAATAAAAATTTCTGTAGTCGAATTACTACCTTCATACC
AAGGGGACAGCTTCAAGAGCAACCTGATACGGGCGGAAGTCGGTGCACTG
GTCTTTTCGGTCTATGTACCGTTCTTGAAGGGGGCATTATGATGATTCCT
GAAGCAGGAATTTGTAATCTCAGCATAGACTACCATTCAATATGTACGTA
CATAATGTCCAGTTCACTGGCGTTGCCGAGATGACTGAGACCGATTTCCG

Solution For The Output (Output of UVA 612 DNA Sorting Program):

AATAGAGCCCATCATGCGGCCTTCAGATCAGCGTGCCCTGGCGTGTCTTG
CAACATAGCCGATACCACAAAGGCGGGGATTGATAGTTTCCATACGGGGT
GCACGATATAAATCACCCTGCATTAATTTGTCTGTTTATTGTCCTGTAGC
CCATAACAGATGATGAAAGACAATTGGACTGTCAGCGGGGTCCCTTATAT
GAGGGGCGCCGGAGCCTGCGTGCTGGCGTGGCGCCAGCGTGGGAAGGGGG
ACACTGAGTCCCCTTGTTGGATAGCCTGTAGACGGTATGGCTTCTCTGTG
CTGACCATAAATTCACATTATAAATACGTCCGAGCGACCTTGGCCCTTCT
AACAGTTCCCGGACAAGATTCCAAGAGGTTGTGGTGATCTGAGAGTATCG
AAGGGGACAGCTTCAAGAGCAACCTGATACGGGCGGAAGTCGGTGCACTG
ACCCTGAACATGACTACGTCTCTGGTAGGCAATGTAATGTTCTTCCCGGG
GAAAATCCGGTTGCCACACTGAACCGACTAATCTACTCGTGAACTGTGGT
AAATGACCTTTTGCGAAGGAGATTCCGCATGGGTCATTGGTATTATGAGT
ACGACGTACCCCTTTATATAGTTGACACAATTAGCTCGTCCGGTTCTCAT
ACAAAAGGCCTGGGCCGTGAAGGATGCAGTTAAGGGCCCTAGTTACCGAG
GTTGATTAACGTTGTATCCGATTACGCCTGCGGTCCTTTTCTGGGTTCCT
CCCGGCGCAGATTAACCTCTAATTTGCCGTCTCAACTACTTTGGGGACGT
ATTGCCTCATCGATAGTACGCTAGTCAGAAACTTCTTCGGACGTTTCCTT
CCCCTGCCCCCGGTGCTTGTGGTGCCAACCACAAAGAGGACTTGGTTTTG
TAACGCGTGATAACTACCGGCGGTATTAAACATCTCCATGTAGCCTCTCT
GATGGCACGCCAGGTACCTGTGCGGGATTTCGTCTGTGGGTGTCCCAAGG
TATTACAACTTATACTATTAATAATCATAAACGCCACTCAAATTAATTTG
CCACACTTCCCGGCGCTACGTTGCGGCACAACGAACAAAGCTGTGGGGGG
TAATACCGCAATACGCCCGCCTTGCATTCGAGGCTTAGTAAATGCTGACG
AGAGGGGATCAACAGAGCCATCTGCGAGGGATATGTCATATTATGCGCCA
GCCTAAGACATGAAAATCGGCCTGAATGGTCTGGCGAAAGCGACAAGTTT
CAATCGGAACGAGGCCATGGAGTTTGTCCGGGATCACCTATTATCGGAGC
CGCAAATAACGTACAGCGCATATGACCGATCGTAGCAGCTGTTCAGAAAG
GGCCTACAAATTGAAGGCATCTCGAATTACGTATACAGAGGGAGTTTCCG
GATCTCCTCGAGTATGAACAAGGACAAGGGTATTGGCAGTGTAAATGTGG
GAGAACTTTGGTCACTTTAACTACGTCTGCCGCCGCCTGTGGCTCGTCTA
GGAACGTCACGTCGTTACAAACGACTAGCGTAGTCGATAGTGCGGGATCC
CCTAGATTACACACTAGCATATTCGCCGCCCCGAATATGTAGGGATACCT
CTATTTCAGCTCACTCTAAACTCGCAGGAACGCGGCGTACCGTTCGTTAG
GTCAAGGACACCTGTCGCAGGTATGCTTAATTTCTCTGGGTGCGCCAAGG
CAATCGCCTGTGGATCGCGCTTTGGTGGAAGGTAACCTACGGTCTACTTG
GCTGATATCGAGAGGGTAGGCATGTCACCAGATGTTACCGGTGTTAGTCC
ACCGCTCGAGGCTATTCTCTAGAATAAGGAGATGCTCAATGCCCTGGCTG
TTCCTCCCAGGTCCGCAAAACGCATCTTAGCAAAGGGGCCGCACGGTCTT
ACCATTGGCATTGGCTAATAATAGTTCGCGATCAGGTACCGGCTGCTCCT
GAAGCAGGAATTTGTAATCTCAGCATAGACTACCATTCAATATGTACGTA
ATTTGTGATGAATAAACGCATGCGCCGGAGTGCCCCCGTGGTGGTTCGAC
CCTCGTGTGAATAGACACTGTGCTGTTATGAACAGCCTTCAGCGTTTGCC
CAATGCTATGGCTCGACTTGGCTTACAAGTCGATCCCCCATATTTTGAGG
CTCCCCCTCCTCCCTGAATCTCAGCCGACCGTTAGTAGTAAGGTCGCCGA
TAAGTGCGATTGGAAATGTCGCTGATTCGCACGCATCCGTATGGGGTACT
ATATGGGACTCGAGGATTTGCTATCCTAGATCAGGTAATTTCTGGTCGAC
TTGACTCAACACCTAGGTGGCAATTAGATCCGTTTGTAGTGCCGCCCCAT
AGGTAGCAAGGATTAGAGCGTGGGCTTGGCCAAAGAGCCGAAGCCTATGT
AGCAGTAACCCCCCCGGAACGATCACGAGGTGAGTCGTCGACACAAACAG
AGCCCGCTATCGTCTAGGTGTTACGCAGCGTGTGATGGCCGGGAAGAATT
GTCTTCTACACTCATAAGCCGTAATAATTGATTACGCGGAAATTCTTTCA
CATAATGTCCAGTTCACTGGCGTTGCCGAGATGACTGAGACCGATTTCCG
GTAGACGAGTTTCTTAGAGTTATCTATTACAGTTGTAGGCCCCCTGTGGC
GTTATTCACACTATTCCGCGCACCACCTATCGGGCACCTTACCCGCGTAT
CGCTGGCGTCGGTAACAGAAATTACCGCCTGTCGATCGTTCCCGGGGGAA
ATGTTCAGTTGTACGTGAAGCTATAGGCGAAGGCTCCGGGATTCACTTTG
TTGAGGTCTCAGGTGCGTCGCGAGCATCTGTGCCGCCGTCATGTCCGTGG
AACGTCATTCACTAATACGTTTGCCTGACTCATCTCACATGCAGCAGATC
ACTTGGCCGCTGAATAAAAATTTCTGTAGTCGAATTACTACCTTCATACC
TATCCGGGGGCAACAACGGGGATAGCTTGCTCGAGCGAAAGGCGTGCATA
GCTTCTCGGACGACTGACTCTTGTTATTAATCAAGTCCTTCGGTATATGA
TGACCCCACGTCGCCGATGTTCCTGCTTCACTTAAAGTGCACTGTTAGAA
TAGCACTACCAGATAGCGTTAATGGTGGCAAATAGAAATATAGATAAGGC
GCATTGCCAAGTGTAGAACAACTGCACAAGGATGTAAGAACCGTACACGT
TTAACGTACTGACGGGTCTTCCTGTACACGAACTGATTCATTACTTCCGA
ATTACTGACACTATGATCCCAGGTATAGTTCGCCAGAATCGGATCCGAAT
CGTGGCTCACCATTCTCAGACGGTTCGGCCGCAGTTCTTCGTCGACCATA
ATCTGCGCTTCCCAGTAAGGGATCACTATCAATTTGGGGTAAAGGTGGAC
TGTCGAGAAAGCCAGCCCAGCGGATCGTGAGCGTATAACCCTACTTCAAC
CAGTGGGGCTCCAAGTTCTCCTGCGCTTTACACGCTGTAACCCGCGTACT
CATGGGCATAGTGGACGAACGGTATATTCCTGTACAGATCCAAAGACTGT
TCTCTTATGCACTGAATTTTTCAATTCTAATGATTGGTCCACTACACTGT
CCTGTTCAAGAGGGTTAGCGATTTTAGGATAATCGCTCCCCGGCAGGTGC
GAAACGTAAACGCTTGTCCGCCTAGCATCGAGGGTACGACTCAAGCACAC
GAGCTGTAGGACTAATGCTGGGATACAAGGGCTCCAAGGGACGGATGCGA
GTCAGAGTAGATCTCCGTTGGTCATAGGTATAAAGAGCAGAGCCGGGGCG
CTGGGCCGTTGGCCTTCACAGGGGAGCGAATACCGCGCTGCGTGACAGGG
ATTTTGATGATACAGCTGAATGCAGAACCCGATTATAGTAAATCGGGACT
CGTGGGTCGTTGCAGTGGCCCCCCTAAATTTCAATGATCATTGTTAGCGG
GGAACTGACTATGGAGAGAACTTATAACTTCCCGCGCGCAGACGCCCAAG
GTCTTTTCGGTCTATGTACCGTTCTTGAAGGGGGCATTATGATGATTCCT
CCTGTATTTGCAGTAGTGTCTCATCCACTTTGTAGTAGGAATGCTCAGCT
TTGTCACACGAATACGAAGCACGCAACGAGAAAAATCATTTAGACAAGAC
AGGACTGGCTTAGTTTCGTGCATTAAGCACATCGCGTCAGTCTTCGCCCA
GTTGGTGGGCGATCCGCCGGAATATTCTCGAGCTAGGAGTTTTGTCGCAA
GGTAGCCCCGCAAATTACTCACTCAACGGCTTTCACCAAGAGAATATTAA
TGTAGTTAGGCTGATTCTTTTCAGCGAAAACAGTCGTGGGTAGACGACTT
GGTATACTAGCATGGTTGAGCTGGATCCAACACGCATTGACGCCAGGACT
TATGTTGGCGCCGGAGGGAACGAGCGAGCACCGGTTGCTGTTGCAAGACA
TTTGAATAGCCTCCGCAACAGCCCGTGTCCTTACGGGAGGTACCACGACA
GTAATTGCCGCGCTCTCCCGCTAACTTGAACTAAAGCGATGCCTCAAAGG
GGATGGCCGCCGTCTTCGCCGCCGAATCGGACACTGGCAATCCCGTATAA
TAACTTTCGCCACGCTTTGGCTGCTTATTGCAATAATACAAAACCGCGTA
TTCGGGCGATGTAGGAGGAGGATACCCGCCACGGCGAAACTTTCACGCGA
TTGCAGCCGACATTCTTAGTAGAATAACACCCCACCAACAGGTAAAGTAA
GGTTCATTGGGGGAACAGTACTCGTCCCAACGAAAGGAAGTAGATCAGAT
CTGCAAAGGCTTCTGGCCGGTTATGCGCGGGTACTGGCGGCAAACTAAAA
ATTCCAGGTGTCATCCGCGTTATACAAAGGCCCAACTCATAGCTCCCAAA
TATTATTGGCCTCATTGATAGAACAATGTATCCATGCAAGGGCGCCCACC
GGGTTTTTCTGTGTATCGCTTCAAGCTGCCTGCAACATATCTAAAGACGT

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s