comment créer une population prédéfinie
bonsoir les amis , je sais que c'est un forum perl et c'est le seul endroits qui gère le domaine du bio-informatique
j'ai réalise ce code source et je veux créer une population un peux spéciale (c'est à dire une population représenté par l'emplacement des gaps)
aidez moi S'il vous plait
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
package biojava;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import javax.sound.midi.Sequence;
import org.biojava.bio.BioException;
import org.biojava.bio.dist.Count;
import org.biojava.bio.dist.Distribution;
import org.biojava.bio.dist.DistributionTools;
import org.biojava.bio.dist.IndexedCount;
import org.biojava.bio.dist.UniformDistribution;
import org.biojava.bio.seq.RNATools;
import org.biojava.bio.seq.SequenceIterator;
import org.biojava.bio.seq.db.SequenceDB;
import org.biojava.bio.seq.io.SeqIOTools;
import org.biojava.bio.symbol.Alphabet;
import org.biojava.bio.symbol.AlphabetManager;
import org.biojava.bio.symbol.FiniteAlphabet;
import org.biojava.bio.symbol.Symbol;
import org.biojava.bio.symbol.SymbolList;
import org.biojavax.ga.Population;
import org.biojavax.ga.impl.SimplePopulation;
import org.biojavax.ga.util.GATools;
public class PositionGap {
public static void main (String[]args) throws BioException, FileNotFoundException, IOException{
int count;
int position=1;
HashMap hash= new HashMap();
String filename = "D:\\RV20_BBS20002.AFA";
//get the alphabet
FiniteAlphabet a = (FiniteAlphabet) AlphabetManager.alphabetForName("DNA");
//open the file and read the sequences
FileInputStream fis = new FileInputStream(filename);
SequenceDB seqdb = SeqIOTools.readFasta(fis, a);
SequenceIterator stream = seqdb.sequenceIterator();
while(stream.hasNext()){
count=0;
org.biojava.bio.seq.Sequence dna=stream.nextSequence();
Iterator ai = a.iterator();
for(int i=1;i<=dna.length();i++){
//System.out.println(dna.getName());
Symbol sym = dna.symbolAt(i);
Symbol gap =dna.getAlphabet().getGapSymbol();
if(sym.equals(gap) ){
position=i;
System.out.println(" la position :"+position);
hash.put(gap.getName(), new Integer(position++));
System.out.print("hash = " + hash + "\n");
}
Distribution bin_dist = new UniformDistribution(GATools.getBinaryAlphabet());
// initialize the population
Population pop = new SimplePopulation("demo population");
}
System.out.println("________fin de sequence________");
}
}
} |