Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
52 | 2 | 3 | 0.982 | stmt_list[2] |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 52 | 119 | Bio/Align/Generic.py |
2 | 51 | 594 | Bio/SeqRecord.py |
| ||||
def format(self,format): '''Returns the alignment as a string in the specified file format. The format should be a lower case string supported as an output format by Bio.AlignIO (such as "fasta", "clustal", "phylip", "stockholm", etc), which is used to turn the alignment into a string. e.g. >>> from Bio.Alphabet import IUPAC, Gapped >>> align = Alignment(Gapped(IUPAC.unambiguous_dna, "-")) >>> align.add_sequence("Alpha", "ACTGCTAGCTAG") >>> align.add_sequence("Beta", "ACT-CTAGCTAG") >>> align.add_sequence("Gamma", "ACTGCTAGATAG") >>> print align.format("fasta") >Alpha ACTGCTAGCTAG >Beta ACT-CTAGCTAG >Gamma ACTGCTAGATAG <BLANKLINE> >>> print align.format("phylip") 3 12 Alpha ACTGCTAGCT AG Beta ACT-CTAGCT AG Gamma ACTGCTAGAT AG <BLANKLINE> For Python 2.6, 3.0 or later see also the built in format() function. ''' #See also the __format__ added for Python 2.6 / 3.0, PEP 3101 #See also the SeqRecord class and its format() method using Bio.SeqIO return self.__format__(format) def __format__(self,format_spec): """Returns the alignment as a string in the specified file format. This method supports the python format() function added in Python 2.6/3.0. The format_spec should be a lower case string supported by Bio.AlignIO as an output file format. See also the alignment's format() method.""" if format_spec: from StringIO import StringIO from Bio import AlignIO handle = StringIO( ) AlignIO.write([self],handle,format_spec) return handle.getvalue( ) else: #Follow python convention and default to using __str__ return str(self) |
| ||||
def format(self,format): """Returns the record as a string in the specified file format. The format should be a lower case string supported as an output format by Bio.SeqIO, which is used to turn the SeqRecord into a string. e.g. >>> from Bio.Seq import Seq >>> from Bio.SeqRecord import SeqRecord >>> from Bio.Alphabet import IUPAC >>> record = SeqRecord(Seq("MKQHKAMIVALIVICITAVVAALVTRKDLCEVHIRTGQTEVAVF", ... IUPAC.protein), ... id="YP_025292.1", name="HokC", ... description="toxic membrane protein") >>> record.format("fasta") '>YP_025292.1 toxic membrane protein\\nMKQHKAMIVALIVICITAVVAALVTRKDLCEVHIRTGQTEVAVF\\n' >>> print record.format("fasta") >YP_025292.1 toxic membrane protein MKQHKAMIVALIVICITAVVAALVTRKDLCEVHIRTGQTEVAVF <BLANKLINE> The python print command automatically appends a new line, meaning in this example a blank line is shown. If you look at the string representation you can see there is a trailing new line (shown as slash n) which is important when writing to a file or if concatenating mutliple sequence strings together. Note that this method will NOT work on every possible file format supported by Bio.SeqIO (e.g. some are for multiple sequences only). """ #See also the __format__ added for Python 2.6 / 3.0, PEP 3101 #See also the Bio.Align.Generic.Alignment class and its format() return self.__format__(format) def __format__(self,format_spec): """Returns the record as a string in the specified file format. This method supports the python format() function added in Python 2.6/3.0. The format_spec should be a lower case string supported by Bio.SeqIO as an output file format. See also the SeqRecord's format() method. """ if format_spec: from StringIO import StringIO from Bio import SeqIO handle = StringIO( ) SeqIO.write([self],handle,format_spec) return handle.getvalue( ) else: #Follow python convention and default to using __str__ return str(self) |
| |||
def format(self,format): [[#variable19c2fe60]] #See also the __format__ added for Python 2.6 / 3.0, PEP 3101 #See also the SeqRecord class and its format() method using Bio.SeqIO #See also the Bio.Align.Generic.Alignment class and its format() return self.__format__(format) def __format__(self,format_spec): [[#variable19c2fea0]] if format_spec: from StringIO import StringIO from Bio import [[#variable19c2e420]] handle = StringIO( ) [[#variable19c2e420]].write([self],handle,format_spec) return handle.getvalue( ) else: #Follow python convention and default to using __str__ return str(self) |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#19c2fe60]] | '''Returns the alignment as a string in the specified file format. The format should be a lower case string supported as an output format by Bio.AlignIO (such as "fasta", "clustal", "phylip", "stockholm", etc), which is used to turn the alignment into a string. e.g. >>> from Bio.Alphabet import IUPAC, Gapped >>> align = Alignment(Gapped(IUPAC.unambiguous_dna, "-")) >>> align.add_sequence("Alpha", "ACTGCTAGCTAG") >>> align.add_sequence("Beta", "ACT-CTAGCTAG") >>> align.add_sequence("Gamma", "ACTGCTAGATAG") >>> print align.format("fasta") >Alpha ACTGCTAGCTAG >Beta ACT-CTAGCTAG >Gamma ACTGCTAGATAG <BLANKLINE> >>> print align.format("phylip") 3 12 Alpha ACTGCTAGCT AG Beta ACT-CTAGCT AG Gamma ACTGCTAGAT AG <BLANKLINE> For Python 2.6, 3.0 or later see also the built in format() function. ''' |
1 | 2 | [[#19c2fe60]] | """Returns the record as a string in the specified file format. The format should be a lower case string supported as an output format by Bio.SeqIO, which is used to turn the SeqRecord into a string. e.g. >>> from Bio.Seq import Seq >>> from Bio.SeqRecord import SeqRecord >>> from Bio.Alphabet import IUPAC >>> record = SeqRecord(Seq("MKQHKAMIVALIVICITAVVAALVTRKDLCEVHIRTGQTEVAVF", ... IUPAC.protein), ... id="YP_025292.1", name="HokC", ... description="toxic membrane protein") >>> record.format("fasta") '>YP_025292.1 toxic membrane protein\\nMKQHKAMIVALIVICITAVVAALVTRKDLCEVHIRTGQTEVAVF\\n' >>> print record.format("fasta") >YP_025292.1 toxic membrane protein MKQHKAMIVALIVICITAVVAALVTRKDLCEVHIRTGQTEVAVF <BLANKLINE> The python print command automatically appends a new line, meaning in this example a blank line is shown. If you look at the string representation you can see there is a trailing new line (shown as slash n) which is important when writing to a file or if concatenating mutliple sequence strings together. Note that this method will NOT work on every possible file format supported by Bio.SeqIO (e.g. some are for multiple sequences only). """ |
2 | 1 | [[#19c2fea0]] | """Returns the alignment as a string in the specified file format. This method supports the python format() function added in Python 2.6/3.0. The format_spec should be a lower case string supported by Bio.AlignIO as an output file format. See also the alignment's format() method.""" |
2 | 2 | [[#19c2fea0]] | """Returns the record as a string in the specified file format. This method supports the python format() function added in Python 2.6/3.0. The format_spec should be a lower case string supported by Bio.SeqIO as an output file format. See also the SeqRecord's format() method. """ |
3 | 1 | [[#19c2e420]] | AlignIO |
3 | 2 | [[#19c2e420]] | SeqIO |